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 ((long)(p) > 1024) { free(p); }
22 #define DO_ASSERT(a) (void)(a)
25 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
26 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
32 typedef uint32_t int64_tArray;
33 typedef uint32_t int8_tArray;
34 typedef uint32_t uint32_tArray;
35 typedef uint32_t ptrArray;
36 typedef uint32_t jstring;
38 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
39 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
41 return (uint32_t)elems;
44 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
45 char* err_buf = MALLOC(len + 4, "str conv buf");
46 *((uint32_t*)err_buf) = len;
47 memcpy(err_buf + 4, chars, len);
48 return (uint32_t) err_buf;
50 static inline LDKStr str_ref_to_owned_c(jstring str) {
51 uint32_t *str_len = (uint32_t*)str;
52 char* newchars = MALLOC(*str_len + 1, "String chars");
53 memcpy(newchars, (const char*)(str + 4), *str_len);
54 newchars[*str_len] = 0;
58 .chars_is_owned = true
63 typedef bool jboolean;
65 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
66 return (uint32_t)MALLOC(size, "JS-Called malloc");
68 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
71 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
72 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
74 case 0: return LDKAccessError_UnknownChain;
75 case 1: return LDKAccessError_UnknownTx;
79 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
81 case LDKAccessError_UnknownChain: return 0;
82 case LDKAccessError_UnknownTx: return 1;
86 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
88 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
89 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
93 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
95 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
96 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
100 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
102 case 0: return LDKConfirmationTarget_Background;
103 case 1: return LDKConfirmationTarget_Normal;
104 case 2: return LDKConfirmationTarget_HighPriority;
108 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
110 case LDKConfirmationTarget_Background: return 0;
111 case LDKConfirmationTarget_Normal: return 1;
112 case LDKConfirmationTarget_HighPriority: return 2;
116 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
118 case 0: return LDKCreationError_DescriptionTooLong;
119 case 1: return LDKCreationError_RouteTooLong;
120 case 2: return LDKCreationError_TimestampOutOfBounds;
121 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
125 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
127 case LDKCreationError_DescriptionTooLong: return 0;
128 case LDKCreationError_RouteTooLong: return 1;
129 case LDKCreationError_TimestampOutOfBounds: return 2;
130 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
134 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
136 case 0: return LDKCurrency_Bitcoin;
137 case 1: return LDKCurrency_BitcoinTestnet;
138 case 2: return LDKCurrency_Regtest;
139 case 3: return LDKCurrency_Simnet;
140 case 4: return LDKCurrency_Signet;
144 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
146 case LDKCurrency_Bitcoin: return 0;
147 case LDKCurrency_BitcoinTestnet: return 1;
148 case LDKCurrency_Regtest: return 2;
149 case LDKCurrency_Simnet: return 3;
150 case LDKCurrency_Signet: return 4;
154 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
156 case 0: return LDKIOError_NotFound;
157 case 1: return LDKIOError_PermissionDenied;
158 case 2: return LDKIOError_ConnectionRefused;
159 case 3: return LDKIOError_ConnectionReset;
160 case 4: return LDKIOError_ConnectionAborted;
161 case 5: return LDKIOError_NotConnected;
162 case 6: return LDKIOError_AddrInUse;
163 case 7: return LDKIOError_AddrNotAvailable;
164 case 8: return LDKIOError_BrokenPipe;
165 case 9: return LDKIOError_AlreadyExists;
166 case 10: return LDKIOError_WouldBlock;
167 case 11: return LDKIOError_InvalidInput;
168 case 12: return LDKIOError_InvalidData;
169 case 13: return LDKIOError_TimedOut;
170 case 14: return LDKIOError_WriteZero;
171 case 15: return LDKIOError_Interrupted;
172 case 16: return LDKIOError_Other;
173 case 17: return LDKIOError_UnexpectedEof;
177 static inline int32_t LDKIOError_to_js(LDKIOError val) {
179 case LDKIOError_NotFound: return 0;
180 case LDKIOError_PermissionDenied: return 1;
181 case LDKIOError_ConnectionRefused: return 2;
182 case LDKIOError_ConnectionReset: return 3;
183 case LDKIOError_ConnectionAborted: return 4;
184 case LDKIOError_NotConnected: return 5;
185 case LDKIOError_AddrInUse: return 6;
186 case LDKIOError_AddrNotAvailable: return 7;
187 case LDKIOError_BrokenPipe: return 8;
188 case LDKIOError_AlreadyExists: return 9;
189 case LDKIOError_WouldBlock: return 10;
190 case LDKIOError_InvalidInput: return 11;
191 case LDKIOError_InvalidData: return 12;
192 case LDKIOError_TimedOut: return 13;
193 case LDKIOError_WriteZero: return 14;
194 case LDKIOError_Interrupted: return 15;
195 case LDKIOError_Other: return 16;
196 case LDKIOError_UnexpectedEof: return 17;
200 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
202 case 0: return LDKLevel_Trace;
203 case 1: return LDKLevel_Debug;
204 case 2: return LDKLevel_Info;
205 case 3: return LDKLevel_Warn;
206 case 4: return LDKLevel_Error;
210 static inline int32_t LDKLevel_to_js(LDKLevel val) {
212 case LDKLevel_Trace: return 0;
213 case LDKLevel_Debug: return 1;
214 case LDKLevel_Info: return 2;
215 case LDKLevel_Warn: return 3;
216 case LDKLevel_Error: return 4;
220 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
222 case 0: return LDKNetwork_Bitcoin;
223 case 1: return LDKNetwork_Testnet;
224 case 2: return LDKNetwork_Regtest;
225 case 3: return LDKNetwork_Signet;
229 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
231 case LDKNetwork_Bitcoin: return 0;
232 case LDKNetwork_Testnet: return 1;
233 case LDKNetwork_Regtest: return 2;
234 case LDKNetwork_Signet: return 3;
238 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
240 case 0: return LDKSecp256k1Error_IncorrectSignature;
241 case 1: return LDKSecp256k1Error_InvalidMessage;
242 case 2: return LDKSecp256k1Error_InvalidPublicKey;
243 case 3: return LDKSecp256k1Error_InvalidSignature;
244 case 4: return LDKSecp256k1Error_InvalidSecretKey;
245 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
246 case 6: return LDKSecp256k1Error_InvalidTweak;
247 case 7: return LDKSecp256k1Error_TweakCheckFailed;
248 case 8: return LDKSecp256k1Error_NotEnoughMemory;
252 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
254 case LDKSecp256k1Error_IncorrectSignature: return 0;
255 case LDKSecp256k1Error_InvalidMessage: return 1;
256 case LDKSecp256k1Error_InvalidPublicKey: return 2;
257 case LDKSecp256k1Error_InvalidSignature: return 3;
258 case LDKSecp256k1Error_InvalidSecretKey: return 4;
259 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
260 case LDKSecp256k1Error_InvalidTweak: return 6;
261 case LDKSecp256k1Error_TweakCheckFailed: return 7;
262 case LDKSecp256k1Error_NotEnoughMemory: return 8;
266 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
268 case 0: return LDKSemanticError_NoPaymentHash;
269 case 1: return LDKSemanticError_MultiplePaymentHashes;
270 case 2: return LDKSemanticError_NoDescription;
271 case 3: return LDKSemanticError_MultipleDescriptions;
272 case 4: return LDKSemanticError_MultiplePaymentSecrets;
273 case 5: return LDKSemanticError_InvalidFeatures;
274 case 6: return LDKSemanticError_InvalidRecoveryId;
275 case 7: return LDKSemanticError_InvalidSignature;
279 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
281 case LDKSemanticError_NoPaymentHash: return 0;
282 case LDKSemanticError_MultiplePaymentHashes: return 1;
283 case LDKSemanticError_NoDescription: return 2;
284 case LDKSemanticError_MultipleDescriptions: return 3;
285 case LDKSemanticError_MultiplePaymentSecrets: return 4;
286 case LDKSemanticError_InvalidFeatures: return 5;
287 case LDKSemanticError_InvalidRecoveryId: return 6;
288 case LDKSemanticError_InvalidSignature: return 7;
292 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
294 case 0: return LDKSiPrefix_Milli;
295 case 1: return LDKSiPrefix_Micro;
296 case 2: return LDKSiPrefix_Nano;
297 case 3: return LDKSiPrefix_Pico;
301 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
303 case LDKSiPrefix_Milli: return 0;
304 case LDKSiPrefix_Micro: return 1;
305 case LDKSiPrefix_Nano: return 2;
306 case LDKSiPrefix_Pico: return 3;
310 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
311 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
312 ret->datalen = *((uint32_t*)elems);
313 if (ret->datalen == 0) {
316 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
317 int8_t *java_elems = (int8_t*)(elems + 4);
318 for (size_t i = 0; i < ret->datalen; i++) {
319 ret->data[i] = java_elems[i];
322 return (uint64_t)ret;
324 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
325 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
326 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
329 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) {
330 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
331 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
332 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
333 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
334 CVec_u8Z_free(ret_var);
338 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
339 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
340 int64_t ret_val = TxOut_get_value(thing_conv);
344 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
345 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
347 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
348 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
349 CHECK(val->result_ok);
350 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
351 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
355 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
356 CHECK(!val->result_ok);
357 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
360 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
361 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
363 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
364 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
365 CHECK(val->result_ok);
366 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
367 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
371 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
372 CHECK(!val->result_ok);
373 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
376 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
377 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
379 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
380 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
381 CHECK(val->result_ok);
382 LDKTxCreationKeys res_var = (*val->contents.result);
383 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
384 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
385 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
388 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
389 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
390 CHECK(!val->result_ok);
391 LDKDecodeError err_var = (*val->contents.err);
392 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
393 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
394 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
397 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
398 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
401 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
402 CHECK(val->result_ok);
403 LDKChannelPublicKeys res_var = (*val->contents.result);
404 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
405 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
406 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
409 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
410 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
411 CHECK(!val->result_ok);
412 LDKDecodeError err_var = (*val->contents.err);
413 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
414 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
415 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
418 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
419 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
421 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
422 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
423 CHECK(val->result_ok);
424 LDKTxCreationKeys res_var = (*val->contents.result);
425 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
426 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
427 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
431 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
432 CHECK(!val->result_ok);
433 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
436 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
437 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
439 case LDKCOption_u32Z_Some: {
440 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
442 case LDKCOption_u32Z_None: {
443 return 0 /* LDKCOption_u32Z - None */;
448 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
449 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
451 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
452 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
453 CHECK(val->result_ok);
454 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
455 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
456 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
457 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
460 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
461 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
462 CHECK(!val->result_ok);
463 LDKDecodeError err_var = (*val->contents.err);
464 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
465 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
466 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
469 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
470 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
472 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
473 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
474 CHECK(val->result_ok);
475 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
476 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
477 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
478 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
482 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
483 CHECK(!val->result_ok);
484 LDKDecodeError err_var = (*val->contents.err);
485 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
486 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
487 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
490 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
491 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
493 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
494 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
495 CHECK(val->result_ok);
496 LDKChannelTransactionParameters res_var = (*val->contents.result);
497 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
498 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
499 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
502 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
503 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
504 CHECK(!val->result_ok);
505 LDKDecodeError err_var = (*val->contents.err);
506 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
507 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
508 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
511 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
512 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
514 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
515 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
516 CHECK(val->result_ok);
517 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
518 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
519 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
520 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
524 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
525 CHECK(!val->result_ok);
526 LDKDecodeError err_var = (*val->contents.err);
527 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
528 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
529 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
532 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
533 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
535 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
536 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
537 CHECK(val->result_ok);
538 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
539 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
540 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
541 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
544 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
545 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
546 CHECK(!val->result_ok);
547 LDKDecodeError err_var = (*val->contents.err);
548 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
549 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
550 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
553 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
554 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
556 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
557 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
558 CHECK(val->result_ok);
559 LDKCommitmentTransaction res_var = (*val->contents.result);
560 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
561 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
562 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
566 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
567 CHECK(!val->result_ok);
568 LDKDecodeError err_var = (*val->contents.err);
569 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
570 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
571 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
574 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
575 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
577 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
578 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
579 CHECK(val->result_ok);
580 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
581 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
582 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
583 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
586 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
587 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
588 CHECK(!val->result_ok);
589 return *val->contents.err;
591 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
592 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
594 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
595 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
596 CHECK(val->result_ok);
597 LDKCVec_SignatureZ res_var = (*val->contents.result);
598 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
599 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
600 for (size_t m = 0; m < res_var.datalen; m++) {
601 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
602 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
603 res_arr_ptr[m] = res_conv_12_arr;
607 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
608 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
609 CHECK(!val->result_ok);
610 return *val->contents.err;
612 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
613 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
615 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
616 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
617 CHECK(val->result_ok);
618 return *val->contents.result;
620 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
621 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
622 CHECK(!val->result_ok);
623 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
626 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
627 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
629 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
630 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
631 CHECK(val->result_ok);
632 LDKRouteHop res_var = (*val->contents.result);
633 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
634 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
635 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
638 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
639 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
640 CHECK(!val->result_ok);
641 LDKDecodeError err_var = (*val->contents.err);
642 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
643 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
644 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
647 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
648 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
649 ret->datalen = *((uint32_t*)elems);
650 if (ret->datalen == 0) {
653 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
654 uint32_t *java_elems = (uint32_t*)(elems + 4);
655 for (size_t i = 0; i < ret->datalen; i++) {
656 uint32_t arr_elem = java_elems[i];
657 LDKRouteHop arr_elem_conv;
658 arr_elem_conv.inner = (void*)(arr_elem & (~1));
659 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
660 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
661 ret->data[i] = arr_elem_conv;
664 return (uint64_t)ret;
666 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
667 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
668 for (size_t i = 0; i < ret.datalen; i++) {
669 ret.data[i] = RouteHop_clone(&orig->data[i]);
673 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
674 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
675 for (size_t i = 0; i < ret.datalen; i++) {
676 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
680 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
681 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
684 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
685 CHECK(val->result_ok);
686 LDKRoute res_var = (*val->contents.result);
687 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
688 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
689 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
693 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
694 CHECK(!val->result_ok);
695 LDKDecodeError err_var = (*val->contents.err);
696 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
697 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
698 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
701 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
702 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
704 case LDKCOption_u64Z_Some: {
705 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
707 case LDKCOption_u64Z_None: {
708 return 0 /* LDKCOption_u64Z - None */;
713 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
714 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
715 ret->datalen = *((uint32_t*)elems);
716 if (ret->datalen == 0) {
719 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
720 uint32_t *java_elems = (uint32_t*)(elems + 4);
721 for (size_t i = 0; i < ret->datalen; i++) {
722 uint32_t arr_elem = java_elems[i];
723 LDKChannelDetails arr_elem_conv;
724 arr_elem_conv.inner = (void*)(arr_elem & (~1));
725 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
726 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
727 ret->data[i] = arr_elem_conv;
730 return (uint64_t)ret;
732 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
733 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
734 for (size_t i = 0; i < ret.datalen; i++) {
735 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
739 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
740 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
741 ret->datalen = *((uint32_t*)elems);
742 if (ret->datalen == 0) {
745 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
746 uint32_t *java_elems = (uint32_t*)(elems + 4);
747 for (size_t i = 0; i < ret->datalen; i++) {
748 uint32_t arr_elem = java_elems[i];
749 LDKRouteHint arr_elem_conv;
750 arr_elem_conv.inner = (void*)(arr_elem & (~1));
751 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
752 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
753 ret->data[i] = arr_elem_conv;
756 return (uint64_t)ret;
758 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
759 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
760 for (size_t i = 0; i < ret.datalen; i++) {
761 ret.data[i] = RouteHint_clone(&orig->data[i]);
765 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
766 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
768 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
769 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
770 CHECK(val->result_ok);
771 LDKRoute res_var = (*val->contents.result);
772 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
773 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
774 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
777 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
778 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
779 CHECK(!val->result_ok);
780 LDKLightningError err_var = (*val->contents.err);
781 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
782 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
783 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
786 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
787 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
790 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
791 CHECK(val->result_ok);
792 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
793 return (uint64_t)res_ref;
795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
796 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
797 CHECK(!val->result_ok);
798 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
801 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
802 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
804 LDKTransaction b_ref;
805 b_ref.datalen = *((uint32_t*)b);
806 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
807 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
808 b_ref.data_is_owned = false;
810 return (uint64_t)ret;
812 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
813 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
816 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
817 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
818 LDKTransaction b_var = tuple->b;
819 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
820 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
823 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
824 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
825 ret->datalen = *((uint32_t*)elems);
826 if (ret->datalen == 0) {
829 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
830 uint32_t *java_elems = (uint32_t*)(elems + 4);
831 for (size_t i = 0; i < ret->datalen; i++) {
832 uint32_t arr_elem = java_elems[i];
833 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
834 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
835 ret->data[i] = arr_elem_conv;
838 return (uint64_t)ret;
840 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
841 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
842 for (size_t i = 0; i < ret.datalen; i++) {
843 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
847 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
848 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
849 for (size_t i = 0; i < ret.datalen; i++) {
850 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
854 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
855 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
857 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
858 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
859 CHECK(val->result_ok);
860 return *val->contents.result;
862 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
863 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
864 CHECK(!val->result_ok);
865 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
868 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
869 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
871 case LDKMonitorEvent_HTLCEvent: {
872 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
873 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
874 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
875 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
876 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
878 case LDKMonitorEvent_CommitmentTxBroadcasted: {
879 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
880 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
881 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
882 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
883 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
888 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
889 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
890 ret->datalen = *((uint32_t*)elems);
891 if (ret->datalen == 0) {
894 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
895 uint32_t *java_elems = (uint32_t*)(elems + 4);
896 for (size_t i = 0; i < ret->datalen; i++) {
897 uint32_t arr_elem = java_elems[i];
898 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
899 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
900 ret->data[i] = arr_elem_conv;
903 return (uint64_t)ret;
905 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
906 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
907 for (size_t i = 0; i < ret.datalen; i++) {
908 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
912 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
913 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
915 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
916 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
917 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
919 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
920 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
925 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
926 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
928 case LDKSpendableOutputDescriptor_StaticOutput: {
929 LDKOutPoint outpoint_var = obj->static_output.outpoint;
930 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
931 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
932 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
933 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
934 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
936 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
937 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
938 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
941 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
943 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
944 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
945 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
946 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
947 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
948 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
953 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
954 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
955 ret->datalen = *((uint32_t*)elems);
956 if (ret->datalen == 0) {
959 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
960 uint32_t *java_elems = (uint32_t*)(elems + 4);
961 for (size_t i = 0; i < ret->datalen; i++) {
962 uint32_t arr_elem = java_elems[i];
963 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
964 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
965 ret->data[i] = arr_elem_conv;
968 return (uint64_t)ret;
970 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
971 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
972 for (size_t i = 0; i < ret.datalen; i++) {
973 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
977 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
978 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
980 case LDKErrorAction_DisconnectPeer: {
981 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
982 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
985 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
987 case LDKErrorAction_IgnoreError: {
988 return 0 /* LDKErrorAction - IgnoreError */;
990 case LDKErrorAction_IgnoreAndLog: {
991 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
992 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
994 case LDKErrorAction_SendErrorMessage: {
995 LDKErrorMessage msg_var = obj->send_error_message.msg;
996 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
997 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
998 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
999 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1004 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
1005 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1007 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1008 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1009 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1010 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1011 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1012 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
1014 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1015 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1017 case LDKHTLCFailChannelUpdate_NodeFailure: {
1018 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1019 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1020 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1025 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1026 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1028 case LDKMessageSendEvent_SendAcceptChannel: {
1029 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1030 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1031 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1032 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1033 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1034 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1035 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1037 case LDKMessageSendEvent_SendOpenChannel: {
1038 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1039 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1040 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1041 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1042 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1043 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1044 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1046 case LDKMessageSendEvent_SendFundingCreated: {
1047 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1048 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1049 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1050 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1053 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1055 case LDKMessageSendEvent_SendFundingSigned: {
1056 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1057 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1058 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1059 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1060 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1061 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1062 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1064 case LDKMessageSendEvent_SendFundingLocked: {
1065 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1066 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1067 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1068 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1071 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1073 case LDKMessageSendEvent_SendAnnouncementSignatures: {
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->send_announcement_signatures.node_id.compressed_form, 33);
1076 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1077 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1078 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1079 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1080 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1082 case LDKMessageSendEvent_UpdateHTLCs: {
1083 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1084 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1085 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1086 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1087 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1088 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1089 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1091 case LDKMessageSendEvent_SendRevokeAndACK: {
1092 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1093 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1094 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1095 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1096 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1097 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1098 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1100 case LDKMessageSendEvent_SendClosingSigned: {
1101 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1102 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1103 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1104 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1105 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1106 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1107 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1109 case LDKMessageSendEvent_SendShutdown: {
1110 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1111 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1112 LDKShutdown msg_var = obj->send_shutdown.msg;
1113 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1114 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1115 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1116 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1118 case LDKMessageSendEvent_SendChannelReestablish: {
1119 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1120 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1121 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1122 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1123 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1124 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1125 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1127 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1128 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1129 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1130 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1131 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1132 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1133 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1136 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1138 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1139 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1140 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1141 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1142 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1143 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1145 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1146 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1147 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1148 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1149 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1150 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1152 case LDKMessageSendEvent_SendChannelUpdate: {
1153 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1154 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1155 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1156 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1157 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1158 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1159 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1161 case LDKMessageSendEvent_HandleError: {
1162 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1163 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1164 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1165 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1167 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1168 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1169 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
1171 case LDKMessageSendEvent_SendChannelRangeQuery: {
1172 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1173 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1174 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1175 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1176 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1177 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1178 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1180 case LDKMessageSendEvent_SendShortIdsQuery: {
1181 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1182 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1183 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1184 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1185 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1186 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1187 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1189 case LDKMessageSendEvent_SendReplyChannelRange: {
1190 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1191 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1192 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1193 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1194 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1196 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1201 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1202 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1203 ret->datalen = *((uint32_t*)elems);
1204 if (ret->datalen == 0) {
1207 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1208 uint32_t *java_elems = (uint32_t*)(elems + 4);
1209 for (size_t i = 0; i < ret->datalen; i++) {
1210 uint32_t arr_elem = java_elems[i];
1211 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1212 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1213 ret->data[i] = arr_elem_conv;
1216 return (uint64_t)ret;
1218 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1219 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1220 for (size_t i = 0; i < ret.datalen; i++) {
1221 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1225 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1226 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1228 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1229 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1230 CHECK(val->result_ok);
1231 LDKInitFeatures res_var = (*val->contents.result);
1232 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1233 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1234 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1237 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1238 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1239 CHECK(!val->result_ok);
1240 LDKDecodeError err_var = (*val->contents.err);
1241 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1242 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1243 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1246 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1247 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1249 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1250 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1251 CHECK(val->result_ok);
1252 LDKNodeFeatures res_var = (*val->contents.result);
1253 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1254 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1255 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1258 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1259 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1260 CHECK(!val->result_ok);
1261 LDKDecodeError err_var = (*val->contents.err);
1262 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1263 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1264 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1267 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1268 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1270 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1271 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1272 CHECK(val->result_ok);
1273 LDKChannelFeatures res_var = (*val->contents.result);
1274 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1275 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1276 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1279 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1280 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1281 CHECK(!val->result_ok);
1282 LDKDecodeError err_var = (*val->contents.err);
1283 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1284 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1285 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1288 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1289 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1291 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1292 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1293 CHECK(val->result_ok);
1294 LDKInvoiceFeatures res_var = (*val->contents.result);
1295 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1296 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1297 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1301 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1302 CHECK(!val->result_ok);
1303 LDKDecodeError err_var = (*val->contents.err);
1304 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1305 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1306 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1309 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1310 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1312 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1313 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1314 CHECK(val->result_ok);
1315 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1316 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1317 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1318 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1321 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1322 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1323 CHECK(!val->result_ok);
1324 LDKDecodeError err_var = (*val->contents.err);
1325 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1327 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1330 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1331 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1334 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1335 CHECK(val->result_ok);
1336 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1337 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1338 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1339 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1342 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1343 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1344 CHECK(!val->result_ok);
1345 LDKDecodeError err_var = (*val->contents.err);
1346 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1347 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1348 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1351 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1352 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1355 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1356 CHECK(val->result_ok);
1357 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1361 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1362 CHECK(!val->result_ok);
1363 LDKDecodeError err_var = (*val->contents.err);
1364 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1365 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1366 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1369 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1370 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1372 CHECK(*((uint32_t*)a) == 64);
1373 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1375 LDKCVec_SignatureZ b_constr;
1376 b_constr.datalen = *((uint32_t*)b);
1377 if (b_constr.datalen > 0)
1378 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1380 b_constr.data = NULL;
1381 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1382 for (size_t m = 0; m < b_constr.datalen; m++) {
1383 int8_tArray b_conv_12 = b_vals[m];
1384 LDKSignature b_conv_12_ref;
1385 CHECK(*((uint32_t*)b_conv_12) == 64);
1386 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1387 b_constr.data[m] = b_conv_12_ref;
1390 return (uint64_t)ret;
1392 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1393 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1394 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1395 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1398 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1399 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1400 LDKCVec_SignatureZ b_var = tuple->b;
1401 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1402 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1403 for (size_t m = 0; m < b_var.datalen; m++) {
1404 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1405 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1406 b_arr_ptr[m] = b_conv_12_arr;
1410 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1411 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1413 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1414 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1415 CHECK(val->result_ok);
1416 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
1419 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1420 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1421 CHECK(!val->result_ok);
1422 return *val->contents.err;
1424 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1425 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1427 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1428 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1429 CHECK(val->result_ok);
1430 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1431 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1434 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1435 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1436 CHECK(!val->result_ok);
1437 return *val->contents.err;
1439 typedef struct LDKBaseSign_JCalls {
1440 atomic_size_t refcnt;
1441 uint32_t get_per_commitment_point_meth;
1442 uint32_t release_commitment_secret_meth;
1443 uint32_t channel_keys_id_meth;
1444 uint32_t sign_counterparty_commitment_meth;
1445 uint32_t sign_holder_commitment_and_htlcs_meth;
1446 uint32_t sign_justice_revoked_output_meth;
1447 uint32_t sign_justice_revoked_htlc_meth;
1448 uint32_t sign_counterparty_htlc_transaction_meth;
1449 uint32_t sign_closing_transaction_meth;
1450 uint32_t sign_channel_announcement_meth;
1451 uint32_t ready_channel_meth;
1452 } LDKBaseSign_JCalls;
1453 static void LDKBaseSign_JCalls_free(void* this_arg) {
1454 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1455 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1456 js_free(j_calls->get_per_commitment_point_meth);
1457 js_free(j_calls->release_commitment_secret_meth);
1458 js_free(j_calls->channel_keys_id_meth);
1459 js_free(j_calls->sign_counterparty_commitment_meth);
1460 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1461 js_free(j_calls->sign_justice_revoked_output_meth);
1462 js_free(j_calls->sign_justice_revoked_htlc_meth);
1463 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1464 js_free(j_calls->sign_closing_transaction_meth);
1465 js_free(j_calls->sign_channel_announcement_meth);
1466 js_free(j_calls->ready_channel_meth);
1470 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1471 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1472 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1473 LDKPublicKey ret_ref;
1474 CHECK(*((uint32_t*)ret) == 33);
1475 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1478 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1479 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1480 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1481 LDKThirtyTwoBytes ret_ref;
1482 CHECK(*((uint32_t*)ret) == 32);
1483 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1486 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1487 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1488 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1489 LDKThirtyTwoBytes ret_ref;
1490 CHECK(*((uint32_t*)ret) == 32);
1491 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1494 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1495 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1496 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1497 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1498 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1499 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1500 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1501 if (commitment_tx_var.is_owned) {
1502 commitment_tx_ref |= 1;
1504 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1505 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1506 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1509 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1510 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1511 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1512 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1513 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1514 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1515 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1516 if (commitment_tx_var.is_owned) {
1517 commitment_tx_ref |= 1;
1519 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1520 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1521 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1524 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]) {
1525 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1526 LDKTransaction justice_tx_var = justice_tx;
1527 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1528 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1529 Transaction_free(justice_tx_var);
1530 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1531 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1532 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1533 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1534 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1537 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) {
1538 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1539 LDKTransaction justice_tx_var = justice_tx;
1540 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1541 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1542 Transaction_free(justice_tx_var);
1543 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1544 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1545 LDKHTLCOutputInCommitment htlc_var = *htlc;
1546 htlc_var = HTLCOutputInCommitment_clone(htlc);
1547 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1548 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1549 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1550 if (htlc_var.is_owned) {
1553 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1554 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1555 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1558 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) {
1559 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1560 LDKTransaction htlc_tx_var = htlc_tx;
1561 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1562 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1563 Transaction_free(htlc_tx_var);
1564 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1565 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1566 LDKHTLCOutputInCommitment htlc_var = *htlc;
1567 htlc_var = HTLCOutputInCommitment_clone(htlc);
1568 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1569 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1570 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1571 if (htlc_var.is_owned) {
1574 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1575 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1576 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1579 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1580 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1581 LDKTransaction closing_tx_var = closing_tx;
1582 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1583 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1584 Transaction_free(closing_tx_var);
1585 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1586 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1587 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1590 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1591 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1592 LDKUnsignedChannelAnnouncement msg_var = *msg;
1593 msg_var = UnsignedChannelAnnouncement_clone(msg);
1594 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1595 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1596 uint64_t msg_ref = (uint64_t)msg_var.inner;
1597 if (msg_var.is_owned) {
1600 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1601 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1602 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1605 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1606 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1607 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1608 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1609 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1610 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1611 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1612 if (channel_parameters_var.is_owned) {
1613 channel_parameters_ref |= 1;
1615 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1617 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1618 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1619 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1621 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1622 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1623 atomic_init(&calls->refcnt, 1);
1624 //TODO: Assign calls->o from o
1626 LDKChannelPublicKeys pubkeys_conv;
1627 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1628 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1629 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1632 .this_arg = (void*) calls,
1633 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1634 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1635 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1636 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1637 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1638 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1639 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1640 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1641 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1642 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1643 .ready_channel = ready_channel_LDKBaseSign_jcall,
1644 .free = LDKBaseSign_JCalls_free,
1645 .pubkeys = pubkeys_conv,
1646 .set_pubkeys = NULL,
1650 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1651 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1652 *res_ptr = LDKBaseSign_init(o, pubkeys);
1653 return (long)res_ptr;
1655 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1656 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1657 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1658 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1662 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1663 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1664 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1665 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1669 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1670 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1671 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1672 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1676 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1677 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1678 LDKCommitmentTransaction commitment_tx_conv;
1679 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1680 commitment_tx_conv.is_owned = false;
1681 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1682 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1683 return (uint64_t)ret_conv;
1686 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1687 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1688 LDKHolderCommitmentTransaction commitment_tx_conv;
1689 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1690 commitment_tx_conv.is_owned = false;
1691 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1692 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1693 return (uint64_t)ret_conv;
1696 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) {
1697 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1698 LDKTransaction justice_tx_ref;
1699 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1700 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1701 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1702 justice_tx_ref.data_is_owned = true;
1703 unsigned char per_commitment_key_arr[32];
1704 CHECK(*((uint32_t*)per_commitment_key) == 32);
1705 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1706 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1707 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1708 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1709 return (uint64_t)ret_conv;
1712 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) {
1713 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1714 LDKTransaction justice_tx_ref;
1715 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1716 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1717 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1718 justice_tx_ref.data_is_owned = true;
1719 unsigned char per_commitment_key_arr[32];
1720 CHECK(*((uint32_t*)per_commitment_key) == 32);
1721 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1722 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1723 LDKHTLCOutputInCommitment htlc_conv;
1724 htlc_conv.inner = (void*)(htlc & (~1));
1725 htlc_conv.is_owned = false;
1726 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1727 *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);
1728 return (uint64_t)ret_conv;
1731 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) {
1732 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1733 LDKTransaction htlc_tx_ref;
1734 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1735 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1736 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1737 htlc_tx_ref.data_is_owned = true;
1738 LDKPublicKey per_commitment_point_ref;
1739 CHECK(*((uint32_t*)per_commitment_point) == 33);
1740 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1741 LDKHTLCOutputInCommitment htlc_conv;
1742 htlc_conv.inner = (void*)(htlc & (~1));
1743 htlc_conv.is_owned = false;
1744 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1745 *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);
1746 return (uint64_t)ret_conv;
1749 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1750 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1751 LDKTransaction closing_tx_ref;
1752 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1753 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1754 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1755 closing_tx_ref.data_is_owned = true;
1756 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1757 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1758 return (uint64_t)ret_conv;
1761 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1762 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1763 LDKUnsignedChannelAnnouncement msg_conv;
1764 msg_conv.inner = (void*)(msg & (~1));
1765 msg_conv.is_owned = false;
1766 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1767 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1768 return (uint64_t)ret_conv;
1771 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1772 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1773 LDKChannelTransactionParameters channel_parameters_conv;
1774 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1775 channel_parameters_conv.is_owned = false;
1776 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1779 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1780 if (this_arg->set_pubkeys != NULL)
1781 this_arg->set_pubkeys(this_arg);
1782 return this_arg->pubkeys;
1784 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1785 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1786 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1789 uint64_t ret_ref = (uint64_t)ret_var.inner;
1790 if (ret_var.is_owned) {
1796 typedef struct LDKSign_JCalls {
1797 atomic_size_t refcnt;
1798 LDKBaseSign_JCalls* BaseSign;
1799 uint32_t write_meth;
1801 static void LDKSign_JCalls_free(void* this_arg) {
1802 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1803 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1804 js_free(j_calls->write_meth);
1808 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1809 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1810 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1811 LDKCVec_u8Z ret_ref;
1812 ret_ref.datalen = *((uint32_t*)ret);
1813 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1814 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1817 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1818 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1819 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1820 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1822 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1823 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1824 atomic_init(&calls->refcnt, 1);
1825 //TODO: Assign calls->o from o
1827 LDKChannelPublicKeys pubkeys_conv;
1828 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1829 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1830 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1833 .this_arg = (void*) calls,
1834 .write = write_LDKSign_jcall,
1835 .cloned = LDKSign_JCalls_cloned,
1836 .free = LDKSign_JCalls_free,
1837 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1839 calls->BaseSign = ret.BaseSign.this_arg;
1842 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1843 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1844 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1845 return (long)res_ptr;
1847 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1848 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1849 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1850 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1851 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1852 CVec_u8Z_free(ret_var);
1856 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
1857 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
1859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
1860 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1861 CHECK(val->result_ok);
1862 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
1863 *ret = Sign_clone(&(*val->contents.result));
1864 return (uint64_t)ret;
1866 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
1867 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1868 CHECK(!val->result_ok);
1869 LDKDecodeError err_var = (*val->contents.err);
1870 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1871 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1872 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1875 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
1876 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
1878 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
1879 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1880 CHECK(val->result_ok);
1881 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
1882 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
1885 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
1886 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1887 CHECK(!val->result_ok);
1888 return *val->contents.err;
1890 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
1891 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
1892 for (size_t i = 0; i < ret.datalen; i++) {
1893 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
1897 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
1898 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
1900 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
1901 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1902 CHECK(val->result_ok);
1903 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
1904 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1905 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
1906 for (size_t m = 0; m < res_var.datalen; m++) {
1907 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
1908 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1909 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
1910 res_arr_ptr[m] = res_conv_12_arr;
1914 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
1915 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1916 CHECK(!val->result_ok);
1917 return *val->contents.err;
1919 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
1920 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
1922 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
1923 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1924 CHECK(val->result_ok);
1925 LDKInMemorySigner res_var = (*val->contents.result);
1926 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1931 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
1932 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1933 CHECK(!val->result_ok);
1934 LDKDecodeError err_var = (*val->contents.err);
1935 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1940 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
1941 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
1942 ret->datalen = *((uint32_t*)elems);
1943 if (ret->datalen == 0) {
1946 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
1947 uint32_t *java_elems = (uint32_t*)(elems + 4);
1948 for (size_t i = 0; i < ret->datalen; i++) {
1949 uint32_t arr_elem = java_elems[i];
1950 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
1951 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
1952 ret->data[i] = arr_elem_conv;
1955 return (uint64_t)ret;
1957 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1958 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1959 for (size_t i = 0; i < ret.datalen; i++) {
1960 ret.data[i] = TxOut_clone(&orig->data[i]);
1964 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
1965 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
1967 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
1968 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
1969 CHECK(val->result_ok);
1970 LDKTransaction res_var = (*val->contents.result);
1971 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1972 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
1975 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
1976 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
1977 CHECK(!val->result_ok);
1978 return *val->contents.err;
1980 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1981 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1982 LDKThirtyTwoBytes a_ref;
1983 CHECK(*((uint32_t*)a) == 32);
1984 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1986 LDKChannelMonitor b_conv;
1987 b_conv.inner = (void*)(b & (~1));
1988 b_conv.is_owned = (b & 1) || (b == 0);
1989 b_conv = ChannelMonitor_clone(&b_conv);
1991 return (uint64_t)ret;
1993 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1994 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1995 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1996 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1999 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2000 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2001 LDKChannelMonitor b_var = tuple->b;
2002 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2003 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2004 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2007 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2008 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2009 ret->datalen = *((uint32_t*)elems);
2010 if (ret->datalen == 0) {
2013 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2014 uint32_t *java_elems = (uint32_t*)(elems + 4);
2015 for (size_t i = 0; i < ret->datalen; i++) {
2016 uint32_t arr_elem = java_elems[i];
2017 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2018 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2019 ret->data[i] = arr_elem_conv;
2022 return (uint64_t)ret;
2024 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2025 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2027 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2028 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2029 CHECK(val->result_ok);
2030 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2031 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2032 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2033 for (size_t m = 0; m < res_var.datalen; m++) {
2034 uint64_t res_conv_38_ref = (uint64_t)(&res_var.data[m]) | 1;
2035 res_arr_ptr[m] = res_conv_38_ref;
2039 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2040 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2041 CHECK(!val->result_ok);
2042 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2045 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2046 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2048 case LDKCOption_u16Z_Some: {
2049 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2051 case LDKCOption_u16Z_None: {
2052 return 0 /* LDKCOption_u16Z - None */;
2057 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2058 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2060 case LDKAPIError_APIMisuseError: {
2061 LDKStr err_str = obj->api_misuse_error.err;
2062 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2063 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2065 case LDKAPIError_FeeRateTooHigh: {
2066 LDKStr err_str = obj->fee_rate_too_high.err;
2067 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2068 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2070 case LDKAPIError_RouteError: {
2071 LDKStr err_str = obj->route_error.err;
2072 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2073 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2075 case LDKAPIError_ChannelUnavailable: {
2076 LDKStr err_str = obj->channel_unavailable.err;
2077 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2078 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2080 case LDKAPIError_MonitorUpdateFailed: {
2081 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2086 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2087 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2089 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2090 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2091 CHECK(val->result_ok);
2092 return *val->contents.result;
2094 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2095 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2096 CHECK(!val->result_ok);
2097 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2100 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2101 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2102 ret->datalen = *((uint32_t*)elems);
2103 if (ret->datalen == 0) {
2106 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2107 uint32_t *java_elems = (uint32_t*)(elems + 4);
2108 for (size_t i = 0; i < ret->datalen; i++) {
2109 uint32_t arr_elem = java_elems[i];
2110 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2111 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2112 ret->data[i] = arr_elem_conv;
2115 return (uint64_t)ret;
2117 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2118 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2119 for (size_t i = 0; i < ret.datalen; i++) {
2120 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2124 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2125 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2126 ret->datalen = *((uint32_t*)elems);
2127 if (ret->datalen == 0) {
2130 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2131 uint32_t *java_elems = (uint32_t*)(elems + 4);
2132 for (size_t i = 0; i < ret->datalen; i++) {
2133 uint32_t arr_elem = java_elems[i];
2134 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2135 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2136 ret->data[i] = arr_elem_conv;
2139 return (uint64_t)ret;
2141 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2142 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2143 for (size_t i = 0; i < ret.datalen; i++) {
2144 ret.data[i] = APIError_clone(&orig->data[i]);
2148 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2149 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2151 case LDKPaymentSendFailure_ParameterError: {
2152 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2153 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2155 case LDKPaymentSendFailure_PathParameterError: {
2156 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2157 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2158 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2159 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2160 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2161 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2162 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2163 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2165 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2167 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2168 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2169 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2170 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2171 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2172 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2173 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2175 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2177 case LDKPaymentSendFailure_PartialFailure: {
2178 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2179 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2180 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2181 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2182 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2183 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2184 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2185 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2187 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2192 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2193 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2195 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2196 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2197 CHECK(val->result_ok);
2198 return *val->contents.result;
2200 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2201 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2202 CHECK(!val->result_ok);
2203 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2206 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2207 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2209 case LDKNetAddress_IPv4: {
2210 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2211 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2212 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2214 case LDKNetAddress_IPv6: {
2215 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2216 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2217 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2219 case LDKNetAddress_OnionV2: {
2220 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2221 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2222 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2224 case LDKNetAddress_OnionV3: {
2225 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2226 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2227 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2232 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2233 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2234 ret->datalen = *((uint32_t*)elems);
2235 if (ret->datalen == 0) {
2238 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2239 uint32_t *java_elems = (uint32_t*)(elems + 4);
2240 for (size_t i = 0; i < ret->datalen; i++) {
2241 uint32_t arr_elem = java_elems[i];
2242 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2243 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2244 ret->data[i] = arr_elem_conv;
2247 return (uint64_t)ret;
2249 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2250 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2251 for (size_t i = 0; i < ret.datalen; i++) {
2252 ret.data[i] = NetAddress_clone(&orig->data[i]);
2256 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2257 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2258 LDKThirtyTwoBytes a_ref;
2259 CHECK(*((uint32_t*)a) == 32);
2260 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2262 LDKThirtyTwoBytes b_ref;
2263 CHECK(*((uint32_t*)b) == 32);
2264 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2266 return (uint64_t)ret;
2268 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t ptr) {
2269 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2270 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2271 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2274 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t ptr) {
2275 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2276 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2277 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2280 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2281 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2283 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2284 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2285 CHECK(val->result_ok);
2286 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2287 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2291 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2292 CHECK(!val->result_ok);
2293 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2296 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2297 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2298 ret->datalen = *((uint32_t*)elems);
2299 if (ret->datalen == 0) {
2302 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2303 uint32_t *java_elems = (uint32_t*)(elems + 4);
2304 for (size_t i = 0; i < ret->datalen; i++) {
2305 uint32_t arr_elem = java_elems[i];
2306 LDKChannelMonitor arr_elem_conv;
2307 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2308 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2309 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2310 ret->data[i] = arr_elem_conv;
2313 return (uint64_t)ret;
2315 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2316 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2317 for (size_t i = 0; i < ret.datalen; i++) {
2318 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2322 typedef struct LDKWatch_JCalls {
2323 atomic_size_t refcnt;
2324 uint32_t watch_channel_meth;
2325 uint32_t update_channel_meth;
2326 uint32_t release_pending_monitor_events_meth;
2328 static void LDKWatch_JCalls_free(void* this_arg) {
2329 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2330 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2331 js_free(j_calls->watch_channel_meth);
2332 js_free(j_calls->update_channel_meth);
2333 js_free(j_calls->release_pending_monitor_events_meth);
2337 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2338 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2339 LDKOutPoint funding_txo_var = funding_txo;
2340 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2341 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2342 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2343 if (funding_txo_var.is_owned) {
2344 funding_txo_ref |= 1;
2346 LDKChannelMonitor monitor_var = monitor;
2347 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2348 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2349 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2350 if (monitor_var.is_owned) {
2353 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2354 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2355 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2358 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2359 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2360 LDKOutPoint funding_txo_var = funding_txo;
2361 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2362 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2363 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2364 if (funding_txo_var.is_owned) {
2365 funding_txo_ref |= 1;
2367 LDKChannelMonitorUpdate update_var = update;
2368 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 uint64_t update_ref = (uint64_t)update_var.inner;
2371 if (update_var.is_owned) {
2374 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2375 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2376 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2379 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2380 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2381 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2382 LDKCVec_MonitorEventZ ret_constr;
2383 ret_constr.datalen = *((uint32_t*)ret);
2384 if (ret_constr.datalen > 0)
2385 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2387 ret_constr.data = NULL;
2388 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2389 for (size_t o = 0; o < ret_constr.datalen; o++) {
2390 uint32_t ret_conv_14 = ret_vals[o];
2391 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2392 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2393 ret_constr.data[o] = ret_conv_14_conv;
2397 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2398 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2399 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2401 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2402 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2403 atomic_init(&calls->refcnt, 1);
2404 //TODO: Assign calls->o from o
2407 .this_arg = (void*) calls,
2408 .watch_channel = watch_channel_LDKWatch_jcall,
2409 .update_channel = update_channel_LDKWatch_jcall,
2410 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2411 .free = LDKWatch_JCalls_free,
2415 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2416 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2417 *res_ptr = LDKWatch_init(o);
2418 return (long)res_ptr;
2420 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2421 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2422 LDKOutPoint funding_txo_conv;
2423 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2424 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2425 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2426 LDKChannelMonitor monitor_conv;
2427 monitor_conv.inner = (void*)(monitor & (~1));
2428 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2429 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2430 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2431 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2432 return (uint64_t)ret_conv;
2435 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2436 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2437 LDKOutPoint funding_txo_conv;
2438 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2439 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2440 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2441 LDKChannelMonitorUpdate update_conv;
2442 update_conv.inner = (void*)(update & (~1));
2443 update_conv.is_owned = (update & 1) || (update == 0);
2444 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2445 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2446 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2447 return (uint64_t)ret_conv;
2450 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2451 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2452 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2453 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2454 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2455 for (size_t o = 0; o < ret_var.datalen; o++) {
2456 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2457 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2458 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2459 ret_arr_ptr[o] = ret_conv_14_ref;
2465 typedef struct LDKBroadcasterInterface_JCalls {
2466 atomic_size_t refcnt;
2467 uint32_t broadcast_transaction_meth;
2468 } LDKBroadcasterInterface_JCalls;
2469 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2470 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2471 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2472 js_free(j_calls->broadcast_transaction_meth);
2476 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2477 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2478 LDKTransaction tx_var = tx;
2479 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2480 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2481 Transaction_free(tx_var);
2482 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2484 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2485 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2486 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2488 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2489 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2490 atomic_init(&calls->refcnt, 1);
2491 //TODO: Assign calls->o from o
2493 LDKBroadcasterInterface ret = {
2494 .this_arg = (void*) calls,
2495 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2496 .free = LDKBroadcasterInterface_JCalls_free,
2500 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2501 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2502 *res_ptr = LDKBroadcasterInterface_init(o);
2503 return (long)res_ptr;
2505 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2506 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2507 LDKTransaction tx_ref;
2508 tx_ref.datalen = *((uint32_t*)tx);
2509 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2510 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2511 tx_ref.data_is_owned = true;
2512 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2515 typedef struct LDKKeysInterface_JCalls {
2516 atomic_size_t refcnt;
2517 uint32_t get_node_secret_meth;
2518 uint32_t get_destination_script_meth;
2519 uint32_t get_shutdown_pubkey_meth;
2520 uint32_t get_channel_signer_meth;
2521 uint32_t get_secure_random_bytes_meth;
2522 uint32_t read_chan_signer_meth;
2523 uint32_t sign_invoice_meth;
2524 } LDKKeysInterface_JCalls;
2525 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2526 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2527 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2528 js_free(j_calls->get_node_secret_meth);
2529 js_free(j_calls->get_destination_script_meth);
2530 js_free(j_calls->get_shutdown_pubkey_meth);
2531 js_free(j_calls->get_channel_signer_meth);
2532 js_free(j_calls->get_secure_random_bytes_meth);
2533 js_free(j_calls->read_chan_signer_meth);
2534 js_free(j_calls->sign_invoice_meth);
2538 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2539 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2540 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2541 LDKSecretKey ret_ref;
2542 CHECK(*((uint32_t*)ret) == 32);
2543 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2546 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2547 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2548 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2549 LDKCVec_u8Z ret_ref;
2550 ret_ref.datalen = *((uint32_t*)ret);
2551 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2552 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2555 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
2556 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2557 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2558 LDKPublicKey ret_ref;
2559 CHECK(*((uint32_t*)ret) == 33);
2560 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2563 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2564 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2565 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2566 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2567 ret_conv = Sign_clone(ret);
2570 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2571 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2572 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2573 LDKThirtyTwoBytes ret_ref;
2574 CHECK(*((uint32_t*)ret) == 32);
2575 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2578 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2579 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2580 LDKu8slice reader_var = reader;
2581 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2582 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2583 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2584 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2585 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2588 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2589 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2590 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2591 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2592 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2593 CVec_u8Z_free(invoice_preimage_var);
2594 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2595 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2596 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2599 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2600 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2601 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2603 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2604 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2605 atomic_init(&calls->refcnt, 1);
2606 //TODO: Assign calls->o from o
2608 LDKKeysInterface ret = {
2609 .this_arg = (void*) calls,
2610 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2611 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2612 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
2613 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2614 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2615 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2616 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2617 .free = LDKKeysInterface_JCalls_free,
2621 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2622 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2623 *res_ptr = LDKKeysInterface_init(o);
2624 return (long)res_ptr;
2626 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2627 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2628 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2629 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2633 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2634 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2635 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2636 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2637 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2638 CVec_u8Z_free(ret_var);
2642 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2643 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2644 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2645 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2649 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2650 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2651 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2652 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2653 return (uint64_t)ret;
2656 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2657 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2658 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2659 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2663 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2664 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2665 LDKu8slice reader_ref;
2666 reader_ref.datalen = *((uint32_t*)reader);
2667 reader_ref.data = (int8_t*)(reader + 4);
2668 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2669 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2670 return (uint64_t)ret_conv;
2673 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2674 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2675 LDKCVec_u8Z invoice_preimage_ref;
2676 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2677 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2678 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2679 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2680 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2681 return (uint64_t)ret_conv;
2684 typedef struct LDKFeeEstimator_JCalls {
2685 atomic_size_t refcnt;
2686 uint32_t get_est_sat_per_1000_weight_meth;
2687 } LDKFeeEstimator_JCalls;
2688 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2689 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2690 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2691 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2695 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2696 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2697 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2698 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2700 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2701 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2702 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2704 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2705 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2706 atomic_init(&calls->refcnt, 1);
2707 //TODO: Assign calls->o from o
2709 LDKFeeEstimator ret = {
2710 .this_arg = (void*) calls,
2711 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2712 .free = LDKFeeEstimator_JCalls_free,
2716 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2717 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2718 *res_ptr = LDKFeeEstimator_init(o);
2719 return (long)res_ptr;
2721 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2722 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2723 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2724 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2728 typedef struct LDKLogger_JCalls {
2729 atomic_size_t refcnt;
2732 static void LDKLogger_JCalls_free(void* this_arg) {
2733 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2734 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2735 js_free(j_calls->log_meth);
2739 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2740 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2741 const char* record_str = record;
2742 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2743 js_invoke_function_1(j_calls->log_meth, record_conv);
2745 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2746 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2747 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2749 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2750 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2751 atomic_init(&calls->refcnt, 1);
2752 //TODO: Assign calls->o from o
2755 .this_arg = (void*) calls,
2756 .log = log_LDKLogger_jcall,
2757 .free = LDKLogger_JCalls_free,
2761 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2762 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2763 *res_ptr = LDKLogger_init(o);
2764 return (long)res_ptr;
2766 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2767 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2768 LDKThirtyTwoBytes a_ref;
2769 CHECK(*((uint32_t*)a) == 32);
2770 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2772 LDKChannelManager b_conv;
2773 b_conv.inner = (void*)(b & (~1));
2774 b_conv.is_owned = (b & 1) || (b == 0);
2775 // Warning: we need a move here but no clone is available for LDKChannelManager
2777 return (uint64_t)ret;
2779 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2780 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2781 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2782 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2785 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2786 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2787 LDKChannelManager b_var = tuple->b;
2788 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2789 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2790 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2793 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2794 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2796 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2797 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2798 CHECK(val->result_ok);
2799 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2802 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2803 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2804 CHECK(!val->result_ok);
2805 LDKDecodeError err_var = (*val->contents.err);
2806 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2807 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2808 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2811 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
2812 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
2814 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
2815 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2816 CHECK(val->result_ok);
2817 LDKChannelConfig res_var = (*val->contents.result);
2818 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2819 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2820 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2823 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
2824 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2825 CHECK(!val->result_ok);
2826 LDKDecodeError err_var = (*val->contents.err);
2827 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2828 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2829 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2832 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
2833 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
2835 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
2836 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2837 CHECK(val->result_ok);
2838 LDKOutPoint res_var = (*val->contents.result);
2839 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2840 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2841 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2844 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
2845 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2846 CHECK(!val->result_ok);
2847 LDKDecodeError err_var = (*val->contents.err);
2848 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2849 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2850 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2853 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
2854 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
2856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
2857 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2858 CHECK(val->result_ok);
2859 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
2862 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
2863 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2864 CHECK(!val->result_ok);
2865 return *val->contents.err;
2867 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
2868 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
2870 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
2871 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2872 CHECK(val->result_ok);
2873 LDKInvoice res_var = (*val->contents.result);
2874 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2875 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2876 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2879 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
2880 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2881 CHECK(!val->result_ok);
2882 return *val->contents.err;
2884 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
2885 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
2887 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
2888 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2889 CHECK(val->result_ok);
2890 LDKSignedRawInvoice res_var = (*val->contents.result);
2891 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2892 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2893 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2896 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
2897 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2898 CHECK(!val->result_ok);
2899 return *val->contents.err;
2901 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
2902 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
2903 LDKRawInvoice a_conv;
2904 a_conv.inner = (void*)(a & (~1));
2905 a_conv.is_owned = (a & 1) || (a == 0);
2906 a_conv = RawInvoice_clone(&a_conv);
2908 LDKThirtyTwoBytes b_ref;
2909 CHECK(*((uint32_t*)b) == 32);
2910 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2912 LDKInvoiceSignature c_conv;
2913 c_conv.inner = (void*)(c & (~1));
2914 c_conv.is_owned = (c & 1) || (c == 0);
2915 c_conv = InvoiceSignature_clone(&c_conv);
2917 return (uint64_t)ret;
2919 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t ptr) {
2920 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2921 LDKRawInvoice a_var = tuple->a;
2922 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2923 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2924 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
2927 int8_tArray __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t ptr) {
2928 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2929 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2930 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2933 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t ptr) {
2934 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2935 LDKInvoiceSignature c_var = tuple->c;
2936 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2937 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2938 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
2941 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
2942 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
2944 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
2945 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
2946 CHECK(val->result_ok);
2947 LDKPayeePubKey res_var = (*val->contents.result);
2948 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2949 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2950 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2953 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
2954 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
2955 CHECK(!val->result_ok);
2956 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2959 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
2960 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
2961 ret->datalen = *((uint32_t*)elems);
2962 if (ret->datalen == 0) {
2965 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
2966 uint32_t *java_elems = (uint32_t*)(elems + 4);
2967 for (size_t i = 0; i < ret->datalen; i++) {
2968 uint32_t arr_elem = java_elems[i];
2969 LDKPrivateRoute arr_elem_conv;
2970 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2971 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2972 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
2973 ret->data[i] = arr_elem_conv;
2976 return (uint64_t)ret;
2978 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
2979 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
2980 for (size_t i = 0; i < ret.datalen; i++) {
2981 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
2985 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
2986 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
2988 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
2989 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
2990 CHECK(val->result_ok);
2991 LDKPositiveTimestamp res_var = (*val->contents.result);
2992 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2993 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2994 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2997 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
2998 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
2999 CHECK(!val->result_ok);
3000 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3003 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3004 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3006 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3007 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3008 CHECK(val->result_ok);
3009 return *val->contents.result;
3011 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3012 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3013 CHECK(!val->result_ok);
3014 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3017 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3018 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3020 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3021 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3022 CHECK(val->result_ok);
3023 LDKInvoice res_var = (*val->contents.result);
3024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3026 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3029 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3030 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3031 CHECK(!val->result_ok);
3032 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3035 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3036 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3038 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3039 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3040 CHECK(val->result_ok);
3041 LDKDescription res_var = (*val->contents.result);
3042 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3043 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3044 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3047 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3048 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3049 CHECK(!val->result_ok);
3050 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3053 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3054 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3056 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3057 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3058 CHECK(val->result_ok);
3059 LDKExpiryTime res_var = (*val->contents.result);
3060 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3061 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3062 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3065 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3066 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3067 CHECK(!val->result_ok);
3068 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3071 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3072 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3074 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3075 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3076 CHECK(val->result_ok);
3077 LDKPrivateRoute res_var = (*val->contents.result);
3078 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3079 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3080 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3083 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3084 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3085 CHECK(!val->result_ok);
3086 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3089 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3090 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3092 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3093 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3094 CHECK(val->result_ok);
3095 LDKStr res_str = (*val->contents.result);
3096 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3100 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3101 CHECK(!val->result_ok);
3102 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3105 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3106 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3108 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3109 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3110 CHECK(val->result_ok);
3111 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3112 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3113 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3114 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3117 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3118 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3119 CHECK(!val->result_ok);
3120 LDKDecodeError err_var = (*val->contents.err);
3121 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3122 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3123 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3126 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3127 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3129 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3130 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3131 CHECK(val->result_ok);
3132 LDKHTLCUpdate res_var = (*val->contents.result);
3133 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3134 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3135 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3138 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3139 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3140 CHECK(!val->result_ok);
3141 LDKDecodeError err_var = (*val->contents.err);
3142 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3143 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3144 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3147 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3148 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3150 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3151 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3152 CHECK(val->result_ok);
3153 return *val->contents.result;
3155 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3156 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3157 CHECK(!val->result_ok);
3158 LDKMonitorUpdateError err_var = (*val->contents.err);
3159 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3160 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3161 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3164 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3165 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3167 a_conv.inner = (void*)(a & (~1));
3168 a_conv.is_owned = (a & 1) || (a == 0);
3169 a_conv = OutPoint_clone(&a_conv);
3172 b_ref.datalen = *((uint32_t*)b);
3173 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3174 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3176 return (uint64_t)ret;
3178 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
3179 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3180 LDKOutPoint a_var = tuple->a;
3181 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3182 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3183 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3186 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
3187 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3188 LDKCVec_u8Z b_var = tuple->b;
3189 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3190 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3193 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3194 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3197 b_ref.datalen = *((uint32_t*)b);
3198 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3199 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3201 return (uint64_t)ret;
3203 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
3204 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3207 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
3208 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3209 LDKCVec_u8Z b_var = tuple->b;
3210 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3211 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3214 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3215 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3216 ret->datalen = *((uint32_t*)elems);
3217 if (ret->datalen == 0) {
3220 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3221 uint32_t *java_elems = (uint32_t*)(elems + 4);
3222 for (size_t i = 0; i < ret->datalen; i++) {
3223 uint32_t arr_elem = java_elems[i];
3224 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3225 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3226 ret->data[i] = arr_elem_conv;
3229 return (uint64_t)ret;
3231 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3232 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3233 for (size_t i = 0; i < ret.datalen; i++) {
3234 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3238 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3239 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3240 LDKThirtyTwoBytes a_ref;
3241 CHECK(*((uint32_t*)a) == 32);
3242 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3244 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3245 b_constr.datalen = *((uint32_t*)b);
3246 if (b_constr.datalen > 0)
3247 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3249 b_constr.data = NULL;
3250 uint32_t* b_vals = (uint32_t*)(b + 4);
3251 for (size_t e = 0; e < b_constr.datalen; e++) {
3252 uint32_t b_conv_30 = b_vals[e];
3253 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
3254 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
3255 b_constr.data[e] = b_conv_30_conv;
3258 return (uint64_t)ret;
3260 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
3261 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3262 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3263 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3266 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
3267 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3268 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
3269 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3270 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3271 for (size_t e = 0; e < b_var.datalen; e++) {
3272 uint64_t b_conv_30_ref = (uint64_t)(&b_var.data[e]) | 1;
3273 b_arr_ptr[e] = b_conv_30_ref;
3277 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3278 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3279 ret->datalen = *((uint32_t*)elems);
3280 if (ret->datalen == 0) {
3283 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3284 uint32_t *java_elems = (uint32_t*)(elems + 4);
3285 for (size_t i = 0; i < ret->datalen; i++) {
3286 uint32_t arr_elem = java_elems[i];
3287 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3288 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3289 ret->data[i] = arr_elem_conv;
3292 return (uint64_t)ret;
3294 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3295 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 };
3296 for (size_t i = 0; i < ret.datalen; i++) {
3297 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3301 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3302 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3304 case LDKEvent_FundingGenerationReady: {
3305 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3306 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3307 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3308 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3309 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3310 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;
3312 case LDKEvent_PaymentReceived: {
3313 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3314 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3315 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3316 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_received.payment_preimage.data, 32);
3317 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3318 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
3319 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->payment_received.amt; (void) obj->payment_received.user_payment_id;
3321 case LDKEvent_PaymentSent: {
3322 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3323 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3324 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3326 case LDKEvent_PaymentFailed: {
3327 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3328 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
3329 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
3331 case LDKEvent_PendingHTLCsForwardable: {
3332 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3334 case LDKEvent_SpendableOutputs: {
3335 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3336 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3337 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3338 for (size_t b = 0; b < outputs_var.datalen; b++) {
3339 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3340 outputs_arr_ptr[b] = outputs_conv_27_ref;
3342 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3347 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3348 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3349 ret->datalen = *((uint32_t*)elems);
3350 if (ret->datalen == 0) {
3353 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3354 uint32_t *java_elems = (uint32_t*)(elems + 4);
3355 for (size_t i = 0; i < ret->datalen; i++) {
3356 uint32_t arr_elem = java_elems[i];
3357 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3358 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3359 ret->data[i] = arr_elem_conv;
3362 return (uint64_t)ret;
3364 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3365 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3366 for (size_t i = 0; i < ret.datalen; i++) {
3367 ret.data[i] = Event_clone(&orig->data[i]);
3371 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3372 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3374 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3375 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3377 return (uint64_t)ret;
3379 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
3380 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3383 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
3384 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3385 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
3386 return (uint64_t)b_ref;
3388 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3389 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3390 ret->datalen = *((uint32_t*)elems);
3391 if (ret->datalen == 0) {
3394 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3395 uint32_t *java_elems = (uint32_t*)(elems + 4);
3396 for (size_t i = 0; i < ret->datalen; i++) {
3397 uint32_t arr_elem = java_elems[i];
3398 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3399 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3400 ret->data[i] = arr_elem_conv;
3403 return (uint64_t)ret;
3405 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3406 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3407 for (size_t i = 0; i < ret.datalen; i++) {
3408 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3412 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3413 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3414 LDKThirtyTwoBytes a_ref;
3415 CHECK(*((uint32_t*)a) == 32);
3416 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3418 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3419 b_constr.datalen = *((uint32_t*)b);
3420 if (b_constr.datalen > 0)
3421 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3423 b_constr.data = NULL;
3424 uint32_t* b_vals = (uint32_t*)(b + 4);
3425 for (size_t z = 0; z < b_constr.datalen; z++) {
3426 uint32_t b_conv_25 = b_vals[z];
3427 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
3428 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
3429 b_constr.data[z] = b_conv_25_conv;
3432 return (uint64_t)ret;
3434 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
3435 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3436 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3437 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3440 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
3441 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3442 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
3443 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3444 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3445 for (size_t z = 0; z < b_var.datalen; z++) {
3446 uint64_t b_conv_25_ref = (uint64_t)(&b_var.data[z]) | 1;
3447 b_arr_ptr[z] = b_conv_25_ref;
3451 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3452 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3453 ret->datalen = *((uint32_t*)elems);
3454 if (ret->datalen == 0) {
3457 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3458 uint32_t *java_elems = (uint32_t*)(elems + 4);
3459 for (size_t i = 0; i < ret->datalen; i++) {
3460 uint32_t arr_elem = java_elems[i];
3461 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3462 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3463 ret->data[i] = arr_elem_conv;
3466 return (uint64_t)ret;
3468 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3469 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 };
3470 for (size_t i = 0; i < ret.datalen; i++) {
3471 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3475 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3476 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3478 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3479 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3480 CHECK(val->result_ok);
3481 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3484 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
3485 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3486 CHECK(!val->result_ok);
3487 LDKDecodeError err_var = (*val->contents.err);
3488 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3489 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3490 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3493 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
3494 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3496 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
3497 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3498 CHECK(val->result_ok);
3499 return *val->contents.result;
3501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
3502 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3503 CHECK(!val->result_ok);
3504 LDKLightningError err_var = (*val->contents.err);
3505 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3506 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3507 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3510 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
3511 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3512 LDKChannelAnnouncement a_conv;
3513 a_conv.inner = (void*)(a & (~1));
3514 a_conv.is_owned = (a & 1) || (a == 0);
3515 a_conv = ChannelAnnouncement_clone(&a_conv);
3517 LDKChannelUpdate b_conv;
3518 b_conv.inner = (void*)(b & (~1));
3519 b_conv.is_owned = (b & 1) || (b == 0);
3520 b_conv = ChannelUpdate_clone(&b_conv);
3522 LDKChannelUpdate c_conv;
3523 c_conv.inner = (void*)(c & (~1));
3524 c_conv.is_owned = (c & 1) || (c == 0);
3525 c_conv = ChannelUpdate_clone(&c_conv);
3527 return (uint64_t)ret;
3529 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
3530 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3531 LDKChannelAnnouncement a_var = tuple->a;
3532 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3533 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3534 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3537 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
3538 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3539 LDKChannelUpdate b_var = tuple->b;
3540 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3541 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3542 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3545 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
3546 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3547 LDKChannelUpdate c_var = tuple->c;
3548 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3549 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3550 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3553 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
3554 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3555 ret->datalen = *((uint32_t*)elems);
3556 if (ret->datalen == 0) {
3559 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3560 uint32_t *java_elems = (uint32_t*)(elems + 4);
3561 for (size_t i = 0; i < ret->datalen; i++) {
3562 uint32_t arr_elem = java_elems[i];
3563 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
3564 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
3565 ret->data[i] = arr_elem_conv;
3568 return (uint64_t)ret;
3570 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3571 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3572 for (size_t i = 0; i < ret.datalen; i++) {
3573 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3577 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
3578 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3579 ret->datalen = *((uint32_t*)elems);
3580 if (ret->datalen == 0) {
3583 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3584 uint32_t *java_elems = (uint32_t*)(elems + 4);
3585 for (size_t i = 0; i < ret->datalen; i++) {
3586 uint32_t arr_elem = java_elems[i];
3587 LDKNodeAnnouncement arr_elem_conv;
3588 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3589 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3590 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3591 ret->data[i] = arr_elem_conv;
3594 return (uint64_t)ret;
3596 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3597 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3598 for (size_t i = 0; i < ret.datalen; i++) {
3599 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3603 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
3604 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3606 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
3607 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3608 CHECK(val->result_ok);
3609 return *val->contents.result;
3611 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
3612 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3613 CHECK(!val->result_ok);
3614 LDKLightningError err_var = (*val->contents.err);
3615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3617 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3620 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
3621 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3623 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
3624 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3625 CHECK(val->result_ok);
3626 LDKCVec_u8Z res_var = (*val->contents.result);
3627 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3628 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3631 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
3632 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3633 CHECK(!val->result_ok);
3634 LDKPeerHandleError err_var = (*val->contents.err);
3635 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3636 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3637 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3640 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
3641 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3643 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
3644 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3645 CHECK(val->result_ok);
3646 return *val->contents.result;
3648 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
3649 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3650 CHECK(!val->result_ok);
3651 LDKPeerHandleError err_var = (*val->contents.err);
3652 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3653 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3654 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3657 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
3658 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3660 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
3661 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3662 CHECK(val->result_ok);
3663 return *val->contents.result;
3665 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
3666 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3667 CHECK(!val->result_ok);
3668 LDKPeerHandleError err_var = (*val->contents.err);
3669 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3670 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3671 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3674 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3675 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
3677 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3678 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3679 CHECK(val->result_ok);
3680 LDKDirectionalChannelInfo res_var = (*val->contents.result);
3681 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3682 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3683 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3686 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3687 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3688 CHECK(!val->result_ok);
3689 LDKDecodeError err_var = (*val->contents.err);
3690 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3691 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3692 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3695 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3696 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
3698 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3699 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3700 CHECK(val->result_ok);
3701 LDKChannelInfo res_var = (*val->contents.result);
3702 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3703 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3704 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3707 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3708 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3709 CHECK(!val->result_ok);
3710 LDKDecodeError err_var = (*val->contents.err);
3711 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3712 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3713 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3716 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
3717 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3719 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
3720 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3721 CHECK(val->result_ok);
3722 LDKRoutingFees res_var = (*val->contents.result);
3723 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3724 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3725 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3728 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
3729 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3730 CHECK(!val->result_ok);
3731 LDKDecodeError err_var = (*val->contents.err);
3732 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3733 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3734 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3737 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
3738 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3740 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
3741 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3742 CHECK(val->result_ok);
3743 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3744 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3745 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3746 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3749 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
3750 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3751 CHECK(!val->result_ok);
3752 LDKDecodeError err_var = (*val->contents.err);
3753 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3758 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
3759 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
3760 ret->datalen = *((uint32_t*)elems);
3761 if (ret->datalen == 0) {
3764 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
3765 int64_t *java_elems = (int64_t*)(elems + 4);
3766 for (size_t i = 0; i < ret->datalen; i++) {
3767 ret->data[i] = java_elems[i];
3770 return (uint64_t)ret;
3772 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3773 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3774 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3777 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
3778 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3780 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
3781 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3782 CHECK(val->result_ok);
3783 LDKNodeInfo res_var = (*val->contents.result);
3784 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3785 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3786 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3789 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
3790 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3791 CHECK(!val->result_ok);
3792 LDKDecodeError err_var = (*val->contents.err);
3793 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3794 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3795 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3798 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
3799 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3801 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
3802 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3803 CHECK(val->result_ok);
3804 LDKNetworkGraph res_var = (*val->contents.result);
3805 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3806 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3807 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3810 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
3811 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3812 CHECK(!val->result_ok);
3813 LDKDecodeError err_var = (*val->contents.err);
3814 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3815 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3816 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3819 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
3820 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3822 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
3823 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3824 CHECK(val->result_ok);
3825 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3828 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
3829 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3830 CHECK(!val->result_ok);
3831 return *val->contents.err;
3833 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
3834 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3836 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
3837 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3838 CHECK(val->result_ok);
3839 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3840 *res_conv = (*val->contents.result);
3841 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3842 return (uint64_t)res_conv;
3844 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3845 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3846 CHECK(!val->result_ok);
3847 LDKDecodeError err_var = (*val->contents.err);
3848 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3849 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3850 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3853 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
3854 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
3856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
3857 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3858 CHECK(val->result_ok);
3859 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3862 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
3863 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3864 CHECK(!val->result_ok);
3865 LDKDecodeError err_var = (*val->contents.err);
3866 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3867 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3868 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3871 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3872 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3873 ret->datalen = *((uint32_t*)elems);
3874 if (ret->datalen == 0) {
3877 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3878 uint32_t *java_elems = (uint32_t*)(elems + 4);
3879 for (size_t i = 0; i < ret->datalen; i++) {
3880 uint32_t arr_elem = java_elems[i];
3881 LDKUpdateAddHTLC arr_elem_conv;
3882 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3883 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3884 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3885 ret->data[i] = arr_elem_conv;
3888 return (uint64_t)ret;
3890 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3891 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3892 for (size_t i = 0; i < ret.datalen; i++) {
3893 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3897 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3898 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3899 ret->datalen = *((uint32_t*)elems);
3900 if (ret->datalen == 0) {
3903 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3904 uint32_t *java_elems = (uint32_t*)(elems + 4);
3905 for (size_t i = 0; i < ret->datalen; i++) {
3906 uint32_t arr_elem = java_elems[i];
3907 LDKUpdateFulfillHTLC arr_elem_conv;
3908 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3909 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3910 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3911 ret->data[i] = arr_elem_conv;
3914 return (uint64_t)ret;
3916 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3917 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3918 for (size_t i = 0; i < ret.datalen; i++) {
3919 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3923 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
3924 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3925 ret->datalen = *((uint32_t*)elems);
3926 if (ret->datalen == 0) {
3929 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3930 uint32_t *java_elems = (uint32_t*)(elems + 4);
3931 for (size_t i = 0; i < ret->datalen; i++) {
3932 uint32_t arr_elem = java_elems[i];
3933 LDKUpdateFailHTLC arr_elem_conv;
3934 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3935 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3936 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3937 ret->data[i] = arr_elem_conv;
3940 return (uint64_t)ret;
3942 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3943 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3944 for (size_t i = 0; i < ret.datalen; i++) {
3945 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3949 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3950 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3951 ret->datalen = *((uint32_t*)elems);
3952 if (ret->datalen == 0) {
3955 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3956 uint32_t *java_elems = (uint32_t*)(elems + 4);
3957 for (size_t i = 0; i < ret->datalen; i++) {
3958 uint32_t arr_elem = java_elems[i];
3959 LDKUpdateFailMalformedHTLC arr_elem_conv;
3960 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3961 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3962 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3963 ret->data[i] = arr_elem_conv;
3966 return (uint64_t)ret;
3968 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3969 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3970 for (size_t i = 0; i < ret.datalen; i++) {
3971 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3975 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3976 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3978 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3979 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3980 CHECK(val->result_ok);
3981 LDKAcceptChannel res_var = (*val->contents.result);
3982 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3983 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3984 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3987 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3988 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3989 CHECK(!val->result_ok);
3990 LDKDecodeError err_var = (*val->contents.err);
3991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3993 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3996 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3997 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3999 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4000 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4001 CHECK(val->result_ok);
4002 LDKAnnouncementSignatures res_var = (*val->contents.result);
4003 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4004 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4005 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4008 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4009 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4010 CHECK(!val->result_ok);
4011 LDKDecodeError err_var = (*val->contents.err);
4012 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4013 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4014 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4017 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4018 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4020 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4021 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4022 CHECK(val->result_ok);
4023 LDKChannelReestablish res_var = (*val->contents.result);
4024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4026 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4029 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4030 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4031 CHECK(!val->result_ok);
4032 LDKDecodeError err_var = (*val->contents.err);
4033 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4034 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4035 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4038 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4039 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4041 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4042 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4043 CHECK(val->result_ok);
4044 LDKClosingSigned res_var = (*val->contents.result);
4045 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4046 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4047 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4050 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4051 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4052 CHECK(!val->result_ok);
4053 LDKDecodeError err_var = (*val->contents.err);
4054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4059 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4060 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4062 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4063 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4064 CHECK(val->result_ok);
4065 LDKCommitmentSigned res_var = (*val->contents.result);
4066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4071 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4072 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4073 CHECK(!val->result_ok);
4074 LDKDecodeError err_var = (*val->contents.err);
4075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4080 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4081 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4083 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4084 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4085 CHECK(val->result_ok);
4086 LDKFundingCreated res_var = (*val->contents.result);
4087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4092 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4093 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4094 CHECK(!val->result_ok);
4095 LDKDecodeError err_var = (*val->contents.err);
4096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4101 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4102 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4104 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4105 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4106 CHECK(val->result_ok);
4107 LDKFundingSigned res_var = (*val->contents.result);
4108 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4109 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4110 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4113 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4114 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4115 CHECK(!val->result_ok);
4116 LDKDecodeError err_var = (*val->contents.err);
4117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4122 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4123 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4125 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4126 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4127 CHECK(val->result_ok);
4128 LDKFundingLocked res_var = (*val->contents.result);
4129 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4130 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4131 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4135 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4136 CHECK(!val->result_ok);
4137 LDKDecodeError err_var = (*val->contents.err);
4138 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4139 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4140 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4143 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4144 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4146 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4147 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4148 CHECK(val->result_ok);
4149 LDKInit res_var = (*val->contents.result);
4150 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4151 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4152 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4155 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4156 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4157 CHECK(!val->result_ok);
4158 LDKDecodeError err_var = (*val->contents.err);
4159 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4160 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4161 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4164 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4165 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4167 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4168 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4169 CHECK(val->result_ok);
4170 LDKOpenChannel res_var = (*val->contents.result);
4171 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4172 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4173 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4176 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4177 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4178 CHECK(!val->result_ok);
4179 LDKDecodeError err_var = (*val->contents.err);
4180 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4181 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4182 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4185 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4186 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4188 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4189 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4190 CHECK(val->result_ok);
4191 LDKRevokeAndACK res_var = (*val->contents.result);
4192 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4193 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4194 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4197 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4198 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4199 CHECK(!val->result_ok);
4200 LDKDecodeError err_var = (*val->contents.err);
4201 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4202 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4203 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4206 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4207 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4209 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4210 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4211 CHECK(val->result_ok);
4212 LDKShutdown res_var = (*val->contents.result);
4213 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4214 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4215 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4218 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4219 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4220 CHECK(!val->result_ok);
4221 LDKDecodeError err_var = (*val->contents.err);
4222 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4223 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4224 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4227 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4228 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4230 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4231 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4232 CHECK(val->result_ok);
4233 LDKUpdateFailHTLC res_var = (*val->contents.result);
4234 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4235 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4236 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4239 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4240 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4241 CHECK(!val->result_ok);
4242 LDKDecodeError err_var = (*val->contents.err);
4243 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4244 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4245 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4248 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4249 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4251 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4252 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4253 CHECK(val->result_ok);
4254 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4255 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4256 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4257 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4260 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4261 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4262 CHECK(!val->result_ok);
4263 LDKDecodeError err_var = (*val->contents.err);
4264 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4265 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4266 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4269 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4270 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4272 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4273 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4274 CHECK(val->result_ok);
4275 LDKUpdateFee res_var = (*val->contents.result);
4276 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4277 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4278 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4281 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4282 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4283 CHECK(!val->result_ok);
4284 LDKDecodeError err_var = (*val->contents.err);
4285 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4286 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4287 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4290 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4291 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4293 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4294 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4295 CHECK(val->result_ok);
4296 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4297 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4298 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4299 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4303 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4304 CHECK(!val->result_ok);
4305 LDKDecodeError err_var = (*val->contents.err);
4306 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4307 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4308 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4311 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4312 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4314 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4315 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4316 CHECK(val->result_ok);
4317 LDKUpdateAddHTLC res_var = (*val->contents.result);
4318 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4319 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4320 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4323 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4324 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4325 CHECK(!val->result_ok);
4326 LDKDecodeError err_var = (*val->contents.err);
4327 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4332 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
4333 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4335 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4336 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4337 CHECK(val->result_ok);
4338 LDKPing res_var = (*val->contents.result);
4339 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4340 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4341 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4344 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4345 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4346 CHECK(!val->result_ok);
4347 LDKDecodeError err_var = (*val->contents.err);
4348 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4349 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4350 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4353 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
4354 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4357 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4358 CHECK(val->result_ok);
4359 LDKPong res_var = (*val->contents.result);
4360 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4361 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4362 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4365 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4366 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4367 CHECK(!val->result_ok);
4368 LDKDecodeError err_var = (*val->contents.err);
4369 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4370 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4371 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4374 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4375 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4377 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4378 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4379 CHECK(val->result_ok);
4380 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4381 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4382 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4383 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4387 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4388 CHECK(!val->result_ok);
4389 LDKDecodeError err_var = (*val->contents.err);
4390 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4391 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4392 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4395 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4396 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4398 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4399 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4400 CHECK(val->result_ok);
4401 LDKChannelAnnouncement res_var = (*val->contents.result);
4402 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4403 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4404 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4408 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4409 CHECK(!val->result_ok);
4410 LDKDecodeError err_var = (*val->contents.err);
4411 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4412 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4413 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4416 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4417 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4419 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4420 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4421 CHECK(val->result_ok);
4422 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4423 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4424 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4425 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4428 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4429 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4430 CHECK(!val->result_ok);
4431 LDKDecodeError err_var = (*val->contents.err);
4432 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4433 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4434 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4437 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4438 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4440 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4441 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4442 CHECK(val->result_ok);
4443 LDKChannelUpdate res_var = (*val->contents.result);
4444 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4445 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4446 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4449 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4450 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4451 CHECK(!val->result_ok);
4452 LDKDecodeError err_var = (*val->contents.err);
4453 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4454 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4455 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4458 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
4459 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4461 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
4462 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4463 CHECK(val->result_ok);
4464 LDKErrorMessage res_var = (*val->contents.result);
4465 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4466 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4467 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4470 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
4471 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4472 CHECK(!val->result_ok);
4473 LDKDecodeError err_var = (*val->contents.err);
4474 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4475 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4476 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4479 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4480 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4482 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4483 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4484 CHECK(val->result_ok);
4485 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4486 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4487 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4488 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4491 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4492 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4493 CHECK(!val->result_ok);
4494 LDKDecodeError err_var = (*val->contents.err);
4495 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4496 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4497 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4500 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4501 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4503 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4504 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4505 CHECK(val->result_ok);
4506 LDKNodeAnnouncement res_var = (*val->contents.result);
4507 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4508 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4509 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4513 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4514 CHECK(!val->result_ok);
4515 LDKDecodeError err_var = (*val->contents.err);
4516 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4517 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4518 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4521 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
4522 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4524 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
4525 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4526 CHECK(val->result_ok);
4527 LDKQueryShortChannelIds res_var = (*val->contents.result);
4528 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4529 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4530 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4533 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
4534 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4535 CHECK(!val->result_ok);
4536 LDKDecodeError err_var = (*val->contents.err);
4537 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4538 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4539 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4542 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
4543 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4545 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
4546 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4547 CHECK(val->result_ok);
4548 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4549 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4550 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4551 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4554 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
4555 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4556 CHECK(!val->result_ok);
4557 LDKDecodeError err_var = (*val->contents.err);
4558 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4559 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4560 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4563 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4564 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4566 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4567 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4568 CHECK(val->result_ok);
4569 LDKQueryChannelRange res_var = (*val->contents.result);
4570 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4571 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4572 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4576 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4577 CHECK(!val->result_ok);
4578 LDKDecodeError err_var = (*val->contents.err);
4579 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4580 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4581 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4584 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4585 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4587 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4588 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4589 CHECK(val->result_ok);
4590 LDKReplyChannelRange res_var = (*val->contents.result);
4591 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4592 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4593 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4597 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4598 CHECK(!val->result_ok);
4599 LDKDecodeError err_var = (*val->contents.err);
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 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4605 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
4606 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4608 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
4609 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4610 CHECK(val->result_ok);
4611 LDKGossipTimestampFilter res_var = (*val->contents.result);
4612 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4613 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4614 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
4618 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4619 CHECK(!val->result_ok);
4620 LDKDecodeError err_var = (*val->contents.err);
4621 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4622 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4623 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4626 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
4627 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
4629 case LDKSignOrCreationError_SignError: {
4630 return 0 /* LDKSignOrCreationError - SignError */;
4632 case LDKSignOrCreationError_CreationError: {
4633 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
4634 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
4639 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
4640 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
4642 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
4643 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4644 CHECK(val->result_ok);
4645 LDKInvoice res_var = (*val->contents.result);
4646 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4647 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4648 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4651 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
4652 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4653 CHECK(!val->result_ok);
4654 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4657 typedef struct LDKMessageSendEventsProvider_JCalls {
4658 atomic_size_t refcnt;
4659 uint32_t get_and_clear_pending_msg_events_meth;
4660 } LDKMessageSendEventsProvider_JCalls;
4661 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4662 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4663 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4664 js_free(j_calls->get_and_clear_pending_msg_events_meth);
4668 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4669 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4670 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
4671 LDKCVec_MessageSendEventZ ret_constr;
4672 ret_constr.datalen = *((uint32_t*)ret);
4673 if (ret_constr.datalen > 0)
4674 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4676 ret_constr.data = NULL;
4677 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4678 for (size_t s = 0; s < ret_constr.datalen; s++) {
4679 uint32_t ret_conv_18 = ret_vals[s];
4680 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4681 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
4682 ret_constr.data[s] = ret_conv_18_conv;
4686 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
4687 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
4688 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4690 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4691 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4692 atomic_init(&calls->refcnt, 1);
4693 //TODO: Assign calls->o from o
4695 LDKMessageSendEventsProvider ret = {
4696 .this_arg = (void*) calls,
4697 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4698 .free = LDKMessageSendEventsProvider_JCalls_free,
4702 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4703 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4704 *res_ptr = LDKMessageSendEventsProvider_init(o);
4705 return (long)res_ptr;
4707 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
4708 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4709 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4710 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4711 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4712 for (size_t s = 0; s < ret_var.datalen; s++) {
4713 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4714 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4715 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
4716 ret_arr_ptr[s] = ret_conv_18_ref;
4722 typedef struct LDKEventHandler_JCalls {
4723 atomic_size_t refcnt;
4724 uint32_t handle_event_meth;
4725 } LDKEventHandler_JCalls;
4726 static void LDKEventHandler_JCalls_free(void* this_arg) {
4727 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4728 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4729 js_free(j_calls->handle_event_meth);
4733 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
4734 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4735 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4736 *event_copy = event;
4737 uint64_t event_ref = (uint64_t)event_copy;
4738 js_invoke_function_1(j_calls->handle_event_meth, event_ref);
4740 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
4741 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
4742 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4744 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
4745 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
4746 atomic_init(&calls->refcnt, 1);
4747 //TODO: Assign calls->o from o
4749 LDKEventHandler ret = {
4750 .this_arg = (void*) calls,
4751 .handle_event = handle_event_LDKEventHandler_jcall,
4752 .free = LDKEventHandler_JCalls_free,
4756 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
4757 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4758 *res_ptr = LDKEventHandler_init(o);
4759 return (long)res_ptr;
4761 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
4762 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
4763 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
4764 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
4767 typedef struct LDKEventsProvider_JCalls {
4768 atomic_size_t refcnt;
4769 uint32_t process_pending_events_meth;
4770 } LDKEventsProvider_JCalls;
4771 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4772 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4773 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4774 js_free(j_calls->process_pending_events_meth);
4778 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
4779 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4780 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4782 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)ret);
4784 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
4785 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
4786 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4788 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4789 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4790 atomic_init(&calls->refcnt, 1);
4791 //TODO: Assign calls->o from o
4793 LDKEventsProvider ret = {
4794 .this_arg = (void*) calls,
4795 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
4796 .free = LDKEventsProvider_JCalls_free,
4800 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4801 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4802 *res_ptr = LDKEventsProvider_init(o);
4803 return (long)res_ptr;
4805 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
4806 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4807 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
4808 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
4811 typedef struct LDKAccess_JCalls {
4812 atomic_size_t refcnt;
4813 uint32_t get_utxo_meth;
4815 static void LDKAccess_JCalls_free(void* this_arg) {
4816 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4817 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4818 js_free(j_calls->get_utxo_meth);
4822 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4823 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4824 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4825 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4826 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4827 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4828 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4831 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4832 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4833 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4835 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4836 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4837 atomic_init(&calls->refcnt, 1);
4838 //TODO: Assign calls->o from o
4841 .this_arg = (void*) calls,
4842 .get_utxo = get_utxo_LDKAccess_jcall,
4843 .free = LDKAccess_JCalls_free,
4847 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4848 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4849 *res_ptr = LDKAccess_init(o);
4850 return (long)res_ptr;
4852 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4853 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4854 unsigned char genesis_hash_arr[32];
4855 CHECK(*((uint32_t*)genesis_hash) == 32);
4856 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4857 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4858 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4859 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4860 return (uint64_t)ret_conv;
4863 typedef struct LDKListen_JCalls {
4864 atomic_size_t refcnt;
4865 uint32_t block_connected_meth;
4866 uint32_t block_disconnected_meth;
4868 static void LDKListen_JCalls_free(void* this_arg) {
4869 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4870 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4871 js_free(j_calls->block_connected_meth);
4872 js_free(j_calls->block_disconnected_meth);
4876 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4877 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4878 LDKu8slice block_var = block;
4879 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4880 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4881 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4883 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4884 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4885 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4886 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4887 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4889 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
4890 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
4891 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4893 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4894 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4895 atomic_init(&calls->refcnt, 1);
4896 //TODO: Assign calls->o from o
4899 .this_arg = (void*) calls,
4900 .block_connected = block_connected_LDKListen_jcall,
4901 .block_disconnected = block_disconnected_LDKListen_jcall,
4902 .free = LDKListen_JCalls_free,
4906 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4907 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4908 *res_ptr = LDKListen_init(o);
4909 return (long)res_ptr;
4911 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4912 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4913 LDKu8slice block_ref;
4914 block_ref.datalen = *((uint32_t*)block);
4915 block_ref.data = (int8_t*)(block + 4);
4916 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4919 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4920 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4921 unsigned char header_arr[80];
4922 CHECK(*((uint32_t*)header) == 80);
4923 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4924 unsigned char (*header_ref)[80] = &header_arr;
4925 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4928 typedef struct LDKConfirm_JCalls {
4929 atomic_size_t refcnt;
4930 uint32_t transactions_confirmed_meth;
4931 uint32_t transaction_unconfirmed_meth;
4932 uint32_t best_block_updated_meth;
4933 uint32_t get_relevant_txids_meth;
4934 } LDKConfirm_JCalls;
4935 static void LDKConfirm_JCalls_free(void* this_arg) {
4936 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4937 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4938 js_free(j_calls->transactions_confirmed_meth);
4939 js_free(j_calls->transaction_unconfirmed_meth);
4940 js_free(j_calls->best_block_updated_meth);
4941 js_free(j_calls->get_relevant_txids_meth);
4945 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
4946 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4947 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4948 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4949 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
4950 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4951 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
4952 for (size_t e = 0; e < txdata_var.datalen; e++) {
4953 LDKC2Tuple_usizeTransactionZ* txdata_conv_30_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4954 *txdata_conv_30_ref = txdata_var.data[e];
4955 txdata_arr_ptr[e] = (uint64_t)txdata_conv_30_ref;
4957 FREE(txdata_var.data);
4958 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
4960 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
4961 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4962 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4963 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4964 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
4966 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4967 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4968 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4969 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4970 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
4972 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
4973 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4974 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
4975 LDKCVec_TxidZ ret_constr;
4976 ret_constr.datalen = *((uint32_t*)ret);
4977 if (ret_constr.datalen > 0)
4978 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
4980 ret_constr.data = NULL;
4981 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
4982 for (size_t m = 0; m < ret_constr.datalen; m++) {
4983 int8_tArray ret_conv_12 = ret_vals[m];
4984 LDKThirtyTwoBytes ret_conv_12_ref;
4985 CHECK(*((uint32_t*)ret_conv_12) == 32);
4986 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
4987 ret_constr.data[m] = ret_conv_12_ref;
4991 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
4992 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
4993 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4995 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
4996 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
4997 atomic_init(&calls->refcnt, 1);
4998 //TODO: Assign calls->o from o
5001 .this_arg = (void*) calls,
5002 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5003 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5004 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5005 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5006 .free = LDKConfirm_JCalls_free,
5010 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5011 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5012 *res_ptr = LDKConfirm_init(o);
5013 return (long)res_ptr;
5015 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5016 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5017 unsigned char header_arr[80];
5018 CHECK(*((uint32_t*)header) == 80);
5019 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5020 unsigned char (*header_ref)[80] = &header_arr;
5021 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5022 txdata_constr.datalen = *((uint32_t*)txdata);
5023 if (txdata_constr.datalen > 0)
5024 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5026 txdata_constr.data = NULL;
5027 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5028 for (size_t e = 0; e < txdata_constr.datalen; e++) {
5029 uint32_t txdata_conv_30 = txdata_vals[e];
5030 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
5031 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
5032 txdata_constr.data[e] = txdata_conv_30_conv;
5034 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5037 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5038 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5039 unsigned char txid_arr[32];
5040 CHECK(*((uint32_t*)txid) == 32);
5041 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5042 unsigned char (*txid_ref)[32] = &txid_arr;
5043 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5046 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5047 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5048 unsigned char header_arr[80];
5049 CHECK(*((uint32_t*)header) == 80);
5050 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5051 unsigned char (*header_ref)[80] = &header_arr;
5052 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5055 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5056 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5057 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5058 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5059 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5060 for (size_t m = 0; m < ret_var.datalen; m++) {
5061 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5062 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5063 ret_arr_ptr[m] = ret_conv_12_arr;
5069 typedef struct LDKFilter_JCalls {
5070 atomic_size_t refcnt;
5071 uint32_t register_tx_meth;
5072 uint32_t register_output_meth;
5074 static void LDKFilter_JCalls_free(void* this_arg) {
5075 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5076 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5077 js_free(j_calls->register_tx_meth);
5078 js_free(j_calls->register_output_meth);
5082 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5083 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5084 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5085 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5086 LDKu8slice script_pubkey_var = script_pubkey;
5087 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5088 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5089 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5091 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5092 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5093 LDKWatchedOutput output_var = output;
5094 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5095 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5096 uint64_t output_ref = (uint64_t)output_var.inner;
5097 if (output_var.is_owned) {
5100 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
5101 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5102 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5105 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5106 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5107 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5109 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5110 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5111 atomic_init(&calls->refcnt, 1);
5112 //TODO: Assign calls->o from o
5115 .this_arg = (void*) calls,
5116 .register_tx = register_tx_LDKFilter_jcall,
5117 .register_output = register_output_LDKFilter_jcall,
5118 .free = LDKFilter_JCalls_free,
5122 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5123 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5124 *res_ptr = LDKFilter_init(o);
5125 return (long)res_ptr;
5127 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5128 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5129 unsigned char txid_arr[32];
5130 CHECK(*((uint32_t*)txid) == 32);
5131 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5132 unsigned char (*txid_ref)[32] = &txid_arr;
5133 LDKu8slice script_pubkey_ref;
5134 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5135 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5136 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5139 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5140 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5141 LDKWatchedOutput output_conv;
5142 output_conv.inner = (void*)(output & (~1));
5143 output_conv.is_owned = (output & 1) || (output == 0);
5144 output_conv = WatchedOutput_clone(&output_conv);
5145 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5146 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5147 uint64_t ret_ref = (uint64_t)ret_copy;
5151 typedef struct LDKPersist_JCalls {
5152 atomic_size_t refcnt;
5153 uint32_t persist_new_channel_meth;
5154 uint32_t update_persisted_channel_meth;
5155 } LDKPersist_JCalls;
5156 static void LDKPersist_JCalls_free(void* this_arg) {
5157 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5158 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5159 js_free(j_calls->persist_new_channel_meth);
5160 js_free(j_calls->update_persisted_channel_meth);
5164 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5165 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5166 LDKOutPoint id_var = id;
5167 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5168 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5169 uint64_t id_ref = (uint64_t)id_var.inner;
5170 if (id_var.is_owned) {
5173 LDKChannelMonitor data_var = *data;
5174 data_var = ChannelMonitor_clone(data);
5175 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5176 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5177 uint64_t data_ref = (uint64_t)data_var.inner;
5178 if (data_var.is_owned) {
5181 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5182 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5183 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5186 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5187 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5188 LDKOutPoint id_var = id;
5189 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5190 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5191 uint64_t id_ref = (uint64_t)id_var.inner;
5192 if (id_var.is_owned) {
5195 LDKChannelMonitorUpdate update_var = *update;
5196 update_var = ChannelMonitorUpdate_clone(update);
5197 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5198 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5199 uint64_t update_ref = (uint64_t)update_var.inner;
5200 if (update_var.is_owned) {
5203 LDKChannelMonitor data_var = *data;
5204 data_var = ChannelMonitor_clone(data);
5205 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5206 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5207 uint64_t data_ref = (uint64_t)data_var.inner;
5208 if (data_var.is_owned) {
5211 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5212 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5213 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5216 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5217 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5218 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5220 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5221 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5222 atomic_init(&calls->refcnt, 1);
5223 //TODO: Assign calls->o from o
5226 .this_arg = (void*) calls,
5227 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5228 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5229 .free = LDKPersist_JCalls_free,
5233 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5234 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5235 *res_ptr = LDKPersist_init(o);
5236 return (long)res_ptr;
5238 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5239 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5240 LDKOutPoint id_conv;
5241 id_conv.inner = (void*)(id & (~1));
5242 id_conv.is_owned = (id & 1) || (id == 0);
5243 id_conv = OutPoint_clone(&id_conv);
5244 LDKChannelMonitor data_conv;
5245 data_conv.inner = (void*)(data & (~1));
5246 data_conv.is_owned = false;
5247 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5248 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5249 return (uint64_t)ret_conv;
5252 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5253 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5254 LDKOutPoint id_conv;
5255 id_conv.inner = (void*)(id & (~1));
5256 id_conv.is_owned = (id & 1) || (id == 0);
5257 id_conv = OutPoint_clone(&id_conv);
5258 LDKChannelMonitorUpdate update_conv;
5259 update_conv.inner = (void*)(update & (~1));
5260 update_conv.is_owned = false;
5261 LDKChannelMonitor data_conv;
5262 data_conv.inner = (void*)(data & (~1));
5263 data_conv.is_owned = false;
5264 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5265 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5266 return (uint64_t)ret_conv;
5269 typedef struct LDKChannelMessageHandler_JCalls {
5270 atomic_size_t refcnt;
5271 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5272 uint32_t handle_open_channel_meth;
5273 uint32_t handle_accept_channel_meth;
5274 uint32_t handle_funding_created_meth;
5275 uint32_t handle_funding_signed_meth;
5276 uint32_t handle_funding_locked_meth;
5277 uint32_t handle_shutdown_meth;
5278 uint32_t handle_closing_signed_meth;
5279 uint32_t handle_update_add_htlc_meth;
5280 uint32_t handle_update_fulfill_htlc_meth;
5281 uint32_t handle_update_fail_htlc_meth;
5282 uint32_t handle_update_fail_malformed_htlc_meth;
5283 uint32_t handle_commitment_signed_meth;
5284 uint32_t handle_revoke_and_ack_meth;
5285 uint32_t handle_update_fee_meth;
5286 uint32_t handle_announcement_signatures_meth;
5287 uint32_t peer_disconnected_meth;
5288 uint32_t peer_connected_meth;
5289 uint32_t handle_channel_reestablish_meth;
5290 uint32_t handle_channel_update_meth;
5291 uint32_t handle_error_meth;
5292 } LDKChannelMessageHandler_JCalls;
5293 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5294 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5295 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5296 js_free(j_calls->handle_open_channel_meth);
5297 js_free(j_calls->handle_accept_channel_meth);
5298 js_free(j_calls->handle_funding_created_meth);
5299 js_free(j_calls->handle_funding_signed_meth);
5300 js_free(j_calls->handle_funding_locked_meth);
5301 js_free(j_calls->handle_shutdown_meth);
5302 js_free(j_calls->handle_closing_signed_meth);
5303 js_free(j_calls->handle_update_add_htlc_meth);
5304 js_free(j_calls->handle_update_fulfill_htlc_meth);
5305 js_free(j_calls->handle_update_fail_htlc_meth);
5306 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5307 js_free(j_calls->handle_commitment_signed_meth);
5308 js_free(j_calls->handle_revoke_and_ack_meth);
5309 js_free(j_calls->handle_update_fee_meth);
5310 js_free(j_calls->handle_announcement_signatures_meth);
5311 js_free(j_calls->peer_disconnected_meth);
5312 js_free(j_calls->peer_connected_meth);
5313 js_free(j_calls->handle_channel_reestablish_meth);
5314 js_free(j_calls->handle_channel_update_meth);
5315 js_free(j_calls->handle_error_meth);
5319 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5320 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5321 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5322 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5323 LDKInitFeatures their_features_var = their_features;
5324 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5325 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5326 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5327 if (their_features_var.is_owned) {
5328 their_features_ref |= 1;
5330 LDKOpenChannel msg_var = *msg;
5331 msg_var = OpenChannel_clone(msg);
5332 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5333 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5334 uint64_t msg_ref = (uint64_t)msg_var.inner;
5335 if (msg_var.is_owned) {
5338 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5340 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5341 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5342 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5343 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5344 LDKInitFeatures their_features_var = their_features;
5345 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5346 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5347 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5348 if (their_features_var.is_owned) {
5349 their_features_ref |= 1;
5351 LDKAcceptChannel msg_var = *msg;
5352 msg_var = AcceptChannel_clone(msg);
5353 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5354 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5355 uint64_t msg_ref = (uint64_t)msg_var.inner;
5356 if (msg_var.is_owned) {
5359 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5361 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5362 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5363 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5364 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5365 LDKFundingCreated msg_var = *msg;
5366 msg_var = FundingCreated_clone(msg);
5367 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5368 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5369 uint64_t msg_ref = (uint64_t)msg_var.inner;
5370 if (msg_var.is_owned) {
5373 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5375 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5376 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5377 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5378 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5379 LDKFundingSigned msg_var = *msg;
5380 msg_var = FundingSigned_clone(msg);
5381 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5382 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5383 uint64_t msg_ref = (uint64_t)msg_var.inner;
5384 if (msg_var.is_owned) {
5387 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5389 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5390 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5391 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5392 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5393 LDKFundingLocked msg_var = *msg;
5394 msg_var = FundingLocked_clone(msg);
5395 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5396 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5397 uint64_t msg_ref = (uint64_t)msg_var.inner;
5398 if (msg_var.is_owned) {
5401 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5403 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5404 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5405 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5406 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5407 LDKInitFeatures their_features_var = *their_features;
5408 their_features_var = InitFeatures_clone(their_features);
5409 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5410 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5411 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5412 if (their_features_var.is_owned) {
5413 their_features_ref |= 1;
5415 LDKShutdown msg_var = *msg;
5416 msg_var = Shutdown_clone(msg);
5417 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5418 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5419 uint64_t msg_ref = (uint64_t)msg_var.inner;
5420 if (msg_var.is_owned) {
5423 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5425 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5426 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5427 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5428 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5429 LDKClosingSigned msg_var = *msg;
5430 msg_var = ClosingSigned_clone(msg);
5431 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5432 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5433 uint64_t msg_ref = (uint64_t)msg_var.inner;
5434 if (msg_var.is_owned) {
5437 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5439 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5440 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5441 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5442 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5443 LDKUpdateAddHTLC msg_var = *msg;
5444 msg_var = UpdateAddHTLC_clone(msg);
5445 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5446 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5447 uint64_t msg_ref = (uint64_t)msg_var.inner;
5448 if (msg_var.is_owned) {
5451 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5453 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5454 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5455 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5456 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5457 LDKUpdateFulfillHTLC msg_var = *msg;
5458 msg_var = UpdateFulfillHTLC_clone(msg);
5459 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5460 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5461 uint64_t msg_ref = (uint64_t)msg_var.inner;
5462 if (msg_var.is_owned) {
5465 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5467 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5468 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5469 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5470 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5471 LDKUpdateFailHTLC msg_var = *msg;
5472 msg_var = UpdateFailHTLC_clone(msg);
5473 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5474 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5475 uint64_t msg_ref = (uint64_t)msg_var.inner;
5476 if (msg_var.is_owned) {
5479 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5481 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5482 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5483 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5484 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5485 LDKUpdateFailMalformedHTLC msg_var = *msg;
5486 msg_var = UpdateFailMalformedHTLC_clone(msg);
5487 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5488 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5489 uint64_t msg_ref = (uint64_t)msg_var.inner;
5490 if (msg_var.is_owned) {
5493 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5495 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5496 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5497 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5498 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5499 LDKCommitmentSigned msg_var = *msg;
5500 msg_var = CommitmentSigned_clone(msg);
5501 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5502 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5503 uint64_t msg_ref = (uint64_t)msg_var.inner;
5504 if (msg_var.is_owned) {
5507 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5509 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5510 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5511 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5512 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5513 LDKRevokeAndACK msg_var = *msg;
5514 msg_var = RevokeAndACK_clone(msg);
5515 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5516 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5517 uint64_t msg_ref = (uint64_t)msg_var.inner;
5518 if (msg_var.is_owned) {
5521 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5523 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5524 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5525 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5526 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5527 LDKUpdateFee msg_var = *msg;
5528 msg_var = UpdateFee_clone(msg);
5529 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5530 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5531 uint64_t msg_ref = (uint64_t)msg_var.inner;
5532 if (msg_var.is_owned) {
5535 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5537 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5538 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5539 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5540 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5541 LDKAnnouncementSignatures msg_var = *msg;
5542 msg_var = AnnouncementSignatures_clone(msg);
5543 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5544 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5545 uint64_t msg_ref = (uint64_t)msg_var.inner;
5546 if (msg_var.is_owned) {
5549 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5551 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5552 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5553 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5554 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5555 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5557 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5558 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5559 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5560 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5561 LDKInit msg_var = *msg;
5562 msg_var = Init_clone(msg);
5563 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5564 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5565 uint64_t msg_ref = (uint64_t)msg_var.inner;
5566 if (msg_var.is_owned) {
5569 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5571 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5572 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5573 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5574 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5575 LDKChannelReestablish msg_var = *msg;
5576 msg_var = ChannelReestablish_clone(msg);
5577 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5578 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5579 uint64_t msg_ref = (uint64_t)msg_var.inner;
5580 if (msg_var.is_owned) {
5583 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5585 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
5586 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5587 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5588 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5589 LDKChannelUpdate msg_var = *msg;
5590 msg_var = ChannelUpdate_clone(msg);
5591 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5592 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5593 uint64_t msg_ref = (uint64_t)msg_var.inner;
5594 if (msg_var.is_owned) {
5597 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
5599 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5600 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5601 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5602 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5603 LDKErrorMessage msg_var = *msg;
5604 msg_var = ErrorMessage_clone(msg);
5605 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5606 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5607 uint64_t msg_ref = (uint64_t)msg_var.inner;
5608 if (msg_var.is_owned) {
5611 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5613 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
5614 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
5615 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5616 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5618 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5619 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5620 atomic_init(&calls->refcnt, 1);
5621 //TODO: Assign calls->o from o
5623 LDKChannelMessageHandler ret = {
5624 .this_arg = (void*) calls,
5625 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
5626 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
5627 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
5628 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
5629 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
5630 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
5631 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
5632 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
5633 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
5634 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
5635 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
5636 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
5637 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
5638 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
5639 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
5640 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
5641 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
5642 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
5643 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
5644 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
5645 .free = LDKChannelMessageHandler_JCalls_free,
5646 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5648 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5651 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5652 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5653 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
5654 return (long)res_ptr;
5656 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) {
5657 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5658 LDKPublicKey their_node_id_ref;
5659 CHECK(*((uint32_t*)their_node_id) == 33);
5660 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5661 LDKInitFeatures their_features_conv;
5662 their_features_conv.inner = (void*)(their_features & (~1));
5663 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5664 their_features_conv = InitFeatures_clone(&their_features_conv);
5665 LDKOpenChannel msg_conv;
5666 msg_conv.inner = (void*)(msg & (~1));
5667 msg_conv.is_owned = false;
5668 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5671 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) {
5672 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5673 LDKPublicKey their_node_id_ref;
5674 CHECK(*((uint32_t*)their_node_id) == 33);
5675 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5676 LDKInitFeatures their_features_conv;
5677 their_features_conv.inner = (void*)(their_features & (~1));
5678 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5679 their_features_conv = InitFeatures_clone(&their_features_conv);
5680 LDKAcceptChannel msg_conv;
5681 msg_conv.inner = (void*)(msg & (~1));
5682 msg_conv.is_owned = false;
5683 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5686 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5687 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5688 LDKPublicKey their_node_id_ref;
5689 CHECK(*((uint32_t*)their_node_id) == 33);
5690 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5691 LDKFundingCreated msg_conv;
5692 msg_conv.inner = (void*)(msg & (~1));
5693 msg_conv.is_owned = false;
5694 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5697 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5698 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5699 LDKPublicKey their_node_id_ref;
5700 CHECK(*((uint32_t*)their_node_id) == 33);
5701 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5702 LDKFundingSigned msg_conv;
5703 msg_conv.inner = (void*)(msg & (~1));
5704 msg_conv.is_owned = false;
5705 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5708 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5709 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5710 LDKPublicKey their_node_id_ref;
5711 CHECK(*((uint32_t*)their_node_id) == 33);
5712 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5713 LDKFundingLocked msg_conv;
5714 msg_conv.inner = (void*)(msg & (~1));
5715 msg_conv.is_owned = false;
5716 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5719 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
5720 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5721 LDKPublicKey their_node_id_ref;
5722 CHECK(*((uint32_t*)their_node_id) == 33);
5723 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5724 LDKInitFeatures their_features_conv;
5725 their_features_conv.inner = (void*)(their_features & (~1));
5726 their_features_conv.is_owned = false;
5727 LDKShutdown msg_conv;
5728 msg_conv.inner = (void*)(msg & (~1));
5729 msg_conv.is_owned = false;
5730 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5733 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5734 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5735 LDKPublicKey their_node_id_ref;
5736 CHECK(*((uint32_t*)their_node_id) == 33);
5737 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5738 LDKClosingSigned msg_conv;
5739 msg_conv.inner = (void*)(msg & (~1));
5740 msg_conv.is_owned = false;
5741 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5744 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5745 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5746 LDKPublicKey their_node_id_ref;
5747 CHECK(*((uint32_t*)their_node_id) == 33);
5748 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5749 LDKUpdateAddHTLC msg_conv;
5750 msg_conv.inner = (void*)(msg & (~1));
5751 msg_conv.is_owned = false;
5752 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5755 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5756 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5757 LDKPublicKey their_node_id_ref;
5758 CHECK(*((uint32_t*)their_node_id) == 33);
5759 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5760 LDKUpdateFulfillHTLC msg_conv;
5761 msg_conv.inner = (void*)(msg & (~1));
5762 msg_conv.is_owned = false;
5763 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5766 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5767 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5768 LDKPublicKey their_node_id_ref;
5769 CHECK(*((uint32_t*)their_node_id) == 33);
5770 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5771 LDKUpdateFailHTLC msg_conv;
5772 msg_conv.inner = (void*)(msg & (~1));
5773 msg_conv.is_owned = false;
5774 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5777 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5778 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5779 LDKPublicKey their_node_id_ref;
5780 CHECK(*((uint32_t*)their_node_id) == 33);
5781 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5782 LDKUpdateFailMalformedHTLC msg_conv;
5783 msg_conv.inner = (void*)(msg & (~1));
5784 msg_conv.is_owned = false;
5785 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5788 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5789 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5790 LDKPublicKey their_node_id_ref;
5791 CHECK(*((uint32_t*)their_node_id) == 33);
5792 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5793 LDKCommitmentSigned msg_conv;
5794 msg_conv.inner = (void*)(msg & (~1));
5795 msg_conv.is_owned = false;
5796 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5799 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5800 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5801 LDKPublicKey their_node_id_ref;
5802 CHECK(*((uint32_t*)their_node_id) == 33);
5803 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5804 LDKRevokeAndACK msg_conv;
5805 msg_conv.inner = (void*)(msg & (~1));
5806 msg_conv.is_owned = false;
5807 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5810 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5811 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5812 LDKPublicKey their_node_id_ref;
5813 CHECK(*((uint32_t*)their_node_id) == 33);
5814 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5815 LDKUpdateFee msg_conv;
5816 msg_conv.inner = (void*)(msg & (~1));
5817 msg_conv.is_owned = false;
5818 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5821 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5822 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5823 LDKPublicKey their_node_id_ref;
5824 CHECK(*((uint32_t*)their_node_id) == 33);
5825 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5826 LDKAnnouncementSignatures msg_conv;
5827 msg_conv.inner = (void*)(msg & (~1));
5828 msg_conv.is_owned = false;
5829 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5832 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5833 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5834 LDKPublicKey their_node_id_ref;
5835 CHECK(*((uint32_t*)their_node_id) == 33);
5836 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5837 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5840 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5841 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5842 LDKPublicKey their_node_id_ref;
5843 CHECK(*((uint32_t*)their_node_id) == 33);
5844 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5846 msg_conv.inner = (void*)(msg & (~1));
5847 msg_conv.is_owned = false;
5848 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5851 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5852 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5853 LDKPublicKey their_node_id_ref;
5854 CHECK(*((uint32_t*)their_node_id) == 33);
5855 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5856 LDKChannelReestablish msg_conv;
5857 msg_conv.inner = (void*)(msg & (~1));
5858 msg_conv.is_owned = false;
5859 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5862 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5863 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5864 LDKPublicKey their_node_id_ref;
5865 CHECK(*((uint32_t*)their_node_id) == 33);
5866 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5867 LDKChannelUpdate msg_conv;
5868 msg_conv.inner = (void*)(msg & (~1));
5869 msg_conv.is_owned = false;
5870 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5873 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5874 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5875 LDKPublicKey their_node_id_ref;
5876 CHECK(*((uint32_t*)their_node_id) == 33);
5877 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5878 LDKErrorMessage msg_conv;
5879 msg_conv.inner = (void*)(msg & (~1));
5880 msg_conv.is_owned = false;
5881 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5884 typedef struct LDKRoutingMessageHandler_JCalls {
5885 atomic_size_t refcnt;
5886 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5887 uint32_t handle_node_announcement_meth;
5888 uint32_t handle_channel_announcement_meth;
5889 uint32_t handle_channel_update_meth;
5890 uint32_t handle_htlc_fail_channel_update_meth;
5891 uint32_t get_next_channel_announcements_meth;
5892 uint32_t get_next_node_announcements_meth;
5893 uint32_t sync_routing_table_meth;
5894 uint32_t handle_reply_channel_range_meth;
5895 uint32_t handle_reply_short_channel_ids_end_meth;
5896 uint32_t handle_query_channel_range_meth;
5897 uint32_t handle_query_short_channel_ids_meth;
5898 } LDKRoutingMessageHandler_JCalls;
5899 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5900 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5901 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5902 js_free(j_calls->handle_node_announcement_meth);
5903 js_free(j_calls->handle_channel_announcement_meth);
5904 js_free(j_calls->handle_channel_update_meth);
5905 js_free(j_calls->handle_htlc_fail_channel_update_meth);
5906 js_free(j_calls->get_next_channel_announcements_meth);
5907 js_free(j_calls->get_next_node_announcements_meth);
5908 js_free(j_calls->sync_routing_table_meth);
5909 js_free(j_calls->handle_reply_channel_range_meth);
5910 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
5911 js_free(j_calls->handle_query_channel_range_meth);
5912 js_free(j_calls->handle_query_short_channel_ids_meth);
5916 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5917 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5918 LDKNodeAnnouncement msg_var = *msg;
5919 msg_var = NodeAnnouncement_clone(msg);
5920 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5921 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5922 uint64_t msg_ref = (uint64_t)msg_var.inner;
5923 if (msg_var.is_owned) {
5926 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
5927 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5928 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5931 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5932 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5933 LDKChannelAnnouncement msg_var = *msg;
5934 msg_var = ChannelAnnouncement_clone(msg);
5935 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5936 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5937 uint64_t msg_ref = (uint64_t)msg_var.inner;
5938 if (msg_var.is_owned) {
5941 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
5942 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5943 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5946 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5947 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5948 LDKChannelUpdate msg_var = *msg;
5949 msg_var = ChannelUpdate_clone(msg);
5950 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5951 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5952 uint64_t msg_ref = (uint64_t)msg_var.inner;
5953 if (msg_var.is_owned) {
5956 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
5957 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5958 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5961 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5962 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5963 uint64_t ret_update = (uint64_t)update;
5964 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5966 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5967 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5968 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5969 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5970 ret_constr.datalen = *((uint32_t*)ret);
5971 if (ret_constr.datalen > 0)
5972 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5974 ret_constr.data = NULL;
5975 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5976 for (size_t l = 0; l < ret_constr.datalen; l++) {
5977 uint32_t ret_conv_63 = ret_vals[l];
5978 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5979 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
5980 ret_constr.data[l] = ret_conv_63_conv;
5984 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5985 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5986 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5987 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
5988 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5989 LDKCVec_NodeAnnouncementZ ret_constr;
5990 ret_constr.datalen = *((uint32_t*)ret);
5991 if (ret_constr.datalen > 0)
5992 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5994 ret_constr.data = NULL;
5995 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5996 for (size_t s = 0; s < ret_constr.datalen; s++) {
5997 uint32_t ret_conv_18 = ret_vals[s];
5998 LDKNodeAnnouncement ret_conv_18_conv;
5999 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6000 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6001 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6002 ret_constr.data[s] = ret_conv_18_conv;
6006 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6007 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6008 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6009 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6010 LDKInit init_var = *init;
6011 init_var = Init_clone(init);
6012 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6013 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6014 uint64_t init_ref = (uint64_t)init_var.inner;
6015 if (init_var.is_owned) {
6018 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6020 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6021 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6022 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6023 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6024 LDKReplyChannelRange msg_var = msg;
6025 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6026 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6027 uint64_t msg_ref = (uint64_t)msg_var.inner;
6028 if (msg_var.is_owned) {
6031 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6032 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6033 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6036 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6037 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6038 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6039 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6040 LDKReplyShortChannelIdsEnd msg_var = msg;
6041 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6042 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6043 uint64_t msg_ref = (uint64_t)msg_var.inner;
6044 if (msg_var.is_owned) {
6047 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6048 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6049 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6052 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6053 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6054 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6055 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6056 LDKQueryChannelRange msg_var = msg;
6057 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6058 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6059 uint64_t msg_ref = (uint64_t)msg_var.inner;
6060 if (msg_var.is_owned) {
6063 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6064 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6065 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6068 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6069 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6070 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6071 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6072 LDKQueryShortChannelIds msg_var = msg;
6073 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6074 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6075 uint64_t msg_ref = (uint64_t)msg_var.inner;
6076 if (msg_var.is_owned) {
6079 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6080 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6081 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6084 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6085 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6086 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6087 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6089 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6090 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6091 atomic_init(&calls->refcnt, 1);
6092 //TODO: Assign calls->o from o
6094 LDKRoutingMessageHandler ret = {
6095 .this_arg = (void*) calls,
6096 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6097 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6098 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6099 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
6100 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6101 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6102 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6103 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6104 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6105 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6106 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6107 .free = LDKRoutingMessageHandler_JCalls_free,
6108 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6110 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6113 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6114 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6115 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6116 return (long)res_ptr;
6118 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6119 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6120 LDKNodeAnnouncement msg_conv;
6121 msg_conv.inner = (void*)(msg & (~1));
6122 msg_conv.is_owned = false;
6123 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6124 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6125 return (uint64_t)ret_conv;
6128 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6129 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6130 LDKChannelAnnouncement msg_conv;
6131 msg_conv.inner = (void*)(msg & (~1));
6132 msg_conv.is_owned = false;
6133 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6134 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6135 return (uint64_t)ret_conv;
6138 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6139 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6140 LDKChannelUpdate msg_conv;
6141 msg_conv.inner = (void*)(msg & (~1));
6142 msg_conv.is_owned = false;
6143 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6144 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6145 return (uint64_t)ret_conv;
6148 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
6149 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6150 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6151 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6154 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6155 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6156 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6157 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6158 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6159 for (size_t l = 0; l < ret_var.datalen; l++) {
6160 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6161 *ret_conv_63_ref = ret_var.data[l];
6162 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
6168 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6169 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6170 LDKPublicKey starting_point_ref;
6171 CHECK(*((uint32_t*)starting_point) == 33);
6172 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6173 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6174 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6175 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6176 for (size_t s = 0; s < ret_var.datalen; s++) {
6177 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6178 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6179 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6180 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6181 if (ret_conv_18_var.is_owned) {
6182 ret_conv_18_ref |= 1;
6184 ret_arr_ptr[s] = ret_conv_18_ref;
6190 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6191 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6192 LDKPublicKey their_node_id_ref;
6193 CHECK(*((uint32_t*)their_node_id) == 33);
6194 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6196 init_conv.inner = (void*)(init & (~1));
6197 init_conv.is_owned = false;
6198 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6201 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6202 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6203 LDKPublicKey their_node_id_ref;
6204 CHECK(*((uint32_t*)their_node_id) == 33);
6205 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6206 LDKReplyChannelRange msg_conv;
6207 msg_conv.inner = (void*)(msg & (~1));
6208 msg_conv.is_owned = (msg & 1) || (msg == 0);
6209 msg_conv = ReplyChannelRange_clone(&msg_conv);
6210 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6211 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6212 return (uint64_t)ret_conv;
6215 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) {
6216 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6217 LDKPublicKey their_node_id_ref;
6218 CHECK(*((uint32_t*)their_node_id) == 33);
6219 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6220 LDKReplyShortChannelIdsEnd msg_conv;
6221 msg_conv.inner = (void*)(msg & (~1));
6222 msg_conv.is_owned = (msg & 1) || (msg == 0);
6223 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6224 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6225 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6226 return (uint64_t)ret_conv;
6229 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6230 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6231 LDKPublicKey their_node_id_ref;
6232 CHECK(*((uint32_t*)their_node_id) == 33);
6233 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6234 LDKQueryChannelRange msg_conv;
6235 msg_conv.inner = (void*)(msg & (~1));
6236 msg_conv.is_owned = (msg & 1) || (msg == 0);
6237 msg_conv = QueryChannelRange_clone(&msg_conv);
6238 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6239 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6240 return (uint64_t)ret_conv;
6243 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6244 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6245 LDKPublicKey their_node_id_ref;
6246 CHECK(*((uint32_t*)their_node_id) == 33);
6247 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6248 LDKQueryShortChannelIds msg_conv;
6249 msg_conv.inner = (void*)(msg & (~1));
6250 msg_conv.is_owned = (msg & 1) || (msg == 0);
6251 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6252 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6253 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6254 return (uint64_t)ret_conv;
6257 typedef struct LDKSocketDescriptor_JCalls {
6258 atomic_size_t refcnt;
6259 uint32_t send_data_meth;
6260 uint32_t disconnect_socket_meth;
6263 } LDKSocketDescriptor_JCalls;
6264 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6265 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6266 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6267 js_free(j_calls->send_data_meth);
6268 js_free(j_calls->disconnect_socket_meth);
6269 js_free(j_calls->eq_meth);
6270 js_free(j_calls->hash_meth);
6274 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6275 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6276 LDKu8slice data_var = data;
6277 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6278 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
6279 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
6281 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6282 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6283 js_invoke_function_0(j_calls->disconnect_socket_meth);
6285 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6286 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6287 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6288 *other_arg_clone = SocketDescriptor_clone(other_arg);
6289 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
6291 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6292 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6293 return js_invoke_function_0(j_calls->hash_meth);
6295 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
6296 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
6297 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6299 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
6300 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6301 atomic_init(&calls->refcnt, 1);
6302 //TODO: Assign calls->o from o
6304 LDKSocketDescriptor ret = {
6305 .this_arg = (void*) calls,
6306 .send_data = send_data_LDKSocketDescriptor_jcall,
6307 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6308 .eq = eq_LDKSocketDescriptor_jcall,
6309 .hash = hash_LDKSocketDescriptor_jcall,
6310 .cloned = LDKSocketDescriptor_JCalls_cloned,
6311 .free = LDKSocketDescriptor_JCalls_free,
6315 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
6316 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6317 *res_ptr = LDKSocketDescriptor_init(o);
6318 return (long)res_ptr;
6320 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
6321 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6322 LDKu8slice data_ref;
6323 data_ref.datalen = *((uint32_t*)data);
6324 data_ref.data = (int8_t*)(data + 4);
6325 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6329 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
6330 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6331 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6334 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
6335 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6336 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6340 typedef struct LDKChannelManagerPersister_JCalls {
6341 atomic_size_t refcnt;
6342 uint32_t persist_manager_meth;
6343 } LDKChannelManagerPersister_JCalls;
6344 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
6345 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6346 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6347 js_free(j_calls->persist_manager_meth);
6351 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
6352 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6353 LDKChannelManager channel_manager_var = *channel_manager;
6354 // Warning: we may need a move here but no clone is available for LDKChannelManager
6355 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6356 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6357 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
6358 if (channel_manager_var.is_owned) {
6359 channel_manager_ref |= 1;
6361 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
6362 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
6363 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
6366 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
6367 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
6368 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6370 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
6371 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
6372 atomic_init(&calls->refcnt, 1);
6373 //TODO: Assign calls->o from o
6375 LDKChannelManagerPersister ret = {
6376 .this_arg = (void*) calls,
6377 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
6378 .free = LDKChannelManagerPersister_JCalls_free,
6382 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
6383 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
6384 *res_ptr = LDKChannelManagerPersister_init(o);
6385 return (long)res_ptr;
6387 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
6388 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
6389 LDKChannelManager channel_manager_conv;
6390 channel_manager_conv.inner = (void*)(channel_manager & (~1));
6391 channel_manager_conv.is_owned = false;
6392 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6393 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
6394 return (uint64_t)ret_conv;
6397 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
6398 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
6400 case LDKFallback_SegWitProgram: {
6401 uint8_t version_val = obj->seg_wit_program.version._0;
6402 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
6403 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6404 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
6405 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
6407 case LDKFallback_PubKeyHash: {
6408 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6409 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
6410 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
6412 case LDKFallback_ScriptHash: {
6413 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6414 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
6415 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
6420 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
6421 LDKStr ret_str = _ldk_get_compiled_version();
6422 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6427 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
6428 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
6429 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6434 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
6435 LDKTransaction _res_ref;
6436 _res_ref.datalen = *((uint32_t*)_res);
6437 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6438 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6439 _res_ref.data_is_owned = true;
6440 Transaction_free(_res_ref);
6443 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
6444 LDKCVec_u8Z script_pubkey_ref;
6445 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
6446 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
6447 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
6448 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6449 *ret_ref = TxOut_new(script_pubkey_ref, value);
6450 return (uint64_t)ret_ref;
6453 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
6454 if ((_res & 1) != 0) return;
6455 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6457 TxOut_free(_res_conv);
6460 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
6461 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6462 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6463 *ret_ref = TxOut_clone(orig_conv);
6464 return (uint64_t)ret_ref;
6467 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
6468 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
6472 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
6474 CHECK(*((uint32_t*)o) == 32);
6475 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
6476 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6477 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6478 return (uint64_t)ret_conv;
6481 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
6482 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6483 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6484 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6485 return (uint64_t)ret_conv;
6488 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
6489 if ((_res & 1) != 0) return;
6490 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6492 CResult_SecretKeyErrorZ_free(_res_conv);
6495 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
6497 CHECK(*((uint32_t*)o) == 33);
6498 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
6499 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6500 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6501 return (uint64_t)ret_conv;
6504 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
6505 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6506 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6507 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6508 return (uint64_t)ret_conv;
6511 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
6512 if ((_res & 1) != 0) return;
6513 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6515 CResult_PublicKeyErrorZ_free(_res_conv);
6518 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
6519 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
6520 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6521 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
6522 return (uint64_t)ret_conv;
6525 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
6526 LDKTxCreationKeys o_conv;
6527 o_conv.inner = (void*)(o & (~1));
6528 o_conv.is_owned = (o & 1) || (o == 0);
6529 o_conv = TxCreationKeys_clone(&o_conv);
6530 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6531 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6532 return (uint64_t)ret_conv;
6535 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
6536 LDKDecodeError e_conv;
6537 e_conv.inner = (void*)(e & (~1));
6538 e_conv.is_owned = (e & 1) || (e == 0);
6539 e_conv = DecodeError_clone(&e_conv);
6540 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6541 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6542 return (uint64_t)ret_conv;
6545 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
6546 if ((_res & 1) != 0) return;
6547 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6549 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6552 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
6553 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6554 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6555 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6556 return (uint64_t)ret_conv;
6559 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
6560 LDKChannelPublicKeys o_conv;
6561 o_conv.inner = (void*)(o & (~1));
6562 o_conv.is_owned = (o & 1) || (o == 0);
6563 o_conv = ChannelPublicKeys_clone(&o_conv);
6564 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6565 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6566 return (uint64_t)ret_conv;
6569 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
6570 LDKDecodeError e_conv;
6571 e_conv.inner = (void*)(e & (~1));
6572 e_conv.is_owned = (e & 1) || (e == 0);
6573 e_conv = DecodeError_clone(&e_conv);
6574 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6575 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6576 return (uint64_t)ret_conv;
6579 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
6580 if ((_res & 1) != 0) return;
6581 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6583 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6586 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
6587 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6588 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6589 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6590 return (uint64_t)ret_conv;
6593 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
6594 LDKTxCreationKeys o_conv;
6595 o_conv.inner = (void*)(o & (~1));
6596 o_conv.is_owned = (o & 1) || (o == 0);
6597 o_conv = TxCreationKeys_clone(&o_conv);
6598 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6599 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6600 return (uint64_t)ret_conv;
6603 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
6604 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6605 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6606 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6607 return (uint64_t)ret_conv;
6610 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
6611 if ((_res & 1) != 0) return;
6612 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6614 CResult_TxCreationKeysErrorZ_free(_res_conv);
6617 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
6618 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
6619 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6620 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
6621 return (uint64_t)ret_conv;
6624 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
6625 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6626 *ret_copy = COption_u32Z_some(o);
6627 uint64_t ret_ref = (uint64_t)ret_copy;
6631 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
6632 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6633 *ret_copy = COption_u32Z_none();
6634 uint64_t ret_ref = (uint64_t)ret_copy;
6638 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
6639 if ((_res & 1) != 0) return;
6640 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
6642 COption_u32Z_free(_res_conv);
6645 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
6646 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
6647 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6648 *ret_copy = COption_u32Z_clone(orig_conv);
6649 uint64_t ret_ref = (uint64_t)ret_copy;
6653 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
6654 LDKHTLCOutputInCommitment o_conv;
6655 o_conv.inner = (void*)(o & (~1));
6656 o_conv.is_owned = (o & 1) || (o == 0);
6657 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6658 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6659 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6660 return (uint64_t)ret_conv;
6663 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
6664 LDKDecodeError e_conv;
6665 e_conv.inner = (void*)(e & (~1));
6666 e_conv.is_owned = (e & 1) || (e == 0);
6667 e_conv = DecodeError_clone(&e_conv);
6668 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6669 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6670 return (uint64_t)ret_conv;
6673 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
6674 if ((_res & 1) != 0) return;
6675 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6677 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6680 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
6681 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6682 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6683 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6684 return (uint64_t)ret_conv;
6687 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6688 LDKCounterpartyChannelTransactionParameters o_conv;
6689 o_conv.inner = (void*)(o & (~1));
6690 o_conv.is_owned = (o & 1) || (o == 0);
6691 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6692 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6693 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6694 return (uint64_t)ret_conv;
6697 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6698 LDKDecodeError e_conv;
6699 e_conv.inner = (void*)(e & (~1));
6700 e_conv.is_owned = (e & 1) || (e == 0);
6701 e_conv = DecodeError_clone(&e_conv);
6702 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6703 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6704 return (uint64_t)ret_conv;
6707 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6708 if ((_res & 1) != 0) return;
6709 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6711 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6714 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6715 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6716 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6717 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6718 return (uint64_t)ret_conv;
6721 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6722 LDKChannelTransactionParameters o_conv;
6723 o_conv.inner = (void*)(o & (~1));
6724 o_conv.is_owned = (o & 1) || (o == 0);
6725 o_conv = ChannelTransactionParameters_clone(&o_conv);
6726 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6727 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6728 return (uint64_t)ret_conv;
6731 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6732 LDKDecodeError e_conv;
6733 e_conv.inner = (void*)(e & (~1));
6734 e_conv.is_owned = (e & 1) || (e == 0);
6735 e_conv = DecodeError_clone(&e_conv);
6736 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6737 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6738 return (uint64_t)ret_conv;
6741 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6742 if ((_res & 1) != 0) return;
6743 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6745 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6748 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6749 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6750 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6751 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6752 return (uint64_t)ret_conv;
6755 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
6756 LDKCVec_SignatureZ _res_constr;
6757 _res_constr.datalen = *((uint32_t*)_res);
6758 if (_res_constr.datalen > 0)
6759 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6761 _res_constr.data = NULL;
6762 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6763 for (size_t m = 0; m < _res_constr.datalen; m++) {
6764 int8_tArray _res_conv_12 = _res_vals[m];
6765 LDKSignature _res_conv_12_ref;
6766 CHECK(*((uint32_t*)_res_conv_12) == 64);
6767 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
6768 _res_constr.data[m] = _res_conv_12_ref;
6770 CVec_SignatureZ_free(_res_constr);
6773 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6774 LDKHolderCommitmentTransaction o_conv;
6775 o_conv.inner = (void*)(o & (~1));
6776 o_conv.is_owned = (o & 1) || (o == 0);
6777 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6778 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6779 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6780 return (uint64_t)ret_conv;
6783 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6784 LDKDecodeError e_conv;
6785 e_conv.inner = (void*)(e & (~1));
6786 e_conv.is_owned = (e & 1) || (e == 0);
6787 e_conv = DecodeError_clone(&e_conv);
6788 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6789 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6790 return (uint64_t)ret_conv;
6793 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6794 if ((_res & 1) != 0) return;
6795 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6797 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6800 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6801 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6802 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6803 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6804 return (uint64_t)ret_conv;
6807 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6808 LDKBuiltCommitmentTransaction o_conv;
6809 o_conv.inner = (void*)(o & (~1));
6810 o_conv.is_owned = (o & 1) || (o == 0);
6811 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6812 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6813 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6814 return (uint64_t)ret_conv;
6817 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6818 LDKDecodeError e_conv;
6819 e_conv.inner = (void*)(e & (~1));
6820 e_conv.is_owned = (e & 1) || (e == 0);
6821 e_conv = DecodeError_clone(&e_conv);
6822 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6823 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6824 return (uint64_t)ret_conv;
6827 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6828 if ((_res & 1) != 0) return;
6829 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6831 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6834 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6835 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6836 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6837 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6838 return (uint64_t)ret_conv;
6841 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6842 LDKCommitmentTransaction o_conv;
6843 o_conv.inner = (void*)(o & (~1));
6844 o_conv.is_owned = (o & 1) || (o == 0);
6845 o_conv = CommitmentTransaction_clone(&o_conv);
6846 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6847 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6848 return (uint64_t)ret_conv;
6851 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6852 LDKDecodeError e_conv;
6853 e_conv.inner = (void*)(e & (~1));
6854 e_conv.is_owned = (e & 1) || (e == 0);
6855 e_conv = DecodeError_clone(&e_conv);
6856 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6857 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6858 return (uint64_t)ret_conv;
6861 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6862 if ((_res & 1) != 0) return;
6863 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6865 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6868 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6869 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6870 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6871 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6872 return (uint64_t)ret_conv;
6875 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
6876 LDKTrustedCommitmentTransaction o_conv;
6877 o_conv.inner = (void*)(o & (~1));
6878 o_conv.is_owned = (o & 1) || (o == 0);
6879 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6880 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6881 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6882 return (uint64_t)ret_conv;
6885 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
6886 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6887 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6888 return (uint64_t)ret_conv;
6891 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
6892 if ((_res & 1) != 0) return;
6893 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6895 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6898 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
6899 LDKCVec_SignatureZ o_constr;
6900 o_constr.datalen = *((uint32_t*)o);
6901 if (o_constr.datalen > 0)
6902 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6904 o_constr.data = NULL;
6905 int8_tArray* o_vals = (int8_tArray*)(o + 4);
6906 for (size_t m = 0; m < o_constr.datalen; m++) {
6907 int8_tArray o_conv_12 = o_vals[m];
6908 LDKSignature o_conv_12_ref;
6909 CHECK(*((uint32_t*)o_conv_12) == 64);
6910 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
6911 o_constr.data[m] = o_conv_12_ref;
6913 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6914 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6915 return (uint64_t)ret_conv;
6918 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
6919 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6920 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6921 return (uint64_t)ret_conv;
6924 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
6925 if ((_res & 1) != 0) return;
6926 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6928 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6931 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
6932 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6933 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6934 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6935 return (uint64_t)ret_conv;
6938 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
6939 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6940 *ret_conv = CResult_NoneErrorZ_ok();
6941 return (uint64_t)ret_conv;
6944 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
6945 LDKIOError e_conv = LDKIOError_from_js(e);
6946 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6947 *ret_conv = CResult_NoneErrorZ_err(e_conv);
6948 return (uint64_t)ret_conv;
6951 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
6952 if ((_res & 1) != 0) return;
6953 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
6955 CResult_NoneErrorZ_free(_res_conv);
6958 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
6959 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
6960 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6961 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
6962 return (uint64_t)ret_conv;
6965 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
6967 o_conv.inner = (void*)(o & (~1));
6968 o_conv.is_owned = (o & 1) || (o == 0);
6969 o_conv = RouteHop_clone(&o_conv);
6970 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6971 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
6972 return (uint64_t)ret_conv;
6975 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
6976 LDKDecodeError e_conv;
6977 e_conv.inner = (void*)(e & (~1));
6978 e_conv.is_owned = (e & 1) || (e == 0);
6979 e_conv = DecodeError_clone(&e_conv);
6980 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6981 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
6982 return (uint64_t)ret_conv;
6985 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
6986 if ((_res & 1) != 0) return;
6987 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
6989 CResult_RouteHopDecodeErrorZ_free(_res_conv);
6992 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
6993 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
6994 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6995 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
6996 return (uint64_t)ret_conv;
6999 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7000 LDKCVec_RouteHopZ _res_constr;
7001 _res_constr.datalen = *((uint32_t*)_res);
7002 if (_res_constr.datalen > 0)
7003 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7005 _res_constr.data = NULL;
7006 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7007 for (size_t k = 0; k < _res_constr.datalen; k++) {
7008 uint32_t _res_conv_10 = _res_vals[k];
7009 LDKRouteHop _res_conv_10_conv;
7010 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7011 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7012 _res_constr.data[k] = _res_conv_10_conv;
7014 CVec_RouteHopZ_free(_res_constr);
7017 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7018 LDKCVec_CVec_RouteHopZZ _res_constr;
7019 _res_constr.datalen = *((uint32_t*)_res);
7020 if (_res_constr.datalen > 0)
7021 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7023 _res_constr.data = NULL;
7024 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7025 for (size_t m = 0; m < _res_constr.datalen; m++) {
7026 uint32_tArray _res_conv_12 = _res_vals[m];
7027 LDKCVec_RouteHopZ _res_conv_12_constr;
7028 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7029 if (_res_conv_12_constr.datalen > 0)
7030 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7032 _res_conv_12_constr.data = NULL;
7033 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7034 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7035 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7036 LDKRouteHop _res_conv_12_conv_10_conv;
7037 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7038 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7039 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7041 _res_constr.data[m] = _res_conv_12_constr;
7043 CVec_CVec_RouteHopZZ_free(_res_constr);
7046 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7048 o_conv.inner = (void*)(o & (~1));
7049 o_conv.is_owned = (o & 1) || (o == 0);
7050 o_conv = Route_clone(&o_conv);
7051 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7052 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7053 return (uint64_t)ret_conv;
7056 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7057 LDKDecodeError e_conv;
7058 e_conv.inner = (void*)(e & (~1));
7059 e_conv.is_owned = (e & 1) || (e == 0);
7060 e_conv = DecodeError_clone(&e_conv);
7061 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7062 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7063 return (uint64_t)ret_conv;
7066 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7067 if ((_res & 1) != 0) return;
7068 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7070 CResult_RouteDecodeErrorZ_free(_res_conv);
7073 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7074 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7075 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7076 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7077 return (uint64_t)ret_conv;
7080 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7081 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7082 *ret_copy = COption_u64Z_some(o);
7083 uint64_t ret_ref = (uint64_t)ret_copy;
7087 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7088 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7089 *ret_copy = COption_u64Z_none();
7090 uint64_t ret_ref = (uint64_t)ret_copy;
7094 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7095 if ((_res & 1) != 0) return;
7096 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7098 COption_u64Z_free(_res_conv);
7101 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7102 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7103 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7104 *ret_copy = COption_u64Z_clone(orig_conv);
7105 uint64_t ret_ref = (uint64_t)ret_copy;
7109 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7110 LDKCVec_ChannelDetailsZ _res_constr;
7111 _res_constr.datalen = *((uint32_t*)_res);
7112 if (_res_constr.datalen > 0)
7113 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7115 _res_constr.data = NULL;
7116 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7117 for (size_t q = 0; q < _res_constr.datalen; q++) {
7118 uint32_t _res_conv_16 = _res_vals[q];
7119 LDKChannelDetails _res_conv_16_conv;
7120 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7121 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7122 _res_constr.data[q] = _res_conv_16_conv;
7124 CVec_ChannelDetailsZ_free(_res_constr);
7127 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7128 LDKCVec_RouteHintZ _res_constr;
7129 _res_constr.datalen = *((uint32_t*)_res);
7130 if (_res_constr.datalen > 0)
7131 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7133 _res_constr.data = NULL;
7134 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7135 for (size_t l = 0; l < _res_constr.datalen; l++) {
7136 uint32_t _res_conv_11 = _res_vals[l];
7137 LDKRouteHint _res_conv_11_conv;
7138 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7139 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7140 _res_constr.data[l] = _res_conv_11_conv;
7142 CVec_RouteHintZ_free(_res_constr);
7145 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7147 o_conv.inner = (void*)(o & (~1));
7148 o_conv.is_owned = (o & 1) || (o == 0);
7149 o_conv = Route_clone(&o_conv);
7150 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7151 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7152 return (uint64_t)ret_conv;
7155 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7156 LDKLightningError e_conv;
7157 e_conv.inner = (void*)(e & (~1));
7158 e_conv.is_owned = (e & 1) || (e == 0);
7159 e_conv = LightningError_clone(&e_conv);
7160 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7161 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7162 return (uint64_t)ret_conv;
7165 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7166 if ((_res & 1) != 0) return;
7167 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7169 CResult_RouteLightningErrorZ_free(_res_conv);
7172 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7173 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7174 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7175 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7176 return (uint64_t)ret_conv;
7179 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7180 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7181 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7182 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7183 return (uint64_t)ret_conv;
7186 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7187 LDKAccessError e_conv = LDKAccessError_from_js(e);
7188 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7189 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7190 return (uint64_t)ret_conv;
7193 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7194 if ((_res & 1) != 0) return;
7195 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7197 CResult_TxOutAccessErrorZ_free(_res_conv);
7200 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7201 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7202 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7203 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7204 return (uint64_t)ret_conv;
7207 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
7208 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
7209 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7210 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
7211 return (uint64_t)ret_ref;
7214 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
7215 LDKTransaction b_ref;
7216 b_ref.datalen = *((uint32_t*)b);
7217 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7218 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
7219 b_ref.data_is_owned = true;
7220 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7221 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7222 return (uint64_t)ret_ref;
7225 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
7226 if ((_res & 1) != 0) return;
7227 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7229 C2Tuple_usizeTransactionZ_free(_res_conv);
7232 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
7233 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7234 _res_constr.datalen = *((uint32_t*)_res);
7235 if (_res_constr.datalen > 0)
7236 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7238 _res_constr.data = NULL;
7239 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7240 for (size_t e = 0; e < _res_constr.datalen; e++) {
7241 uint32_t _res_conv_30 = _res_vals[e];
7242 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
7243 FREE((void*)_res_conv_30);
7244 _res_constr.data[e] = _res_conv_30_conv;
7246 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7249 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
7250 LDKCVec_TxidZ _res_constr;
7251 _res_constr.datalen = *((uint32_t*)_res);
7252 if (_res_constr.datalen > 0)
7253 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7255 _res_constr.data = NULL;
7256 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7257 for (size_t m = 0; m < _res_constr.datalen; m++) {
7258 int8_tArray _res_conv_12 = _res_vals[m];
7259 LDKThirtyTwoBytes _res_conv_12_ref;
7260 CHECK(*((uint32_t*)_res_conv_12) == 32);
7261 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
7262 _res_constr.data[m] = _res_conv_12_ref;
7264 CVec_TxidZ_free(_res_constr);
7267 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
7268 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7269 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7270 return (uint64_t)ret_conv;
7273 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
7274 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
7275 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7276 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7277 return (uint64_t)ret_conv;
7280 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
7281 if ((_res & 1) != 0) return;
7282 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7284 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7287 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
7288 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7289 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7290 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7291 return (uint64_t)ret_conv;
7294 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
7295 LDKCVec_MonitorEventZ _res_constr;
7296 _res_constr.datalen = *((uint32_t*)_res);
7297 if (_res_constr.datalen > 0)
7298 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7300 _res_constr.data = NULL;
7301 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7302 for (size_t o = 0; o < _res_constr.datalen; o++) {
7303 uint32_t _res_conv_14 = _res_vals[o];
7304 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7305 FREE((void*)_res_conv_14);
7306 _res_constr.data[o] = _res_conv_14_conv;
7308 CVec_MonitorEventZ_free(_res_constr);
7311 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7312 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7313 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7314 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7315 uint64_t ret_ref = (uint64_t)ret_copy;
7319 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7320 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7321 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7322 uint64_t ret_ref = (uint64_t)ret_copy;
7326 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7327 if ((_res & 1) != 0) return;
7328 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7330 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7333 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
7334 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
7335 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7336 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
7337 uint64_t ret_ref = (uint64_t)ret_copy;
7341 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7342 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7343 _res_constr.datalen = *((uint32_t*)_res);
7344 if (_res_constr.datalen > 0)
7345 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7347 _res_constr.data = NULL;
7348 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7349 for (size_t b = 0; b < _res_constr.datalen; b++) {
7350 uint32_t _res_conv_27 = _res_vals[b];
7351 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7352 FREE((void*)_res_conv_27);
7353 _res_constr.data[b] = _res_conv_27_conv;
7355 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7358 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
7359 LDKCVec_MessageSendEventZ _res_constr;
7360 _res_constr.datalen = *((uint32_t*)_res);
7361 if (_res_constr.datalen > 0)
7362 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7364 _res_constr.data = NULL;
7365 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7366 for (size_t s = 0; s < _res_constr.datalen; s++) {
7367 uint32_t _res_conv_18 = _res_vals[s];
7368 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
7369 FREE((void*)_res_conv_18);
7370 _res_constr.data[s] = _res_conv_18_conv;
7372 CVec_MessageSendEventZ_free(_res_constr);
7375 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
7376 LDKInitFeatures o_conv;
7377 o_conv.inner = (void*)(o & (~1));
7378 o_conv.is_owned = (o & 1) || (o == 0);
7379 o_conv = InitFeatures_clone(&o_conv);
7380 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7381 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7382 return (uint64_t)ret_conv;
7385 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
7386 LDKDecodeError e_conv;
7387 e_conv.inner = (void*)(e & (~1));
7388 e_conv.is_owned = (e & 1) || (e == 0);
7389 e_conv = DecodeError_clone(&e_conv);
7390 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7391 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7392 return (uint64_t)ret_conv;
7395 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
7396 if ((_res & 1) != 0) return;
7397 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7399 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7402 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
7403 LDKNodeFeatures o_conv;
7404 o_conv.inner = (void*)(o & (~1));
7405 o_conv.is_owned = (o & 1) || (o == 0);
7406 o_conv = NodeFeatures_clone(&o_conv);
7407 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7408 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7409 return (uint64_t)ret_conv;
7412 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
7413 LDKDecodeError e_conv;
7414 e_conv.inner = (void*)(e & (~1));
7415 e_conv.is_owned = (e & 1) || (e == 0);
7416 e_conv = DecodeError_clone(&e_conv);
7417 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7418 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7419 return (uint64_t)ret_conv;
7422 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
7423 if ((_res & 1) != 0) return;
7424 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7426 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7429 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
7430 LDKChannelFeatures o_conv;
7431 o_conv.inner = (void*)(o & (~1));
7432 o_conv.is_owned = (o & 1) || (o == 0);
7433 o_conv = ChannelFeatures_clone(&o_conv);
7434 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7435 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7436 return (uint64_t)ret_conv;
7439 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
7440 LDKDecodeError e_conv;
7441 e_conv.inner = (void*)(e & (~1));
7442 e_conv.is_owned = (e & 1) || (e == 0);
7443 e_conv = DecodeError_clone(&e_conv);
7444 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7445 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7446 return (uint64_t)ret_conv;
7449 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
7450 if ((_res & 1) != 0) return;
7451 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7453 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7456 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
7457 LDKInvoiceFeatures o_conv;
7458 o_conv.inner = (void*)(o & (~1));
7459 o_conv.is_owned = (o & 1) || (o == 0);
7460 o_conv = InvoiceFeatures_clone(&o_conv);
7461 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7462 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7463 return (uint64_t)ret_conv;
7466 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
7467 LDKDecodeError e_conv;
7468 e_conv.inner = (void*)(e & (~1));
7469 e_conv.is_owned = (e & 1) || (e == 0);
7470 e_conv = DecodeError_clone(&e_conv);
7471 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7472 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7473 return (uint64_t)ret_conv;
7476 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
7477 if ((_res & 1) != 0) return;
7478 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7480 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7483 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7484 LDKDelayedPaymentOutputDescriptor o_conv;
7485 o_conv.inner = (void*)(o & (~1));
7486 o_conv.is_owned = (o & 1) || (o == 0);
7487 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
7488 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7489 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7490 return (uint64_t)ret_conv;
7493 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7494 LDKDecodeError e_conv;
7495 e_conv.inner = (void*)(e & (~1));
7496 e_conv.is_owned = (e & 1) || (e == 0);
7497 e_conv = DecodeError_clone(&e_conv);
7498 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7499 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7500 return (uint64_t)ret_conv;
7503 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7504 if ((_res & 1) != 0) return;
7505 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7507 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7510 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7511 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7512 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7513 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7514 return (uint64_t)ret_conv;
7517 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7518 LDKStaticPaymentOutputDescriptor o_conv;
7519 o_conv.inner = (void*)(o & (~1));
7520 o_conv.is_owned = (o & 1) || (o == 0);
7521 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
7522 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7523 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7524 return (uint64_t)ret_conv;
7527 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7528 LDKDecodeError e_conv;
7529 e_conv.inner = (void*)(e & (~1));
7530 e_conv.is_owned = (e & 1) || (e == 0);
7531 e_conv = DecodeError_clone(&e_conv);
7532 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7533 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7534 return (uint64_t)ret_conv;
7537 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7538 if ((_res & 1) != 0) return;
7539 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7541 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7544 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7545 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7546 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7547 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7548 return (uint64_t)ret_conv;
7551 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7552 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7553 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7554 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7555 return (uint64_t)ret_conv;
7558 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7559 LDKDecodeError e_conv;
7560 e_conv.inner = (void*)(e & (~1));
7561 e_conv.is_owned = (e & 1) || (e == 0);
7562 e_conv = DecodeError_clone(&e_conv);
7563 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7564 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7565 return (uint64_t)ret_conv;
7568 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7569 if ((_res & 1) != 0) return;
7570 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7572 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7575 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7576 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7577 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7578 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7579 return (uint64_t)ret_conv;
7582 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
7583 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7584 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7585 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7586 return (uint64_t)ret_ref;
7589 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
7591 CHECK(*((uint32_t*)a) == 64);
7592 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
7593 LDKCVec_SignatureZ b_constr;
7594 b_constr.datalen = *((uint32_t*)b);
7595 if (b_constr.datalen > 0)
7596 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7598 b_constr.data = NULL;
7599 int8_tArray* b_vals = (int8_tArray*)(b + 4);
7600 for (size_t m = 0; m < b_constr.datalen; m++) {
7601 int8_tArray b_conv_12 = b_vals[m];
7602 LDKSignature b_conv_12_ref;
7603 CHECK(*((uint32_t*)b_conv_12) == 64);
7604 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7605 b_constr.data[m] = b_conv_12_ref;
7607 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7608 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7609 return (uint64_t)ret_ref;
7612 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7613 if ((_res & 1) != 0) return;
7614 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7616 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7619 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7620 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7621 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7622 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7623 return (uint64_t)ret_conv;
7626 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7627 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7628 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7629 return (uint64_t)ret_conv;
7632 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7633 if ((_res & 1) != 0) return;
7634 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7636 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7639 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7640 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7641 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7642 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7643 return (uint64_t)ret_conv;
7646 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7648 CHECK(*((uint32_t*)o) == 64);
7649 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7650 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7651 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7652 return (uint64_t)ret_conv;
7655 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7656 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7657 *ret_conv = CResult_SignatureNoneZ_err();
7658 return (uint64_t)ret_conv;
7661 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7662 if ((_res & 1) != 0) return;
7663 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7665 CResult_SignatureNoneZ_free(_res_conv);
7668 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7669 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7670 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7671 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7672 return (uint64_t)ret_conv;
7675 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7676 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7677 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7678 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7679 return (uint64_t)ret_conv;
7682 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7683 LDKDecodeError e_conv;
7684 e_conv.inner = (void*)(e & (~1));
7685 e_conv.is_owned = (e & 1) || (e == 0);
7686 e_conv = DecodeError_clone(&e_conv);
7687 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7688 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7689 return (uint64_t)ret_conv;
7692 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7693 if ((_res & 1) != 0) return;
7694 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7696 CResult_SignDecodeErrorZ_free(_res_conv);
7699 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7700 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7701 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7702 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7703 return (uint64_t)ret_conv;
7706 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
7707 LDKCVec_u8Z _res_ref;
7708 _res_ref.datalen = *((uint32_t*)_res);
7709 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
7710 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7711 CVec_u8Z_free(_res_ref);
7714 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
7715 LDKRecoverableSignature arg_ref;
7716 CHECK(*((uint32_t*)arg) == 68);
7717 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
7718 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7719 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
7720 return (uint64_t)ret_conv;
7723 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
7724 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7725 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
7726 return (uint64_t)ret_conv;
7729 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
7730 if ((_res & 1) != 0) return;
7731 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
7733 CResult_RecoverableSignatureNoneZ_free(_res_conv);
7736 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
7737 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
7738 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7739 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
7740 return (uint64_t)ret_conv;
7743 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7744 LDKCVec_CVec_u8ZZ _res_constr;
7745 _res_constr.datalen = *((uint32_t*)_res);
7746 if (_res_constr.datalen > 0)
7747 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7749 _res_constr.data = NULL;
7750 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7751 for (size_t m = 0; m < _res_constr.datalen; m++) {
7752 int8_tArray _res_conv_12 = _res_vals[m];
7753 LDKCVec_u8Z _res_conv_12_ref;
7754 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7755 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7756 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7757 _res_constr.data[m] = _res_conv_12_ref;
7759 CVec_CVec_u8ZZ_free(_res_constr);
7762 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7763 LDKCVec_CVec_u8ZZ o_constr;
7764 o_constr.datalen = *((uint32_t*)o);
7765 if (o_constr.datalen > 0)
7766 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7768 o_constr.data = NULL;
7769 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7770 for (size_t m = 0; m < o_constr.datalen; m++) {
7771 int8_tArray o_conv_12 = o_vals[m];
7772 LDKCVec_u8Z o_conv_12_ref;
7773 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7774 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7775 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7776 o_constr.data[m] = o_conv_12_ref;
7778 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7779 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7780 return (uint64_t)ret_conv;
7783 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7784 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7785 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7786 return (uint64_t)ret_conv;
7789 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7790 if ((_res & 1) != 0) return;
7791 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7793 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7796 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7797 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7798 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7799 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7800 return (uint64_t)ret_conv;
7803 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7804 LDKInMemorySigner o_conv;
7805 o_conv.inner = (void*)(o & (~1));
7806 o_conv.is_owned = (o & 1) || (o == 0);
7807 o_conv = InMemorySigner_clone(&o_conv);
7808 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7809 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7810 return (uint64_t)ret_conv;
7813 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7814 LDKDecodeError e_conv;
7815 e_conv.inner = (void*)(e & (~1));
7816 e_conv.is_owned = (e & 1) || (e == 0);
7817 e_conv = DecodeError_clone(&e_conv);
7818 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7819 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7820 return (uint64_t)ret_conv;
7823 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7824 if ((_res & 1) != 0) return;
7825 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7827 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7830 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7831 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7832 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7833 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7834 return (uint64_t)ret_conv;
7837 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7838 LDKCVec_TxOutZ _res_constr;
7839 _res_constr.datalen = *((uint32_t*)_res);
7840 if (_res_constr.datalen > 0)
7841 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7843 _res_constr.data = NULL;
7844 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7845 for (size_t h = 0; h < _res_constr.datalen; h++) {
7846 uint32_t _res_conv_7 = _res_vals[h];
7847 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7848 FREE((void*)_res_conv_7);
7849 _res_constr.data[h] = _res_conv_7_conv;
7851 CVec_TxOutZ_free(_res_constr);
7854 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7855 LDKTransaction o_ref;
7856 o_ref.datalen = *((uint32_t*)o);
7857 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7858 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7859 o_ref.data_is_owned = true;
7860 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7861 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7862 return (uint64_t)ret_conv;
7865 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7866 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7867 *ret_conv = CResult_TransactionNoneZ_err();
7868 return (uint64_t)ret_conv;
7871 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7872 if ((_res & 1) != 0) return;
7873 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7875 CResult_TransactionNoneZ_free(_res_conv);
7878 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
7879 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
7880 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7881 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
7882 return (uint64_t)ret_conv;
7885 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
7886 LDKThirtyTwoBytes a_ref;
7887 CHECK(*((uint32_t*)a) == 32);
7888 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
7889 LDKChannelMonitor b_conv;
7890 b_conv.inner = (void*)(b & (~1));
7891 b_conv.is_owned = (b & 1) || (b == 0);
7892 b_conv = ChannelMonitor_clone(&b_conv);
7893 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7894 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7895 return (uint64_t)ret_ref;
7898 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
7899 if ((_res & 1) != 0) return;
7900 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7902 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7905 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
7906 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
7907 _res_constr.datalen = *((uint32_t*)_res);
7908 if (_res_constr.datalen > 0)
7909 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
7911 _res_constr.data = NULL;
7912 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7913 for (size_t m = 0; m < _res_constr.datalen; m++) {
7914 uint32_t _res_conv_38 = _res_vals[m];
7915 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
7916 FREE((void*)_res_conv_38);
7917 _res_constr.data[m] = _res_conv_38_conv;
7919 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
7922 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
7923 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
7924 o_constr.datalen = *((uint32_t*)o);
7925 if (o_constr.datalen > 0)
7926 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
7928 o_constr.data = NULL;
7929 uint32_t* o_vals = (uint32_t*)(o + 4);
7930 for (size_t m = 0; m < o_constr.datalen; m++) {
7931 uint32_t o_conv_38 = o_vals[m];
7932 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
7933 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
7934 o_constr.data[m] = o_conv_38_conv;
7936 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
7937 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
7938 return (uint64_t)ret_conv;
7941 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
7942 LDKIOError e_conv = LDKIOError_from_js(e);
7943 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
7944 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
7945 return (uint64_t)ret_conv;
7948 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
7949 if ((_res & 1) != 0) return;
7950 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
7952 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
7955 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
7956 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7957 *ret_copy = COption_u16Z_some(o);
7958 uint64_t ret_ref = (uint64_t)ret_copy;
7962 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
7963 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7964 *ret_copy = COption_u16Z_none();
7965 uint64_t ret_ref = (uint64_t)ret_copy;
7969 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
7970 if ((_res & 1) != 0) return;
7971 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
7973 COption_u16Z_free(_res_conv);
7976 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
7977 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
7978 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7979 *ret_copy = COption_u16Z_clone(orig_conv);
7980 uint64_t ret_ref = (uint64_t)ret_copy;
7984 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
7985 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7986 *ret_conv = CResult_NoneAPIErrorZ_ok();
7987 return (uint64_t)ret_conv;
7990 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
7991 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
7992 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7993 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
7994 return (uint64_t)ret_conv;
7997 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
7998 if ((_res & 1) != 0) return;
7999 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8001 CResult_NoneAPIErrorZ_free(_res_conv);
8004 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8005 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8006 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8007 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8008 return (uint64_t)ret_conv;
8011 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8012 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8013 _res_constr.datalen = *((uint32_t*)_res);
8014 if (_res_constr.datalen > 0)
8015 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8017 _res_constr.data = NULL;
8018 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8019 for (size_t w = 0; w < _res_constr.datalen; w++) {
8020 uint32_t _res_conv_22 = _res_vals[w];
8021 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8022 FREE((void*)_res_conv_22);
8023 _res_constr.data[w] = _res_conv_22_conv;
8025 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8028 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8029 LDKCVec_APIErrorZ _res_constr;
8030 _res_constr.datalen = *((uint32_t*)_res);
8031 if (_res_constr.datalen > 0)
8032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8034 _res_constr.data = NULL;
8035 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8036 for (size_t k = 0; k < _res_constr.datalen; k++) {
8037 uint32_t _res_conv_10 = _res_vals[k];
8038 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8039 FREE((void*)_res_conv_10);
8040 _res_constr.data[k] = _res_conv_10_conv;
8042 CVec_APIErrorZ_free(_res_constr);
8045 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8046 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8047 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8048 return (uint64_t)ret_conv;
8051 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8052 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8053 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8054 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8055 return (uint64_t)ret_conv;
8058 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8059 if ((_res & 1) != 0) return;
8060 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8062 CResult_NonePaymentSendFailureZ_free(_res_conv);
8065 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
8066 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8067 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8068 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8069 return (uint64_t)ret_conv;
8072 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
8073 LDKCVec_NetAddressZ _res_constr;
8074 _res_constr.datalen = *((uint32_t*)_res);
8075 if (_res_constr.datalen > 0)
8076 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8078 _res_constr.data = NULL;
8079 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8080 for (size_t m = 0; m < _res_constr.datalen; m++) {
8081 uint32_t _res_conv_12 = _res_vals[m];
8082 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
8083 FREE((void*)_res_conv_12);
8084 _res_constr.data[m] = _res_conv_12_conv;
8086 CVec_NetAddressZ_free(_res_constr);
8089 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
8090 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
8091 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8092 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
8093 return (uint64_t)ret_ref;
8096 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
8097 LDKThirtyTwoBytes a_ref;
8098 CHECK(*((uint32_t*)a) == 32);
8099 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8100 LDKThirtyTwoBytes b_ref;
8101 CHECK(*((uint32_t*)b) == 32);
8102 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8103 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8104 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
8105 return (uint64_t)ret_ref;
8108 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
8109 if ((_res & 1) != 0) return;
8110 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
8112 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
8115 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
8116 LDKThirtyTwoBytes o_ref;
8117 CHECK(*((uint32_t*)o) == 32);
8118 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8119 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8120 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
8121 return (uint64_t)ret_conv;
8124 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
8125 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8126 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8127 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
8128 return (uint64_t)ret_conv;
8131 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
8132 if ((_res & 1) != 0) return;
8133 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
8135 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
8138 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
8139 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
8140 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8141 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
8142 return (uint64_t)ret_conv;
8145 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
8146 LDKCVec_ChannelMonitorZ _res_constr;
8147 _res_constr.datalen = *((uint32_t*)_res);
8148 if (_res_constr.datalen > 0)
8149 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8151 _res_constr.data = NULL;
8152 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8153 for (size_t q = 0; q < _res_constr.datalen; q++) {
8154 uint32_t _res_conv_16 = _res_vals[q];
8155 LDKChannelMonitor _res_conv_16_conv;
8156 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8157 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8158 _res_constr.data[q] = _res_conv_16_conv;
8160 CVec_ChannelMonitorZ_free(_res_constr);
8163 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
8164 LDKThirtyTwoBytes a_ref;
8165 CHECK(*((uint32_t*)a) == 32);
8166 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8167 LDKChannelManager b_conv;
8168 b_conv.inner = (void*)(b & (~1));
8169 b_conv.is_owned = (b & 1) || (b == 0);
8170 // Warning: we need a move here but no clone is available for LDKChannelManager
8171 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8172 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8173 return (uint64_t)ret_ref;
8176 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
8177 if ((_res & 1) != 0) return;
8178 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8180 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8183 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
8184 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8185 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8186 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8187 return (uint64_t)ret_conv;
8190 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
8191 LDKDecodeError e_conv;
8192 e_conv.inner = (void*)(e & (~1));
8193 e_conv.is_owned = (e & 1) || (e == 0);
8194 e_conv = DecodeError_clone(&e_conv);
8195 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8196 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8197 return (uint64_t)ret_conv;
8200 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
8201 if ((_res & 1) != 0) return;
8202 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8204 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8207 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8208 LDKChannelConfig o_conv;
8209 o_conv.inner = (void*)(o & (~1));
8210 o_conv.is_owned = (o & 1) || (o == 0);
8211 o_conv = ChannelConfig_clone(&o_conv);
8212 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8213 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8214 return (uint64_t)ret_conv;
8217 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8218 LDKDecodeError e_conv;
8219 e_conv.inner = (void*)(e & (~1));
8220 e_conv.is_owned = (e & 1) || (e == 0);
8221 e_conv = DecodeError_clone(&e_conv);
8222 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8223 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8224 return (uint64_t)ret_conv;
8227 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
8228 if ((_res & 1) != 0) return;
8229 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
8231 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
8234 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
8235 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
8236 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8237 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
8238 return (uint64_t)ret_conv;
8241 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
8243 o_conv.inner = (void*)(o & (~1));
8244 o_conv.is_owned = (o & 1) || (o == 0);
8245 o_conv = OutPoint_clone(&o_conv);
8246 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8247 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
8248 return (uint64_t)ret_conv;
8251 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
8252 LDKDecodeError e_conv;
8253 e_conv.inner = (void*)(e & (~1));
8254 e_conv.is_owned = (e & 1) || (e == 0);
8255 e_conv = DecodeError_clone(&e_conv);
8256 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8257 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
8258 return (uint64_t)ret_conv;
8261 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
8262 if ((_res & 1) != 0) return;
8263 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
8265 CResult_OutPointDecodeErrorZ_free(_res_conv);
8268 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
8269 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
8270 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8271 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
8272 return (uint64_t)ret_conv;
8275 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
8276 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
8277 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8278 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
8279 return (uint64_t)ret_conv;
8282 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
8283 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8284 *ret_conv = CResult_SiPrefixNoneZ_err();
8285 return (uint64_t)ret_conv;
8288 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
8289 if ((_res & 1) != 0) return;
8290 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
8292 CResult_SiPrefixNoneZ_free(_res_conv);
8295 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
8296 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
8297 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8298 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
8299 return (uint64_t)ret_conv;
8302 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
8304 o_conv.inner = (void*)(o & (~1));
8305 o_conv.is_owned = (o & 1) || (o == 0);
8306 o_conv = Invoice_clone(&o_conv);
8307 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8308 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
8309 return (uint64_t)ret_conv;
8312 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
8313 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8314 *ret_conv = CResult_InvoiceNoneZ_err();
8315 return (uint64_t)ret_conv;
8318 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
8319 if ((_res & 1) != 0) return;
8320 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
8322 CResult_InvoiceNoneZ_free(_res_conv);
8325 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
8326 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
8327 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8328 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
8329 return (uint64_t)ret_conv;
8332 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
8333 LDKSignedRawInvoice o_conv;
8334 o_conv.inner = (void*)(o & (~1));
8335 o_conv.is_owned = (o & 1) || (o == 0);
8336 o_conv = SignedRawInvoice_clone(&o_conv);
8337 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8338 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
8339 return (uint64_t)ret_conv;
8342 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
8343 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8344 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
8345 return (uint64_t)ret_conv;
8348 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
8349 if ((_res & 1) != 0) return;
8350 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
8352 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
8355 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
8356 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
8357 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8358 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
8359 return (uint64_t)ret_conv;
8362 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
8363 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
8364 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8365 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
8366 return (uint64_t)ret_ref;
8369 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
8370 LDKRawInvoice a_conv;
8371 a_conv.inner = (void*)(a & (~1));
8372 a_conv.is_owned = (a & 1) || (a == 0);
8373 a_conv = RawInvoice_clone(&a_conv);
8374 LDKThirtyTwoBytes b_ref;
8375 CHECK(*((uint32_t*)b) == 32);
8376 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8377 LDKInvoiceSignature c_conv;
8378 c_conv.inner = (void*)(c & (~1));
8379 c_conv.is_owned = (c & 1) || (c == 0);
8380 c_conv = InvoiceSignature_clone(&c_conv);
8381 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8382 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
8383 return (uint64_t)ret_ref;
8386 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
8387 if ((_res & 1) != 0) return;
8388 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
8390 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
8393 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
8394 LDKPayeePubKey o_conv;
8395 o_conv.inner = (void*)(o & (~1));
8396 o_conv.is_owned = (o & 1) || (o == 0);
8397 o_conv = PayeePubKey_clone(&o_conv);
8398 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8399 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
8400 return (uint64_t)ret_conv;
8403 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
8404 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8405 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8406 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
8407 return (uint64_t)ret_conv;
8410 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
8411 if ((_res & 1) != 0) return;
8412 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
8414 CResult_PayeePubKeyErrorZ_free(_res_conv);
8417 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
8418 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
8419 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8420 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
8421 return (uint64_t)ret_conv;
8424 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
8425 LDKCVec_PrivateRouteZ _res_constr;
8426 _res_constr.datalen = *((uint32_t*)_res);
8427 if (_res_constr.datalen > 0)
8428 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
8430 _res_constr.data = NULL;
8431 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8432 for (size_t o = 0; o < _res_constr.datalen; o++) {
8433 uint32_t _res_conv_14 = _res_vals[o];
8434 LDKPrivateRoute _res_conv_14_conv;
8435 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
8436 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
8437 _res_constr.data[o] = _res_conv_14_conv;
8439 CVec_PrivateRouteZ_free(_res_constr);
8442 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
8443 LDKPositiveTimestamp o_conv;
8444 o_conv.inner = (void*)(o & (~1));
8445 o_conv.is_owned = (o & 1) || (o == 0);
8446 o_conv = PositiveTimestamp_clone(&o_conv);
8447 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8448 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
8449 return (uint64_t)ret_conv;
8452 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
8453 LDKCreationError e_conv = LDKCreationError_from_js(e);
8454 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8455 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
8456 return (uint64_t)ret_conv;
8459 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
8460 if ((_res & 1) != 0) return;
8461 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
8463 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
8466 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
8467 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
8468 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8469 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
8470 return (uint64_t)ret_conv;
8473 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
8474 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8475 *ret_conv = CResult_NoneSemanticErrorZ_ok();
8476 return (uint64_t)ret_conv;
8479 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
8480 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8481 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8482 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
8483 return (uint64_t)ret_conv;
8486 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
8487 if ((_res & 1) != 0) return;
8488 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
8490 CResult_NoneSemanticErrorZ_free(_res_conv);
8493 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
8494 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
8495 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8496 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
8497 return (uint64_t)ret_conv;
8500 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
8502 o_conv.inner = (void*)(o & (~1));
8503 o_conv.is_owned = (o & 1) || (o == 0);
8504 o_conv = Invoice_clone(&o_conv);
8505 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8506 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
8507 return (uint64_t)ret_conv;
8510 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
8511 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8512 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8513 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
8514 return (uint64_t)ret_conv;
8517 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
8518 if ((_res & 1) != 0) return;
8519 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
8521 CResult_InvoiceSemanticErrorZ_free(_res_conv);
8524 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
8525 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
8526 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8527 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
8528 return (uint64_t)ret_conv;
8531 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
8532 LDKDescription o_conv;
8533 o_conv.inner = (void*)(o & (~1));
8534 o_conv.is_owned = (o & 1) || (o == 0);
8535 o_conv = Description_clone(&o_conv);
8536 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8537 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
8538 return (uint64_t)ret_conv;
8541 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
8542 LDKCreationError e_conv = LDKCreationError_from_js(e);
8543 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8544 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
8545 return (uint64_t)ret_conv;
8548 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
8549 if ((_res & 1) != 0) return;
8550 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
8552 CResult_DescriptionCreationErrorZ_free(_res_conv);
8555 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
8556 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
8557 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8558 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
8559 return (uint64_t)ret_conv;
8562 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
8563 LDKExpiryTime o_conv;
8564 o_conv.inner = (void*)(o & (~1));
8565 o_conv.is_owned = (o & 1) || (o == 0);
8566 o_conv = ExpiryTime_clone(&o_conv);
8567 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8568 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
8569 return (uint64_t)ret_conv;
8572 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
8573 LDKCreationError e_conv = LDKCreationError_from_js(e);
8574 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8575 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
8576 return (uint64_t)ret_conv;
8579 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
8580 if ((_res & 1) != 0) return;
8581 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
8583 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
8586 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
8587 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
8588 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8589 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
8590 return (uint64_t)ret_conv;
8593 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
8594 LDKPrivateRoute o_conv;
8595 o_conv.inner = (void*)(o & (~1));
8596 o_conv.is_owned = (o & 1) || (o == 0);
8597 o_conv = PrivateRoute_clone(&o_conv);
8598 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8599 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
8600 return (uint64_t)ret_conv;
8603 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
8604 LDKCreationError e_conv = LDKCreationError_from_js(e);
8605 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8606 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
8607 return (uint64_t)ret_conv;
8610 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
8611 if ((_res & 1) != 0) return;
8612 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
8614 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
8617 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
8618 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
8619 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8620 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
8621 return (uint64_t)ret_conv;
8624 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
8625 LDKStr o_conv = str_ref_to_owned_c(o);
8626 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8627 *ret_conv = CResult_StringErrorZ_ok(o_conv);
8628 return (uint64_t)ret_conv;
8631 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
8632 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8633 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8634 *ret_conv = CResult_StringErrorZ_err(e_conv);
8635 return (uint64_t)ret_conv;
8638 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
8639 if ((_res & 1) != 0) return;
8640 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
8642 CResult_StringErrorZ_free(_res_conv);
8645 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
8646 LDKChannelMonitorUpdate o_conv;
8647 o_conv.inner = (void*)(o & (~1));
8648 o_conv.is_owned = (o & 1) || (o == 0);
8649 o_conv = ChannelMonitorUpdate_clone(&o_conv);
8650 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8651 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
8652 return (uint64_t)ret_conv;
8655 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
8656 LDKDecodeError e_conv;
8657 e_conv.inner = (void*)(e & (~1));
8658 e_conv.is_owned = (e & 1) || (e == 0);
8659 e_conv = DecodeError_clone(&e_conv);
8660 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8661 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
8662 return (uint64_t)ret_conv;
8665 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
8666 if ((_res & 1) != 0) return;
8667 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8669 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
8672 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
8673 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
8674 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8675 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
8676 return (uint64_t)ret_conv;
8679 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
8680 LDKHTLCUpdate o_conv;
8681 o_conv.inner = (void*)(o & (~1));
8682 o_conv.is_owned = (o & 1) || (o == 0);
8683 o_conv = HTLCUpdate_clone(&o_conv);
8684 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8685 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
8686 return (uint64_t)ret_conv;
8689 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
8690 LDKDecodeError e_conv;
8691 e_conv.inner = (void*)(e & (~1));
8692 e_conv.is_owned = (e & 1) || (e == 0);
8693 e_conv = DecodeError_clone(&e_conv);
8694 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8695 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
8696 return (uint64_t)ret_conv;
8699 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
8700 if ((_res & 1) != 0) return;
8701 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8703 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
8706 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
8707 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
8708 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8709 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
8710 return (uint64_t)ret_conv;
8713 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
8714 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8715 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
8716 return (uint64_t)ret_conv;
8719 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
8720 LDKMonitorUpdateError e_conv;
8721 e_conv.inner = (void*)(e & (~1));
8722 e_conv.is_owned = (e & 1) || (e == 0);
8723 e_conv = MonitorUpdateError_clone(&e_conv);
8724 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8725 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
8726 return (uint64_t)ret_conv;
8729 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
8730 if ((_res & 1) != 0) return;
8731 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
8733 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
8736 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
8737 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
8738 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8739 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
8740 return (uint64_t)ret_conv;
8743 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
8744 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
8745 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8746 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
8747 return (uint64_t)ret_ref;
8750 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
8752 a_conv.inner = (void*)(a & (~1));
8753 a_conv.is_owned = (a & 1) || (a == 0);
8754 a_conv = OutPoint_clone(&a_conv);
8756 b_ref.datalen = *((uint32_t*)b);
8757 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8758 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8759 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8760 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
8761 return (uint64_t)ret_ref;
8764 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
8765 if ((_res & 1) != 0) return;
8766 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
8768 C2Tuple_OutPointScriptZ_free(_res_conv);
8771 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
8772 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
8773 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8774 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
8775 return (uint64_t)ret_ref;
8778 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
8780 b_ref.datalen = *((uint32_t*)b);
8781 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8782 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8783 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8784 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
8785 return (uint64_t)ret_ref;
8788 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
8789 if ((_res & 1) != 0) return;
8790 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
8792 C2Tuple_u32ScriptZ_free(_res_conv);
8795 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
8796 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
8797 _res_constr.datalen = *((uint32_t*)_res);
8798 if (_res_constr.datalen > 0)
8799 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
8801 _res_constr.data = NULL;
8802 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8803 for (size_t e = 0; e < _res_constr.datalen; e++) {
8804 uint32_t _res_conv_30 = _res_vals[e];
8805 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
8806 FREE((void*)_res_conv_30);
8807 _res_constr.data[e] = _res_conv_30_conv;
8809 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
8812 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
8813 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
8814 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
8815 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
8816 return (uint64_t)ret_ref;
8819 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
8820 LDKThirtyTwoBytes a_ref;
8821 CHECK(*((uint32_t*)a) == 32);
8822 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8823 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
8824 b_constr.datalen = *((uint32_t*)b);
8825 if (b_constr.datalen > 0)
8826 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
8828 b_constr.data = NULL;
8829 uint32_t* b_vals = (uint32_t*)(b + 4);
8830 for (size_t e = 0; e < b_constr.datalen; e++) {
8831 uint32_t b_conv_30 = b_vals[e];
8832 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
8833 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
8834 b_constr.data[e] = b_conv_30_conv;
8836 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
8837 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
8838 return (uint64_t)ret_ref;
8841 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
8842 if ((_res & 1) != 0) return;
8843 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
8845 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
8848 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
8849 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
8850 _res_constr.datalen = *((uint32_t*)_res);
8851 if (_res_constr.datalen > 0)
8852 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
8854 _res_constr.data = NULL;
8855 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8856 for (size_t c = 0; c < _res_constr.datalen; c++) {
8857 uint32_t _res_conv_54 = _res_vals[c];
8858 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
8859 FREE((void*)_res_conv_54);
8860 _res_constr.data[c] = _res_conv_54_conv;
8862 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
8865 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
8866 LDKCVec_EventZ _res_constr;
8867 _res_constr.datalen = *((uint32_t*)_res);
8868 if (_res_constr.datalen > 0)
8869 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
8871 _res_constr.data = NULL;
8872 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8873 for (size_t h = 0; h < _res_constr.datalen; h++) {
8874 uint32_t _res_conv_7 = _res_vals[h];
8875 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
8876 FREE((void*)_res_conv_7);
8877 _res_constr.data[h] = _res_conv_7_conv;
8879 CVec_EventZ_free(_res_constr);
8882 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
8883 LDKCVec_TransactionZ _res_constr;
8884 _res_constr.datalen = *((uint32_t*)_res);
8885 if (_res_constr.datalen > 0)
8886 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8888 _res_constr.data = NULL;
8889 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8890 for (size_t m = 0; m < _res_constr.datalen; m++) {
8891 int8_tArray _res_conv_12 = _res_vals[m];
8892 LDKTransaction _res_conv_12_ref;
8893 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8894 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
8895 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8896 _res_conv_12_ref.data_is_owned = true;
8897 _res_constr.data[m] = _res_conv_12_ref;
8899 CVec_TransactionZ_free(_res_constr);
8902 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
8903 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
8904 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8905 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
8906 return (uint64_t)ret_ref;
8909 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
8910 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
8911 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8912 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
8913 return (uint64_t)ret_ref;
8916 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
8917 if ((_res & 1) != 0) return;
8918 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
8920 C2Tuple_u32TxOutZ_free(_res_conv);
8923 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
8924 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
8925 _res_constr.datalen = *((uint32_t*)_res);
8926 if (_res_constr.datalen > 0)
8927 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8929 _res_constr.data = NULL;
8930 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8931 for (size_t z = 0; z < _res_constr.datalen; z++) {
8932 uint32_t _res_conv_25 = _res_vals[z];
8933 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
8934 FREE((void*)_res_conv_25);
8935 _res_constr.data[z] = _res_conv_25_conv;
8937 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
8940 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
8941 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
8942 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8943 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
8944 return (uint64_t)ret_ref;
8947 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
8948 LDKThirtyTwoBytes a_ref;
8949 CHECK(*((uint32_t*)a) == 32);
8950 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8951 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
8952 b_constr.datalen = *((uint32_t*)b);
8953 if (b_constr.datalen > 0)
8954 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8956 b_constr.data = NULL;
8957 uint32_t* b_vals = (uint32_t*)(b + 4);
8958 for (size_t z = 0; z < b_constr.datalen; z++) {
8959 uint32_t b_conv_25 = b_vals[z];
8960 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
8961 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
8962 b_constr.data[z] = b_conv_25_conv;
8964 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8965 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
8966 return (uint64_t)ret_ref;
8969 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
8970 if ((_res & 1) != 0) return;
8971 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
8973 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
8976 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
8977 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
8978 _res_constr.datalen = *((uint32_t*)_res);
8979 if (_res_constr.datalen > 0)
8980 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
8982 _res_constr.data = NULL;
8983 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8984 for (size_t x = 0; x < _res_constr.datalen; x++) {
8985 uint32_t _res_conv_49 = _res_vals[x];
8986 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
8987 FREE((void*)_res_conv_49);
8988 _res_constr.data[x] = _res_conv_49_conv;
8990 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
8993 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
8994 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
8995 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8996 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
8997 return (uint64_t)ret_conv;
9000 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
9001 LDKDecodeError e_conv;
9002 e_conv.inner = (void*)(e & (~1));
9003 e_conv.is_owned = (e & 1) || (e == 0);
9004 e_conv = DecodeError_clone(&e_conv);
9005 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9006 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
9007 return (uint64_t)ret_conv;
9010 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
9011 if ((_res & 1) != 0) return;
9012 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9014 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
9017 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
9018 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9019 *ret_conv = CResult_boolLightningErrorZ_ok(o);
9020 return (uint64_t)ret_conv;
9023 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
9024 LDKLightningError e_conv;
9025 e_conv.inner = (void*)(e & (~1));
9026 e_conv.is_owned = (e & 1) || (e == 0);
9027 e_conv = LightningError_clone(&e_conv);
9028 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9029 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
9030 return (uint64_t)ret_conv;
9033 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
9034 if ((_res & 1) != 0) return;
9035 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
9037 CResult_boolLightningErrorZ_free(_res_conv);
9040 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
9041 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
9042 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9043 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
9044 return (uint64_t)ret_conv;
9047 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
9048 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
9049 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9050 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
9051 return (uint64_t)ret_ref;
9054 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
9055 LDKChannelAnnouncement a_conv;
9056 a_conv.inner = (void*)(a & (~1));
9057 a_conv.is_owned = (a & 1) || (a == 0);
9058 a_conv = ChannelAnnouncement_clone(&a_conv);
9059 LDKChannelUpdate b_conv;
9060 b_conv.inner = (void*)(b & (~1));
9061 b_conv.is_owned = (b & 1) || (b == 0);
9062 b_conv = ChannelUpdate_clone(&b_conv);
9063 LDKChannelUpdate c_conv;
9064 c_conv.inner = (void*)(c & (~1));
9065 c_conv.is_owned = (c & 1) || (c == 0);
9066 c_conv = ChannelUpdate_clone(&c_conv);
9067 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9068 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
9069 return (uint64_t)ret_ref;
9072 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
9073 if ((_res & 1) != 0) return;
9074 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
9076 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
9079 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
9080 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
9081 _res_constr.datalen = *((uint32_t*)_res);
9082 if (_res_constr.datalen > 0)
9083 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9085 _res_constr.data = NULL;
9086 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9087 for (size_t l = 0; l < _res_constr.datalen; l++) {
9088 uint32_t _res_conv_63 = _res_vals[l];
9089 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
9090 FREE((void*)_res_conv_63);
9091 _res_constr.data[l] = _res_conv_63_conv;
9093 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
9096 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
9097 LDKCVec_NodeAnnouncementZ _res_constr;
9098 _res_constr.datalen = *((uint32_t*)_res);
9099 if (_res_constr.datalen > 0)
9100 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9102 _res_constr.data = NULL;
9103 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9104 for (size_t s = 0; s < _res_constr.datalen; s++) {
9105 uint32_t _res_conv_18 = _res_vals[s];
9106 LDKNodeAnnouncement _res_conv_18_conv;
9107 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
9108 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
9109 _res_constr.data[s] = _res_conv_18_conv;
9111 CVec_NodeAnnouncementZ_free(_res_constr);
9114 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
9115 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9116 *ret_conv = CResult_NoneLightningErrorZ_ok();
9117 return (uint64_t)ret_conv;
9120 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
9121 LDKLightningError e_conv;
9122 e_conv.inner = (void*)(e & (~1));
9123 e_conv.is_owned = (e & 1) || (e == 0);
9124 e_conv = LightningError_clone(&e_conv);
9125 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9126 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
9127 return (uint64_t)ret_conv;
9130 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
9131 if ((_res & 1) != 0) return;
9132 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
9134 CResult_NoneLightningErrorZ_free(_res_conv);
9137 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
9138 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
9139 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9140 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
9141 return (uint64_t)ret_conv;
9144 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
9145 LDKCVec_PublicKeyZ _res_constr;
9146 _res_constr.datalen = *((uint32_t*)_res);
9147 if (_res_constr.datalen > 0)
9148 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9150 _res_constr.data = NULL;
9151 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9152 for (size_t m = 0; m < _res_constr.datalen; m++) {
9153 int8_tArray _res_conv_12 = _res_vals[m];
9154 LDKPublicKey _res_conv_12_ref;
9155 CHECK(*((uint32_t*)_res_conv_12) == 33);
9156 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
9157 _res_constr.data[m] = _res_conv_12_ref;
9159 CVec_PublicKeyZ_free(_res_constr);
9162 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
9164 o_ref.datalen = *((uint32_t*)o);
9165 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
9166 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9167 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9168 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
9169 return (uint64_t)ret_conv;
9172 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
9173 LDKPeerHandleError e_conv;
9174 e_conv.inner = (void*)(e & (~1));
9175 e_conv.is_owned = (e & 1) || (e == 0);
9176 e_conv = PeerHandleError_clone(&e_conv);
9177 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9178 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
9179 return (uint64_t)ret_conv;
9182 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
9183 if ((_res & 1) != 0) return;
9184 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9186 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
9189 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
9190 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
9191 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9192 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
9193 return (uint64_t)ret_conv;
9196 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
9197 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9198 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
9199 return (uint64_t)ret_conv;
9202 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
9203 LDKPeerHandleError e_conv;
9204 e_conv.inner = (void*)(e & (~1));
9205 e_conv.is_owned = (e & 1) || (e == 0);
9206 e_conv = PeerHandleError_clone(&e_conv);
9207 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9208 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
9209 return (uint64_t)ret_conv;
9212 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
9213 if ((_res & 1) != 0) return;
9214 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9216 CResult_NonePeerHandleErrorZ_free(_res_conv);
9219 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
9220 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
9221 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9222 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
9223 return (uint64_t)ret_conv;
9226 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
9227 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9228 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
9229 return (uint64_t)ret_conv;
9232 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
9233 LDKPeerHandleError e_conv;
9234 e_conv.inner = (void*)(e & (~1));
9235 e_conv.is_owned = (e & 1) || (e == 0);
9236 e_conv = PeerHandleError_clone(&e_conv);
9237 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9238 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
9239 return (uint64_t)ret_conv;
9242 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
9243 if ((_res & 1) != 0) return;
9244 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9246 CResult_boolPeerHandleErrorZ_free(_res_conv);
9249 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
9250 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
9251 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9252 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
9253 return (uint64_t)ret_conv;
9256 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
9257 LDKDirectionalChannelInfo o_conv;
9258 o_conv.inner = (void*)(o & (~1));
9259 o_conv.is_owned = (o & 1) || (o == 0);
9260 o_conv = DirectionalChannelInfo_clone(&o_conv);
9261 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9262 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
9263 return (uint64_t)ret_conv;
9266 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
9267 LDKDecodeError e_conv;
9268 e_conv.inner = (void*)(e & (~1));
9269 e_conv.is_owned = (e & 1) || (e == 0);
9270 e_conv = DecodeError_clone(&e_conv);
9271 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9272 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
9273 return (uint64_t)ret_conv;
9276 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
9277 if ((_res & 1) != 0) return;
9278 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9280 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
9283 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9284 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
9285 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9286 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
9287 return (uint64_t)ret_conv;
9290 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
9291 LDKChannelInfo o_conv;
9292 o_conv.inner = (void*)(o & (~1));
9293 o_conv.is_owned = (o & 1) || (o == 0);
9294 o_conv = ChannelInfo_clone(&o_conv);
9295 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9296 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
9297 return (uint64_t)ret_conv;
9300 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
9301 LDKDecodeError e_conv;
9302 e_conv.inner = (void*)(e & (~1));
9303 e_conv.is_owned = (e & 1) || (e == 0);
9304 e_conv = DecodeError_clone(&e_conv);
9305 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9306 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
9307 return (uint64_t)ret_conv;
9310 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
9311 if ((_res & 1) != 0) return;
9312 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9314 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
9317 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9318 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
9319 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9320 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
9321 return (uint64_t)ret_conv;
9324 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
9325 LDKRoutingFees o_conv;
9326 o_conv.inner = (void*)(o & (~1));
9327 o_conv.is_owned = (o & 1) || (o == 0);
9328 o_conv = RoutingFees_clone(&o_conv);
9329 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9330 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
9331 return (uint64_t)ret_conv;
9334 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
9335 LDKDecodeError e_conv;
9336 e_conv.inner = (void*)(e & (~1));
9337 e_conv.is_owned = (e & 1) || (e == 0);
9338 e_conv = DecodeError_clone(&e_conv);
9339 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9340 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
9341 return (uint64_t)ret_conv;
9344 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
9345 if ((_res & 1) != 0) return;
9346 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9348 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
9351 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
9352 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
9353 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9354 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
9355 return (uint64_t)ret_conv;
9358 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
9359 LDKNodeAnnouncementInfo o_conv;
9360 o_conv.inner = (void*)(o & (~1));
9361 o_conv.is_owned = (o & 1) || (o == 0);
9362 o_conv = NodeAnnouncementInfo_clone(&o_conv);
9363 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9364 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
9365 return (uint64_t)ret_conv;
9368 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
9369 LDKDecodeError e_conv;
9370 e_conv.inner = (void*)(e & (~1));
9371 e_conv.is_owned = (e & 1) || (e == 0);
9372 e_conv = DecodeError_clone(&e_conv);
9373 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9374 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
9375 return (uint64_t)ret_conv;
9378 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
9379 if ((_res & 1) != 0) return;
9380 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9382 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
9385 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
9386 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
9387 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9388 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
9389 return (uint64_t)ret_conv;
9392 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
9393 LDKCVec_u64Z _res_constr;
9394 _res_constr.datalen = *((uint32_t*)_res);
9395 if (_res_constr.datalen > 0)
9396 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
9398 _res_constr.data = NULL;
9399 int64_t* _res_vals = (int64_t*)(_res + 4);
9400 for (size_t i = 0; i < _res_constr.datalen; i++) {
9401 int64_t _res_conv_8 = _res_vals[i];
9402 _res_constr.data[i] = _res_conv_8;
9404 CVec_u64Z_free(_res_constr);
9407 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
9409 o_conv.inner = (void*)(o & (~1));
9410 o_conv.is_owned = (o & 1) || (o == 0);
9411 o_conv = NodeInfo_clone(&o_conv);
9412 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9413 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
9414 return (uint64_t)ret_conv;
9417 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
9418 LDKDecodeError e_conv;
9419 e_conv.inner = (void*)(e & (~1));
9420 e_conv.is_owned = (e & 1) || (e == 0);
9421 e_conv = DecodeError_clone(&e_conv);
9422 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9423 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
9424 return (uint64_t)ret_conv;
9427 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
9428 if ((_res & 1) != 0) return;
9429 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9431 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
9434 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
9435 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
9436 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9437 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
9438 return (uint64_t)ret_conv;
9441 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
9442 LDKNetworkGraph o_conv;
9443 o_conv.inner = (void*)(o & (~1));
9444 o_conv.is_owned = (o & 1) || (o == 0);
9445 o_conv = NetworkGraph_clone(&o_conv);
9446 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9447 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
9448 return (uint64_t)ret_conv;
9451 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
9452 LDKDecodeError e_conv;
9453 e_conv.inner = (void*)(e & (~1));
9454 e_conv.is_owned = (e & 1) || (e == 0);
9455 e_conv = DecodeError_clone(&e_conv);
9456 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9457 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
9458 return (uint64_t)ret_conv;
9461 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
9462 if ((_res & 1) != 0) return;
9463 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
9465 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
9468 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
9469 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
9470 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9471 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
9472 return (uint64_t)ret_conv;
9475 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
9476 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9477 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9478 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
9479 return (uint64_t)ret_conv;
9482 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
9483 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9484 *ret_conv = CResult_NetAddressu8Z_err(e);
9485 return (uint64_t)ret_conv;
9488 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
9489 if ((_res & 1) != 0) return;
9490 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
9492 CResult_NetAddressu8Z_free(_res_conv);
9495 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
9496 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
9497 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9498 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
9499 return (uint64_t)ret_conv;
9502 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
9503 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
9504 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9505 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
9506 return (uint64_t)ret_conv;
9509 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
9510 LDKDecodeError e_conv;
9511 e_conv.inner = (void*)(e & (~1));
9512 e_conv.is_owned = (e & 1) || (e == 0);
9513 e_conv = DecodeError_clone(&e_conv);
9514 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9515 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
9516 return (uint64_t)ret_conv;
9519 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
9520 if ((_res & 1) != 0) return;
9521 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9523 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
9526 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
9527 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
9528 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9529 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
9530 return (uint64_t)ret_conv;
9533 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
9534 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9535 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9536 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
9537 return (uint64_t)ret_conv;
9540 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
9541 LDKDecodeError e_conv;
9542 e_conv.inner = (void*)(e & (~1));
9543 e_conv.is_owned = (e & 1) || (e == 0);
9544 e_conv = DecodeError_clone(&e_conv);
9545 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9546 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
9547 return (uint64_t)ret_conv;
9550 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
9551 if ((_res & 1) != 0) return;
9552 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
9554 CResult_NetAddressDecodeErrorZ_free(_res_conv);
9557 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
9558 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
9559 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9560 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
9561 return (uint64_t)ret_conv;
9564 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
9565 LDKCVec_UpdateAddHTLCZ _res_constr;
9566 _res_constr.datalen = *((uint32_t*)_res);
9567 if (_res_constr.datalen > 0)
9568 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
9570 _res_constr.data = NULL;
9571 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9572 for (size_t p = 0; p < _res_constr.datalen; p++) {
9573 uint32_t _res_conv_15 = _res_vals[p];
9574 LDKUpdateAddHTLC _res_conv_15_conv;
9575 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
9576 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
9577 _res_constr.data[p] = _res_conv_15_conv;
9579 CVec_UpdateAddHTLCZ_free(_res_constr);
9582 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
9583 LDKCVec_UpdateFulfillHTLCZ _res_constr;
9584 _res_constr.datalen = *((uint32_t*)_res);
9585 if (_res_constr.datalen > 0)
9586 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
9588 _res_constr.data = NULL;
9589 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9590 for (size_t t = 0; t < _res_constr.datalen; t++) {
9591 uint32_t _res_conv_19 = _res_vals[t];
9592 LDKUpdateFulfillHTLC _res_conv_19_conv;
9593 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
9594 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
9595 _res_constr.data[t] = _res_conv_19_conv;
9597 CVec_UpdateFulfillHTLCZ_free(_res_constr);
9600 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
9601 LDKCVec_UpdateFailHTLCZ _res_constr;
9602 _res_constr.datalen = *((uint32_t*)_res);
9603 if (_res_constr.datalen > 0)
9604 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
9606 _res_constr.data = NULL;
9607 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9608 for (size_t q = 0; q < _res_constr.datalen; q++) {
9609 uint32_t _res_conv_16 = _res_vals[q];
9610 LDKUpdateFailHTLC _res_conv_16_conv;
9611 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9612 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9613 _res_constr.data[q] = _res_conv_16_conv;
9615 CVec_UpdateFailHTLCZ_free(_res_constr);
9618 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
9619 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
9620 _res_constr.datalen = *((uint32_t*)_res);
9621 if (_res_constr.datalen > 0)
9622 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
9624 _res_constr.data = NULL;
9625 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9626 for (size_t z = 0; z < _res_constr.datalen; z++) {
9627 uint32_t _res_conv_25 = _res_vals[z];
9628 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
9629 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
9630 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
9631 _res_constr.data[z] = _res_conv_25_conv;
9633 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
9636 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
9637 LDKAcceptChannel o_conv;
9638 o_conv.inner = (void*)(o & (~1));
9639 o_conv.is_owned = (o & 1) || (o == 0);
9640 o_conv = AcceptChannel_clone(&o_conv);
9641 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9642 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
9643 return (uint64_t)ret_conv;
9646 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
9647 LDKDecodeError e_conv;
9648 e_conv.inner = (void*)(e & (~1));
9649 e_conv.is_owned = (e & 1) || (e == 0);
9650 e_conv = DecodeError_clone(&e_conv);
9651 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9652 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
9653 return (uint64_t)ret_conv;
9656 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
9657 if ((_res & 1) != 0) return;
9658 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9660 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
9663 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
9664 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
9665 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9666 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
9667 return (uint64_t)ret_conv;
9670 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
9671 LDKAnnouncementSignatures o_conv;
9672 o_conv.inner = (void*)(o & (~1));
9673 o_conv.is_owned = (o & 1) || (o == 0);
9674 o_conv = AnnouncementSignatures_clone(&o_conv);
9675 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9676 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
9677 return (uint64_t)ret_conv;
9680 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
9681 LDKDecodeError e_conv;
9682 e_conv.inner = (void*)(e & (~1));
9683 e_conv.is_owned = (e & 1) || (e == 0);
9684 e_conv = DecodeError_clone(&e_conv);
9685 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9686 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
9687 return (uint64_t)ret_conv;
9690 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
9691 if ((_res & 1) != 0) return;
9692 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9694 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
9697 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
9698 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
9699 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9700 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
9701 return (uint64_t)ret_conv;
9704 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
9705 LDKChannelReestablish o_conv;
9706 o_conv.inner = (void*)(o & (~1));
9707 o_conv.is_owned = (o & 1) || (o == 0);
9708 o_conv = ChannelReestablish_clone(&o_conv);
9709 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9710 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
9711 return (uint64_t)ret_conv;
9714 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
9715 LDKDecodeError e_conv;
9716 e_conv.inner = (void*)(e & (~1));
9717 e_conv.is_owned = (e & 1) || (e == 0);
9718 e_conv = DecodeError_clone(&e_conv);
9719 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9720 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
9721 return (uint64_t)ret_conv;
9724 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
9725 if ((_res & 1) != 0) return;
9726 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
9728 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
9731 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
9732 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
9733 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9734 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
9735 return (uint64_t)ret_conv;
9738 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
9739 LDKClosingSigned o_conv;
9740 o_conv.inner = (void*)(o & (~1));
9741 o_conv.is_owned = (o & 1) || (o == 0);
9742 o_conv = ClosingSigned_clone(&o_conv);
9743 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9744 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
9745 return (uint64_t)ret_conv;
9748 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
9749 LDKDecodeError e_conv;
9750 e_conv.inner = (void*)(e & (~1));
9751 e_conv.is_owned = (e & 1) || (e == 0);
9752 e_conv = DecodeError_clone(&e_conv);
9753 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9754 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
9755 return (uint64_t)ret_conv;
9758 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
9759 if ((_res & 1) != 0) return;
9760 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9762 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
9765 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
9766 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
9767 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9768 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
9769 return (uint64_t)ret_conv;
9772 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
9773 LDKCommitmentSigned o_conv;
9774 o_conv.inner = (void*)(o & (~1));
9775 o_conv.is_owned = (o & 1) || (o == 0);
9776 o_conv = CommitmentSigned_clone(&o_conv);
9777 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9778 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
9779 return (uint64_t)ret_conv;
9782 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
9783 LDKDecodeError e_conv;
9784 e_conv.inner = (void*)(e & (~1));
9785 e_conv.is_owned = (e & 1) || (e == 0);
9786 e_conv = DecodeError_clone(&e_conv);
9787 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9788 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
9789 return (uint64_t)ret_conv;
9792 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
9793 if ((_res & 1) != 0) return;
9794 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9796 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
9799 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
9800 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
9801 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9802 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
9803 return (uint64_t)ret_conv;
9806 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
9807 LDKFundingCreated o_conv;
9808 o_conv.inner = (void*)(o & (~1));
9809 o_conv.is_owned = (o & 1) || (o == 0);
9810 o_conv = FundingCreated_clone(&o_conv);
9811 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9812 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
9813 return (uint64_t)ret_conv;
9816 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
9817 LDKDecodeError e_conv;
9818 e_conv.inner = (void*)(e & (~1));
9819 e_conv.is_owned = (e & 1) || (e == 0);
9820 e_conv = DecodeError_clone(&e_conv);
9821 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9822 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
9823 return (uint64_t)ret_conv;
9826 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
9827 if ((_res & 1) != 0) return;
9828 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9830 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
9833 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
9834 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
9835 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9836 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
9837 return (uint64_t)ret_conv;
9840 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
9841 LDKFundingSigned o_conv;
9842 o_conv.inner = (void*)(o & (~1));
9843 o_conv.is_owned = (o & 1) || (o == 0);
9844 o_conv = FundingSigned_clone(&o_conv);
9845 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9846 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
9847 return (uint64_t)ret_conv;
9850 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
9851 LDKDecodeError e_conv;
9852 e_conv.inner = (void*)(e & (~1));
9853 e_conv.is_owned = (e & 1) || (e == 0);
9854 e_conv = DecodeError_clone(&e_conv);
9855 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9856 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
9857 return (uint64_t)ret_conv;
9860 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
9861 if ((_res & 1) != 0) return;
9862 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9864 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
9867 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
9868 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
9869 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9870 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
9871 return (uint64_t)ret_conv;
9874 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
9875 LDKFundingLocked o_conv;
9876 o_conv.inner = (void*)(o & (~1));
9877 o_conv.is_owned = (o & 1) || (o == 0);
9878 o_conv = FundingLocked_clone(&o_conv);
9879 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9880 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
9881 return (uint64_t)ret_conv;
9884 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
9885 LDKDecodeError e_conv;
9886 e_conv.inner = (void*)(e & (~1));
9887 e_conv.is_owned = (e & 1) || (e == 0);
9888 e_conv = DecodeError_clone(&e_conv);
9889 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9890 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
9891 return (uint64_t)ret_conv;
9894 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
9895 if ((_res & 1) != 0) return;
9896 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9898 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
9901 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
9902 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
9903 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9904 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
9905 return (uint64_t)ret_conv;
9908 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
9910 o_conv.inner = (void*)(o & (~1));
9911 o_conv.is_owned = (o & 1) || (o == 0);
9912 o_conv = Init_clone(&o_conv);
9913 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9914 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
9915 return (uint64_t)ret_conv;
9918 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
9919 LDKDecodeError e_conv;
9920 e_conv.inner = (void*)(e & (~1));
9921 e_conv.is_owned = (e & 1) || (e == 0);
9922 e_conv = DecodeError_clone(&e_conv);
9923 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9924 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
9925 return (uint64_t)ret_conv;
9928 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
9929 if ((_res & 1) != 0) return;
9930 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
9932 CResult_InitDecodeErrorZ_free(_res_conv);
9935 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
9936 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
9937 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9938 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
9939 return (uint64_t)ret_conv;
9942 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
9943 LDKOpenChannel o_conv;
9944 o_conv.inner = (void*)(o & (~1));
9945 o_conv.is_owned = (o & 1) || (o == 0);
9946 o_conv = OpenChannel_clone(&o_conv);
9947 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9948 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
9949 return (uint64_t)ret_conv;
9952 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
9953 LDKDecodeError e_conv;
9954 e_conv.inner = (void*)(e & (~1));
9955 e_conv.is_owned = (e & 1) || (e == 0);
9956 e_conv = DecodeError_clone(&e_conv);
9957 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9958 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
9959 return (uint64_t)ret_conv;
9962 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
9963 if ((_res & 1) != 0) return;
9964 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9966 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
9969 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
9970 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
9971 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9972 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
9973 return (uint64_t)ret_conv;
9976 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
9977 LDKRevokeAndACK o_conv;
9978 o_conv.inner = (void*)(o & (~1));
9979 o_conv.is_owned = (o & 1) || (o == 0);
9980 o_conv = RevokeAndACK_clone(&o_conv);
9981 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9982 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
9983 return (uint64_t)ret_conv;
9986 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
9987 LDKDecodeError e_conv;
9988 e_conv.inner = (void*)(e & (~1));
9989 e_conv.is_owned = (e & 1) || (e == 0);
9990 e_conv = DecodeError_clone(&e_conv);
9991 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9992 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
9993 return (uint64_t)ret_conv;
9996 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
9997 if ((_res & 1) != 0) return;
9998 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
10000 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
10003 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
10004 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
10005 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10006 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
10007 return (uint64_t)ret_conv;
10010 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
10011 LDKShutdown o_conv;
10012 o_conv.inner = (void*)(o & (~1));
10013 o_conv.is_owned = (o & 1) || (o == 0);
10014 o_conv = Shutdown_clone(&o_conv);
10015 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10016 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
10017 return (uint64_t)ret_conv;
10020 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
10021 LDKDecodeError e_conv;
10022 e_conv.inner = (void*)(e & (~1));
10023 e_conv.is_owned = (e & 1) || (e == 0);
10024 e_conv = DecodeError_clone(&e_conv);
10025 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10026 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
10027 return (uint64_t)ret_conv;
10030 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
10031 if ((_res & 1) != 0) return;
10032 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
10034 CResult_ShutdownDecodeErrorZ_free(_res_conv);
10037 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
10038 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
10039 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10040 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
10041 return (uint64_t)ret_conv;
10044 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
10045 LDKUpdateFailHTLC o_conv;
10046 o_conv.inner = (void*)(o & (~1));
10047 o_conv.is_owned = (o & 1) || (o == 0);
10048 o_conv = UpdateFailHTLC_clone(&o_conv);
10049 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10050 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
10051 return (uint64_t)ret_conv;
10054 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
10055 LDKDecodeError e_conv;
10056 e_conv.inner = (void*)(e & (~1));
10057 e_conv.is_owned = (e & 1) || (e == 0);
10058 e_conv = DecodeError_clone(&e_conv);
10059 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10060 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
10061 return (uint64_t)ret_conv;
10064 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
10065 if ((_res & 1) != 0) return;
10066 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10068 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
10071 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
10072 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
10073 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10074 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
10075 return (uint64_t)ret_conv;
10078 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
10079 LDKUpdateFailMalformedHTLC o_conv;
10080 o_conv.inner = (void*)(o & (~1));
10081 o_conv.is_owned = (o & 1) || (o == 0);
10082 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
10083 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10084 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
10085 return (uint64_t)ret_conv;
10088 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
10089 LDKDecodeError e_conv;
10090 e_conv.inner = (void*)(e & (~1));
10091 e_conv.is_owned = (e & 1) || (e == 0);
10092 e_conv = DecodeError_clone(&e_conv);
10093 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10094 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
10095 return (uint64_t)ret_conv;
10098 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
10099 if ((_res & 1) != 0) return;
10100 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10102 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
10105 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
10106 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
10107 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10108 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
10109 return (uint64_t)ret_conv;
10112 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
10113 LDKUpdateFee o_conv;
10114 o_conv.inner = (void*)(o & (~1));
10115 o_conv.is_owned = (o & 1) || (o == 0);
10116 o_conv = UpdateFee_clone(&o_conv);
10117 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10118 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
10119 return (uint64_t)ret_conv;
10122 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
10123 LDKDecodeError e_conv;
10124 e_conv.inner = (void*)(e & (~1));
10125 e_conv.is_owned = (e & 1) || (e == 0);
10126 e_conv = DecodeError_clone(&e_conv);
10127 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10128 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
10129 return (uint64_t)ret_conv;
10132 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
10133 if ((_res & 1) != 0) return;
10134 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10136 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
10139 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
10140 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
10141 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10142 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
10143 return (uint64_t)ret_conv;
10146 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
10147 LDKUpdateFulfillHTLC o_conv;
10148 o_conv.inner = (void*)(o & (~1));
10149 o_conv.is_owned = (o & 1) || (o == 0);
10150 o_conv = UpdateFulfillHTLC_clone(&o_conv);
10151 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10152 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
10153 return (uint64_t)ret_conv;
10156 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
10157 LDKDecodeError e_conv;
10158 e_conv.inner = (void*)(e & (~1));
10159 e_conv.is_owned = (e & 1) || (e == 0);
10160 e_conv = DecodeError_clone(&e_conv);
10161 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10162 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
10163 return (uint64_t)ret_conv;
10166 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
10167 if ((_res & 1) != 0) return;
10168 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10170 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
10173 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
10174 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
10175 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10176 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
10177 return (uint64_t)ret_conv;
10180 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
10181 LDKUpdateAddHTLC o_conv;
10182 o_conv.inner = (void*)(o & (~1));
10183 o_conv.is_owned = (o & 1) || (o == 0);
10184 o_conv = UpdateAddHTLC_clone(&o_conv);
10185 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10186 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
10187 return (uint64_t)ret_conv;
10190 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
10191 LDKDecodeError e_conv;
10192 e_conv.inner = (void*)(e & (~1));
10193 e_conv.is_owned = (e & 1) || (e == 0);
10194 e_conv = DecodeError_clone(&e_conv);
10195 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10196 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
10197 return (uint64_t)ret_conv;
10200 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
10201 if ((_res & 1) != 0) return;
10202 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10204 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
10207 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
10208 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
10209 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10210 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
10211 return (uint64_t)ret_conv;
10214 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
10216 o_conv.inner = (void*)(o & (~1));
10217 o_conv.is_owned = (o & 1) || (o == 0);
10218 o_conv = Ping_clone(&o_conv);
10219 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10220 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
10221 return (uint64_t)ret_conv;
10224 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
10225 LDKDecodeError e_conv;
10226 e_conv.inner = (void*)(e & (~1));
10227 e_conv.is_owned = (e & 1) || (e == 0);
10228 e_conv = DecodeError_clone(&e_conv);
10229 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10230 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
10231 return (uint64_t)ret_conv;
10234 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
10235 if ((_res & 1) != 0) return;
10236 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
10238 CResult_PingDecodeErrorZ_free(_res_conv);
10241 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
10242 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
10243 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10244 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
10245 return (uint64_t)ret_conv;
10248 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
10250 o_conv.inner = (void*)(o & (~1));
10251 o_conv.is_owned = (o & 1) || (o == 0);
10252 o_conv = Pong_clone(&o_conv);
10253 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10254 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
10255 return (uint64_t)ret_conv;
10258 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
10259 LDKDecodeError e_conv;
10260 e_conv.inner = (void*)(e & (~1));
10261 e_conv.is_owned = (e & 1) || (e == 0);
10262 e_conv = DecodeError_clone(&e_conv);
10263 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10264 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
10265 return (uint64_t)ret_conv;
10268 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
10269 if ((_res & 1) != 0) return;
10270 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
10272 CResult_PongDecodeErrorZ_free(_res_conv);
10275 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
10276 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
10277 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10278 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
10279 return (uint64_t)ret_conv;
10282 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10283 LDKUnsignedChannelAnnouncement o_conv;
10284 o_conv.inner = (void*)(o & (~1));
10285 o_conv.is_owned = (o & 1) || (o == 0);
10286 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
10287 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10288 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
10289 return (uint64_t)ret_conv;
10292 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10293 LDKDecodeError e_conv;
10294 e_conv.inner = (void*)(e & (~1));
10295 e_conv.is_owned = (e & 1) || (e == 0);
10296 e_conv = DecodeError_clone(&e_conv);
10297 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10298 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
10299 return (uint64_t)ret_conv;
10302 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10303 if ((_res & 1) != 0) return;
10304 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10306 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
10309 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10310 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10311 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10312 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10313 return (uint64_t)ret_conv;
10316 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10317 LDKChannelAnnouncement o_conv;
10318 o_conv.inner = (void*)(o & (~1));
10319 o_conv.is_owned = (o & 1) || (o == 0);
10320 o_conv = ChannelAnnouncement_clone(&o_conv);
10321 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10322 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
10323 return (uint64_t)ret_conv;
10326 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10327 LDKDecodeError e_conv;
10328 e_conv.inner = (void*)(e & (~1));
10329 e_conv.is_owned = (e & 1) || (e == 0);
10330 e_conv = DecodeError_clone(&e_conv);
10331 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10332 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
10333 return (uint64_t)ret_conv;
10336 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10337 if ((_res & 1) != 0) return;
10338 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10340 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
10343 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10344 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10345 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10346 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10347 return (uint64_t)ret_conv;
10350 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10351 LDKUnsignedChannelUpdate o_conv;
10352 o_conv.inner = (void*)(o & (~1));
10353 o_conv.is_owned = (o & 1) || (o == 0);
10354 o_conv = UnsignedChannelUpdate_clone(&o_conv);
10355 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10356 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
10357 return (uint64_t)ret_conv;
10360 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
10361 LDKDecodeError e_conv;
10362 e_conv.inner = (void*)(e & (~1));
10363 e_conv.is_owned = (e & 1) || (e == 0);
10364 e_conv = DecodeError_clone(&e_conv);
10365 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10366 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
10367 return (uint64_t)ret_conv;
10370 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10371 if ((_res & 1) != 0) return;
10372 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10374 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
10377 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10378 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
10379 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10380 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
10381 return (uint64_t)ret_conv;
10384 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10385 LDKChannelUpdate o_conv;
10386 o_conv.inner = (void*)(o & (~1));
10387 o_conv.is_owned = (o & 1) || (o == 0);
10388 o_conv = ChannelUpdate_clone(&o_conv);
10389 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10390 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
10391 return (uint64_t)ret_conv;
10394 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
10395 LDKDecodeError e_conv;
10396 e_conv.inner = (void*)(e & (~1));
10397 e_conv.is_owned = (e & 1) || (e == 0);
10398 e_conv = DecodeError_clone(&e_conv);
10399 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10400 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
10401 return (uint64_t)ret_conv;
10404 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10405 if ((_res & 1) != 0) return;
10406 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10408 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
10411 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10412 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
10413 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10414 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
10415 return (uint64_t)ret_conv;
10418 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
10419 LDKErrorMessage o_conv;
10420 o_conv.inner = (void*)(o & (~1));
10421 o_conv.is_owned = (o & 1) || (o == 0);
10422 o_conv = ErrorMessage_clone(&o_conv);
10423 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10424 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
10425 return (uint64_t)ret_conv;
10428 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
10429 LDKDecodeError e_conv;
10430 e_conv.inner = (void*)(e & (~1));
10431 e_conv.is_owned = (e & 1) || (e == 0);
10432 e_conv = DecodeError_clone(&e_conv);
10433 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10434 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
10435 return (uint64_t)ret_conv;
10438 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
10439 if ((_res & 1) != 0) return;
10440 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
10442 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
10445 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
10446 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
10447 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10448 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
10449 return (uint64_t)ret_conv;
10452 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10453 LDKUnsignedNodeAnnouncement o_conv;
10454 o_conv.inner = (void*)(o & (~1));
10455 o_conv.is_owned = (o & 1) || (o == 0);
10456 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
10457 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10458 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
10459 return (uint64_t)ret_conv;
10462 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10463 LDKDecodeError e_conv;
10464 e_conv.inner = (void*)(e & (~1));
10465 e_conv.is_owned = (e & 1) || (e == 0);
10466 e_conv = DecodeError_clone(&e_conv);
10467 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10468 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
10469 return (uint64_t)ret_conv;
10472 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10473 if ((_res & 1) != 0) return;
10474 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10476 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
10479 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10480 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
10481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10482 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
10483 return (uint64_t)ret_conv;
10486 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10487 LDKNodeAnnouncement o_conv;
10488 o_conv.inner = (void*)(o & (~1));
10489 o_conv.is_owned = (o & 1) || (o == 0);
10490 o_conv = NodeAnnouncement_clone(&o_conv);
10491 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10492 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
10493 return (uint64_t)ret_conv;
10496 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10497 LDKDecodeError e_conv;
10498 e_conv.inner = (void*)(e & (~1));
10499 e_conv.is_owned = (e & 1) || (e == 0);
10500 e_conv = DecodeError_clone(&e_conv);
10501 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10502 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
10503 return (uint64_t)ret_conv;
10506 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10507 if ((_res & 1) != 0) return;
10508 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10510 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
10513 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10514 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
10515 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10516 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
10517 return (uint64_t)ret_conv;
10520 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
10521 LDKQueryShortChannelIds o_conv;
10522 o_conv.inner = (void*)(o & (~1));
10523 o_conv.is_owned = (o & 1) || (o == 0);
10524 o_conv = QueryShortChannelIds_clone(&o_conv);
10525 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10526 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
10527 return (uint64_t)ret_conv;
10530 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
10531 LDKDecodeError e_conv;
10532 e_conv.inner = (void*)(e & (~1));
10533 e_conv.is_owned = (e & 1) || (e == 0);
10534 e_conv = DecodeError_clone(&e_conv);
10535 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10536 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
10537 return (uint64_t)ret_conv;
10540 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
10541 if ((_res & 1) != 0) return;
10542 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
10544 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
10547 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
10548 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
10549 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10550 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
10551 return (uint64_t)ret_conv;
10554 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
10555 LDKReplyShortChannelIdsEnd o_conv;
10556 o_conv.inner = (void*)(o & (~1));
10557 o_conv.is_owned = (o & 1) || (o == 0);
10558 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
10559 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10560 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
10561 return (uint64_t)ret_conv;
10564 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
10565 LDKDecodeError e_conv;
10566 e_conv.inner = (void*)(e & (~1));
10567 e_conv.is_owned = (e & 1) || (e == 0);
10568 e_conv = DecodeError_clone(&e_conv);
10569 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10570 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
10571 return (uint64_t)ret_conv;
10574 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
10575 if ((_res & 1) != 0) return;
10576 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
10578 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
10581 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
10582 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
10583 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10584 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
10585 return (uint64_t)ret_conv;
10588 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
10589 LDKQueryChannelRange o_conv;
10590 o_conv.inner = (void*)(o & (~1));
10591 o_conv.is_owned = (o & 1) || (o == 0);
10592 o_conv = QueryChannelRange_clone(&o_conv);
10593 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10594 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
10595 return (uint64_t)ret_conv;
10598 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
10599 LDKDecodeError e_conv;
10600 e_conv.inner = (void*)(e & (~1));
10601 e_conv.is_owned = (e & 1) || (e == 0);
10602 e_conv = DecodeError_clone(&e_conv);
10603 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10604 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
10605 return (uint64_t)ret_conv;
10608 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
10609 if ((_res & 1) != 0) return;
10610 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10612 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
10615 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10616 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
10617 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10618 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
10619 return (uint64_t)ret_conv;
10622 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
10623 LDKReplyChannelRange o_conv;
10624 o_conv.inner = (void*)(o & (~1));
10625 o_conv.is_owned = (o & 1) || (o == 0);
10626 o_conv = ReplyChannelRange_clone(&o_conv);
10627 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10628 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
10629 return (uint64_t)ret_conv;
10632 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
10633 LDKDecodeError e_conv;
10634 e_conv.inner = (void*)(e & (~1));
10635 e_conv.is_owned = (e & 1) || (e == 0);
10636 e_conv = DecodeError_clone(&e_conv);
10637 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10638 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
10639 return (uint64_t)ret_conv;
10642 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
10643 if ((_res & 1) != 0) return;
10644 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10646 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
10649 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10650 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
10651 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10652 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
10653 return (uint64_t)ret_conv;
10656 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
10657 LDKGossipTimestampFilter o_conv;
10658 o_conv.inner = (void*)(o & (~1));
10659 o_conv.is_owned = (o & 1) || (o == 0);
10660 o_conv = GossipTimestampFilter_clone(&o_conv);
10661 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10662 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
10663 return (uint64_t)ret_conv;
10666 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
10667 LDKDecodeError e_conv;
10668 e_conv.inner = (void*)(e & (~1));
10669 e_conv.is_owned = (e & 1) || (e == 0);
10670 e_conv = DecodeError_clone(&e_conv);
10671 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10672 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
10673 return (uint64_t)ret_conv;
10676 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
10677 if ((_res & 1) != 0) return;
10678 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
10680 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
10683 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
10684 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
10685 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10686 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
10687 return (uint64_t)ret_conv;
10690 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
10692 o_conv.inner = (void*)(o & (~1));
10693 o_conv.is_owned = (o & 1) || (o == 0);
10694 o_conv = Invoice_clone(&o_conv);
10695 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10696 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
10697 return (uint64_t)ret_conv;
10700 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
10701 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
10702 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10703 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
10704 return (uint64_t)ret_conv;
10707 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
10708 if ((_res & 1) != 0) return;
10709 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
10711 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
10714 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
10715 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
10716 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10717 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
10718 return (uint64_t)ret_conv;
10721 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
10722 if ((this_ptr & 1) != 0) return;
10723 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
10724 FREE((void*)this_ptr);
10725 Event_free(this_ptr_conv);
10728 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
10729 LDKEvent* orig_conv = (LDKEvent*)orig;
10730 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10731 *ret_copy = Event_clone(orig_conv);
10732 uint64_t ret_ref = (uint64_t)ret_copy;
10736 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) {
10737 LDKThirtyTwoBytes temporary_channel_id_ref;
10738 CHECK(*((uint32_t*)temporary_channel_id) == 32);
10739 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
10740 LDKCVec_u8Z output_script_ref;
10741 output_script_ref.datalen = *((uint32_t*)output_script);
10742 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
10743 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
10744 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10745 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
10746 uint64_t ret_ref = (uint64_t)ret_copy;
10750 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
10751 LDKThirtyTwoBytes payment_hash_ref;
10752 CHECK(*((uint32_t*)payment_hash) == 32);
10753 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10754 LDKThirtyTwoBytes payment_preimage_ref;
10755 CHECK(*((uint32_t*)payment_preimage) == 32);
10756 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10757 LDKThirtyTwoBytes payment_secret_ref;
10758 CHECK(*((uint32_t*)payment_secret) == 32);
10759 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10760 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10761 *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
10762 uint64_t ret_ref = (uint64_t)ret_copy;
10766 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
10767 LDKThirtyTwoBytes payment_preimage_ref;
10768 CHECK(*((uint32_t*)payment_preimage) == 32);
10769 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10770 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10771 *ret_copy = Event_payment_sent(payment_preimage_ref);
10772 uint64_t ret_ref = (uint64_t)ret_copy;
10776 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_hash, jboolean rejected_by_dest) {
10777 LDKThirtyTwoBytes payment_hash_ref;
10778 CHECK(*((uint32_t*)payment_hash) == 32);
10779 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10780 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10781 *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
10782 uint64_t ret_ref = (uint64_t)ret_copy;
10786 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
10787 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10788 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
10789 uint64_t ret_ref = (uint64_t)ret_copy;
10793 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
10794 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
10795 outputs_constr.datalen = *((uint32_t*)outputs);
10796 if (outputs_constr.datalen > 0)
10797 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10799 outputs_constr.data = NULL;
10800 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10801 for (size_t b = 0; b < outputs_constr.datalen; b++) {
10802 uint32_t outputs_conv_27 = outputs_vals[b];
10803 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
10804 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
10805 outputs_constr.data[b] = outputs_conv_27_conv;
10807 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10808 *ret_copy = Event_spendable_outputs(outputs_constr);
10809 uint64_t ret_ref = (uint64_t)ret_copy;
10813 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
10814 LDKEvent* obj_conv = (LDKEvent*)obj;
10815 LDKCVec_u8Z ret_var = Event_write(obj_conv);
10816 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10817 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10818 CVec_u8Z_free(ret_var);
10822 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
10823 if ((this_ptr & 1) != 0) return;
10824 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
10825 FREE((void*)this_ptr);
10826 MessageSendEvent_free(this_ptr_conv);
10829 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
10830 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
10831 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10832 *ret_copy = MessageSendEvent_clone(orig_conv);
10833 uint64_t ret_ref = (uint64_t)ret_copy;
10837 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
10838 LDKPublicKey node_id_ref;
10839 CHECK(*((uint32_t*)node_id) == 33);
10840 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10841 LDKAcceptChannel msg_conv;
10842 msg_conv.inner = (void*)(msg & (~1));
10843 msg_conv.is_owned = (msg & 1) || (msg == 0);
10844 msg_conv = AcceptChannel_clone(&msg_conv);
10845 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10846 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
10847 uint64_t ret_ref = (uint64_t)ret_copy;
10851 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
10852 LDKPublicKey node_id_ref;
10853 CHECK(*((uint32_t*)node_id) == 33);
10854 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10855 LDKOpenChannel msg_conv;
10856 msg_conv.inner = (void*)(msg & (~1));
10857 msg_conv.is_owned = (msg & 1) || (msg == 0);
10858 msg_conv = OpenChannel_clone(&msg_conv);
10859 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10860 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
10861 uint64_t ret_ref = (uint64_t)ret_copy;
10865 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
10866 LDKPublicKey node_id_ref;
10867 CHECK(*((uint32_t*)node_id) == 33);
10868 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10869 LDKFundingCreated msg_conv;
10870 msg_conv.inner = (void*)(msg & (~1));
10871 msg_conv.is_owned = (msg & 1) || (msg == 0);
10872 msg_conv = FundingCreated_clone(&msg_conv);
10873 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10874 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
10875 uint64_t ret_ref = (uint64_t)ret_copy;
10879 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
10880 LDKPublicKey node_id_ref;
10881 CHECK(*((uint32_t*)node_id) == 33);
10882 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10883 LDKFundingSigned msg_conv;
10884 msg_conv.inner = (void*)(msg & (~1));
10885 msg_conv.is_owned = (msg & 1) || (msg == 0);
10886 msg_conv = FundingSigned_clone(&msg_conv);
10887 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10888 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
10889 uint64_t ret_ref = (uint64_t)ret_copy;
10893 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
10894 LDKPublicKey node_id_ref;
10895 CHECK(*((uint32_t*)node_id) == 33);
10896 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10897 LDKFundingLocked msg_conv;
10898 msg_conv.inner = (void*)(msg & (~1));
10899 msg_conv.is_owned = (msg & 1) || (msg == 0);
10900 msg_conv = FundingLocked_clone(&msg_conv);
10901 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10902 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
10903 uint64_t ret_ref = (uint64_t)ret_copy;
10907 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
10908 LDKPublicKey node_id_ref;
10909 CHECK(*((uint32_t*)node_id) == 33);
10910 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10911 LDKAnnouncementSignatures msg_conv;
10912 msg_conv.inner = (void*)(msg & (~1));
10913 msg_conv.is_owned = (msg & 1) || (msg == 0);
10914 msg_conv = AnnouncementSignatures_clone(&msg_conv);
10915 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10916 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
10917 uint64_t ret_ref = (uint64_t)ret_copy;
10921 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
10922 LDKPublicKey node_id_ref;
10923 CHECK(*((uint32_t*)node_id) == 33);
10924 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10925 LDKCommitmentUpdate updates_conv;
10926 updates_conv.inner = (void*)(updates & (~1));
10927 updates_conv.is_owned = (updates & 1) || (updates == 0);
10928 updates_conv = CommitmentUpdate_clone(&updates_conv);
10929 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10930 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
10931 uint64_t ret_ref = (uint64_t)ret_copy;
10935 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
10936 LDKPublicKey node_id_ref;
10937 CHECK(*((uint32_t*)node_id) == 33);
10938 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10939 LDKRevokeAndACK msg_conv;
10940 msg_conv.inner = (void*)(msg & (~1));
10941 msg_conv.is_owned = (msg & 1) || (msg == 0);
10942 msg_conv = RevokeAndACK_clone(&msg_conv);
10943 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10944 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
10945 uint64_t ret_ref = (uint64_t)ret_copy;
10949 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
10950 LDKPublicKey node_id_ref;
10951 CHECK(*((uint32_t*)node_id) == 33);
10952 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10953 LDKClosingSigned msg_conv;
10954 msg_conv.inner = (void*)(msg & (~1));
10955 msg_conv.is_owned = (msg & 1) || (msg == 0);
10956 msg_conv = ClosingSigned_clone(&msg_conv);
10957 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10958 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
10959 uint64_t ret_ref = (uint64_t)ret_copy;
10963 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
10964 LDKPublicKey node_id_ref;
10965 CHECK(*((uint32_t*)node_id) == 33);
10966 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10967 LDKShutdown msg_conv;
10968 msg_conv.inner = (void*)(msg & (~1));
10969 msg_conv.is_owned = (msg & 1) || (msg == 0);
10970 msg_conv = Shutdown_clone(&msg_conv);
10971 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10972 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
10973 uint64_t ret_ref = (uint64_t)ret_copy;
10977 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
10978 LDKPublicKey node_id_ref;
10979 CHECK(*((uint32_t*)node_id) == 33);
10980 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10981 LDKChannelReestablish msg_conv;
10982 msg_conv.inner = (void*)(msg & (~1));
10983 msg_conv.is_owned = (msg & 1) || (msg == 0);
10984 msg_conv = ChannelReestablish_clone(&msg_conv);
10985 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10986 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
10987 uint64_t ret_ref = (uint64_t)ret_copy;
10991 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
10992 LDKChannelAnnouncement msg_conv;
10993 msg_conv.inner = (void*)(msg & (~1));
10994 msg_conv.is_owned = (msg & 1) || (msg == 0);
10995 msg_conv = ChannelAnnouncement_clone(&msg_conv);
10996 LDKChannelUpdate update_msg_conv;
10997 update_msg_conv.inner = (void*)(update_msg & (~1));
10998 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
10999 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
11000 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11001 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
11002 uint64_t ret_ref = (uint64_t)ret_copy;
11006 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
11007 LDKNodeAnnouncement msg_conv;
11008 msg_conv.inner = (void*)(msg & (~1));
11009 msg_conv.is_owned = (msg & 1) || (msg == 0);
11010 msg_conv = NodeAnnouncement_clone(&msg_conv);
11011 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11012 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
11013 uint64_t ret_ref = (uint64_t)ret_copy;
11017 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
11018 LDKChannelUpdate msg_conv;
11019 msg_conv.inner = (void*)(msg & (~1));
11020 msg_conv.is_owned = (msg & 1) || (msg == 0);
11021 msg_conv = ChannelUpdate_clone(&msg_conv);
11022 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11023 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
11024 uint64_t ret_ref = (uint64_t)ret_copy;
11028 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
11029 LDKPublicKey node_id_ref;
11030 CHECK(*((uint32_t*)node_id) == 33);
11031 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11032 LDKChannelUpdate msg_conv;
11033 msg_conv.inner = (void*)(msg & (~1));
11034 msg_conv.is_owned = (msg & 1) || (msg == 0);
11035 msg_conv = ChannelUpdate_clone(&msg_conv);
11036 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11037 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
11038 uint64_t ret_ref = (uint64_t)ret_copy;
11042 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
11043 LDKPublicKey node_id_ref;
11044 CHECK(*((uint32_t*)node_id) == 33);
11045 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11046 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
11047 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11048 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
11049 uint64_t ret_ref = (uint64_t)ret_copy;
11053 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_payment_failure_network_update(uint32_t update) {
11054 LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
11055 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11056 *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
11057 uint64_t ret_ref = (uint64_t)ret_copy;
11061 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
11062 LDKPublicKey node_id_ref;
11063 CHECK(*((uint32_t*)node_id) == 33);
11064 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11065 LDKQueryChannelRange msg_conv;
11066 msg_conv.inner = (void*)(msg & (~1));
11067 msg_conv.is_owned = (msg & 1) || (msg == 0);
11068 msg_conv = QueryChannelRange_clone(&msg_conv);
11069 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11070 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
11071 uint64_t ret_ref = (uint64_t)ret_copy;
11075 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
11076 LDKPublicKey node_id_ref;
11077 CHECK(*((uint32_t*)node_id) == 33);
11078 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11079 LDKQueryShortChannelIds msg_conv;
11080 msg_conv.inner = (void*)(msg & (~1));
11081 msg_conv.is_owned = (msg & 1) || (msg == 0);
11082 msg_conv = QueryShortChannelIds_clone(&msg_conv);
11083 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11084 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
11085 uint64_t ret_ref = (uint64_t)ret_copy;
11089 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
11090 LDKPublicKey node_id_ref;
11091 CHECK(*((uint32_t*)node_id) == 33);
11092 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11093 LDKReplyChannelRange msg_conv;
11094 msg_conv.inner = (void*)(msg & (~1));
11095 msg_conv.is_owned = (msg & 1) || (msg == 0);
11096 msg_conv = ReplyChannelRange_clone(&msg_conv);
11097 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11098 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
11099 uint64_t ret_ref = (uint64_t)ret_copy;
11103 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
11104 if ((this_ptr & 1) != 0) return;
11105 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
11106 FREE((void*)this_ptr);
11107 MessageSendEventsProvider_free(this_ptr_conv);
11110 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
11111 if ((this_ptr & 1) != 0) return;
11112 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
11113 FREE((void*)this_ptr);
11114 EventsProvider_free(this_ptr_conv);
11117 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
11118 if ((this_ptr & 1) != 0) return;
11119 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
11120 FREE((void*)this_ptr);
11121 EventHandler_free(this_ptr_conv);
11124 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
11125 if ((this_ptr & 1) != 0) return;
11126 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
11127 FREE((void*)this_ptr);
11128 APIError_free(this_ptr_conv);
11131 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
11132 LDKAPIError* orig_conv = (LDKAPIError*)orig;
11133 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11134 *ret_copy = APIError_clone(orig_conv);
11135 uint64_t ret_ref = (uint64_t)ret_copy;
11139 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
11140 LDKStr err_conv = str_ref_to_owned_c(err);
11141 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11142 *ret_copy = APIError_apimisuse_error(err_conv);
11143 uint64_t ret_ref = (uint64_t)ret_copy;
11147 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
11148 LDKStr err_conv = str_ref_to_owned_c(err);
11149 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11150 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
11151 uint64_t ret_ref = (uint64_t)ret_copy;
11155 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
11156 LDKStr err_conv = str_ref_to_owned_c(err);
11157 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11158 *ret_copy = APIError_route_error(err_conv);
11159 uint64_t ret_ref = (uint64_t)ret_copy;
11163 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
11164 LDKStr err_conv = str_ref_to_owned_c(err);
11165 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11166 *ret_copy = APIError_channel_unavailable(err_conv);
11167 uint64_t ret_ref = (uint64_t)ret_copy;
11171 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
11172 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11173 *ret_copy = APIError_monitor_update_failed();
11174 uint64_t ret_ref = (uint64_t)ret_copy;
11178 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
11179 LDKu8slice msg_ref;
11180 msg_ref.datalen = *((uint32_t*)msg);
11181 msg_ref.data = (int8_t*)(msg + 4);
11182 unsigned char sk_arr[32];
11183 CHECK(*((uint32_t*)sk) == 32);
11184 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
11185 unsigned char (*sk_ref)[32] = &sk_arr;
11186 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11187 *ret_conv = sign(msg_ref, sk_ref);
11188 return (uint64_t)ret_conv;
11191 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
11192 LDKu8slice msg_ref;
11193 msg_ref.datalen = *((uint32_t*)msg);
11194 msg_ref.data = (int8_t*)(msg + 4);
11195 LDKStr sig_conv = str_ref_to_owned_c(sig);
11196 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11197 *ret_conv = recover_pk(msg_ref, sig_conv);
11198 return (uint64_t)ret_conv;
11201 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
11202 LDKu8slice msg_ref;
11203 msg_ref.datalen = *((uint32_t*)msg);
11204 msg_ref.data = (int8_t*)(msg + 4);
11205 LDKStr sig_conv = str_ref_to_owned_c(sig);
11206 LDKPublicKey pk_ref;
11207 CHECK(*((uint32_t*)pk) == 33);
11208 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
11209 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
11213 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
11214 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
11215 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
11219 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
11220 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
11224 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
11225 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
11229 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
11230 uint32_t ret_conv = LDKLevel_to_js(Level_info());
11234 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
11235 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
11239 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
11240 uint32_t ret_conv = LDKLevel_to_js(Level_error());
11244 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
11245 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
11246 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
11247 jboolean ret_val = Level_eq(a_conv, b_conv);
11251 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
11252 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
11253 int64_t ret_val = Level_hash(o_conv);
11257 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
11258 uint32_t ret_conv = LDKLevel_to_js(Level_max());
11262 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
11263 if ((this_ptr & 1) != 0) return;
11264 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
11265 FREE((void*)this_ptr);
11266 Logger_free(this_ptr_conv);
11269 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
11270 LDKChannelHandshakeConfig this_obj_conv;
11271 this_obj_conv.inner = (void*)(this_obj & (~1));
11272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11273 ChannelHandshakeConfig_free(this_obj_conv);
11276 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
11277 LDKChannelHandshakeConfig this_ptr_conv;
11278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11279 this_ptr_conv.is_owned = false;
11280 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
11284 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
11285 LDKChannelHandshakeConfig this_ptr_conv;
11286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11287 this_ptr_conv.is_owned = false;
11288 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
11291 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
11292 LDKChannelHandshakeConfig this_ptr_conv;
11293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11294 this_ptr_conv.is_owned = false;
11295 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
11299 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
11300 LDKChannelHandshakeConfig this_ptr_conv;
11301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11302 this_ptr_conv.is_owned = false;
11303 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
11306 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
11307 LDKChannelHandshakeConfig this_ptr_conv;
11308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11309 this_ptr_conv.is_owned = false;
11310 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
11314 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11315 LDKChannelHandshakeConfig this_ptr_conv;
11316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11317 this_ptr_conv.is_owned = false;
11318 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
11321 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) {
11322 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
11323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11325 uint64_t ret_ref = (uint64_t)ret_var.inner;
11326 if (ret_var.is_owned) {
11332 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
11333 LDKChannelHandshakeConfig orig_conv;
11334 orig_conv.inner = (void*)(orig & (~1));
11335 orig_conv.is_owned = false;
11336 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
11337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11339 uint64_t ret_ref = (uint64_t)ret_var.inner;
11340 if (ret_var.is_owned) {
11346 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
11347 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
11348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11350 uint64_t ret_ref = (uint64_t)ret_var.inner;
11351 if (ret_var.is_owned) {
11357 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
11358 LDKChannelHandshakeLimits this_obj_conv;
11359 this_obj_conv.inner = (void*)(this_obj & (~1));
11360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11361 ChannelHandshakeLimits_free(this_obj_conv);
11364 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
11365 LDKChannelHandshakeLimits this_ptr_conv;
11366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11367 this_ptr_conv.is_owned = false;
11368 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
11372 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
11373 LDKChannelHandshakeLimits this_ptr_conv;
11374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11375 this_ptr_conv.is_owned = false;
11376 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
11379 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
11380 LDKChannelHandshakeLimits this_ptr_conv;
11381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11382 this_ptr_conv.is_owned = false;
11383 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
11387 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11388 LDKChannelHandshakeLimits this_ptr_conv;
11389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11390 this_ptr_conv.is_owned = false;
11391 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
11394 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11395 LDKChannelHandshakeLimits this_ptr_conv;
11396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11397 this_ptr_conv.is_owned = false;
11398 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
11402 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11403 LDKChannelHandshakeLimits this_ptr_conv;
11404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11405 this_ptr_conv.is_owned = false;
11406 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11409 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
11410 LDKChannelHandshakeLimits this_ptr_conv;
11411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11412 this_ptr_conv.is_owned = false;
11413 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
11417 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11418 LDKChannelHandshakeLimits this_ptr_conv;
11419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11420 this_ptr_conv.is_owned = false;
11421 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
11424 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
11425 LDKChannelHandshakeLimits this_ptr_conv;
11426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11427 this_ptr_conv.is_owned = false;
11428 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
11432 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11433 LDKChannelHandshakeLimits this_ptr_conv;
11434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11435 this_ptr_conv.is_owned = false;
11436 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
11439 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
11440 LDKChannelHandshakeLimits this_ptr_conv;
11441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11442 this_ptr_conv.is_owned = false;
11443 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
11447 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
11448 LDKChannelHandshakeLimits this_ptr_conv;
11449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11450 this_ptr_conv.is_owned = false;
11451 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
11454 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
11455 LDKChannelHandshakeLimits this_ptr_conv;
11456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11457 this_ptr_conv.is_owned = false;
11458 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
11462 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
11463 LDKChannelHandshakeLimits this_ptr_conv;
11464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11465 this_ptr_conv.is_owned = false;
11466 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
11469 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
11470 LDKChannelHandshakeLimits this_ptr_conv;
11471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11472 this_ptr_conv.is_owned = false;
11473 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
11477 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
11478 LDKChannelHandshakeLimits this_ptr_conv;
11479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11480 this_ptr_conv.is_owned = false;
11481 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
11484 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) {
11485 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);
11486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11488 uint64_t ret_ref = (uint64_t)ret_var.inner;
11489 if (ret_var.is_owned) {
11495 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
11496 LDKChannelHandshakeLimits orig_conv;
11497 orig_conv.inner = (void*)(orig & (~1));
11498 orig_conv.is_owned = false;
11499 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
11500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11502 uint64_t ret_ref = (uint64_t)ret_var.inner;
11503 if (ret_var.is_owned) {
11509 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
11510 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
11511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11513 uint64_t ret_ref = (uint64_t)ret_var.inner;
11514 if (ret_var.is_owned) {
11520 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
11521 LDKChannelConfig this_obj_conv;
11522 this_obj_conv.inner = (void*)(this_obj & (~1));
11523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11524 ChannelConfig_free(this_obj_conv);
11527 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
11528 LDKChannelConfig this_ptr_conv;
11529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11530 this_ptr_conv.is_owned = false;
11531 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
11535 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
11536 LDKChannelConfig this_ptr_conv;
11537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11538 this_ptr_conv.is_owned = false;
11539 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
11542 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
11543 LDKChannelConfig this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
11550 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
11551 LDKChannelConfig this_ptr_conv;
11552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11553 this_ptr_conv.is_owned = false;
11554 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
11557 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
11558 LDKChannelConfig this_ptr_conv;
11559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11560 this_ptr_conv.is_owned = false;
11561 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
11565 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
11566 LDKChannelConfig this_ptr_conv;
11567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11568 this_ptr_conv.is_owned = false;
11569 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
11572 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
11573 LDKChannelConfig this_ptr_conv;
11574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11575 this_ptr_conv.is_owned = false;
11576 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
11580 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
11581 LDKChannelConfig this_ptr_conv;
11582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11583 this_ptr_conv.is_owned = false;
11584 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
11587 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
11588 LDKChannelConfig this_ptr_conv;
11589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11590 this_ptr_conv.is_owned = false;
11591 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
11595 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
11596 LDKChannelConfig this_ptr_conv;
11597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11598 this_ptr_conv.is_owned = false;
11599 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
11602 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) {
11603 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);
11604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11606 uint64_t ret_ref = (uint64_t)ret_var.inner;
11607 if (ret_var.is_owned) {
11613 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
11614 LDKChannelConfig orig_conv;
11615 orig_conv.inner = (void*)(orig & (~1));
11616 orig_conv.is_owned = false;
11617 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
11618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11620 uint64_t ret_ref = (uint64_t)ret_var.inner;
11621 if (ret_var.is_owned) {
11627 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
11628 LDKChannelConfig ret_var = ChannelConfig_default();
11629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11631 uint64_t ret_ref = (uint64_t)ret_var.inner;
11632 if (ret_var.is_owned) {
11638 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
11639 LDKChannelConfig obj_conv;
11640 obj_conv.inner = (void*)(obj & (~1));
11641 obj_conv.is_owned = false;
11642 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
11643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11645 CVec_u8Z_free(ret_var);
11649 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
11650 LDKu8slice ser_ref;
11651 ser_ref.datalen = *((uint32_t*)ser);
11652 ser_ref.data = (int8_t*)(ser + 4);
11653 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11654 *ret_conv = ChannelConfig_read(ser_ref);
11655 return (uint64_t)ret_conv;
11658 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
11659 LDKUserConfig this_obj_conv;
11660 this_obj_conv.inner = (void*)(this_obj & (~1));
11661 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11662 UserConfig_free(this_obj_conv);
11665 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
11666 LDKUserConfig this_ptr_conv;
11667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11668 this_ptr_conv.is_owned = false;
11669 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
11670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11672 uint64_t ret_ref = (uint64_t)ret_var.inner;
11673 if (ret_var.is_owned) {
11679 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
11680 LDKUserConfig this_ptr_conv;
11681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11682 this_ptr_conv.is_owned = false;
11683 LDKChannelHandshakeConfig val_conv;
11684 val_conv.inner = (void*)(val & (~1));
11685 val_conv.is_owned = (val & 1) || (val == 0);
11686 val_conv = ChannelHandshakeConfig_clone(&val_conv);
11687 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
11690 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
11691 LDKUserConfig this_ptr_conv;
11692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11693 this_ptr_conv.is_owned = false;
11694 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
11695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11697 uint64_t ret_ref = (uint64_t)ret_var.inner;
11698 if (ret_var.is_owned) {
11704 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
11705 LDKUserConfig this_ptr_conv;
11706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11707 this_ptr_conv.is_owned = false;
11708 LDKChannelHandshakeLimits val_conv;
11709 val_conv.inner = (void*)(val & (~1));
11710 val_conv.is_owned = (val & 1) || (val == 0);
11711 val_conv = ChannelHandshakeLimits_clone(&val_conv);
11712 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
11715 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
11716 LDKUserConfig this_ptr_conv;
11717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11718 this_ptr_conv.is_owned = false;
11719 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
11720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11722 uint64_t ret_ref = (uint64_t)ret_var.inner;
11723 if (ret_var.is_owned) {
11729 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
11730 LDKUserConfig this_ptr_conv;
11731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11732 this_ptr_conv.is_owned = false;
11733 LDKChannelConfig val_conv;
11734 val_conv.inner = (void*)(val & (~1));
11735 val_conv.is_owned = (val & 1) || (val == 0);
11736 val_conv = ChannelConfig_clone(&val_conv);
11737 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
11740 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
11741 LDKUserConfig this_ptr_conv;
11742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11743 this_ptr_conv.is_owned = false;
11744 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
11748 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
11749 LDKUserConfig this_ptr_conv;
11750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11751 this_ptr_conv.is_owned = false;
11752 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
11755 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) {
11756 LDKChannelHandshakeConfig own_channel_config_arg_conv;
11757 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
11758 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
11759 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
11760 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
11761 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
11762 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
11763 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
11764 LDKChannelConfig channel_options_arg_conv;
11765 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
11766 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
11767 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
11768 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);
11769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11771 uint64_t ret_ref = (uint64_t)ret_var.inner;
11772 if (ret_var.is_owned) {
11778 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
11779 LDKUserConfig orig_conv;
11780 orig_conv.inner = (void*)(orig & (~1));
11781 orig_conv.is_owned = false;
11782 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
11783 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11784 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11785 uint64_t ret_ref = (uint64_t)ret_var.inner;
11786 if (ret_var.is_owned) {
11792 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
11793 LDKUserConfig ret_var = UserConfig_default();
11794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11796 uint64_t ret_ref = (uint64_t)ret_var.inner;
11797 if (ret_var.is_owned) {
11803 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
11804 LDKBestBlock this_obj_conv;
11805 this_obj_conv.inner = (void*)(this_obj & (~1));
11806 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11807 BestBlock_free(this_obj_conv);
11810 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
11811 LDKBestBlock orig_conv;
11812 orig_conv.inner = (void*)(orig & (~1));
11813 orig_conv.is_owned = false;
11814 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
11815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11817 uint64_t ret_ref = (uint64_t)ret_var.inner;
11818 if (ret_var.is_owned) {
11824 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
11825 LDKNetwork network_conv = LDKNetwork_from_js(network);
11826 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
11827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11829 uint64_t ret_ref = (uint64_t)ret_var.inner;
11830 if (ret_var.is_owned) {
11836 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
11837 LDKThirtyTwoBytes block_hash_ref;
11838 CHECK(*((uint32_t*)block_hash) == 32);
11839 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
11840 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
11841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11843 uint64_t ret_ref = (uint64_t)ret_var.inner;
11844 if (ret_var.is_owned) {
11850 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
11851 LDKBestBlock this_arg_conv;
11852 this_arg_conv.inner = (void*)(this_arg & (~1));
11853 this_arg_conv.is_owned = false;
11854 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11855 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
11859 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
11860 LDKBestBlock this_arg_conv;
11861 this_arg_conv.inner = (void*)(this_arg & (~1));
11862 this_arg_conv.is_owned = false;
11863 int32_t ret_val = BestBlock_height(&this_arg_conv);
11867 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
11868 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
11869 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
11873 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
11874 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
11878 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
11879 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
11883 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
11884 if ((this_ptr & 1) != 0) return;
11885 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
11886 FREE((void*)this_ptr);
11887 Access_free(this_ptr_conv);
11890 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
11891 if ((this_ptr & 1) != 0) return;
11892 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
11893 FREE((void*)this_ptr);
11894 Listen_free(this_ptr_conv);
11897 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
11898 if ((this_ptr & 1) != 0) return;
11899 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
11900 FREE((void*)this_ptr);
11901 Confirm_free(this_ptr_conv);
11904 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
11905 if ((this_ptr & 1) != 0) return;
11906 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
11907 FREE((void*)this_ptr);
11908 Watch_free(this_ptr_conv);
11911 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
11912 if ((this_ptr & 1) != 0) return;
11913 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
11914 FREE((void*)this_ptr);
11915 Filter_free(this_ptr_conv);
11918 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
11919 LDKWatchedOutput this_obj_conv;
11920 this_obj_conv.inner = (void*)(this_obj & (~1));
11921 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11922 WatchedOutput_free(this_obj_conv);
11925 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
11926 LDKWatchedOutput this_ptr_conv;
11927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11928 this_ptr_conv.is_owned = false;
11929 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11930 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
11934 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
11935 LDKWatchedOutput this_ptr_conv;
11936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11937 this_ptr_conv.is_owned = false;
11938 LDKThirtyTwoBytes val_ref;
11939 CHECK(*((uint32_t*)val) == 32);
11940 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11941 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
11944 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
11945 LDKWatchedOutput this_ptr_conv;
11946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11947 this_ptr_conv.is_owned = false;
11948 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
11949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11951 uint64_t ret_ref = (uint64_t)ret_var.inner;
11952 if (ret_var.is_owned) {
11958 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
11959 LDKWatchedOutput this_ptr_conv;
11960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11961 this_ptr_conv.is_owned = false;
11962 LDKOutPoint val_conv;
11963 val_conv.inner = (void*)(val & (~1));
11964 val_conv.is_owned = (val & 1) || (val == 0);
11965 val_conv = OutPoint_clone(&val_conv);
11966 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
11969 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
11970 LDKWatchedOutput this_ptr_conv;
11971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11972 this_ptr_conv.is_owned = false;
11973 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
11974 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11975 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11979 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
11980 LDKWatchedOutput this_ptr_conv;
11981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11982 this_ptr_conv.is_owned = false;
11983 LDKCVec_u8Z val_ref;
11984 val_ref.datalen = *((uint32_t*)val);
11985 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11986 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11987 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
11990 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
11991 LDKThirtyTwoBytes block_hash_arg_ref;
11992 CHECK(*((uint32_t*)block_hash_arg) == 32);
11993 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
11994 LDKOutPoint outpoint_arg_conv;
11995 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11996 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11997 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11998 LDKCVec_u8Z script_pubkey_arg_ref;
11999 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
12000 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12001 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
12002 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
12003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12005 uint64_t ret_ref = (uint64_t)ret_var.inner;
12006 if (ret_var.is_owned) {
12012 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
12013 LDKWatchedOutput orig_conv;
12014 orig_conv.inner = (void*)(orig & (~1));
12015 orig_conv.is_owned = false;
12016 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
12017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12019 uint64_t ret_ref = (uint64_t)ret_var.inner;
12020 if (ret_var.is_owned) {
12026 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
12027 LDKWatchedOutput o_conv;
12028 o_conv.inner = (void*)(o & (~1));
12029 o_conv.is_owned = false;
12030 int64_t ret_val = WatchedOutput_hash(&o_conv);
12034 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
12035 if ((this_ptr & 1) != 0) return;
12036 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
12037 FREE((void*)this_ptr);
12038 BroadcasterInterface_free(this_ptr_conv);
12041 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
12042 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
12043 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
12047 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
12048 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
12052 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
12053 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
12057 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
12058 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
12062 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
12063 if ((this_ptr & 1) != 0) return;
12064 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
12065 FREE((void*)this_ptr);
12066 FeeEstimator_free(this_ptr_conv);
12069 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
12070 LDKChainMonitor this_obj_conv;
12071 this_obj_conv.inner = (void*)(this_obj & (~1));
12072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12073 ChainMonitor_free(this_obj_conv);
12076 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
12077 LDKFilter *chain_source_conv_ptr = NULL;
12078 if (chain_source != 0) {
12079 LDKFilter chain_source_conv;
12080 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
12081 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12082 *chain_source_conv_ptr = chain_source_conv;
12084 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12085 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12086 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
12087 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
12088 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
12089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12091 uint64_t ret_ref = (uint64_t)ret_var.inner;
12092 if (ret_var.is_owned) {
12098 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
12099 LDKChainMonitor this_arg_conv;
12100 this_arg_conv.inner = (void*)(this_arg & (~1));
12101 this_arg_conv.is_owned = false;
12102 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12103 *ret = ChainMonitor_as_Listen(&this_arg_conv);
12104 return (uint64_t)ret;
12107 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
12108 LDKChainMonitor this_arg_conv;
12109 this_arg_conv.inner = (void*)(this_arg & (~1));
12110 this_arg_conv.is_owned = false;
12111 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12112 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
12113 return (uint64_t)ret;
12116 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
12117 LDKChainMonitor this_arg_conv;
12118 this_arg_conv.inner = (void*)(this_arg & (~1));
12119 this_arg_conv.is_owned = false;
12120 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
12121 *ret = ChainMonitor_as_Watch(&this_arg_conv);
12122 return (uint64_t)ret;
12125 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
12126 LDKChainMonitor this_arg_conv;
12127 this_arg_conv.inner = (void*)(this_arg & (~1));
12128 this_arg_conv.is_owned = false;
12129 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12130 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
12131 return (uint64_t)ret;
12134 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
12135 LDKChannelMonitorUpdate this_obj_conv;
12136 this_obj_conv.inner = (void*)(this_obj & (~1));
12137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12138 ChannelMonitorUpdate_free(this_obj_conv);
12141 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
12142 LDKChannelMonitorUpdate this_ptr_conv;
12143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12144 this_ptr_conv.is_owned = false;
12145 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
12149 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
12150 LDKChannelMonitorUpdate this_ptr_conv;
12151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12152 this_ptr_conv.is_owned = false;
12153 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
12156 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
12157 LDKChannelMonitorUpdate orig_conv;
12158 orig_conv.inner = (void*)(orig & (~1));
12159 orig_conv.is_owned = false;
12160 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
12161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12163 uint64_t ret_ref = (uint64_t)ret_var.inner;
12164 if (ret_var.is_owned) {
12170 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
12171 LDKChannelMonitorUpdate obj_conv;
12172 obj_conv.inner = (void*)(obj & (~1));
12173 obj_conv.is_owned = false;
12174 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
12175 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12176 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12177 CVec_u8Z_free(ret_var);
12181 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
12182 LDKu8slice ser_ref;
12183 ser_ref.datalen = *((uint32_t*)ser);
12184 ser_ref.data = (int8_t*)(ser + 4);
12185 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12186 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
12187 return (uint64_t)ret_conv;
12190 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
12191 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
12192 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
12196 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
12197 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
12201 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
12202 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
12206 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
12207 LDKMonitorUpdateError this_obj_conv;
12208 this_obj_conv.inner = (void*)(this_obj & (~1));
12209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12210 MonitorUpdateError_free(this_obj_conv);
12213 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
12214 LDKMonitorUpdateError orig_conv;
12215 orig_conv.inner = (void*)(orig & (~1));
12216 orig_conv.is_owned = false;
12217 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
12218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12220 uint64_t ret_ref = (uint64_t)ret_var.inner;
12221 if (ret_var.is_owned) {
12227 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
12228 if ((this_ptr & 1) != 0) return;
12229 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
12230 FREE((void*)this_ptr);
12231 MonitorEvent_free(this_ptr_conv);
12234 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
12235 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
12236 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12237 *ret_copy = MonitorEvent_clone(orig_conv);
12238 uint64_t ret_ref = (uint64_t)ret_copy;
12242 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
12243 LDKHTLCUpdate a_conv;
12244 a_conv.inner = (void*)(a & (~1));
12245 a_conv.is_owned = (a & 1) || (a == 0);
12246 a_conv = HTLCUpdate_clone(&a_conv);
12247 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12248 *ret_copy = MonitorEvent_htlcevent(a_conv);
12249 uint64_t ret_ref = (uint64_t)ret_copy;
12253 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_broadcasted(uint32_t a) {
12254 LDKOutPoint a_conv;
12255 a_conv.inner = (void*)(a & (~1));
12256 a_conv.is_owned = (a & 1) || (a == 0);
12257 a_conv = OutPoint_clone(&a_conv);
12258 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12259 *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
12260 uint64_t ret_ref = (uint64_t)ret_copy;
12264 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
12265 LDKHTLCUpdate this_obj_conv;
12266 this_obj_conv.inner = (void*)(this_obj & (~1));
12267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12268 HTLCUpdate_free(this_obj_conv);
12271 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
12272 LDKHTLCUpdate orig_conv;
12273 orig_conv.inner = (void*)(orig & (~1));
12274 orig_conv.is_owned = false;
12275 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
12276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12278 uint64_t ret_ref = (uint64_t)ret_var.inner;
12279 if (ret_var.is_owned) {
12285 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
12286 LDKHTLCUpdate obj_conv;
12287 obj_conv.inner = (void*)(obj & (~1));
12288 obj_conv.is_owned = false;
12289 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
12290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12292 CVec_u8Z_free(ret_var);
12296 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
12297 LDKu8slice ser_ref;
12298 ser_ref.datalen = *((uint32_t*)ser);
12299 ser_ref.data = (int8_t*)(ser + 4);
12300 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12301 *ret_conv = HTLCUpdate_read(ser_ref);
12302 return (uint64_t)ret_conv;
12305 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
12306 LDKChannelMonitor this_obj_conv;
12307 this_obj_conv.inner = (void*)(this_obj & (~1));
12308 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12309 ChannelMonitor_free(this_obj_conv);
12312 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
12313 LDKChannelMonitor orig_conv;
12314 orig_conv.inner = (void*)(orig & (~1));
12315 orig_conv.is_owned = false;
12316 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
12317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12319 uint64_t ret_ref = (uint64_t)ret_var.inner;
12320 if (ret_var.is_owned) {
12326 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
12327 LDKChannelMonitor obj_conv;
12328 obj_conv.inner = (void*)(obj & (~1));
12329 obj_conv.is_owned = false;
12330 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
12331 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12332 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12333 CVec_u8Z_free(ret_var);
12337 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) {
12338 LDKChannelMonitor this_arg_conv;
12339 this_arg_conv.inner = (void*)(this_arg & (~1));
12340 this_arg_conv.is_owned = false;
12341 LDKChannelMonitorUpdate updates_conv;
12342 updates_conv.inner = (void*)(updates & (~1));
12343 updates_conv.is_owned = false;
12344 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12345 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12346 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12347 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12348 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
12349 return (uint64_t)ret_conv;
12352 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
12353 LDKChannelMonitor this_arg_conv;
12354 this_arg_conv.inner = (void*)(this_arg & (~1));
12355 this_arg_conv.is_owned = false;
12356 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
12360 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
12361 LDKChannelMonitor this_arg_conv;
12362 this_arg_conv.inner = (void*)(this_arg & (~1));
12363 this_arg_conv.is_owned = false;
12364 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12365 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
12366 return (uint64_t)ret_ref;
12369 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
12370 LDKChannelMonitor this_arg_conv;
12371 this_arg_conv.inner = (void*)(this_arg & (~1));
12372 this_arg_conv.is_owned = false;
12373 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
12374 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12375 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12376 for (size_t c = 0; c < ret_var.datalen; c++) {
12377 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12378 *ret_conv_54_ref = ret_var.data[c];
12379 ret_arr_ptr[c] = (uint64_t)ret_conv_54_ref;
12381 FREE(ret_var.data);
12385 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
12386 LDKChannelMonitor this_arg_conv;
12387 this_arg_conv.inner = (void*)(this_arg & (~1));
12388 this_arg_conv.is_owned = false;
12389 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
12390 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
12393 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
12394 LDKChannelMonitor this_arg_conv;
12395 this_arg_conv.inner = (void*)(this_arg & (~1));
12396 this_arg_conv.is_owned = false;
12397 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
12398 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12399 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12400 for (size_t o = 0; o < ret_var.datalen; o++) {
12401 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12402 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
12403 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
12404 ret_arr_ptr[o] = ret_conv_14_ref;
12406 FREE(ret_var.data);
12410 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
12411 LDKChannelMonitor this_arg_conv;
12412 this_arg_conv.inner = (void*)(this_arg & (~1));
12413 this_arg_conv.is_owned = false;
12414 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
12415 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12416 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12417 for (size_t h = 0; h < ret_var.datalen; h++) {
12418 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12419 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
12420 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
12421 ret_arr_ptr[h] = ret_conv_7_ref;
12423 FREE(ret_var.data);
12427 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
12428 LDKChannelMonitor this_arg_conv;
12429 this_arg_conv.inner = (void*)(this_arg & (~1));
12430 this_arg_conv.is_owned = false;
12431 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12432 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
12433 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12434 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12435 for (size_t m = 0; m < ret_var.datalen; m++) {
12436 LDKTransaction ret_conv_12_var = ret_var.data[m];
12437 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12438 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
12439 Transaction_free(ret_conv_12_var);
12440 ret_arr_ptr[m] = ret_conv_12_arr;
12442 FREE(ret_var.data);
12446 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) {
12447 LDKChannelMonitor this_arg_conv;
12448 this_arg_conv.inner = (void*)(this_arg & (~1));
12449 this_arg_conv.is_owned = false;
12450 unsigned char header_arr[80];
12451 CHECK(*((uint32_t*)header) == 80);
12452 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12453 unsigned char (*header_ref)[80] = &header_arr;
12454 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12455 txdata_constr.datalen = *((uint32_t*)txdata);
12456 if (txdata_constr.datalen > 0)
12457 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12459 txdata_constr.data = NULL;
12460 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12461 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12462 uint32_t txdata_conv_30 = txdata_vals[e];
12463 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12464 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12465 txdata_constr.data[e] = txdata_conv_30_conv;
12467 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12468 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12469 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12470 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);
12471 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12472 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12473 for (size_t x = 0; x < ret_var.datalen; x++) {
12474 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12475 *ret_conv_49_ref = ret_var.data[x];
12476 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12478 FREE(ret_var.data);
12482 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) {
12483 LDKChannelMonitor this_arg_conv;
12484 this_arg_conv.inner = (void*)(this_arg & (~1));
12485 this_arg_conv.is_owned = false;
12486 unsigned char header_arr[80];
12487 CHECK(*((uint32_t*)header) == 80);
12488 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12489 unsigned char (*header_ref)[80] = &header_arr;
12490 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12491 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12492 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12493 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12496 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) {
12497 LDKChannelMonitor this_arg_conv;
12498 this_arg_conv.inner = (void*)(this_arg & (~1));
12499 this_arg_conv.is_owned = false;
12500 unsigned char header_arr[80];
12501 CHECK(*((uint32_t*)header) == 80);
12502 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12503 unsigned char (*header_ref)[80] = &header_arr;
12504 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12505 txdata_constr.datalen = *((uint32_t*)txdata);
12506 if (txdata_constr.datalen > 0)
12507 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12509 txdata_constr.data = NULL;
12510 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12511 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12512 uint32_t txdata_conv_30 = txdata_vals[e];
12513 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12514 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12515 txdata_constr.data[e] = txdata_conv_30_conv;
12517 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12518 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12519 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12520 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);
12521 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12522 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12523 for (size_t x = 0; x < ret_var.datalen; x++) {
12524 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12525 *ret_conv_49_ref = ret_var.data[x];
12526 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12528 FREE(ret_var.data);
12532 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) {
12533 LDKChannelMonitor this_arg_conv;
12534 this_arg_conv.inner = (void*)(this_arg & (~1));
12535 this_arg_conv.is_owned = false;
12536 unsigned char txid_arr[32];
12537 CHECK(*((uint32_t*)txid) == 32);
12538 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
12539 unsigned char (*txid_ref)[32] = &txid_arr;
12540 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12541 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12542 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12543 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
12546 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) {
12547 LDKChannelMonitor this_arg_conv;
12548 this_arg_conv.inner = (void*)(this_arg & (~1));
12549 this_arg_conv.is_owned = false;
12550 unsigned char header_arr[80];
12551 CHECK(*((uint32_t*)header) == 80);
12552 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12553 unsigned char (*header_ref)[80] = &header_arr;
12554 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12555 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12556 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12557 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12558 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12559 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12560 for (size_t x = 0; x < ret_var.datalen; x++) {
12561 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12562 *ret_conv_49_ref = ret_var.data[x];
12563 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12565 FREE(ret_var.data);
12569 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
12570 LDKChannelMonitor this_arg_conv;
12571 this_arg_conv.inner = (void*)(this_arg & (~1));
12572 this_arg_conv.is_owned = false;
12573 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
12574 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12575 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12576 for (size_t m = 0; m < ret_var.datalen; m++) {
12577 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12578 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
12579 ret_arr_ptr[m] = ret_conv_12_arr;
12581 FREE(ret_var.data);
12585 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
12586 LDKChannelMonitor this_arg_conv;
12587 this_arg_conv.inner = (void*)(this_arg & (~1));
12588 this_arg_conv.is_owned = false;
12589 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
12590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12592 uint64_t ret_ref = (uint64_t)ret_var.inner;
12593 if (ret_var.is_owned) {
12599 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
12600 if ((this_ptr & 1) != 0) return;
12601 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
12602 FREE((void*)this_ptr);
12603 Persist_free(this_ptr_conv);
12606 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
12607 LDKu8slice ser_ref;
12608 ser_ref.datalen = *((uint32_t*)ser);
12609 ser_ref.data = (int8_t*)(ser + 4);
12610 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
12611 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12612 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
12613 return (uint64_t)ret_conv;
12616 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
12617 LDKOutPoint this_obj_conv;
12618 this_obj_conv.inner = (void*)(this_obj & (~1));
12619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12620 OutPoint_free(this_obj_conv);
12623 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
12624 LDKOutPoint this_ptr_conv;
12625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12626 this_ptr_conv.is_owned = false;
12627 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12628 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
12632 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
12633 LDKOutPoint this_ptr_conv;
12634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12635 this_ptr_conv.is_owned = false;
12636 LDKThirtyTwoBytes val_ref;
12637 CHECK(*((uint32_t*)val) == 32);
12638 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12639 OutPoint_set_txid(&this_ptr_conv, val_ref);
12642 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
12643 LDKOutPoint this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = false;
12646 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
12650 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
12651 LDKOutPoint this_ptr_conv;
12652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12653 this_ptr_conv.is_owned = false;
12654 OutPoint_set_index(&this_ptr_conv, val);
12657 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
12658 LDKThirtyTwoBytes txid_arg_ref;
12659 CHECK(*((uint32_t*)txid_arg) == 32);
12660 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
12661 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
12662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12664 uint64_t ret_ref = (uint64_t)ret_var.inner;
12665 if (ret_var.is_owned) {
12671 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
12672 LDKOutPoint orig_conv;
12673 orig_conv.inner = (void*)(orig & (~1));
12674 orig_conv.is_owned = false;
12675 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
12676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12678 uint64_t ret_ref = (uint64_t)ret_var.inner;
12679 if (ret_var.is_owned) {
12685 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
12686 LDKOutPoint a_conv;
12687 a_conv.inner = (void*)(a & (~1));
12688 a_conv.is_owned = false;
12689 LDKOutPoint b_conv;
12690 b_conv.inner = (void*)(b & (~1));
12691 b_conv.is_owned = false;
12692 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
12696 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
12697 LDKOutPoint o_conv;
12698 o_conv.inner = (void*)(o & (~1));
12699 o_conv.is_owned = false;
12700 int64_t ret_val = OutPoint_hash(&o_conv);
12704 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
12705 LDKOutPoint this_arg_conv;
12706 this_arg_conv.inner = (void*)(this_arg & (~1));
12707 this_arg_conv.is_owned = false;
12708 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12709 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
12713 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
12714 LDKOutPoint obj_conv;
12715 obj_conv.inner = (void*)(obj & (~1));
12716 obj_conv.is_owned = false;
12717 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
12718 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12719 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12720 CVec_u8Z_free(ret_var);
12724 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
12725 LDKu8slice ser_ref;
12726 ser_ref.datalen = *((uint32_t*)ser);
12727 ser_ref.data = (int8_t*)(ser + 4);
12728 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12729 *ret_conv = OutPoint_read(ser_ref);
12730 return (uint64_t)ret_conv;
12733 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
12734 LDKDelayedPaymentOutputDescriptor this_obj_conv;
12735 this_obj_conv.inner = (void*)(this_obj & (~1));
12736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12737 DelayedPaymentOutputDescriptor_free(this_obj_conv);
12740 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
12741 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12743 this_ptr_conv.is_owned = false;
12744 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
12745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12747 uint64_t ret_ref = (uint64_t)ret_var.inner;
12748 if (ret_var.is_owned) {
12754 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
12755 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12757 this_ptr_conv.is_owned = false;
12758 LDKOutPoint val_conv;
12759 val_conv.inner = (void*)(val & (~1));
12760 val_conv.is_owned = (val & 1) || (val == 0);
12761 val_conv = OutPoint_clone(&val_conv);
12762 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
12765 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
12766 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = false;
12769 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12770 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12774 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12775 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12777 this_ptr_conv.is_owned = false;
12778 LDKPublicKey val_ref;
12779 CHECK(*((uint32_t*)val) == 33);
12780 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12781 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
12784 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
12785 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12787 this_ptr_conv.is_owned = false;
12788 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
12792 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12793 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12795 this_ptr_conv.is_owned = false;
12796 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
12799 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
12800 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12802 this_ptr_conv.is_owned = false;
12803 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
12804 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
12807 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
12808 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12810 this_ptr_conv.is_owned = false;
12811 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12812 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
12816 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
12817 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12819 this_ptr_conv.is_owned = false;
12820 LDKPublicKey val_ref;
12821 CHECK(*((uint32_t*)val) == 33);
12822 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12823 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
12826 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
12827 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12829 this_ptr_conv.is_owned = false;
12830 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12831 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
12835 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
12836 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12838 this_ptr_conv.is_owned = false;
12839 LDKThirtyTwoBytes val_ref;
12840 CHECK(*((uint32_t*)val) == 32);
12841 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12842 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
12845 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
12846 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12848 this_ptr_conv.is_owned = false;
12849 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
12853 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
12854 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12856 this_ptr_conv.is_owned = false;
12857 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
12860 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) {
12861 LDKOutPoint outpoint_arg_conv;
12862 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
12863 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
12864 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
12865 LDKPublicKey per_commitment_point_arg_ref;
12866 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
12867 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
12868 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
12869 LDKPublicKey revocation_pubkey_arg_ref;
12870 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
12871 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
12872 LDKThirtyTwoBytes channel_keys_id_arg_ref;
12873 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
12874 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
12875 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);
12876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12878 uint64_t ret_ref = (uint64_t)ret_var.inner;
12879 if (ret_var.is_owned) {
12885 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
12886 LDKDelayedPaymentOutputDescriptor orig_conv;
12887 orig_conv.inner = (void*)(orig & (~1));
12888 orig_conv.is_owned = false;
12889 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
12890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12892 uint64_t ret_ref = (uint64_t)ret_var.inner;
12893 if (ret_var.is_owned) {
12899 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
12900 LDKDelayedPaymentOutputDescriptor obj_conv;
12901 obj_conv.inner = (void*)(obj & (~1));
12902 obj_conv.is_owned = false;
12903 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
12904 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12905 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12906 CVec_u8Z_free(ret_var);
12910 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
12911 LDKu8slice ser_ref;
12912 ser_ref.datalen = *((uint32_t*)ser);
12913 ser_ref.data = (int8_t*)(ser + 4);
12914 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12915 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
12916 return (uint64_t)ret_conv;
12919 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
12920 LDKStaticPaymentOutputDescriptor this_obj_conv;
12921 this_obj_conv.inner = (void*)(this_obj & (~1));
12922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12923 StaticPaymentOutputDescriptor_free(this_obj_conv);
12926 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
12927 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12929 this_ptr_conv.is_owned = false;
12930 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
12931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12933 uint64_t ret_ref = (uint64_t)ret_var.inner;
12934 if (ret_var.is_owned) {
12940 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
12941 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12943 this_ptr_conv.is_owned = false;
12944 LDKOutPoint val_conv;
12945 val_conv.inner = (void*)(val & (~1));
12946 val_conv.is_owned = (val & 1) || (val == 0);
12947 val_conv = OutPoint_clone(&val_conv);
12948 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
12951 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
12952 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12954 this_ptr_conv.is_owned = false;
12955 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
12956 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
12959 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
12960 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12962 this_ptr_conv.is_owned = false;
12963 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12964 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
12968 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
12969 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12971 this_ptr_conv.is_owned = false;
12972 LDKThirtyTwoBytes val_ref;
12973 CHECK(*((uint32_t*)val) == 32);
12974 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12975 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
12978 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
12979 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = false;
12982 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
12986 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
12987 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12989 this_ptr_conv.is_owned = false;
12990 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
12993 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) {
12994 LDKOutPoint outpoint_arg_conv;
12995 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
12996 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
12997 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
12998 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
12999 LDKThirtyTwoBytes channel_keys_id_arg_ref;
13000 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
13001 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
13002 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
13003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13005 uint64_t ret_ref = (uint64_t)ret_var.inner;
13006 if (ret_var.is_owned) {
13012 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
13013 LDKStaticPaymentOutputDescriptor orig_conv;
13014 orig_conv.inner = (void*)(orig & (~1));
13015 orig_conv.is_owned = false;
13016 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
13017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13019 uint64_t ret_ref = (uint64_t)ret_var.inner;
13020 if (ret_var.is_owned) {
13026 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
13027 LDKStaticPaymentOutputDescriptor obj_conv;
13028 obj_conv.inner = (void*)(obj & (~1));
13029 obj_conv.is_owned = false;
13030 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
13031 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13032 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13033 CVec_u8Z_free(ret_var);
13037 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
13038 LDKu8slice ser_ref;
13039 ser_ref.datalen = *((uint32_t*)ser);
13040 ser_ref.data = (int8_t*)(ser + 4);
13041 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13042 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
13043 return (uint64_t)ret_conv;
13046 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
13047 if ((this_ptr & 1) != 0) return;
13048 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
13049 FREE((void*)this_ptr);
13050 SpendableOutputDescriptor_free(this_ptr_conv);
13053 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
13054 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
13055 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13056 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
13057 uint64_t ret_ref = (uint64_t)ret_copy;
13061 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
13062 LDKOutPoint outpoint_conv;
13063 outpoint_conv.inner = (void*)(outpoint & (~1));
13064 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
13065 outpoint_conv = OutPoint_clone(&outpoint_conv);
13066 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
13067 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13068 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
13069 uint64_t ret_ref = (uint64_t)ret_copy;
13073 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
13074 LDKDelayedPaymentOutputDescriptor a_conv;
13075 a_conv.inner = (void*)(a & (~1));
13076 a_conv.is_owned = (a & 1) || (a == 0);
13077 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
13078 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13079 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
13080 uint64_t ret_ref = (uint64_t)ret_copy;
13084 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
13085 LDKStaticPaymentOutputDescriptor a_conv;
13086 a_conv.inner = (void*)(a & (~1));
13087 a_conv.is_owned = (a & 1) || (a == 0);
13088 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
13089 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13090 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
13091 uint64_t ret_ref = (uint64_t)ret_copy;
13095 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
13096 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
13097 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
13098 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13099 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13100 CVec_u8Z_free(ret_var);
13104 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
13105 LDKu8slice ser_ref;
13106 ser_ref.datalen = *((uint32_t*)ser);
13107 ser_ref.data = (int8_t*)(ser + 4);
13108 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13109 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
13110 return (uint64_t)ret_conv;
13113 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
13114 if ((this_ptr & 1) != 0) return;
13115 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
13116 FREE((void*)this_ptr);
13117 BaseSign_free(this_ptr_conv);
13120 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
13121 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
13122 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13123 *ret = Sign_clone(orig_conv);
13124 return (uint64_t)ret;
13127 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
13128 if ((this_ptr & 1) != 0) return;
13129 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
13130 FREE((void*)this_ptr);
13131 Sign_free(this_ptr_conv);
13134 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
13135 if ((this_ptr & 1) != 0) return;
13136 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
13137 FREE((void*)this_ptr);
13138 KeysInterface_free(this_ptr_conv);
13141 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
13142 LDKInMemorySigner this_obj_conv;
13143 this_obj_conv.inner = (void*)(this_obj & (~1));
13144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13145 InMemorySigner_free(this_obj_conv);
13148 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
13149 LDKInMemorySigner this_ptr_conv;
13150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13151 this_ptr_conv.is_owned = false;
13152 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13153 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
13157 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
13158 LDKInMemorySigner this_ptr_conv;
13159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13160 this_ptr_conv.is_owned = false;
13161 LDKSecretKey val_ref;
13162 CHECK(*((uint32_t*)val) == 32);
13163 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13164 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
13167 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
13168 LDKInMemorySigner this_ptr_conv;
13169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13170 this_ptr_conv.is_owned = false;
13171 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13172 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
13176 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
13177 LDKInMemorySigner this_ptr_conv;
13178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13179 this_ptr_conv.is_owned = false;
13180 LDKSecretKey val_ref;
13181 CHECK(*((uint32_t*)val) == 32);
13182 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13183 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
13186 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
13187 LDKInMemorySigner this_ptr_conv;
13188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13189 this_ptr_conv.is_owned = false;
13190 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13191 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
13195 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
13196 LDKInMemorySigner this_ptr_conv;
13197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13198 this_ptr_conv.is_owned = false;
13199 LDKSecretKey val_ref;
13200 CHECK(*((uint32_t*)val) == 32);
13201 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13202 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
13205 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
13206 LDKInMemorySigner this_ptr_conv;
13207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13208 this_ptr_conv.is_owned = false;
13209 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13210 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
13214 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
13215 LDKInMemorySigner this_ptr_conv;
13216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13217 this_ptr_conv.is_owned = false;
13218 LDKSecretKey val_ref;
13219 CHECK(*((uint32_t*)val) == 32);
13220 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13221 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
13224 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
13225 LDKInMemorySigner this_ptr_conv;
13226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13227 this_ptr_conv.is_owned = false;
13228 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13229 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
13233 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
13234 LDKInMemorySigner this_ptr_conv;
13235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13236 this_ptr_conv.is_owned = false;
13237 LDKSecretKey val_ref;
13238 CHECK(*((uint32_t*)val) == 32);
13239 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13240 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
13243 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
13244 LDKInMemorySigner this_ptr_conv;
13245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13246 this_ptr_conv.is_owned = false;
13247 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13248 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
13252 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
13253 LDKInMemorySigner this_ptr_conv;
13254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13255 this_ptr_conv.is_owned = false;
13256 LDKThirtyTwoBytes val_ref;
13257 CHECK(*((uint32_t*)val) == 32);
13258 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13259 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
13262 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
13263 LDKInMemorySigner orig_conv;
13264 orig_conv.inner = (void*)(orig & (~1));
13265 orig_conv.is_owned = false;
13266 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
13267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13269 uint64_t ret_ref = (uint64_t)ret_var.inner;
13270 if (ret_var.is_owned) {
13276 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) {
13277 LDKSecretKey funding_key_ref;
13278 CHECK(*((uint32_t*)funding_key) == 32);
13279 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
13280 LDKSecretKey revocation_base_key_ref;
13281 CHECK(*((uint32_t*)revocation_base_key) == 32);
13282 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
13283 LDKSecretKey payment_key_ref;
13284 CHECK(*((uint32_t*)payment_key) == 32);
13285 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
13286 LDKSecretKey delayed_payment_base_key_ref;
13287 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
13288 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
13289 LDKSecretKey htlc_base_key_ref;
13290 CHECK(*((uint32_t*)htlc_base_key) == 32);
13291 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
13292 LDKThirtyTwoBytes commitment_seed_ref;
13293 CHECK(*((uint32_t*)commitment_seed) == 32);
13294 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
13295 LDKThirtyTwoBytes channel_keys_id_ref;
13296 CHECK(*((uint32_t*)channel_keys_id) == 32);
13297 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
13298 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);
13299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13301 uint64_t ret_ref = (uint64_t)ret_var.inner;
13302 if (ret_var.is_owned) {
13308 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
13309 LDKInMemorySigner this_arg_conv;
13310 this_arg_conv.inner = (void*)(this_arg & (~1));
13311 this_arg_conv.is_owned = false;
13312 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
13313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13315 uint64_t ret_ref = (uint64_t)ret_var.inner;
13316 if (ret_var.is_owned) {
13322 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
13323 LDKInMemorySigner this_arg_conv;
13324 this_arg_conv.inner = (void*)(this_arg & (~1));
13325 this_arg_conv.is_owned = false;
13326 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
13330 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
13331 LDKInMemorySigner this_arg_conv;
13332 this_arg_conv.inner = (void*)(this_arg & (~1));
13333 this_arg_conv.is_owned = false;
13334 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
13338 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
13339 LDKInMemorySigner this_arg_conv;
13340 this_arg_conv.inner = (void*)(this_arg & (~1));
13341 this_arg_conv.is_owned = false;
13342 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
13346 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
13347 LDKInMemorySigner this_arg_conv;
13348 this_arg_conv.inner = (void*)(this_arg & (~1));
13349 this_arg_conv.is_owned = false;
13350 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
13351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13353 uint64_t ret_ref = (uint64_t)ret_var.inner;
13354 if (ret_var.is_owned) {
13360 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
13361 LDKInMemorySigner this_arg_conv;
13362 this_arg_conv.inner = (void*)(this_arg & (~1));
13363 this_arg_conv.is_owned = false;
13364 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
13365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13367 uint64_t ret_ref = (uint64_t)ret_var.inner;
13368 if (ret_var.is_owned) {
13374 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) {
13375 LDKInMemorySigner this_arg_conv;
13376 this_arg_conv.inner = (void*)(this_arg & (~1));
13377 this_arg_conv.is_owned = false;
13378 LDKTransaction spend_tx_ref;
13379 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13380 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13381 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13382 spend_tx_ref.data_is_owned = true;
13383 LDKStaticPaymentOutputDescriptor descriptor_conv;
13384 descriptor_conv.inner = (void*)(descriptor & (~1));
13385 descriptor_conv.is_owned = false;
13386 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13387 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13388 return (uint64_t)ret_conv;
13391 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) {
13392 LDKInMemorySigner this_arg_conv;
13393 this_arg_conv.inner = (void*)(this_arg & (~1));
13394 this_arg_conv.is_owned = false;
13395 LDKTransaction spend_tx_ref;
13396 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13397 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13398 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13399 spend_tx_ref.data_is_owned = true;
13400 LDKDelayedPaymentOutputDescriptor descriptor_conv;
13401 descriptor_conv.inner = (void*)(descriptor & (~1));
13402 descriptor_conv.is_owned = false;
13403 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13404 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13405 return (uint64_t)ret_conv;
13408 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
13409 LDKInMemorySigner this_arg_conv;
13410 this_arg_conv.inner = (void*)(this_arg & (~1));
13411 this_arg_conv.is_owned = false;
13412 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
13413 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
13414 return (uint64_t)ret;
13417 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
13418 LDKInMemorySigner this_arg_conv;
13419 this_arg_conv.inner = (void*)(this_arg & (~1));
13420 this_arg_conv.is_owned = false;
13421 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13422 *ret = InMemorySigner_as_Sign(&this_arg_conv);
13423 return (uint64_t)ret;
13426 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
13427 LDKInMemorySigner obj_conv;
13428 obj_conv.inner = (void*)(obj & (~1));
13429 obj_conv.is_owned = false;
13430 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
13431 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13432 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13433 CVec_u8Z_free(ret_var);
13437 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
13438 LDKu8slice ser_ref;
13439 ser_ref.datalen = *((uint32_t*)ser);
13440 ser_ref.data = (int8_t*)(ser + 4);
13441 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13442 *ret_conv = InMemorySigner_read(ser_ref);
13443 return (uint64_t)ret_conv;
13446 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
13447 LDKKeysManager this_obj_conv;
13448 this_obj_conv.inner = (void*)(this_obj & (~1));
13449 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13450 KeysManager_free(this_obj_conv);
13453 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
13454 unsigned char seed_arr[32];
13455 CHECK(*((uint32_t*)seed) == 32);
13456 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
13457 unsigned char (*seed_ref)[32] = &seed_arr;
13458 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
13459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13461 uint64_t ret_ref = (uint64_t)ret_var.inner;
13462 if (ret_var.is_owned) {
13468 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
13469 LDKKeysManager this_arg_conv;
13470 this_arg_conv.inner = (void*)(this_arg & (~1));
13471 this_arg_conv.is_owned = false;
13472 unsigned char params_arr[32];
13473 CHECK(*((uint32_t*)params) == 32);
13474 memcpy(params_arr, (uint8_t*)(params + 4), 32);
13475 unsigned char (*params_ref)[32] = ¶ms_arr;
13476 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
13477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13479 uint64_t ret_ref = (uint64_t)ret_var.inner;
13480 if (ret_var.is_owned) {
13486 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) {
13487 LDKKeysManager this_arg_conv;
13488 this_arg_conv.inner = (void*)(this_arg & (~1));
13489 this_arg_conv.is_owned = false;
13490 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13491 descriptors_constr.datalen = *((uint32_t*)descriptors);
13492 if (descriptors_constr.datalen > 0)
13493 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13495 descriptors_constr.data = NULL;
13496 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
13497 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13498 uint32_t descriptors_conv_27 = descriptors_vals[b];
13499 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
13500 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
13501 descriptors_constr.data[b] = descriptors_conv_27_conv;
13503 LDKCVec_TxOutZ outputs_constr;
13504 outputs_constr.datalen = *((uint32_t*)outputs);
13505 if (outputs_constr.datalen > 0)
13506 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13508 outputs_constr.data = NULL;
13509 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
13510 for (size_t h = 0; h < outputs_constr.datalen; h++) {
13511 uint32_t outputs_conv_7 = outputs_vals[h];
13512 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
13513 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
13514 outputs_constr.data[h] = outputs_conv_7_conv;
13516 LDKCVec_u8Z change_destination_script_ref;
13517 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
13518 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13519 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
13520 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13521 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
13522 return (uint64_t)ret_conv;
13525 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
13526 LDKKeysManager this_arg_conv;
13527 this_arg_conv.inner = (void*)(this_arg & (~1));
13528 this_arg_conv.is_owned = false;
13529 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
13530 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
13531 return (uint64_t)ret;
13534 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
13535 LDKChannelManager this_obj_conv;
13536 this_obj_conv.inner = (void*)(this_obj & (~1));
13537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13538 ChannelManager_free(this_obj_conv);
13541 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
13542 LDKChainParameters this_obj_conv;
13543 this_obj_conv.inner = (void*)(this_obj & (~1));
13544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13545 ChainParameters_free(this_obj_conv);
13548 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
13549 LDKChainParameters this_ptr_conv;
13550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13551 this_ptr_conv.is_owned = false;
13552 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
13556 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
13557 LDKChainParameters this_ptr_conv;
13558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13559 this_ptr_conv.is_owned = false;
13560 LDKNetwork val_conv = LDKNetwork_from_js(val);
13561 ChainParameters_set_network(&this_ptr_conv, val_conv);
13564 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
13565 LDKChainParameters this_ptr_conv;
13566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13567 this_ptr_conv.is_owned = false;
13568 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
13569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13571 uint64_t ret_ref = (uint64_t)ret_var.inner;
13572 if (ret_var.is_owned) {
13578 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
13579 LDKChainParameters this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 LDKBestBlock val_conv;
13583 val_conv.inner = (void*)(val & (~1));
13584 val_conv.is_owned = (val & 1) || (val == 0);
13585 val_conv = BestBlock_clone(&val_conv);
13586 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
13589 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
13590 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
13591 LDKBestBlock best_block_arg_conv;
13592 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
13593 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
13594 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
13595 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
13596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13598 uint64_t ret_ref = (uint64_t)ret_var.inner;
13599 if (ret_var.is_owned) {
13605 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
13606 LDKChainParameters orig_conv;
13607 orig_conv.inner = (void*)(orig & (~1));
13608 orig_conv.is_owned = false;
13609 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
13610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13612 uint64_t ret_ref = (uint64_t)ret_var.inner;
13613 if (ret_var.is_owned) {
13619 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
13620 LDKChannelCounterparty this_obj_conv;
13621 this_obj_conv.inner = (void*)(this_obj & (~1));
13622 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13623 ChannelCounterparty_free(this_obj_conv);
13626 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
13627 LDKChannelCounterparty this_ptr_conv;
13628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13629 this_ptr_conv.is_owned = false;
13630 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13631 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
13635 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
13636 LDKChannelCounterparty this_ptr_conv;
13637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13638 this_ptr_conv.is_owned = false;
13639 LDKPublicKey val_ref;
13640 CHECK(*((uint32_t*)val) == 33);
13641 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13642 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
13645 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
13646 LDKChannelCounterparty this_ptr_conv;
13647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13648 this_ptr_conv.is_owned = false;
13649 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
13650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13652 uint64_t ret_ref = (uint64_t)ret_var.inner;
13653 if (ret_var.is_owned) {
13659 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
13660 LDKChannelCounterparty this_ptr_conv;
13661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13662 this_ptr_conv.is_owned = false;
13663 LDKInitFeatures val_conv;
13664 val_conv.inner = (void*)(val & (~1));
13665 val_conv.is_owned = (val & 1) || (val == 0);
13666 val_conv = InitFeatures_clone(&val_conv);
13667 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
13670 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
13671 LDKChannelCounterparty this_ptr_conv;
13672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13673 this_ptr_conv.is_owned = false;
13674 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
13678 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
13679 LDKChannelCounterparty this_ptr_conv;
13680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13681 this_ptr_conv.is_owned = false;
13682 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
13685 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
13686 LDKChannelCounterparty orig_conv;
13687 orig_conv.inner = (void*)(orig & (~1));
13688 orig_conv.is_owned = false;
13689 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
13690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13692 uint64_t ret_ref = (uint64_t)ret_var.inner;
13693 if (ret_var.is_owned) {
13699 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
13700 LDKChannelDetails this_obj_conv;
13701 this_obj_conv.inner = (void*)(this_obj & (~1));
13702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13703 ChannelDetails_free(this_obj_conv);
13706 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
13707 LDKChannelDetails this_ptr_conv;
13708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13709 this_ptr_conv.is_owned = false;
13710 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13711 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
13715 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13716 LDKChannelDetails this_ptr_conv;
13717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13718 this_ptr_conv.is_owned = false;
13719 LDKThirtyTwoBytes val_ref;
13720 CHECK(*((uint32_t*)val) == 32);
13721 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13722 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
13725 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
13726 LDKChannelDetails this_ptr_conv;
13727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13728 this_ptr_conv.is_owned = false;
13729 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
13730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13732 uint64_t ret_ref = (uint64_t)ret_var.inner;
13733 if (ret_var.is_owned) {
13739 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
13740 LDKChannelDetails this_ptr_conv;
13741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13742 this_ptr_conv.is_owned = false;
13743 LDKChannelCounterparty val_conv;
13744 val_conv.inner = (void*)(val & (~1));
13745 val_conv.is_owned = (val & 1) || (val == 0);
13746 val_conv = ChannelCounterparty_clone(&val_conv);
13747 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
13750 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
13751 LDKChannelDetails this_ptr_conv;
13752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13753 this_ptr_conv.is_owned = false;
13754 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
13755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13757 uint64_t ret_ref = (uint64_t)ret_var.inner;
13758 if (ret_var.is_owned) {
13764 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
13765 LDKChannelDetails this_ptr_conv;
13766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13767 this_ptr_conv.is_owned = false;
13768 LDKOutPoint val_conv;
13769 val_conv.inner = (void*)(val & (~1));
13770 val_conv.is_owned = (val & 1) || (val == 0);
13771 val_conv = OutPoint_clone(&val_conv);
13772 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
13775 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
13776 LDKChannelDetails this_ptr_conv;
13777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13778 this_ptr_conv.is_owned = false;
13779 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
13780 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
13781 uint64_t ret_ref = (uint64_t)ret_copy;
13785 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
13786 LDKChannelDetails this_ptr_conv;
13787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13788 this_ptr_conv.is_owned = false;
13789 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
13790 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
13793 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
13794 LDKChannelDetails this_ptr_conv;
13795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13796 this_ptr_conv.is_owned = false;
13797 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
13801 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
13802 LDKChannelDetails this_ptr_conv;
13803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13804 this_ptr_conv.is_owned = false;
13805 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
13808 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
13809 LDKChannelDetails this_ptr_conv;
13810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13811 this_ptr_conv.is_owned = false;
13812 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
13813 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
13814 uint64_t ret_ref = (uint64_t)ret_copy;
13818 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
13819 LDKChannelDetails this_ptr_conv;
13820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13821 this_ptr_conv.is_owned = false;
13822 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
13823 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
13826 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
13827 LDKChannelDetails this_ptr_conv;
13828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13829 this_ptr_conv.is_owned = false;
13830 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
13834 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
13835 LDKChannelDetails this_ptr_conv;
13836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13837 this_ptr_conv.is_owned = false;
13838 ChannelDetails_set_user_id(&this_ptr_conv, val);
13841 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
13842 LDKChannelDetails this_ptr_conv;
13843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13844 this_ptr_conv.is_owned = false;
13845 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
13849 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
13850 LDKChannelDetails this_ptr_conv;
13851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13852 this_ptr_conv.is_owned = false;
13853 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
13856 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
13857 LDKChannelDetails this_ptr_conv;
13858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13859 this_ptr_conv.is_owned = false;
13860 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
13864 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
13865 LDKChannelDetails this_ptr_conv;
13866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13867 this_ptr_conv.is_owned = false;
13868 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
13871 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
13872 LDKChannelDetails this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = false;
13875 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13876 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
13877 uint64_t ret_ref = (uint64_t)ret_copy;
13881 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
13882 LDKChannelDetails this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
13886 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
13889 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
13890 LDKChannelDetails this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = false;
13893 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13894 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
13895 uint64_t ret_ref = (uint64_t)ret_copy;
13899 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
13900 LDKChannelDetails this_ptr_conv;
13901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13902 this_ptr_conv.is_owned = false;
13903 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
13904 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
13907 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
13908 LDKChannelDetails this_ptr_conv;
13909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13910 this_ptr_conv.is_owned = false;
13911 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
13915 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
13916 LDKChannelDetails this_ptr_conv;
13917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13918 this_ptr_conv.is_owned = false;
13919 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
13922 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
13923 LDKChannelDetails this_ptr_conv;
13924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13925 this_ptr_conv.is_owned = false;
13926 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
13930 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
13931 LDKChannelDetails this_ptr_conv;
13932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13933 this_ptr_conv.is_owned = false;
13934 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
13937 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
13938 LDKChannelDetails this_ptr_conv;
13939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13940 this_ptr_conv.is_owned = false;
13941 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
13945 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
13946 LDKChannelDetails this_ptr_conv;
13947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13948 this_ptr_conv.is_owned = false;
13949 ChannelDetails_set_is_usable(&this_ptr_conv, val);
13952 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
13953 LDKChannelDetails this_ptr_conv;
13954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13955 this_ptr_conv.is_owned = false;
13956 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
13960 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
13961 LDKChannelDetails this_ptr_conv;
13962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13963 this_ptr_conv.is_owned = false;
13964 ChannelDetails_set_is_public(&this_ptr_conv, val);
13967 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_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) {
13968 LDKThirtyTwoBytes channel_id_arg_ref;
13969 CHECK(*((uint32_t*)channel_id_arg) == 32);
13970 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13971 LDKChannelCounterparty counterparty_arg_conv;
13972 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
13973 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
13974 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
13975 LDKOutPoint funding_txo_arg_conv;
13976 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
13977 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
13978 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
13979 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
13980 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
13981 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
13982 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
13983 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_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);
13984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13986 uint64_t ret_ref = (uint64_t)ret_var.inner;
13987 if (ret_var.is_owned) {
13993 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
13994 LDKChannelDetails orig_conv;
13995 orig_conv.inner = (void*)(orig & (~1));
13996 orig_conv.is_owned = false;
13997 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
13998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14000 uint64_t ret_ref = (uint64_t)ret_var.inner;
14001 if (ret_var.is_owned) {
14007 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
14008 if ((this_ptr & 1) != 0) return;
14009 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
14010 FREE((void*)this_ptr);
14011 PaymentSendFailure_free(this_ptr_conv);
14014 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
14015 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
14016 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14017 *ret_copy = PaymentSendFailure_clone(orig_conv);
14018 uint64_t ret_ref = (uint64_t)ret_copy;
14022 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
14023 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
14024 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14025 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
14026 uint64_t ret_ref = (uint64_t)ret_copy;
14030 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
14031 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14032 a_constr.datalen = *((uint32_t*)a);
14033 if (a_constr.datalen > 0)
14034 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14036 a_constr.data = NULL;
14037 uint32_t* a_vals = (uint32_t*)(a + 4);
14038 for (size_t w = 0; w < a_constr.datalen; w++) {
14039 uint32_t a_conv_22 = a_vals[w];
14040 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14041 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14042 a_constr.data[w] = a_conv_22_conv;
14044 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14045 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
14046 uint64_t ret_ref = (uint64_t)ret_copy;
14050 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
14051 LDKCVec_APIErrorZ a_constr;
14052 a_constr.datalen = *((uint32_t*)a);
14053 if (a_constr.datalen > 0)
14054 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14056 a_constr.data = NULL;
14057 uint32_t* a_vals = (uint32_t*)(a + 4);
14058 for (size_t k = 0; k < a_constr.datalen; k++) {
14059 uint32_t a_conv_10 = a_vals[k];
14060 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
14061 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
14062 a_constr.data[k] = a_conv_10_conv;
14064 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14065 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
14066 uint64_t ret_ref = (uint64_t)ret_copy;
14070 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
14071 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14072 a_constr.datalen = *((uint32_t*)a);
14073 if (a_constr.datalen > 0)
14074 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14076 a_constr.data = NULL;
14077 uint32_t* a_vals = (uint32_t*)(a + 4);
14078 for (size_t w = 0; w < a_constr.datalen; w++) {
14079 uint32_t a_conv_22 = a_vals[w];
14080 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14081 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14082 a_constr.data[w] = a_conv_22_conv;
14084 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14085 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
14086 uint64_t ret_ref = (uint64_t)ret_copy;
14090 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) {
14091 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
14092 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14093 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14094 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14095 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14096 LDKUserConfig config_conv;
14097 config_conv.inner = (void*)(config & (~1));
14098 config_conv.is_owned = (config & 1) || (config == 0);
14099 config_conv = UserConfig_clone(&config_conv);
14100 LDKChainParameters params_conv;
14101 params_conv.inner = (void*)(params & (~1));
14102 params_conv.is_owned = (params & 1) || (params == 0);
14103 params_conv = ChainParameters_clone(¶ms_conv);
14104 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
14105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14107 uint64_t ret_ref = (uint64_t)ret_var.inner;
14108 if (ret_var.is_owned) {
14114 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
14115 LDKChannelManager this_arg_conv;
14116 this_arg_conv.inner = (void*)(this_arg & (~1));
14117 this_arg_conv.is_owned = false;
14118 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
14119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14121 uint64_t ret_ref = (uint64_t)ret_var.inner;
14122 if (ret_var.is_owned) {
14128 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_id, uint32_t override_config) {
14129 LDKChannelManager this_arg_conv;
14130 this_arg_conv.inner = (void*)(this_arg & (~1));
14131 this_arg_conv.is_owned = false;
14132 LDKPublicKey their_network_key_ref;
14133 CHECK(*((uint32_t*)their_network_key) == 33);
14134 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
14135 LDKUserConfig override_config_conv;
14136 override_config_conv.inner = (void*)(override_config & (~1));
14137 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
14138 override_config_conv = UserConfig_clone(&override_config_conv);
14139 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14140 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
14141 return (uint64_t)ret_conv;
14144 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
14145 LDKChannelManager this_arg_conv;
14146 this_arg_conv.inner = (void*)(this_arg & (~1));
14147 this_arg_conv.is_owned = false;
14148 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
14149 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14150 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14151 for (size_t q = 0; q < ret_var.datalen; q++) {
14152 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14153 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14154 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14155 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14156 if (ret_conv_16_var.is_owned) {
14157 ret_conv_16_ref |= 1;
14159 ret_arr_ptr[q] = ret_conv_16_ref;
14161 FREE(ret_var.data);
14165 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
14166 LDKChannelManager this_arg_conv;
14167 this_arg_conv.inner = (void*)(this_arg & (~1));
14168 this_arg_conv.is_owned = false;
14169 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
14170 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14171 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14172 for (size_t q = 0; q < ret_var.datalen; q++) {
14173 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14174 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14175 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14176 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14177 if (ret_conv_16_var.is_owned) {
14178 ret_conv_16_ref |= 1;
14180 ret_arr_ptr[q] = ret_conv_16_ref;
14182 FREE(ret_var.data);
14186 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14187 LDKChannelManager this_arg_conv;
14188 this_arg_conv.inner = (void*)(this_arg & (~1));
14189 this_arg_conv.is_owned = false;
14190 unsigned char channel_id_arr[32];
14191 CHECK(*((uint32_t*)channel_id) == 32);
14192 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14193 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14194 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14195 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
14196 return (uint64_t)ret_conv;
14199 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14200 LDKChannelManager this_arg_conv;
14201 this_arg_conv.inner = (void*)(this_arg & (~1));
14202 this_arg_conv.is_owned = false;
14203 unsigned char channel_id_arr[32];
14204 CHECK(*((uint32_t*)channel_id) == 32);
14205 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14206 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14207 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14208 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
14209 return (uint64_t)ret_conv;
14212 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
14213 LDKChannelManager this_arg_conv;
14214 this_arg_conv.inner = (void*)(this_arg & (~1));
14215 this_arg_conv.is_owned = false;
14216 ChannelManager_force_close_all_channels(&this_arg_conv);
14219 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
14220 LDKChannelManager this_arg_conv;
14221 this_arg_conv.inner = (void*)(this_arg & (~1));
14222 this_arg_conv.is_owned = false;
14223 LDKRoute route_conv;
14224 route_conv.inner = (void*)(route & (~1));
14225 route_conv.is_owned = false;
14226 LDKThirtyTwoBytes payment_hash_ref;
14227 CHECK(*((uint32_t*)payment_hash) == 32);
14228 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14229 LDKThirtyTwoBytes payment_secret_ref;
14230 CHECK(*((uint32_t*)payment_secret) == 32);
14231 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
14232 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14233 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
14234 return (uint64_t)ret_conv;
14237 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
14238 LDKChannelManager this_arg_conv;
14239 this_arg_conv.inner = (void*)(this_arg & (~1));
14240 this_arg_conv.is_owned = false;
14241 unsigned char temporary_channel_id_arr[32];
14242 CHECK(*((uint32_t*)temporary_channel_id) == 32);
14243 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
14244 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
14245 LDKTransaction funding_transaction_ref;
14246 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
14247 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
14248 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
14249 funding_transaction_ref.data_is_owned = true;
14250 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14251 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
14252 return (uint64_t)ret_conv;
14255 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
14256 LDKChannelManager this_arg_conv;
14257 this_arg_conv.inner = (void*)(this_arg & (~1));
14258 this_arg_conv.is_owned = false;
14259 LDKThreeBytes rgb_ref;
14260 CHECK(*((uint32_t*)rgb) == 3);
14261 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
14262 LDKThirtyTwoBytes alias_ref;
14263 CHECK(*((uint32_t*)alias) == 32);
14264 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
14265 LDKCVec_NetAddressZ addresses_constr;
14266 addresses_constr.datalen = *((uint32_t*)addresses);
14267 if (addresses_constr.datalen > 0)
14268 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14270 addresses_constr.data = NULL;
14271 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
14272 for (size_t m = 0; m < addresses_constr.datalen; m++) {
14273 uint32_t addresses_conv_12 = addresses_vals[m];
14274 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
14275 addresses_constr.data[m] = addresses_conv_12_conv;
14277 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
14280 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
14281 LDKChannelManager this_arg_conv;
14282 this_arg_conv.inner = (void*)(this_arg & (~1));
14283 this_arg_conv.is_owned = false;
14284 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
14287 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
14288 LDKChannelManager this_arg_conv;
14289 this_arg_conv.inner = (void*)(this_arg & (~1));
14290 this_arg_conv.is_owned = false;
14291 ChannelManager_timer_tick_occurred(&this_arg_conv);
14294 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
14295 LDKChannelManager this_arg_conv;
14296 this_arg_conv.inner = (void*)(this_arg & (~1));
14297 this_arg_conv.is_owned = false;
14298 unsigned char payment_hash_arr[32];
14299 CHECK(*((uint32_t*)payment_hash) == 32);
14300 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
14301 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14302 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
14306 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
14307 LDKChannelManager this_arg_conv;
14308 this_arg_conv.inner = (void*)(this_arg & (~1));
14309 this_arg_conv.is_owned = false;
14310 LDKThirtyTwoBytes payment_preimage_ref;
14311 CHECK(*((uint32_t*)payment_preimage) == 32);
14312 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
14313 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
14317 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
14318 LDKChannelManager this_arg_conv;
14319 this_arg_conv.inner = (void*)(this_arg & (~1));
14320 this_arg_conv.is_owned = false;
14321 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14322 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
14326 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
14327 LDKChannelManager this_arg_conv;
14328 this_arg_conv.inner = (void*)(this_arg & (~1));
14329 this_arg_conv.is_owned = false;
14330 LDKOutPoint funding_txo_conv;
14331 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14332 funding_txo_conv.is_owned = false;
14333 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
14336 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) {
14337 LDKChannelManager this_arg_conv;
14338 this_arg_conv.inner = (void*)(this_arg & (~1));
14339 this_arg_conv.is_owned = false;
14340 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14341 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14342 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
14343 return (uint64_t)ret_ref;
14346 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) {
14347 LDKChannelManager this_arg_conv;
14348 this_arg_conv.inner = (void*)(this_arg & (~1));
14349 this_arg_conv.is_owned = false;
14350 LDKThirtyTwoBytes payment_hash_ref;
14351 CHECK(*((uint32_t*)payment_hash) == 32);
14352 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14353 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14354 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14355 *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);
14356 return (uint64_t)ret_conv;
14359 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
14360 LDKChannelManager this_arg_conv;
14361 this_arg_conv.inner = (void*)(this_arg & (~1));
14362 this_arg_conv.is_owned = false;
14363 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14364 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
14365 return (uint64_t)ret;
14368 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
14369 LDKChannelManager this_arg_conv;
14370 this_arg_conv.inner = (void*)(this_arg & (~1));
14371 this_arg_conv.is_owned = false;
14372 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14373 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
14374 return (uint64_t)ret;
14377 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
14378 LDKChannelManager this_arg_conv;
14379 this_arg_conv.inner = (void*)(this_arg & (~1));
14380 this_arg_conv.is_owned = false;
14381 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14382 *ret = ChannelManager_as_Listen(&this_arg_conv);
14383 return (uint64_t)ret;
14386 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
14387 LDKChannelManager this_arg_conv;
14388 this_arg_conv.inner = (void*)(this_arg & (~1));
14389 this_arg_conv.is_owned = false;
14390 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14391 *ret = ChannelManager_as_Confirm(&this_arg_conv);
14392 return (uint64_t)ret;
14395 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
14396 LDKChannelManager this_arg_conv;
14397 this_arg_conv.inner = (void*)(this_arg & (~1));
14398 this_arg_conv.is_owned = false;
14399 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
14403 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
14404 LDKChannelManager this_arg_conv;
14405 this_arg_conv.inner = (void*)(this_arg & (~1));
14406 this_arg_conv.is_owned = false;
14407 ChannelManager_await_persistable_update(&this_arg_conv);
14410 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
14411 LDKChannelManager this_arg_conv;
14412 this_arg_conv.inner = (void*)(this_arg & (~1));
14413 this_arg_conv.is_owned = false;
14414 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
14415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14417 uint64_t ret_ref = (uint64_t)ret_var.inner;
14418 if (ret_var.is_owned) {
14424 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
14425 LDKChannelManager this_arg_conv;
14426 this_arg_conv.inner = (void*)(this_arg & (~1));
14427 this_arg_conv.is_owned = false;
14428 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14429 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
14430 return (uint64_t)ret;
14433 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
14434 LDKChannelManager obj_conv;
14435 obj_conv.inner = (void*)(obj & (~1));
14436 obj_conv.is_owned = false;
14437 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
14438 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14439 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14440 CVec_u8Z_free(ret_var);
14444 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
14445 LDKChannelManagerReadArgs this_obj_conv;
14446 this_obj_conv.inner = (void*)(this_obj & (~1));
14447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14448 ChannelManagerReadArgs_free(this_obj_conv);
14451 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
14452 LDKChannelManagerReadArgs this_ptr_conv;
14453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14454 this_ptr_conv.is_owned = false;
14455 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
14459 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
14460 LDKChannelManagerReadArgs this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
14464 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
14467 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
14468 LDKChannelManagerReadArgs this_ptr_conv;
14469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14470 this_ptr_conv.is_owned = false;
14471 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
14475 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
14476 LDKChannelManagerReadArgs this_ptr_conv;
14477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14478 this_ptr_conv.is_owned = false;
14479 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
14480 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
14483 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
14484 LDKChannelManagerReadArgs this_ptr_conv;
14485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14486 this_ptr_conv.is_owned = false;
14487 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
14491 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
14492 LDKChannelManagerReadArgs this_ptr_conv;
14493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14494 this_ptr_conv.is_owned = false;
14495 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
14496 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
14499 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
14500 LDKChannelManagerReadArgs this_ptr_conv;
14501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14502 this_ptr_conv.is_owned = false;
14503 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
14507 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
14508 LDKChannelManagerReadArgs this_ptr_conv;
14509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14510 this_ptr_conv.is_owned = false;
14511 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
14512 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
14515 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
14516 LDKChannelManagerReadArgs this_ptr_conv;
14517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14518 this_ptr_conv.is_owned = false;
14519 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
14523 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
14524 LDKChannelManagerReadArgs this_ptr_conv;
14525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14526 this_ptr_conv.is_owned = false;
14527 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
14528 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
14531 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
14532 LDKChannelManagerReadArgs this_ptr_conv;
14533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14534 this_ptr_conv.is_owned = false;
14535 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
14536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14538 uint64_t ret_ref = (uint64_t)ret_var.inner;
14539 if (ret_var.is_owned) {
14545 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
14546 LDKChannelManagerReadArgs this_ptr_conv;
14547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14548 this_ptr_conv.is_owned = false;
14549 LDKUserConfig val_conv;
14550 val_conv.inner = (void*)(val & (~1));
14551 val_conv.is_owned = (val & 1) || (val == 0);
14552 val_conv = UserConfig_clone(&val_conv);
14553 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
14556 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) {
14557 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14558 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14559 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14560 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14561 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14562 LDKUserConfig default_config_conv;
14563 default_config_conv.inner = (void*)(default_config & (~1));
14564 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
14565 default_config_conv = UserConfig_clone(&default_config_conv);
14566 LDKCVec_ChannelMonitorZ channel_monitors_constr;
14567 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
14568 if (channel_monitors_constr.datalen > 0)
14569 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
14571 channel_monitors_constr.data = NULL;
14572 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
14573 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
14574 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
14575 LDKChannelMonitor channel_monitors_conv_16_conv;
14576 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
14577 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
14578 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
14580 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);
14581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14583 uint64_t ret_ref = (uint64_t)ret_var.inner;
14584 if (ret_var.is_owned) {
14590 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
14591 LDKu8slice ser_ref;
14592 ser_ref.datalen = *((uint32_t*)ser);
14593 ser_ref.data = (int8_t*)(ser + 4);
14594 LDKChannelManagerReadArgs arg_conv;
14595 arg_conv.inner = (void*)(arg & (~1));
14596 arg_conv.is_owned = (arg & 1) || (arg == 0);
14597 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
14598 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14599 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
14600 return (uint64_t)ret_conv;
14603 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
14604 LDKDecodeError this_obj_conv;
14605 this_obj_conv.inner = (void*)(this_obj & (~1));
14606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14607 DecodeError_free(this_obj_conv);
14610 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
14611 LDKDecodeError orig_conv;
14612 orig_conv.inner = (void*)(orig & (~1));
14613 orig_conv.is_owned = false;
14614 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
14615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14617 uint64_t ret_ref = (uint64_t)ret_var.inner;
14618 if (ret_var.is_owned) {
14624 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
14625 LDKInit this_obj_conv;
14626 this_obj_conv.inner = (void*)(this_obj & (~1));
14627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14628 Init_free(this_obj_conv);
14631 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
14632 LDKInit this_ptr_conv;
14633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14634 this_ptr_conv.is_owned = false;
14635 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
14636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14638 uint64_t ret_ref = (uint64_t)ret_var.inner;
14639 if (ret_var.is_owned) {
14645 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
14646 LDKInit this_ptr_conv;
14647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14648 this_ptr_conv.is_owned = false;
14649 LDKInitFeatures val_conv;
14650 val_conv.inner = (void*)(val & (~1));
14651 val_conv.is_owned = (val & 1) || (val == 0);
14652 val_conv = InitFeatures_clone(&val_conv);
14653 Init_set_features(&this_ptr_conv, val_conv);
14656 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
14657 LDKInitFeatures features_arg_conv;
14658 features_arg_conv.inner = (void*)(features_arg & (~1));
14659 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14660 features_arg_conv = InitFeatures_clone(&features_arg_conv);
14661 LDKInit ret_var = Init_new(features_arg_conv);
14662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14664 uint64_t ret_ref = (uint64_t)ret_var.inner;
14665 if (ret_var.is_owned) {
14671 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
14673 orig_conv.inner = (void*)(orig & (~1));
14674 orig_conv.is_owned = false;
14675 LDKInit ret_var = Init_clone(&orig_conv);
14676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14678 uint64_t ret_ref = (uint64_t)ret_var.inner;
14679 if (ret_var.is_owned) {
14685 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
14686 LDKErrorMessage this_obj_conv;
14687 this_obj_conv.inner = (void*)(this_obj & (~1));
14688 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14689 ErrorMessage_free(this_obj_conv);
14692 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
14693 LDKErrorMessage this_ptr_conv;
14694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14695 this_ptr_conv.is_owned = false;
14696 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14697 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
14701 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14702 LDKErrorMessage this_ptr_conv;
14703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14704 this_ptr_conv.is_owned = false;
14705 LDKThirtyTwoBytes val_ref;
14706 CHECK(*((uint32_t*)val) == 32);
14707 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14708 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
14711 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
14712 LDKErrorMessage this_ptr_conv;
14713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14714 this_ptr_conv.is_owned = false;
14715 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
14716 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14721 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
14722 LDKErrorMessage this_ptr_conv;
14723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14724 this_ptr_conv.is_owned = false;
14725 LDKStr val_conv = str_ref_to_owned_c(val);
14726 ErrorMessage_set_data(&this_ptr_conv, val_conv);
14729 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
14730 LDKThirtyTwoBytes channel_id_arg_ref;
14731 CHECK(*((uint32_t*)channel_id_arg) == 32);
14732 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14733 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
14734 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
14735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14737 uint64_t ret_ref = (uint64_t)ret_var.inner;
14738 if (ret_var.is_owned) {
14744 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
14745 LDKErrorMessage orig_conv;
14746 orig_conv.inner = (void*)(orig & (~1));
14747 orig_conv.is_owned = false;
14748 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
14749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14751 uint64_t ret_ref = (uint64_t)ret_var.inner;
14752 if (ret_var.is_owned) {
14758 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
14759 LDKPing this_obj_conv;
14760 this_obj_conv.inner = (void*)(this_obj & (~1));
14761 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14762 Ping_free(this_obj_conv);
14765 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
14766 LDKPing this_ptr_conv;
14767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14768 this_ptr_conv.is_owned = false;
14769 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
14773 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
14774 LDKPing this_ptr_conv;
14775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14776 this_ptr_conv.is_owned = false;
14777 Ping_set_ponglen(&this_ptr_conv, val);
14780 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
14781 LDKPing this_ptr_conv;
14782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14783 this_ptr_conv.is_owned = false;
14784 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
14788 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
14789 LDKPing this_ptr_conv;
14790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14791 this_ptr_conv.is_owned = false;
14792 Ping_set_byteslen(&this_ptr_conv, val);
14795 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
14796 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
14797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14799 uint64_t ret_ref = (uint64_t)ret_var.inner;
14800 if (ret_var.is_owned) {
14806 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
14808 orig_conv.inner = (void*)(orig & (~1));
14809 orig_conv.is_owned = false;
14810 LDKPing ret_var = Ping_clone(&orig_conv);
14811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14813 uint64_t ret_ref = (uint64_t)ret_var.inner;
14814 if (ret_var.is_owned) {
14820 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
14821 LDKPong this_obj_conv;
14822 this_obj_conv.inner = (void*)(this_obj & (~1));
14823 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14824 Pong_free(this_obj_conv);
14827 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
14828 LDKPong this_ptr_conv;
14829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14830 this_ptr_conv.is_owned = false;
14831 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
14835 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
14836 LDKPong this_ptr_conv;
14837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14838 this_ptr_conv.is_owned = false;
14839 Pong_set_byteslen(&this_ptr_conv, val);
14842 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
14843 LDKPong ret_var = Pong_new(byteslen_arg);
14844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14846 uint64_t ret_ref = (uint64_t)ret_var.inner;
14847 if (ret_var.is_owned) {
14853 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
14855 orig_conv.inner = (void*)(orig & (~1));
14856 orig_conv.is_owned = false;
14857 LDKPong ret_var = Pong_clone(&orig_conv);
14858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14860 uint64_t ret_ref = (uint64_t)ret_var.inner;
14861 if (ret_var.is_owned) {
14867 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
14868 LDKOpenChannel this_obj_conv;
14869 this_obj_conv.inner = (void*)(this_obj & (~1));
14870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14871 OpenChannel_free(this_obj_conv);
14874 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
14875 LDKOpenChannel this_ptr_conv;
14876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14877 this_ptr_conv.is_owned = false;
14878 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14879 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
14883 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14884 LDKOpenChannel this_ptr_conv;
14885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14886 this_ptr_conv.is_owned = false;
14887 LDKThirtyTwoBytes val_ref;
14888 CHECK(*((uint32_t*)val) == 32);
14889 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14890 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
14893 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
14894 LDKOpenChannel this_ptr_conv;
14895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14896 this_ptr_conv.is_owned = false;
14897 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14898 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
14902 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
14903 LDKOpenChannel this_ptr_conv;
14904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14905 this_ptr_conv.is_owned = false;
14906 LDKThirtyTwoBytes val_ref;
14907 CHECK(*((uint32_t*)val) == 32);
14908 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14909 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
14912 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
14913 LDKOpenChannel this_ptr_conv;
14914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14915 this_ptr_conv.is_owned = false;
14916 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
14920 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
14921 LDKOpenChannel this_ptr_conv;
14922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14923 this_ptr_conv.is_owned = false;
14924 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
14927 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
14928 LDKOpenChannel this_ptr_conv;
14929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14930 this_ptr_conv.is_owned = false;
14931 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
14935 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
14936 LDKOpenChannel this_ptr_conv;
14937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14938 this_ptr_conv.is_owned = false;
14939 OpenChannel_set_push_msat(&this_ptr_conv, val);
14942 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
14943 LDKOpenChannel this_ptr_conv;
14944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14945 this_ptr_conv.is_owned = false;
14946 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
14950 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
14951 LDKOpenChannel this_ptr_conv;
14952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14953 this_ptr_conv.is_owned = false;
14954 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
14957 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
14958 LDKOpenChannel this_ptr_conv;
14959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14960 this_ptr_conv.is_owned = false;
14961 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
14965 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
14966 LDKOpenChannel this_ptr_conv;
14967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14968 this_ptr_conv.is_owned = false;
14969 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
14972 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
14973 LDKOpenChannel this_ptr_conv;
14974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14975 this_ptr_conv.is_owned = false;
14976 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
14980 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
14981 LDKOpenChannel this_ptr_conv;
14982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14983 this_ptr_conv.is_owned = false;
14984 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
14987 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
14988 LDKOpenChannel this_ptr_conv;
14989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14990 this_ptr_conv.is_owned = false;
14991 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
14995 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14996 LDKOpenChannel this_ptr_conv;
14997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14998 this_ptr_conv.is_owned = false;
14999 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15002 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
15003 LDKOpenChannel this_ptr_conv;
15004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15005 this_ptr_conv.is_owned = false;
15006 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
15010 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
15011 LDKOpenChannel this_ptr_conv;
15012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15013 this_ptr_conv.is_owned = false;
15014 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
15017 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
15018 LDKOpenChannel this_ptr_conv;
15019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15020 this_ptr_conv.is_owned = false;
15021 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
15025 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15026 LDKOpenChannel this_ptr_conv;
15027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15028 this_ptr_conv.is_owned = false;
15029 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
15032 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15033 LDKOpenChannel this_ptr_conv;
15034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15035 this_ptr_conv.is_owned = false;
15036 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
15040 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15041 LDKOpenChannel this_ptr_conv;
15042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15043 this_ptr_conv.is_owned = false;
15044 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15047 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
15048 LDKOpenChannel this_ptr_conv;
15049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15050 this_ptr_conv.is_owned = false;
15051 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15052 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15056 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15057 LDKOpenChannel this_ptr_conv;
15058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15059 this_ptr_conv.is_owned = false;
15060 LDKPublicKey val_ref;
15061 CHECK(*((uint32_t*)val) == 33);
15062 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15063 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15066 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
15067 LDKOpenChannel this_ptr_conv;
15068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15069 this_ptr_conv.is_owned = false;
15070 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15071 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15075 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15076 LDKOpenChannel this_ptr_conv;
15077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15078 this_ptr_conv.is_owned = false;
15079 LDKPublicKey val_ref;
15080 CHECK(*((uint32_t*)val) == 33);
15081 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15082 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15085 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
15086 LDKOpenChannel this_ptr_conv;
15087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15088 this_ptr_conv.is_owned = false;
15089 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15090 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15094 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15095 LDKOpenChannel this_ptr_conv;
15096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15097 this_ptr_conv.is_owned = false;
15098 LDKPublicKey val_ref;
15099 CHECK(*((uint32_t*)val) == 33);
15100 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15101 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
15104 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15105 LDKOpenChannel this_ptr_conv;
15106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15107 this_ptr_conv.is_owned = false;
15108 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15109 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15113 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15114 LDKOpenChannel this_ptr_conv;
15115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15116 this_ptr_conv.is_owned = false;
15117 LDKPublicKey val_ref;
15118 CHECK(*((uint32_t*)val) == 33);
15119 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15120 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15123 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
15124 LDKOpenChannel this_ptr_conv;
15125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15126 this_ptr_conv.is_owned = false;
15127 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15128 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15132 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15133 LDKOpenChannel this_ptr_conv;
15134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15135 this_ptr_conv.is_owned = false;
15136 LDKPublicKey val_ref;
15137 CHECK(*((uint32_t*)val) == 33);
15138 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15139 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15142 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15143 LDKOpenChannel this_ptr_conv;
15144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15145 this_ptr_conv.is_owned = false;
15146 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15147 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15151 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15152 LDKOpenChannel this_ptr_conv;
15153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15154 this_ptr_conv.is_owned = false;
15155 LDKPublicKey val_ref;
15156 CHECK(*((uint32_t*)val) == 33);
15157 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15158 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15161 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
15162 LDKOpenChannel this_ptr_conv;
15163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15164 this_ptr_conv.is_owned = false;
15165 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
15169 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
15170 LDKOpenChannel this_ptr_conv;
15171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15172 this_ptr_conv.is_owned = false;
15173 OpenChannel_set_channel_flags(&this_ptr_conv, val);
15176 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
15177 LDKOpenChannel orig_conv;
15178 orig_conv.inner = (void*)(orig & (~1));
15179 orig_conv.is_owned = false;
15180 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
15181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15183 uint64_t ret_ref = (uint64_t)ret_var.inner;
15184 if (ret_var.is_owned) {
15190 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
15191 LDKAcceptChannel this_obj_conv;
15192 this_obj_conv.inner = (void*)(this_obj & (~1));
15193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15194 AcceptChannel_free(this_obj_conv);
15197 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
15198 LDKAcceptChannel this_ptr_conv;
15199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15200 this_ptr_conv.is_owned = false;
15201 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15202 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
15206 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15207 LDKAcceptChannel this_ptr_conv;
15208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15209 this_ptr_conv.is_owned = false;
15210 LDKThirtyTwoBytes val_ref;
15211 CHECK(*((uint32_t*)val) == 32);
15212 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15213 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
15216 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
15217 LDKAcceptChannel this_ptr_conv;
15218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15219 this_ptr_conv.is_owned = false;
15220 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
15224 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
15225 LDKAcceptChannel this_ptr_conv;
15226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15227 this_ptr_conv.is_owned = false;
15228 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
15231 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
15232 LDKAcceptChannel this_ptr_conv;
15233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15234 this_ptr_conv.is_owned = false;
15235 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
15239 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
15240 LDKAcceptChannel this_ptr_conv;
15241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15242 this_ptr_conv.is_owned = false;
15243 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15246 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
15247 LDKAcceptChannel this_ptr_conv;
15248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15249 this_ptr_conv.is_owned = false;
15250 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
15254 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
15255 LDKAcceptChannel this_ptr_conv;
15256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15257 this_ptr_conv.is_owned = false;
15258 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
15261 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
15262 LDKAcceptChannel this_ptr_conv;
15263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15264 this_ptr_conv.is_owned = false;
15265 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
15269 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
15270 LDKAcceptChannel this_ptr_conv;
15271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15272 this_ptr_conv.is_owned = false;
15273 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15276 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
15277 LDKAcceptChannel this_ptr_conv;
15278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15279 this_ptr_conv.is_owned = false;
15280 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
15284 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
15285 LDKAcceptChannel this_ptr_conv;
15286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15287 this_ptr_conv.is_owned = false;
15288 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
15291 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
15292 LDKAcceptChannel this_ptr_conv;
15293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15294 this_ptr_conv.is_owned = false;
15295 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
15299 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15300 LDKAcceptChannel this_ptr_conv;
15301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15302 this_ptr_conv.is_owned = false;
15303 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
15306 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15307 LDKAcceptChannel this_ptr_conv;
15308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15309 this_ptr_conv.is_owned = false;
15310 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
15314 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15315 LDKAcceptChannel this_ptr_conv;
15316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15317 this_ptr_conv.is_owned = false;
15318 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15321 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
15322 LDKAcceptChannel this_ptr_conv;
15323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15324 this_ptr_conv.is_owned = false;
15325 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15326 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15330 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15331 LDKAcceptChannel this_ptr_conv;
15332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15333 this_ptr_conv.is_owned = false;
15334 LDKPublicKey val_ref;
15335 CHECK(*((uint32_t*)val) == 33);
15336 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15337 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15340 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
15341 LDKAcceptChannel this_ptr_conv;
15342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15343 this_ptr_conv.is_owned = false;
15344 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15345 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15349 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15350 LDKAcceptChannel this_ptr_conv;
15351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15352 this_ptr_conv.is_owned = false;
15353 LDKPublicKey val_ref;
15354 CHECK(*((uint32_t*)val) == 33);
15355 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15356 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15359 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
15360 LDKAcceptChannel this_ptr_conv;
15361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15362 this_ptr_conv.is_owned = false;
15363 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15364 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15368 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15369 LDKAcceptChannel this_ptr_conv;
15370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15371 this_ptr_conv.is_owned = false;
15372 LDKPublicKey val_ref;
15373 CHECK(*((uint32_t*)val) == 33);
15374 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15375 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
15378 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15379 LDKAcceptChannel this_ptr_conv;
15380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15381 this_ptr_conv.is_owned = false;
15382 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15383 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15387 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15388 LDKAcceptChannel this_ptr_conv;
15389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15390 this_ptr_conv.is_owned = false;
15391 LDKPublicKey val_ref;
15392 CHECK(*((uint32_t*)val) == 33);
15393 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15394 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15397 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
15398 LDKAcceptChannel this_ptr_conv;
15399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15400 this_ptr_conv.is_owned = false;
15401 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15402 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15406 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15407 LDKAcceptChannel this_ptr_conv;
15408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15409 this_ptr_conv.is_owned = false;
15410 LDKPublicKey val_ref;
15411 CHECK(*((uint32_t*)val) == 33);
15412 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15413 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15416 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15417 LDKAcceptChannel this_ptr_conv;
15418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15419 this_ptr_conv.is_owned = false;
15420 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15421 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15425 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15426 LDKAcceptChannel this_ptr_conv;
15427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15428 this_ptr_conv.is_owned = false;
15429 LDKPublicKey val_ref;
15430 CHECK(*((uint32_t*)val) == 33);
15431 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15432 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15435 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
15436 LDKAcceptChannel orig_conv;
15437 orig_conv.inner = (void*)(orig & (~1));
15438 orig_conv.is_owned = false;
15439 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
15440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15442 uint64_t ret_ref = (uint64_t)ret_var.inner;
15443 if (ret_var.is_owned) {
15449 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
15450 LDKFundingCreated this_obj_conv;
15451 this_obj_conv.inner = (void*)(this_obj & (~1));
15452 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15453 FundingCreated_free(this_obj_conv);
15456 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
15457 LDKFundingCreated this_ptr_conv;
15458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15459 this_ptr_conv.is_owned = false;
15460 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15461 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
15465 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15466 LDKFundingCreated this_ptr_conv;
15467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15468 this_ptr_conv.is_owned = false;
15469 LDKThirtyTwoBytes val_ref;
15470 CHECK(*((uint32_t*)val) == 32);
15471 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15472 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
15475 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
15476 LDKFundingCreated this_ptr_conv;
15477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15478 this_ptr_conv.is_owned = false;
15479 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15480 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
15484 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
15485 LDKFundingCreated this_ptr_conv;
15486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15487 this_ptr_conv.is_owned = false;
15488 LDKThirtyTwoBytes val_ref;
15489 CHECK(*((uint32_t*)val) == 32);
15490 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15491 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
15494 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
15495 LDKFundingCreated this_ptr_conv;
15496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15497 this_ptr_conv.is_owned = false;
15498 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
15502 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
15503 LDKFundingCreated this_ptr_conv;
15504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15505 this_ptr_conv.is_owned = false;
15506 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
15509 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
15510 LDKFundingCreated this_ptr_conv;
15511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15512 this_ptr_conv.is_owned = false;
15513 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15514 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
15518 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
15519 LDKFundingCreated this_ptr_conv;
15520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15521 this_ptr_conv.is_owned = false;
15522 LDKSignature val_ref;
15523 CHECK(*((uint32_t*)val) == 64);
15524 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15525 FundingCreated_set_signature(&this_ptr_conv, val_ref);
15528 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) {
15529 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
15530 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
15531 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
15532 LDKThirtyTwoBytes funding_txid_arg_ref;
15533 CHECK(*((uint32_t*)funding_txid_arg) == 32);
15534 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
15535 LDKSignature signature_arg_ref;
15536 CHECK(*((uint32_t*)signature_arg) == 64);
15537 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15538 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
15539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15541 uint64_t ret_ref = (uint64_t)ret_var.inner;
15542 if (ret_var.is_owned) {
15548 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
15549 LDKFundingCreated orig_conv;
15550 orig_conv.inner = (void*)(orig & (~1));
15551 orig_conv.is_owned = false;
15552 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
15553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15555 uint64_t ret_ref = (uint64_t)ret_var.inner;
15556 if (ret_var.is_owned) {
15562 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
15563 LDKFundingSigned this_obj_conv;
15564 this_obj_conv.inner = (void*)(this_obj & (~1));
15565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15566 FundingSigned_free(this_obj_conv);
15569 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
15570 LDKFundingSigned this_ptr_conv;
15571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15572 this_ptr_conv.is_owned = false;
15573 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15574 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
15578 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15579 LDKFundingSigned this_ptr_conv;
15580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15581 this_ptr_conv.is_owned = false;
15582 LDKThirtyTwoBytes val_ref;
15583 CHECK(*((uint32_t*)val) == 32);
15584 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15585 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
15588 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
15589 LDKFundingSigned this_ptr_conv;
15590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15591 this_ptr_conv.is_owned = false;
15592 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15593 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
15597 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
15598 LDKFundingSigned this_ptr_conv;
15599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15600 this_ptr_conv.is_owned = false;
15601 LDKSignature val_ref;
15602 CHECK(*((uint32_t*)val) == 64);
15603 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15604 FundingSigned_set_signature(&this_ptr_conv, val_ref);
15607 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
15608 LDKThirtyTwoBytes channel_id_arg_ref;
15609 CHECK(*((uint32_t*)channel_id_arg) == 32);
15610 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15611 LDKSignature signature_arg_ref;
15612 CHECK(*((uint32_t*)signature_arg) == 64);
15613 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15614 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
15615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15617 uint64_t ret_ref = (uint64_t)ret_var.inner;
15618 if (ret_var.is_owned) {
15624 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
15625 LDKFundingSigned orig_conv;
15626 orig_conv.inner = (void*)(orig & (~1));
15627 orig_conv.is_owned = false;
15628 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
15629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15631 uint64_t ret_ref = (uint64_t)ret_var.inner;
15632 if (ret_var.is_owned) {
15638 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
15639 LDKFundingLocked this_obj_conv;
15640 this_obj_conv.inner = (void*)(this_obj & (~1));
15641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15642 FundingLocked_free(this_obj_conv);
15645 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
15646 LDKFundingLocked this_ptr_conv;
15647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15648 this_ptr_conv.is_owned = false;
15649 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15650 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
15654 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15655 LDKFundingLocked this_ptr_conv;
15656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15657 this_ptr_conv.is_owned = false;
15658 LDKThirtyTwoBytes val_ref;
15659 CHECK(*((uint32_t*)val) == 32);
15660 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15661 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
15664 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
15665 LDKFundingLocked this_ptr_conv;
15666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15667 this_ptr_conv.is_owned = false;
15668 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15669 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15673 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15674 LDKFundingLocked this_ptr_conv;
15675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15676 this_ptr_conv.is_owned = false;
15677 LDKPublicKey val_ref;
15678 CHECK(*((uint32_t*)val) == 33);
15679 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15680 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
15683 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
15684 LDKThirtyTwoBytes channel_id_arg_ref;
15685 CHECK(*((uint32_t*)channel_id_arg) == 32);
15686 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15687 LDKPublicKey next_per_commitment_point_arg_ref;
15688 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
15689 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
15690 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
15691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15693 uint64_t ret_ref = (uint64_t)ret_var.inner;
15694 if (ret_var.is_owned) {
15700 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
15701 LDKFundingLocked orig_conv;
15702 orig_conv.inner = (void*)(orig & (~1));
15703 orig_conv.is_owned = false;
15704 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
15705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15707 uint64_t ret_ref = (uint64_t)ret_var.inner;
15708 if (ret_var.is_owned) {
15714 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
15715 LDKShutdown this_obj_conv;
15716 this_obj_conv.inner = (void*)(this_obj & (~1));
15717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15718 Shutdown_free(this_obj_conv);
15721 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
15722 LDKShutdown this_ptr_conv;
15723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15724 this_ptr_conv.is_owned = false;
15725 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15726 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
15730 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15731 LDKShutdown this_ptr_conv;
15732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15733 this_ptr_conv.is_owned = false;
15734 LDKThirtyTwoBytes val_ref;
15735 CHECK(*((uint32_t*)val) == 32);
15736 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15737 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
15740 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
15741 LDKShutdown this_ptr_conv;
15742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15743 this_ptr_conv.is_owned = false;
15744 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
15745 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15746 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15750 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
15751 LDKShutdown this_ptr_conv;
15752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15753 this_ptr_conv.is_owned = false;
15754 LDKCVec_u8Z val_ref;
15755 val_ref.datalen = *((uint32_t*)val);
15756 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15757 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15758 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
15761 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
15762 LDKThirtyTwoBytes channel_id_arg_ref;
15763 CHECK(*((uint32_t*)channel_id_arg) == 32);
15764 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15765 LDKCVec_u8Z scriptpubkey_arg_ref;
15766 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
15767 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15768 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
15769 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
15770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15772 uint64_t ret_ref = (uint64_t)ret_var.inner;
15773 if (ret_var.is_owned) {
15779 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
15780 LDKShutdown orig_conv;
15781 orig_conv.inner = (void*)(orig & (~1));
15782 orig_conv.is_owned = false;
15783 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
15784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15786 uint64_t ret_ref = (uint64_t)ret_var.inner;
15787 if (ret_var.is_owned) {
15793 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
15794 LDKClosingSigned this_obj_conv;
15795 this_obj_conv.inner = (void*)(this_obj & (~1));
15796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15797 ClosingSigned_free(this_obj_conv);
15800 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
15801 LDKClosingSigned this_ptr_conv;
15802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15803 this_ptr_conv.is_owned = false;
15804 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15805 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
15809 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15810 LDKClosingSigned this_ptr_conv;
15811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15812 this_ptr_conv.is_owned = false;
15813 LDKThirtyTwoBytes val_ref;
15814 CHECK(*((uint32_t*)val) == 32);
15815 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15816 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
15819 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
15820 LDKClosingSigned this_ptr_conv;
15821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15822 this_ptr_conv.is_owned = false;
15823 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
15827 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
15828 LDKClosingSigned this_ptr_conv;
15829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15830 this_ptr_conv.is_owned = false;
15831 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
15834 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
15835 LDKClosingSigned this_ptr_conv;
15836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15837 this_ptr_conv.is_owned = false;
15838 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15839 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
15843 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
15844 LDKClosingSigned this_ptr_conv;
15845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15846 this_ptr_conv.is_owned = false;
15847 LDKSignature val_ref;
15848 CHECK(*((uint32_t*)val) == 64);
15849 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15850 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
15853 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
15854 LDKThirtyTwoBytes channel_id_arg_ref;
15855 CHECK(*((uint32_t*)channel_id_arg) == 32);
15856 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15857 LDKSignature signature_arg_ref;
15858 CHECK(*((uint32_t*)signature_arg) == 64);
15859 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15860 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
15861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15863 uint64_t ret_ref = (uint64_t)ret_var.inner;
15864 if (ret_var.is_owned) {
15870 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
15871 LDKClosingSigned orig_conv;
15872 orig_conv.inner = (void*)(orig & (~1));
15873 orig_conv.is_owned = false;
15874 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
15875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15877 uint64_t ret_ref = (uint64_t)ret_var.inner;
15878 if (ret_var.is_owned) {
15884 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
15885 LDKUpdateAddHTLC this_obj_conv;
15886 this_obj_conv.inner = (void*)(this_obj & (~1));
15887 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15888 UpdateAddHTLC_free(this_obj_conv);
15891 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
15892 LDKUpdateAddHTLC this_ptr_conv;
15893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15894 this_ptr_conv.is_owned = false;
15895 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15896 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
15900 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15901 LDKUpdateAddHTLC this_ptr_conv;
15902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15903 this_ptr_conv.is_owned = false;
15904 LDKThirtyTwoBytes val_ref;
15905 CHECK(*((uint32_t*)val) == 32);
15906 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15907 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
15910 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
15911 LDKUpdateAddHTLC this_ptr_conv;
15912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15913 this_ptr_conv.is_owned = false;
15914 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
15918 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
15919 LDKUpdateAddHTLC this_ptr_conv;
15920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15921 this_ptr_conv.is_owned = false;
15922 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
15925 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
15926 LDKUpdateAddHTLC this_ptr_conv;
15927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15928 this_ptr_conv.is_owned = false;
15929 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
15933 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
15934 LDKUpdateAddHTLC this_ptr_conv;
15935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15936 this_ptr_conv.is_owned = false;
15937 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
15940 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
15941 LDKUpdateAddHTLC this_ptr_conv;
15942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15943 this_ptr_conv.is_owned = false;
15944 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15945 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
15949 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
15950 LDKUpdateAddHTLC this_ptr_conv;
15951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15952 this_ptr_conv.is_owned = false;
15953 LDKThirtyTwoBytes val_ref;
15954 CHECK(*((uint32_t*)val) == 32);
15955 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15956 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
15959 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
15960 LDKUpdateAddHTLC this_ptr_conv;
15961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15962 this_ptr_conv.is_owned = false;
15963 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
15967 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
15968 LDKUpdateAddHTLC this_ptr_conv;
15969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15970 this_ptr_conv.is_owned = false;
15971 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
15974 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
15975 LDKUpdateAddHTLC orig_conv;
15976 orig_conv.inner = (void*)(orig & (~1));
15977 orig_conv.is_owned = false;
15978 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
15979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15981 uint64_t ret_ref = (uint64_t)ret_var.inner;
15982 if (ret_var.is_owned) {
15988 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
15989 LDKUpdateFulfillHTLC this_obj_conv;
15990 this_obj_conv.inner = (void*)(this_obj & (~1));
15991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15992 UpdateFulfillHTLC_free(this_obj_conv);
15995 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
15996 LDKUpdateFulfillHTLC this_ptr_conv;
15997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15998 this_ptr_conv.is_owned = false;
15999 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16000 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
16004 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16005 LDKUpdateFulfillHTLC this_ptr_conv;
16006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16007 this_ptr_conv.is_owned = false;
16008 LDKThirtyTwoBytes val_ref;
16009 CHECK(*((uint32_t*)val) == 32);
16010 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16011 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
16014 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
16015 LDKUpdateFulfillHTLC this_ptr_conv;
16016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16017 this_ptr_conv.is_owned = false;
16018 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
16022 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16023 LDKUpdateFulfillHTLC this_ptr_conv;
16024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16025 this_ptr_conv.is_owned = false;
16026 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
16029 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
16030 LDKUpdateFulfillHTLC this_ptr_conv;
16031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16032 this_ptr_conv.is_owned = false;
16033 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16034 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
16038 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
16039 LDKUpdateFulfillHTLC this_ptr_conv;
16040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16041 this_ptr_conv.is_owned = false;
16042 LDKThirtyTwoBytes val_ref;
16043 CHECK(*((uint32_t*)val) == 32);
16044 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16045 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
16048 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
16049 LDKThirtyTwoBytes channel_id_arg_ref;
16050 CHECK(*((uint32_t*)channel_id_arg) == 32);
16051 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16052 LDKThirtyTwoBytes payment_preimage_arg_ref;
16053 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
16054 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
16055 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
16056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16058 uint64_t ret_ref = (uint64_t)ret_var.inner;
16059 if (ret_var.is_owned) {
16065 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
16066 LDKUpdateFulfillHTLC orig_conv;
16067 orig_conv.inner = (void*)(orig & (~1));
16068 orig_conv.is_owned = false;
16069 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
16070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16072 uint64_t ret_ref = (uint64_t)ret_var.inner;
16073 if (ret_var.is_owned) {
16079 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
16080 LDKUpdateFailHTLC this_obj_conv;
16081 this_obj_conv.inner = (void*)(this_obj & (~1));
16082 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16083 UpdateFailHTLC_free(this_obj_conv);
16086 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
16087 LDKUpdateFailHTLC this_ptr_conv;
16088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16089 this_ptr_conv.is_owned = false;
16090 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16091 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
16095 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16096 LDKUpdateFailHTLC this_ptr_conv;
16097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16098 this_ptr_conv.is_owned = false;
16099 LDKThirtyTwoBytes val_ref;
16100 CHECK(*((uint32_t*)val) == 32);
16101 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16102 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
16105 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
16106 LDKUpdateFailHTLC this_ptr_conv;
16107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16108 this_ptr_conv.is_owned = false;
16109 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
16113 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16114 LDKUpdateFailHTLC this_ptr_conv;
16115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16116 this_ptr_conv.is_owned = false;
16117 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
16120 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
16121 LDKUpdateFailHTLC orig_conv;
16122 orig_conv.inner = (void*)(orig & (~1));
16123 orig_conv.is_owned = false;
16124 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
16125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16127 uint64_t ret_ref = (uint64_t)ret_var.inner;
16128 if (ret_var.is_owned) {
16134 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
16135 LDKUpdateFailMalformedHTLC this_obj_conv;
16136 this_obj_conv.inner = (void*)(this_obj & (~1));
16137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16138 UpdateFailMalformedHTLC_free(this_obj_conv);
16141 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
16142 LDKUpdateFailMalformedHTLC this_ptr_conv;
16143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16144 this_ptr_conv.is_owned = false;
16145 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16146 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
16150 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16151 LDKUpdateFailMalformedHTLC this_ptr_conv;
16152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16153 this_ptr_conv.is_owned = false;
16154 LDKThirtyTwoBytes val_ref;
16155 CHECK(*((uint32_t*)val) == 32);
16156 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16157 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
16160 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
16161 LDKUpdateFailMalformedHTLC this_ptr_conv;
16162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16163 this_ptr_conv.is_owned = false;
16164 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
16168 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16169 LDKUpdateFailMalformedHTLC this_ptr_conv;
16170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16171 this_ptr_conv.is_owned = false;
16172 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
16175 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
16176 LDKUpdateFailMalformedHTLC this_ptr_conv;
16177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16178 this_ptr_conv.is_owned = false;
16179 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
16183 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
16184 LDKUpdateFailMalformedHTLC this_ptr_conv;
16185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16186 this_ptr_conv.is_owned = false;
16187 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
16190 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
16191 LDKUpdateFailMalformedHTLC orig_conv;
16192 orig_conv.inner = (void*)(orig & (~1));
16193 orig_conv.is_owned = false;
16194 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
16195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16197 uint64_t ret_ref = (uint64_t)ret_var.inner;
16198 if (ret_var.is_owned) {
16204 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
16205 LDKCommitmentSigned this_obj_conv;
16206 this_obj_conv.inner = (void*)(this_obj & (~1));
16207 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16208 CommitmentSigned_free(this_obj_conv);
16211 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
16212 LDKCommitmentSigned this_ptr_conv;
16213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16214 this_ptr_conv.is_owned = false;
16215 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16216 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
16220 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16221 LDKCommitmentSigned this_ptr_conv;
16222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16223 this_ptr_conv.is_owned = false;
16224 LDKThirtyTwoBytes val_ref;
16225 CHECK(*((uint32_t*)val) == 32);
16226 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16227 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
16230 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
16231 LDKCommitmentSigned this_ptr_conv;
16232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16233 this_ptr_conv.is_owned = false;
16234 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16235 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
16239 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
16240 LDKCommitmentSigned this_ptr_conv;
16241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16242 this_ptr_conv.is_owned = false;
16243 LDKSignature val_ref;
16244 CHECK(*((uint32_t*)val) == 64);
16245 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16246 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
16249 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
16250 LDKCommitmentSigned this_ptr_conv;
16251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16252 this_ptr_conv.is_owned = false;
16253 LDKCVec_SignatureZ val_constr;
16254 val_constr.datalen = *((uint32_t*)val);
16255 if (val_constr.datalen > 0)
16256 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16258 val_constr.data = NULL;
16259 int8_tArray* val_vals = (int8_tArray*)(val + 4);
16260 for (size_t m = 0; m < val_constr.datalen; m++) {
16261 int8_tArray val_conv_12 = val_vals[m];
16262 LDKSignature val_conv_12_ref;
16263 CHECK(*((uint32_t*)val_conv_12) == 64);
16264 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
16265 val_constr.data[m] = val_conv_12_ref;
16267 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
16270 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
16271 LDKThirtyTwoBytes channel_id_arg_ref;
16272 CHECK(*((uint32_t*)channel_id_arg) == 32);
16273 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16274 LDKSignature signature_arg_ref;
16275 CHECK(*((uint32_t*)signature_arg) == 64);
16276 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16277 LDKCVec_SignatureZ htlc_signatures_arg_constr;
16278 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
16279 if (htlc_signatures_arg_constr.datalen > 0)
16280 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16282 htlc_signatures_arg_constr.data = NULL;
16283 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
16284 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
16285 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
16286 LDKSignature htlc_signatures_arg_conv_12_ref;
16287 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
16288 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
16289 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
16291 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
16292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16294 uint64_t ret_ref = (uint64_t)ret_var.inner;
16295 if (ret_var.is_owned) {
16301 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
16302 LDKCommitmentSigned orig_conv;
16303 orig_conv.inner = (void*)(orig & (~1));
16304 orig_conv.is_owned = false;
16305 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
16306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16308 uint64_t ret_ref = (uint64_t)ret_var.inner;
16309 if (ret_var.is_owned) {
16315 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
16316 LDKRevokeAndACK this_obj_conv;
16317 this_obj_conv.inner = (void*)(this_obj & (~1));
16318 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16319 RevokeAndACK_free(this_obj_conv);
16322 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
16323 LDKRevokeAndACK this_ptr_conv;
16324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16325 this_ptr_conv.is_owned = false;
16326 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16327 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
16331 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16332 LDKRevokeAndACK this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 LDKThirtyTwoBytes val_ref;
16336 CHECK(*((uint32_t*)val) == 32);
16337 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16338 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
16341 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
16342 LDKRevokeAndACK this_ptr_conv;
16343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16344 this_ptr_conv.is_owned = false;
16345 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16346 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
16350 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16351 LDKRevokeAndACK this_ptr_conv;
16352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16353 this_ptr_conv.is_owned = false;
16354 LDKThirtyTwoBytes val_ref;
16355 CHECK(*((uint32_t*)val) == 32);
16356 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16357 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
16360 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
16361 LDKRevokeAndACK this_ptr_conv;
16362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16363 this_ptr_conv.is_owned = false;
16364 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16365 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16369 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16370 LDKRevokeAndACK this_ptr_conv;
16371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16372 this_ptr_conv.is_owned = false;
16373 LDKPublicKey val_ref;
16374 CHECK(*((uint32_t*)val) == 33);
16375 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16376 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
16379 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) {
16380 LDKThirtyTwoBytes channel_id_arg_ref;
16381 CHECK(*((uint32_t*)channel_id_arg) == 32);
16382 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16383 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
16384 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
16385 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
16386 LDKPublicKey next_per_commitment_point_arg_ref;
16387 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
16388 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
16389 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
16390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16392 uint64_t ret_ref = (uint64_t)ret_var.inner;
16393 if (ret_var.is_owned) {
16399 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
16400 LDKRevokeAndACK orig_conv;
16401 orig_conv.inner = (void*)(orig & (~1));
16402 orig_conv.is_owned = false;
16403 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
16404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16406 uint64_t ret_ref = (uint64_t)ret_var.inner;
16407 if (ret_var.is_owned) {
16413 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
16414 LDKUpdateFee this_obj_conv;
16415 this_obj_conv.inner = (void*)(this_obj & (~1));
16416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16417 UpdateFee_free(this_obj_conv);
16420 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
16421 LDKUpdateFee this_ptr_conv;
16422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16423 this_ptr_conv.is_owned = false;
16424 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16425 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
16429 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16430 LDKUpdateFee this_ptr_conv;
16431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16432 this_ptr_conv.is_owned = false;
16433 LDKThirtyTwoBytes val_ref;
16434 CHECK(*((uint32_t*)val) == 32);
16435 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16436 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
16439 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
16440 LDKUpdateFee this_ptr_conv;
16441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16442 this_ptr_conv.is_owned = false;
16443 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
16447 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16448 LDKUpdateFee this_ptr_conv;
16449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16450 this_ptr_conv.is_owned = false;
16451 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
16454 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
16455 LDKThirtyTwoBytes channel_id_arg_ref;
16456 CHECK(*((uint32_t*)channel_id_arg) == 32);
16457 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16458 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
16459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16461 uint64_t ret_ref = (uint64_t)ret_var.inner;
16462 if (ret_var.is_owned) {
16468 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
16469 LDKUpdateFee orig_conv;
16470 orig_conv.inner = (void*)(orig & (~1));
16471 orig_conv.is_owned = false;
16472 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
16473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16475 uint64_t ret_ref = (uint64_t)ret_var.inner;
16476 if (ret_var.is_owned) {
16482 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
16483 LDKDataLossProtect this_obj_conv;
16484 this_obj_conv.inner = (void*)(this_obj & (~1));
16485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16486 DataLossProtect_free(this_obj_conv);
16489 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
16490 LDKDataLossProtect this_ptr_conv;
16491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16492 this_ptr_conv.is_owned = false;
16493 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16494 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
16498 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16499 LDKDataLossProtect this_ptr_conv;
16500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16501 this_ptr_conv.is_owned = false;
16502 LDKThirtyTwoBytes val_ref;
16503 CHECK(*((uint32_t*)val) == 32);
16504 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16505 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
16508 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
16509 LDKDataLossProtect this_ptr_conv;
16510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16511 this_ptr_conv.is_owned = false;
16512 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16513 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16517 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16518 LDKDataLossProtect this_ptr_conv;
16519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16520 this_ptr_conv.is_owned = false;
16521 LDKPublicKey val_ref;
16522 CHECK(*((uint32_t*)val) == 33);
16523 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16524 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
16527 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
16528 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
16529 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
16530 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
16531 LDKPublicKey my_current_per_commitment_point_arg_ref;
16532 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
16533 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
16534 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
16535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16537 uint64_t ret_ref = (uint64_t)ret_var.inner;
16538 if (ret_var.is_owned) {
16544 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
16545 LDKDataLossProtect orig_conv;
16546 orig_conv.inner = (void*)(orig & (~1));
16547 orig_conv.is_owned = false;
16548 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
16549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16551 uint64_t ret_ref = (uint64_t)ret_var.inner;
16552 if (ret_var.is_owned) {
16558 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
16559 LDKChannelReestablish this_obj_conv;
16560 this_obj_conv.inner = (void*)(this_obj & (~1));
16561 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16562 ChannelReestablish_free(this_obj_conv);
16565 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
16566 LDKChannelReestablish this_ptr_conv;
16567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16568 this_ptr_conv.is_owned = false;
16569 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16570 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
16574 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16575 LDKChannelReestablish this_ptr_conv;
16576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16577 this_ptr_conv.is_owned = false;
16578 LDKThirtyTwoBytes val_ref;
16579 CHECK(*((uint32_t*)val) == 32);
16580 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16581 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
16584 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
16585 LDKChannelReestablish this_ptr_conv;
16586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16587 this_ptr_conv.is_owned = false;
16588 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
16592 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
16593 LDKChannelReestablish this_ptr_conv;
16594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16595 this_ptr_conv.is_owned = false;
16596 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
16599 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
16600 LDKChannelReestablish this_ptr_conv;
16601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16602 this_ptr_conv.is_owned = false;
16603 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
16607 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
16608 LDKChannelReestablish this_ptr_conv;
16609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16610 this_ptr_conv.is_owned = false;
16611 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
16614 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
16615 LDKChannelReestablish orig_conv;
16616 orig_conv.inner = (void*)(orig & (~1));
16617 orig_conv.is_owned = false;
16618 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
16619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16621 uint64_t ret_ref = (uint64_t)ret_var.inner;
16622 if (ret_var.is_owned) {
16628 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
16629 LDKAnnouncementSignatures this_obj_conv;
16630 this_obj_conv.inner = (void*)(this_obj & (~1));
16631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16632 AnnouncementSignatures_free(this_obj_conv);
16635 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
16636 LDKAnnouncementSignatures this_ptr_conv;
16637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16638 this_ptr_conv.is_owned = false;
16639 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16640 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
16644 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16645 LDKAnnouncementSignatures this_ptr_conv;
16646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16647 this_ptr_conv.is_owned = false;
16648 LDKThirtyTwoBytes val_ref;
16649 CHECK(*((uint32_t*)val) == 32);
16650 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16651 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
16654 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
16655 LDKAnnouncementSignatures this_ptr_conv;
16656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16657 this_ptr_conv.is_owned = false;
16658 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
16662 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
16663 LDKAnnouncementSignatures this_ptr_conv;
16664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16665 this_ptr_conv.is_owned = false;
16666 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
16669 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
16670 LDKAnnouncementSignatures this_ptr_conv;
16671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16672 this_ptr_conv.is_owned = false;
16673 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16674 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
16678 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
16679 LDKAnnouncementSignatures this_ptr_conv;
16680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16681 this_ptr_conv.is_owned = false;
16682 LDKSignature val_ref;
16683 CHECK(*((uint32_t*)val) == 64);
16684 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16685 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
16688 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
16689 LDKAnnouncementSignatures this_ptr_conv;
16690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16691 this_ptr_conv.is_owned = false;
16692 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16693 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
16697 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
16698 LDKAnnouncementSignatures this_ptr_conv;
16699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16700 this_ptr_conv.is_owned = false;
16701 LDKSignature val_ref;
16702 CHECK(*((uint32_t*)val) == 64);
16703 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16704 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
16707 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) {
16708 LDKThirtyTwoBytes channel_id_arg_ref;
16709 CHECK(*((uint32_t*)channel_id_arg) == 32);
16710 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16711 LDKSignature node_signature_arg_ref;
16712 CHECK(*((uint32_t*)node_signature_arg) == 64);
16713 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
16714 LDKSignature bitcoin_signature_arg_ref;
16715 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
16716 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
16717 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
16718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16720 uint64_t ret_ref = (uint64_t)ret_var.inner;
16721 if (ret_var.is_owned) {
16727 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
16728 LDKAnnouncementSignatures orig_conv;
16729 orig_conv.inner = (void*)(orig & (~1));
16730 orig_conv.is_owned = false;
16731 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
16732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16734 uint64_t ret_ref = (uint64_t)ret_var.inner;
16735 if (ret_var.is_owned) {
16741 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
16742 if ((this_ptr & 1) != 0) return;
16743 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
16744 FREE((void*)this_ptr);
16745 NetAddress_free(this_ptr_conv);
16748 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
16749 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
16750 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16751 *ret_copy = NetAddress_clone(orig_conv);
16752 uint64_t ret_ref = (uint64_t)ret_copy;
16756 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
16757 LDKFourBytes addr_ref;
16758 CHECK(*((uint32_t*)addr) == 4);
16759 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
16760 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16761 *ret_copy = NetAddress_ipv4(addr_ref, port);
16762 uint64_t ret_ref = (uint64_t)ret_copy;
16766 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
16767 LDKSixteenBytes addr_ref;
16768 CHECK(*((uint32_t*)addr) == 16);
16769 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
16770 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16771 *ret_copy = NetAddress_ipv6(addr_ref, port);
16772 uint64_t ret_ref = (uint64_t)ret_copy;
16776 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
16777 LDKTenBytes addr_ref;
16778 CHECK(*((uint32_t*)addr) == 10);
16779 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
16780 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16781 *ret_copy = NetAddress_onion_v2(addr_ref, port);
16782 uint64_t ret_ref = (uint64_t)ret_copy;
16786 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
16787 LDKThirtyTwoBytes ed25519_pubkey_ref;
16788 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
16789 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
16790 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16791 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
16792 uint64_t ret_ref = (uint64_t)ret_copy;
16796 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
16797 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
16798 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
16799 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16800 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16801 CVec_u8Z_free(ret_var);
16805 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
16806 LDKu8slice ser_ref;
16807 ser_ref.datalen = *((uint32_t*)ser);
16808 ser_ref.data = (int8_t*)(ser + 4);
16809 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
16810 *ret_conv = Result_read(ser_ref);
16811 return (uint64_t)ret_conv;
16814 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
16815 LDKu8slice ser_ref;
16816 ser_ref.datalen = *((uint32_t*)ser);
16817 ser_ref.data = (int8_t*)(ser + 4);
16818 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
16819 *ret_conv = NetAddress_read(ser_ref);
16820 return (uint64_t)ret_conv;
16823 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
16824 LDKUnsignedNodeAnnouncement 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 UnsignedNodeAnnouncement_free(this_obj_conv);
16830 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
16831 LDKUnsignedNodeAnnouncement this_ptr_conv;
16832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16833 this_ptr_conv.is_owned = false;
16834 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
16835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16837 uint64_t ret_ref = (uint64_t)ret_var.inner;
16838 if (ret_var.is_owned) {
16844 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
16845 LDKUnsignedNodeAnnouncement this_ptr_conv;
16846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16847 this_ptr_conv.is_owned = false;
16848 LDKNodeFeatures val_conv;
16849 val_conv.inner = (void*)(val & (~1));
16850 val_conv.is_owned = (val & 1) || (val == 0);
16851 val_conv = NodeFeatures_clone(&val_conv);
16852 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
16855 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
16856 LDKUnsignedNodeAnnouncement this_ptr_conv;
16857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16858 this_ptr_conv.is_owned = false;
16859 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
16863 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
16864 LDKUnsignedNodeAnnouncement this_ptr_conv;
16865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16866 this_ptr_conv.is_owned = false;
16867 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
16870 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
16871 LDKUnsignedNodeAnnouncement this_ptr_conv;
16872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16873 this_ptr_conv.is_owned = false;
16874 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16875 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
16879 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
16880 LDKUnsignedNodeAnnouncement this_ptr_conv;
16881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16882 this_ptr_conv.is_owned = false;
16883 LDKPublicKey val_ref;
16884 CHECK(*((uint32_t*)val) == 33);
16885 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16886 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
16889 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
16890 LDKUnsignedNodeAnnouncement this_ptr_conv;
16891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16892 this_ptr_conv.is_owned = false;
16893 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
16894 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
16898 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
16899 LDKUnsignedNodeAnnouncement this_ptr_conv;
16900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16901 this_ptr_conv.is_owned = false;
16902 LDKThreeBytes val_ref;
16903 CHECK(*((uint32_t*)val) == 3);
16904 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
16905 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
16908 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
16909 LDKUnsignedNodeAnnouncement this_ptr_conv;
16910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16911 this_ptr_conv.is_owned = false;
16912 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16913 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
16917 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
16918 LDKUnsignedNodeAnnouncement this_ptr_conv;
16919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16920 this_ptr_conv.is_owned = false;
16921 LDKThirtyTwoBytes val_ref;
16922 CHECK(*((uint32_t*)val) == 32);
16923 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16924 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
16927 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
16928 LDKUnsignedNodeAnnouncement this_ptr_conv;
16929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16930 this_ptr_conv.is_owned = false;
16931 LDKCVec_NetAddressZ val_constr;
16932 val_constr.datalen = *((uint32_t*)val);
16933 if (val_constr.datalen > 0)
16934 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16936 val_constr.data = NULL;
16937 uint32_t* val_vals = (uint32_t*)(val + 4);
16938 for (size_t m = 0; m < val_constr.datalen; m++) {
16939 uint32_t val_conv_12 = val_vals[m];
16940 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
16941 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
16942 val_constr.data[m] = val_conv_12_conv;
16944 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
16947 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
16948 LDKUnsignedNodeAnnouncement orig_conv;
16949 orig_conv.inner = (void*)(orig & (~1));
16950 orig_conv.is_owned = false;
16951 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
16952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16954 uint64_t ret_ref = (uint64_t)ret_var.inner;
16955 if (ret_var.is_owned) {
16961 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
16962 LDKNodeAnnouncement this_obj_conv;
16963 this_obj_conv.inner = (void*)(this_obj & (~1));
16964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16965 NodeAnnouncement_free(this_obj_conv);
16968 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
16969 LDKNodeAnnouncement this_ptr_conv;
16970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16971 this_ptr_conv.is_owned = false;
16972 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16973 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
16977 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
16978 LDKNodeAnnouncement this_ptr_conv;
16979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16980 this_ptr_conv.is_owned = false;
16981 LDKSignature val_ref;
16982 CHECK(*((uint32_t*)val) == 64);
16983 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16984 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
16987 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
16988 LDKNodeAnnouncement this_ptr_conv;
16989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16990 this_ptr_conv.is_owned = false;
16991 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
16992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16994 uint64_t ret_ref = (uint64_t)ret_var.inner;
16995 if (ret_var.is_owned) {
17001 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17002 LDKNodeAnnouncement this_ptr_conv;
17003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17004 this_ptr_conv.is_owned = false;
17005 LDKUnsignedNodeAnnouncement val_conv;
17006 val_conv.inner = (void*)(val & (~1));
17007 val_conv.is_owned = (val & 1) || (val == 0);
17008 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
17009 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
17012 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
17013 LDKSignature signature_arg_ref;
17014 CHECK(*((uint32_t*)signature_arg) == 64);
17015 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17016 LDKUnsignedNodeAnnouncement contents_arg_conv;
17017 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17018 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17019 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
17020 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
17021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17023 uint64_t ret_ref = (uint64_t)ret_var.inner;
17024 if (ret_var.is_owned) {
17030 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
17031 LDKNodeAnnouncement orig_conv;
17032 orig_conv.inner = (void*)(orig & (~1));
17033 orig_conv.is_owned = false;
17034 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
17038 if (ret_var.is_owned) {
17044 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
17045 LDKUnsignedChannelAnnouncement this_obj_conv;
17046 this_obj_conv.inner = (void*)(this_obj & (~1));
17047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17048 UnsignedChannelAnnouncement_free(this_obj_conv);
17051 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
17052 LDKUnsignedChannelAnnouncement this_ptr_conv;
17053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17054 this_ptr_conv.is_owned = false;
17055 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
17056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17058 uint64_t ret_ref = (uint64_t)ret_var.inner;
17059 if (ret_var.is_owned) {
17065 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
17066 LDKUnsignedChannelAnnouncement this_ptr_conv;
17067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17068 this_ptr_conv.is_owned = false;
17069 LDKChannelFeatures val_conv;
17070 val_conv.inner = (void*)(val & (~1));
17071 val_conv.is_owned = (val & 1) || (val == 0);
17072 val_conv = ChannelFeatures_clone(&val_conv);
17073 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
17076 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
17077 LDKUnsignedChannelAnnouncement this_ptr_conv;
17078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17079 this_ptr_conv.is_owned = false;
17080 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17081 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
17085 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17086 LDKUnsignedChannelAnnouncement this_ptr_conv;
17087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17088 this_ptr_conv.is_owned = false;
17089 LDKThirtyTwoBytes val_ref;
17090 CHECK(*((uint32_t*)val) == 32);
17091 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17092 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
17095 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
17096 LDKUnsignedChannelAnnouncement this_ptr_conv;
17097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17098 this_ptr_conv.is_owned = false;
17099 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
17103 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17104 LDKUnsignedChannelAnnouncement this_ptr_conv;
17105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17106 this_ptr_conv.is_owned = false;
17107 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
17110 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
17111 LDKUnsignedChannelAnnouncement this_ptr_conv;
17112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17113 this_ptr_conv.is_owned = false;
17114 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17115 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
17119 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
17120 LDKUnsignedChannelAnnouncement this_ptr_conv;
17121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17122 this_ptr_conv.is_owned = false;
17123 LDKPublicKey val_ref;
17124 CHECK(*((uint32_t*)val) == 33);
17125 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17126 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
17129 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
17130 LDKUnsignedChannelAnnouncement this_ptr_conv;
17131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17132 this_ptr_conv.is_owned = false;
17133 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17134 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
17138 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
17139 LDKUnsignedChannelAnnouncement this_ptr_conv;
17140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17141 this_ptr_conv.is_owned = false;
17142 LDKPublicKey val_ref;
17143 CHECK(*((uint32_t*)val) == 33);
17144 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17145 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
17148 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
17149 LDKUnsignedChannelAnnouncement this_ptr_conv;
17150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17151 this_ptr_conv.is_owned = false;
17152 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17153 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
17157 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
17158 LDKUnsignedChannelAnnouncement this_ptr_conv;
17159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17160 this_ptr_conv.is_owned = false;
17161 LDKPublicKey val_ref;
17162 CHECK(*((uint32_t*)val) == 33);
17163 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17164 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
17167 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
17168 LDKUnsignedChannelAnnouncement this_ptr_conv;
17169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17170 this_ptr_conv.is_owned = false;
17171 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17172 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
17176 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
17177 LDKUnsignedChannelAnnouncement this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 LDKPublicKey val_ref;
17181 CHECK(*((uint32_t*)val) == 33);
17182 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17183 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
17186 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
17187 LDKUnsignedChannelAnnouncement orig_conv;
17188 orig_conv.inner = (void*)(orig & (~1));
17189 orig_conv.is_owned = false;
17190 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
17191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17193 uint64_t ret_ref = (uint64_t)ret_var.inner;
17194 if (ret_var.is_owned) {
17200 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
17201 LDKChannelAnnouncement this_obj_conv;
17202 this_obj_conv.inner = (void*)(this_obj & (~1));
17203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17204 ChannelAnnouncement_free(this_obj_conv);
17207 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
17208 LDKChannelAnnouncement this_ptr_conv;
17209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17210 this_ptr_conv.is_owned = false;
17211 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17212 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
17216 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
17217 LDKChannelAnnouncement this_ptr_conv;
17218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17219 this_ptr_conv.is_owned = false;
17220 LDKSignature val_ref;
17221 CHECK(*((uint32_t*)val) == 64);
17222 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17223 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
17226 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
17227 LDKChannelAnnouncement this_ptr_conv;
17228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17229 this_ptr_conv.is_owned = false;
17230 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17231 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
17235 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
17236 LDKChannelAnnouncement this_ptr_conv;
17237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17238 this_ptr_conv.is_owned = false;
17239 LDKSignature val_ref;
17240 CHECK(*((uint32_t*)val) == 64);
17241 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17242 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
17245 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
17246 LDKChannelAnnouncement this_ptr_conv;
17247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17248 this_ptr_conv.is_owned = false;
17249 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17250 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
17254 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
17255 LDKChannelAnnouncement this_ptr_conv;
17256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17257 this_ptr_conv.is_owned = false;
17258 LDKSignature val_ref;
17259 CHECK(*((uint32_t*)val) == 64);
17260 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17261 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
17264 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
17265 LDKChannelAnnouncement this_ptr_conv;
17266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17267 this_ptr_conv.is_owned = false;
17268 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17269 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
17273 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
17274 LDKChannelAnnouncement this_ptr_conv;
17275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17276 this_ptr_conv.is_owned = false;
17277 LDKSignature val_ref;
17278 CHECK(*((uint32_t*)val) == 64);
17279 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17280 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
17283 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
17284 LDKChannelAnnouncement this_ptr_conv;
17285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17286 this_ptr_conv.is_owned = false;
17287 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
17288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17290 uint64_t ret_ref = (uint64_t)ret_var.inner;
17291 if (ret_var.is_owned) {
17297 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17298 LDKChannelAnnouncement this_ptr_conv;
17299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17300 this_ptr_conv.is_owned = false;
17301 LDKUnsignedChannelAnnouncement val_conv;
17302 val_conv.inner = (void*)(val & (~1));
17303 val_conv.is_owned = (val & 1) || (val == 0);
17304 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
17305 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
17308 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) {
17309 LDKSignature node_signature_1_arg_ref;
17310 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
17311 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
17312 LDKSignature node_signature_2_arg_ref;
17313 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
17314 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
17315 LDKSignature bitcoin_signature_1_arg_ref;
17316 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
17317 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
17318 LDKSignature bitcoin_signature_2_arg_ref;
17319 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
17320 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
17321 LDKUnsignedChannelAnnouncement contents_arg_conv;
17322 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17323 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17324 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
17325 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);
17326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17328 uint64_t ret_ref = (uint64_t)ret_var.inner;
17329 if (ret_var.is_owned) {
17335 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
17336 LDKChannelAnnouncement orig_conv;
17337 orig_conv.inner = (void*)(orig & (~1));
17338 orig_conv.is_owned = false;
17339 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
17340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17342 uint64_t ret_ref = (uint64_t)ret_var.inner;
17343 if (ret_var.is_owned) {
17349 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
17350 LDKUnsignedChannelUpdate this_obj_conv;
17351 this_obj_conv.inner = (void*)(this_obj & (~1));
17352 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17353 UnsignedChannelUpdate_free(this_obj_conv);
17356 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
17357 LDKUnsignedChannelUpdate this_ptr_conv;
17358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17359 this_ptr_conv.is_owned = false;
17360 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17361 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
17365 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17366 LDKUnsignedChannelUpdate this_ptr_conv;
17367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17368 this_ptr_conv.is_owned = false;
17369 LDKThirtyTwoBytes val_ref;
17370 CHECK(*((uint32_t*)val) == 32);
17371 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17372 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
17375 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
17376 LDKUnsignedChannelUpdate this_ptr_conv;
17377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17378 this_ptr_conv.is_owned = false;
17379 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
17383 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17384 LDKUnsignedChannelUpdate this_ptr_conv;
17385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17386 this_ptr_conv.is_owned = false;
17387 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
17390 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
17391 LDKUnsignedChannelUpdate this_ptr_conv;
17392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17393 this_ptr_conv.is_owned = false;
17394 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
17398 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
17399 LDKUnsignedChannelUpdate this_ptr_conv;
17400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17401 this_ptr_conv.is_owned = false;
17402 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
17405 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
17406 LDKUnsignedChannelUpdate this_ptr_conv;
17407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17408 this_ptr_conv.is_owned = false;
17409 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
17413 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
17414 LDKUnsignedChannelUpdate this_ptr_conv;
17415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17416 this_ptr_conv.is_owned = false;
17417 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
17420 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
17421 LDKUnsignedChannelUpdate this_ptr_conv;
17422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17423 this_ptr_conv.is_owned = false;
17424 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
17428 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17429 LDKUnsignedChannelUpdate this_ptr_conv;
17430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17431 this_ptr_conv.is_owned = false;
17432 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
17435 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
17436 LDKUnsignedChannelUpdate this_ptr_conv;
17437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17438 this_ptr_conv.is_owned = false;
17439 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
17443 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17444 LDKUnsignedChannelUpdate this_ptr_conv;
17445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17446 this_ptr_conv.is_owned = false;
17447 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
17450 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
17451 LDKUnsignedChannelUpdate this_ptr_conv;
17452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17453 this_ptr_conv.is_owned = false;
17454 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
17458 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
17459 LDKUnsignedChannelUpdate this_ptr_conv;
17460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17461 this_ptr_conv.is_owned = false;
17462 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
17465 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
17466 LDKUnsignedChannelUpdate this_ptr_conv;
17467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17468 this_ptr_conv.is_owned = false;
17469 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
17473 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17474 LDKUnsignedChannelUpdate this_ptr_conv;
17475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17476 this_ptr_conv.is_owned = false;
17477 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
17480 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
17481 LDKUnsignedChannelUpdate orig_conv;
17482 orig_conv.inner = (void*)(orig & (~1));
17483 orig_conv.is_owned = false;
17484 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
17488 if (ret_var.is_owned) {
17494 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
17495 LDKChannelUpdate this_obj_conv;
17496 this_obj_conv.inner = (void*)(this_obj & (~1));
17497 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17498 ChannelUpdate_free(this_obj_conv);
17501 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
17502 LDKChannelUpdate this_ptr_conv;
17503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17504 this_ptr_conv.is_owned = false;
17505 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17506 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
17510 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
17511 LDKChannelUpdate this_ptr_conv;
17512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17513 this_ptr_conv.is_owned = false;
17514 LDKSignature val_ref;
17515 CHECK(*((uint32_t*)val) == 64);
17516 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17517 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
17520 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
17521 LDKChannelUpdate this_ptr_conv;
17522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17523 this_ptr_conv.is_owned = false;
17524 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
17525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17527 uint64_t ret_ref = (uint64_t)ret_var.inner;
17528 if (ret_var.is_owned) {
17534 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
17535 LDKChannelUpdate this_ptr_conv;
17536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17537 this_ptr_conv.is_owned = false;
17538 LDKUnsignedChannelUpdate val_conv;
17539 val_conv.inner = (void*)(val & (~1));
17540 val_conv.is_owned = (val & 1) || (val == 0);
17541 val_conv = UnsignedChannelUpdate_clone(&val_conv);
17542 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
17545 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
17546 LDKSignature signature_arg_ref;
17547 CHECK(*((uint32_t*)signature_arg) == 64);
17548 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17549 LDKUnsignedChannelUpdate contents_arg_conv;
17550 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17551 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17552 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
17553 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
17554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17556 uint64_t ret_ref = (uint64_t)ret_var.inner;
17557 if (ret_var.is_owned) {
17563 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
17564 LDKChannelUpdate orig_conv;
17565 orig_conv.inner = (void*)(orig & (~1));
17566 orig_conv.is_owned = false;
17567 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
17568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17570 uint64_t ret_ref = (uint64_t)ret_var.inner;
17571 if (ret_var.is_owned) {
17577 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
17578 LDKQueryChannelRange this_obj_conv;
17579 this_obj_conv.inner = (void*)(this_obj & (~1));
17580 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17581 QueryChannelRange_free(this_obj_conv);
17584 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
17585 LDKQueryChannelRange this_ptr_conv;
17586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17587 this_ptr_conv.is_owned = false;
17588 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17589 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
17593 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17594 LDKQueryChannelRange this_ptr_conv;
17595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17596 this_ptr_conv.is_owned = false;
17597 LDKThirtyTwoBytes val_ref;
17598 CHECK(*((uint32_t*)val) == 32);
17599 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17600 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
17603 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
17604 LDKQueryChannelRange this_ptr_conv;
17605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17606 this_ptr_conv.is_owned = false;
17607 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
17611 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
17612 LDKQueryChannelRange this_ptr_conv;
17613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17614 this_ptr_conv.is_owned = false;
17615 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
17618 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
17619 LDKQueryChannelRange this_ptr_conv;
17620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17621 this_ptr_conv.is_owned = false;
17622 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
17626 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
17627 LDKQueryChannelRange this_ptr_conv;
17628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17629 this_ptr_conv.is_owned = false;
17630 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
17633 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
17634 LDKThirtyTwoBytes chain_hash_arg_ref;
17635 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17636 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17637 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
17638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17640 uint64_t ret_ref = (uint64_t)ret_var.inner;
17641 if (ret_var.is_owned) {
17647 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
17648 LDKQueryChannelRange orig_conv;
17649 orig_conv.inner = (void*)(orig & (~1));
17650 orig_conv.is_owned = false;
17651 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
17652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17654 uint64_t ret_ref = (uint64_t)ret_var.inner;
17655 if (ret_var.is_owned) {
17661 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
17662 LDKReplyChannelRange this_obj_conv;
17663 this_obj_conv.inner = (void*)(this_obj & (~1));
17664 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17665 ReplyChannelRange_free(this_obj_conv);
17668 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
17669 LDKReplyChannelRange this_ptr_conv;
17670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17671 this_ptr_conv.is_owned = false;
17672 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17673 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
17677 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17678 LDKReplyChannelRange this_ptr_conv;
17679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17680 this_ptr_conv.is_owned = false;
17681 LDKThirtyTwoBytes val_ref;
17682 CHECK(*((uint32_t*)val) == 32);
17683 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17684 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
17687 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
17688 LDKReplyChannelRange this_ptr_conv;
17689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17690 this_ptr_conv.is_owned = false;
17691 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
17695 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
17696 LDKReplyChannelRange this_ptr_conv;
17697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17698 this_ptr_conv.is_owned = false;
17699 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
17702 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
17703 LDKReplyChannelRange this_ptr_conv;
17704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17705 this_ptr_conv.is_owned = false;
17706 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
17710 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
17711 LDKReplyChannelRange this_ptr_conv;
17712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17713 this_ptr_conv.is_owned = false;
17714 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
17717 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
17718 LDKReplyChannelRange this_ptr_conv;
17719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17720 this_ptr_conv.is_owned = false;
17721 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
17725 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
17726 LDKReplyChannelRange this_ptr_conv;
17727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17728 this_ptr_conv.is_owned = false;
17729 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
17732 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
17733 LDKReplyChannelRange this_ptr_conv;
17734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17735 this_ptr_conv.is_owned = false;
17736 LDKCVec_u64Z val_constr;
17737 val_constr.datalen = *((uint32_t*)val);
17738 if (val_constr.datalen > 0)
17739 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17741 val_constr.data = NULL;
17742 int64_t* val_vals = (int64_t*)(val + 4);
17743 for (size_t i = 0; i < val_constr.datalen; i++) {
17744 int64_t val_conv_8 = val_vals[i];
17745 val_constr.data[i] = val_conv_8;
17747 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
17750 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) {
17751 LDKThirtyTwoBytes chain_hash_arg_ref;
17752 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17753 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17754 LDKCVec_u64Z short_channel_ids_arg_constr;
17755 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
17756 if (short_channel_ids_arg_constr.datalen > 0)
17757 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17759 short_channel_ids_arg_constr.data = NULL;
17760 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
17761 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
17762 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
17763 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
17765 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
17766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17768 uint64_t ret_ref = (uint64_t)ret_var.inner;
17769 if (ret_var.is_owned) {
17775 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
17776 LDKReplyChannelRange orig_conv;
17777 orig_conv.inner = (void*)(orig & (~1));
17778 orig_conv.is_owned = false;
17779 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
17780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17782 uint64_t ret_ref = (uint64_t)ret_var.inner;
17783 if (ret_var.is_owned) {
17789 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
17790 LDKQueryShortChannelIds this_obj_conv;
17791 this_obj_conv.inner = (void*)(this_obj & (~1));
17792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17793 QueryShortChannelIds_free(this_obj_conv);
17796 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
17797 LDKQueryShortChannelIds this_ptr_conv;
17798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17799 this_ptr_conv.is_owned = false;
17800 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17801 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
17805 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17806 LDKQueryShortChannelIds this_ptr_conv;
17807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17808 this_ptr_conv.is_owned = false;
17809 LDKThirtyTwoBytes val_ref;
17810 CHECK(*((uint32_t*)val) == 32);
17811 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17812 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
17815 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
17816 LDKQueryShortChannelIds this_ptr_conv;
17817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17818 this_ptr_conv.is_owned = false;
17819 LDKCVec_u64Z val_constr;
17820 val_constr.datalen = *((uint32_t*)val);
17821 if (val_constr.datalen > 0)
17822 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17824 val_constr.data = NULL;
17825 int64_t* val_vals = (int64_t*)(val + 4);
17826 for (size_t i = 0; i < val_constr.datalen; i++) {
17827 int64_t val_conv_8 = val_vals[i];
17828 val_constr.data[i] = val_conv_8;
17830 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
17833 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
17834 LDKThirtyTwoBytes chain_hash_arg_ref;
17835 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17836 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17837 LDKCVec_u64Z short_channel_ids_arg_constr;
17838 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
17839 if (short_channel_ids_arg_constr.datalen > 0)
17840 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17842 short_channel_ids_arg_constr.data = NULL;
17843 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
17844 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
17845 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
17846 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
17848 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
17849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17851 uint64_t ret_ref = (uint64_t)ret_var.inner;
17852 if (ret_var.is_owned) {
17858 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
17859 LDKQueryShortChannelIds orig_conv;
17860 orig_conv.inner = (void*)(orig & (~1));
17861 orig_conv.is_owned = false;
17862 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
17863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17865 uint64_t ret_ref = (uint64_t)ret_var.inner;
17866 if (ret_var.is_owned) {
17872 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
17873 LDKReplyShortChannelIdsEnd this_obj_conv;
17874 this_obj_conv.inner = (void*)(this_obj & (~1));
17875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17876 ReplyShortChannelIdsEnd_free(this_obj_conv);
17879 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
17880 LDKReplyShortChannelIdsEnd this_ptr_conv;
17881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17882 this_ptr_conv.is_owned = false;
17883 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17884 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
17888 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17889 LDKReplyShortChannelIdsEnd this_ptr_conv;
17890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17891 this_ptr_conv.is_owned = false;
17892 LDKThirtyTwoBytes val_ref;
17893 CHECK(*((uint32_t*)val) == 32);
17894 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17895 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
17898 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
17899 LDKReplyShortChannelIdsEnd this_ptr_conv;
17900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17901 this_ptr_conv.is_owned = false;
17902 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
17906 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
17907 LDKReplyShortChannelIdsEnd this_ptr_conv;
17908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17909 this_ptr_conv.is_owned = false;
17910 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
17913 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
17914 LDKThirtyTwoBytes chain_hash_arg_ref;
17915 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17916 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17917 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
17921 if (ret_var.is_owned) {
17927 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
17928 LDKReplyShortChannelIdsEnd orig_conv;
17929 orig_conv.inner = (void*)(orig & (~1));
17930 orig_conv.is_owned = false;
17931 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
17932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17934 uint64_t ret_ref = (uint64_t)ret_var.inner;
17935 if (ret_var.is_owned) {
17941 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
17942 LDKGossipTimestampFilter this_obj_conv;
17943 this_obj_conv.inner = (void*)(this_obj & (~1));
17944 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17945 GossipTimestampFilter_free(this_obj_conv);
17948 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
17949 LDKGossipTimestampFilter this_ptr_conv;
17950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17951 this_ptr_conv.is_owned = false;
17952 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17953 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
17957 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17958 LDKGossipTimestampFilter this_ptr_conv;
17959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17960 this_ptr_conv.is_owned = false;
17961 LDKThirtyTwoBytes val_ref;
17962 CHECK(*((uint32_t*)val) == 32);
17963 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17964 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
17967 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
17968 LDKGossipTimestampFilter this_ptr_conv;
17969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17970 this_ptr_conv.is_owned = false;
17971 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
17975 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
17976 LDKGossipTimestampFilter this_ptr_conv;
17977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17978 this_ptr_conv.is_owned = false;
17979 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
17982 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
17983 LDKGossipTimestampFilter this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
17990 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
17991 LDKGossipTimestampFilter this_ptr_conv;
17992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17993 this_ptr_conv.is_owned = false;
17994 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
17997 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
17998 LDKThirtyTwoBytes chain_hash_arg_ref;
17999 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18000 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18001 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
18002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18004 uint64_t ret_ref = (uint64_t)ret_var.inner;
18005 if (ret_var.is_owned) {
18011 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
18012 LDKGossipTimestampFilter orig_conv;
18013 orig_conv.inner = (void*)(orig & (~1));
18014 orig_conv.is_owned = false;
18015 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
18016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18018 uint64_t ret_ref = (uint64_t)ret_var.inner;
18019 if (ret_var.is_owned) {
18025 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
18026 if ((this_ptr & 1) != 0) return;
18027 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
18028 FREE((void*)this_ptr);
18029 ErrorAction_free(this_ptr_conv);
18032 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
18033 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
18034 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18035 *ret_copy = ErrorAction_clone(orig_conv);
18036 uint64_t ret_ref = (uint64_t)ret_copy;
18040 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
18041 LDKErrorMessage msg_conv;
18042 msg_conv.inner = (void*)(msg & (~1));
18043 msg_conv.is_owned = (msg & 1) || (msg == 0);
18044 msg_conv = ErrorMessage_clone(&msg_conv);
18045 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18046 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
18047 uint64_t ret_ref = (uint64_t)ret_copy;
18051 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
18052 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18053 *ret_copy = ErrorAction_ignore_error();
18054 uint64_t ret_ref = (uint64_t)ret_copy;
18058 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
18059 LDKLevel a_conv = LDKLevel_from_js(a);
18060 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18061 *ret_copy = ErrorAction_ignore_and_log(a_conv);
18062 uint64_t ret_ref = (uint64_t)ret_copy;
18066 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
18067 LDKErrorMessage msg_conv;
18068 msg_conv.inner = (void*)(msg & (~1));
18069 msg_conv.is_owned = (msg & 1) || (msg == 0);
18070 msg_conv = ErrorMessage_clone(&msg_conv);
18071 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18072 *ret_copy = ErrorAction_send_error_message(msg_conv);
18073 uint64_t ret_ref = (uint64_t)ret_copy;
18077 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
18078 LDKLightningError this_obj_conv;
18079 this_obj_conv.inner = (void*)(this_obj & (~1));
18080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18081 LightningError_free(this_obj_conv);
18084 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
18085 LDKLightningError this_ptr_conv;
18086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18087 this_ptr_conv.is_owned = false;
18088 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
18089 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18094 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
18095 LDKLightningError this_ptr_conv;
18096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18097 this_ptr_conv.is_owned = false;
18098 LDKStr val_conv = str_ref_to_owned_c(val);
18099 LightningError_set_err(&this_ptr_conv, val_conv);
18102 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
18103 LDKLightningError this_ptr_conv;
18104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18105 this_ptr_conv.is_owned = false;
18106 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18107 *ret_copy = LightningError_get_action(&this_ptr_conv);
18108 uint64_t ret_ref = (uint64_t)ret_copy;
18112 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
18113 LDKLightningError this_ptr_conv;
18114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18115 this_ptr_conv.is_owned = false;
18116 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
18117 LightningError_set_action(&this_ptr_conv, val_conv);
18120 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
18121 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
18122 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
18123 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
18124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18126 uint64_t ret_ref = (uint64_t)ret_var.inner;
18127 if (ret_var.is_owned) {
18133 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
18134 LDKLightningError orig_conv;
18135 orig_conv.inner = (void*)(orig & (~1));
18136 orig_conv.is_owned = false;
18137 LDKLightningError ret_var = LightningError_clone(&orig_conv);
18138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18140 uint64_t ret_ref = (uint64_t)ret_var.inner;
18141 if (ret_var.is_owned) {
18147 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
18148 LDKCommitmentUpdate this_obj_conv;
18149 this_obj_conv.inner = (void*)(this_obj & (~1));
18150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18151 CommitmentUpdate_free(this_obj_conv);
18154 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
18155 LDKCommitmentUpdate this_ptr_conv;
18156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18157 this_ptr_conv.is_owned = false;
18158 LDKCVec_UpdateAddHTLCZ val_constr;
18159 val_constr.datalen = *((uint32_t*)val);
18160 if (val_constr.datalen > 0)
18161 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18163 val_constr.data = NULL;
18164 uint32_t* val_vals = (uint32_t*)(val + 4);
18165 for (size_t p = 0; p < val_constr.datalen; p++) {
18166 uint32_t val_conv_15 = val_vals[p];
18167 LDKUpdateAddHTLC val_conv_15_conv;
18168 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
18169 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
18170 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
18171 val_constr.data[p] = val_conv_15_conv;
18173 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
18176 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
18177 LDKCommitmentUpdate this_ptr_conv;
18178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18179 this_ptr_conv.is_owned = false;
18180 LDKCVec_UpdateFulfillHTLCZ val_constr;
18181 val_constr.datalen = *((uint32_t*)val);
18182 if (val_constr.datalen > 0)
18183 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18185 val_constr.data = NULL;
18186 uint32_t* val_vals = (uint32_t*)(val + 4);
18187 for (size_t t = 0; t < val_constr.datalen; t++) {
18188 uint32_t val_conv_19 = val_vals[t];
18189 LDKUpdateFulfillHTLC val_conv_19_conv;
18190 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
18191 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
18192 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
18193 val_constr.data[t] = val_conv_19_conv;
18195 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
18198 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
18199 LDKCommitmentUpdate this_ptr_conv;
18200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18201 this_ptr_conv.is_owned = false;
18202 LDKCVec_UpdateFailHTLCZ val_constr;
18203 val_constr.datalen = *((uint32_t*)val);
18204 if (val_constr.datalen > 0)
18205 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18207 val_constr.data = NULL;
18208 uint32_t* val_vals = (uint32_t*)(val + 4);
18209 for (size_t q = 0; q < val_constr.datalen; q++) {
18210 uint32_t val_conv_16 = val_vals[q];
18211 LDKUpdateFailHTLC val_conv_16_conv;
18212 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
18213 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
18214 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
18215 val_constr.data[q] = val_conv_16_conv;
18217 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
18220 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
18221 LDKCommitmentUpdate this_ptr_conv;
18222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18223 this_ptr_conv.is_owned = false;
18224 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
18225 val_constr.datalen = *((uint32_t*)val);
18226 if (val_constr.datalen > 0)
18227 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18229 val_constr.data = NULL;
18230 uint32_t* val_vals = (uint32_t*)(val + 4);
18231 for (size_t z = 0; z < val_constr.datalen; z++) {
18232 uint32_t val_conv_25 = val_vals[z];
18233 LDKUpdateFailMalformedHTLC val_conv_25_conv;
18234 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
18235 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
18236 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
18237 val_constr.data[z] = val_conv_25_conv;
18239 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
18242 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
18243 LDKCommitmentUpdate this_ptr_conv;
18244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18245 this_ptr_conv.is_owned = false;
18246 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
18247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18249 uint64_t ret_ref = (uint64_t)ret_var.inner;
18250 if (ret_var.is_owned) {
18256 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
18257 LDKCommitmentUpdate this_ptr_conv;
18258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18259 this_ptr_conv.is_owned = false;
18260 LDKUpdateFee val_conv;
18261 val_conv.inner = (void*)(val & (~1));
18262 val_conv.is_owned = (val & 1) || (val == 0);
18263 val_conv = UpdateFee_clone(&val_conv);
18264 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
18267 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
18268 LDKCommitmentUpdate this_ptr_conv;
18269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18270 this_ptr_conv.is_owned = false;
18271 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
18272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18274 uint64_t ret_ref = (uint64_t)ret_var.inner;
18275 if (ret_var.is_owned) {
18281 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
18282 LDKCommitmentUpdate this_ptr_conv;
18283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18284 this_ptr_conv.is_owned = false;
18285 LDKCommitmentSigned val_conv;
18286 val_conv.inner = (void*)(val & (~1));
18287 val_conv.is_owned = (val & 1) || (val == 0);
18288 val_conv = CommitmentSigned_clone(&val_conv);
18289 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
18292 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) {
18293 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
18294 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
18295 if (update_add_htlcs_arg_constr.datalen > 0)
18296 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18298 update_add_htlcs_arg_constr.data = NULL;
18299 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
18300 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
18301 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
18302 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
18303 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
18304 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
18305 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
18306 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
18308 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
18309 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
18310 if (update_fulfill_htlcs_arg_constr.datalen > 0)
18311 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18313 update_fulfill_htlcs_arg_constr.data = NULL;
18314 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
18315 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
18316 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
18317 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
18318 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
18319 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
18320 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
18321 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
18323 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
18324 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
18325 if (update_fail_htlcs_arg_constr.datalen > 0)
18326 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18328 update_fail_htlcs_arg_constr.data = NULL;
18329 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
18330 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
18331 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
18332 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
18333 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
18334 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
18335 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
18336 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
18338 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
18339 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
18340 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
18341 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18343 update_fail_malformed_htlcs_arg_constr.data = NULL;
18344 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
18345 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
18346 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
18347 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
18348 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
18349 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);
18350 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
18351 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
18353 LDKUpdateFee update_fee_arg_conv;
18354 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
18355 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
18356 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
18357 LDKCommitmentSigned commitment_signed_arg_conv;
18358 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
18359 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
18360 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
18361 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);
18362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18364 uint64_t ret_ref = (uint64_t)ret_var.inner;
18365 if (ret_var.is_owned) {
18371 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
18372 LDKCommitmentUpdate orig_conv;
18373 orig_conv.inner = (void*)(orig & (~1));
18374 orig_conv.is_owned = false;
18375 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
18376 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18377 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18378 uint64_t ret_ref = (uint64_t)ret_var.inner;
18379 if (ret_var.is_owned) {
18385 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
18386 if ((this_ptr & 1) != 0) return;
18387 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
18388 FREE((void*)this_ptr);
18389 HTLCFailChannelUpdate_free(this_ptr_conv);
18392 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
18393 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
18394 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18395 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
18396 uint64_t ret_ref = (uint64_t)ret_copy;
18400 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_update_message(uint32_t msg) {
18401 LDKChannelUpdate msg_conv;
18402 msg_conv.inner = (void*)(msg & (~1));
18403 msg_conv.is_owned = (msg & 1) || (msg == 0);
18404 msg_conv = ChannelUpdate_clone(&msg_conv);
18405 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18406 *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
18407 uint64_t ret_ref = (uint64_t)ret_copy;
18411 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
18412 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18413 *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
18414 uint64_t ret_ref = (uint64_t)ret_copy;
18418 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
18419 LDKPublicKey node_id_ref;
18420 CHECK(*((uint32_t*)node_id) == 33);
18421 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
18422 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18423 *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
18424 uint64_t ret_ref = (uint64_t)ret_copy;
18428 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
18429 if ((this_ptr & 1) != 0) return;
18430 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
18431 FREE((void*)this_ptr);
18432 ChannelMessageHandler_free(this_ptr_conv);
18435 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
18436 if ((this_ptr & 1) != 0) return;
18437 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
18438 FREE((void*)this_ptr);
18439 RoutingMessageHandler_free(this_ptr_conv);
18442 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
18443 LDKAcceptChannel obj_conv;
18444 obj_conv.inner = (void*)(obj & (~1));
18445 obj_conv.is_owned = false;
18446 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
18447 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18448 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18449 CVec_u8Z_free(ret_var);
18453 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
18454 LDKu8slice ser_ref;
18455 ser_ref.datalen = *((uint32_t*)ser);
18456 ser_ref.data = (int8_t*)(ser + 4);
18457 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18458 *ret_conv = AcceptChannel_read(ser_ref);
18459 return (uint64_t)ret_conv;
18462 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
18463 LDKAnnouncementSignatures obj_conv;
18464 obj_conv.inner = (void*)(obj & (~1));
18465 obj_conv.is_owned = false;
18466 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
18467 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18468 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18469 CVec_u8Z_free(ret_var);
18473 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
18474 LDKu8slice ser_ref;
18475 ser_ref.datalen = *((uint32_t*)ser);
18476 ser_ref.data = (int8_t*)(ser + 4);
18477 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18478 *ret_conv = AnnouncementSignatures_read(ser_ref);
18479 return (uint64_t)ret_conv;
18482 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
18483 LDKChannelReestablish obj_conv;
18484 obj_conv.inner = (void*)(obj & (~1));
18485 obj_conv.is_owned = false;
18486 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
18487 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18488 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18489 CVec_u8Z_free(ret_var);
18493 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
18494 LDKu8slice ser_ref;
18495 ser_ref.datalen = *((uint32_t*)ser);
18496 ser_ref.data = (int8_t*)(ser + 4);
18497 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18498 *ret_conv = ChannelReestablish_read(ser_ref);
18499 return (uint64_t)ret_conv;
18502 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
18503 LDKClosingSigned obj_conv;
18504 obj_conv.inner = (void*)(obj & (~1));
18505 obj_conv.is_owned = false;
18506 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
18507 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18508 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18509 CVec_u8Z_free(ret_var);
18513 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
18514 LDKu8slice ser_ref;
18515 ser_ref.datalen = *((uint32_t*)ser);
18516 ser_ref.data = (int8_t*)(ser + 4);
18517 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18518 *ret_conv = ClosingSigned_read(ser_ref);
18519 return (uint64_t)ret_conv;
18522 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
18523 LDKCommitmentSigned obj_conv;
18524 obj_conv.inner = (void*)(obj & (~1));
18525 obj_conv.is_owned = false;
18526 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
18527 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18528 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18529 CVec_u8Z_free(ret_var);
18533 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
18534 LDKu8slice ser_ref;
18535 ser_ref.datalen = *((uint32_t*)ser);
18536 ser_ref.data = (int8_t*)(ser + 4);
18537 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18538 *ret_conv = CommitmentSigned_read(ser_ref);
18539 return (uint64_t)ret_conv;
18542 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
18543 LDKFundingCreated obj_conv;
18544 obj_conv.inner = (void*)(obj & (~1));
18545 obj_conv.is_owned = false;
18546 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
18547 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18548 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18549 CVec_u8Z_free(ret_var);
18553 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
18554 LDKu8slice ser_ref;
18555 ser_ref.datalen = *((uint32_t*)ser);
18556 ser_ref.data = (int8_t*)(ser + 4);
18557 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18558 *ret_conv = FundingCreated_read(ser_ref);
18559 return (uint64_t)ret_conv;
18562 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
18563 LDKFundingSigned obj_conv;
18564 obj_conv.inner = (void*)(obj & (~1));
18565 obj_conv.is_owned = false;
18566 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
18567 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18568 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18569 CVec_u8Z_free(ret_var);
18573 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
18574 LDKu8slice ser_ref;
18575 ser_ref.datalen = *((uint32_t*)ser);
18576 ser_ref.data = (int8_t*)(ser + 4);
18577 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18578 *ret_conv = FundingSigned_read(ser_ref);
18579 return (uint64_t)ret_conv;
18582 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
18583 LDKFundingLocked obj_conv;
18584 obj_conv.inner = (void*)(obj & (~1));
18585 obj_conv.is_owned = false;
18586 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
18587 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18588 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18589 CVec_u8Z_free(ret_var);
18593 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
18594 LDKu8slice ser_ref;
18595 ser_ref.datalen = *((uint32_t*)ser);
18596 ser_ref.data = (int8_t*)(ser + 4);
18597 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18598 *ret_conv = FundingLocked_read(ser_ref);
18599 return (uint64_t)ret_conv;
18602 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
18604 obj_conv.inner = (void*)(obj & (~1));
18605 obj_conv.is_owned = false;
18606 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
18607 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18608 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18609 CVec_u8Z_free(ret_var);
18613 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
18614 LDKu8slice ser_ref;
18615 ser_ref.datalen = *((uint32_t*)ser);
18616 ser_ref.data = (int8_t*)(ser + 4);
18617 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18618 *ret_conv = Init_read(ser_ref);
18619 return (uint64_t)ret_conv;
18622 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
18623 LDKOpenChannel obj_conv;
18624 obj_conv.inner = (void*)(obj & (~1));
18625 obj_conv.is_owned = false;
18626 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
18627 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18628 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18629 CVec_u8Z_free(ret_var);
18633 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
18634 LDKu8slice ser_ref;
18635 ser_ref.datalen = *((uint32_t*)ser);
18636 ser_ref.data = (int8_t*)(ser + 4);
18637 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18638 *ret_conv = OpenChannel_read(ser_ref);
18639 return (uint64_t)ret_conv;
18642 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
18643 LDKRevokeAndACK obj_conv;
18644 obj_conv.inner = (void*)(obj & (~1));
18645 obj_conv.is_owned = false;
18646 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
18647 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18648 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18649 CVec_u8Z_free(ret_var);
18653 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
18654 LDKu8slice ser_ref;
18655 ser_ref.datalen = *((uint32_t*)ser);
18656 ser_ref.data = (int8_t*)(ser + 4);
18657 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18658 *ret_conv = RevokeAndACK_read(ser_ref);
18659 return (uint64_t)ret_conv;
18662 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
18663 LDKShutdown obj_conv;
18664 obj_conv.inner = (void*)(obj & (~1));
18665 obj_conv.is_owned = false;
18666 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
18667 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18668 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18669 CVec_u8Z_free(ret_var);
18673 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
18674 LDKu8slice ser_ref;
18675 ser_ref.datalen = *((uint32_t*)ser);
18676 ser_ref.data = (int8_t*)(ser + 4);
18677 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18678 *ret_conv = Shutdown_read(ser_ref);
18679 return (uint64_t)ret_conv;
18682 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
18683 LDKUpdateFailHTLC obj_conv;
18684 obj_conv.inner = (void*)(obj & (~1));
18685 obj_conv.is_owned = false;
18686 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
18687 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18688 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18689 CVec_u8Z_free(ret_var);
18693 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
18694 LDKu8slice ser_ref;
18695 ser_ref.datalen = *((uint32_t*)ser);
18696 ser_ref.data = (int8_t*)(ser + 4);
18697 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18698 *ret_conv = UpdateFailHTLC_read(ser_ref);
18699 return (uint64_t)ret_conv;
18702 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
18703 LDKUpdateFailMalformedHTLC obj_conv;
18704 obj_conv.inner = (void*)(obj & (~1));
18705 obj_conv.is_owned = false;
18706 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
18707 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18708 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18709 CVec_u8Z_free(ret_var);
18713 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
18714 LDKu8slice ser_ref;
18715 ser_ref.datalen = *((uint32_t*)ser);
18716 ser_ref.data = (int8_t*)(ser + 4);
18717 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18718 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
18719 return (uint64_t)ret_conv;
18722 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
18723 LDKUpdateFee obj_conv;
18724 obj_conv.inner = (void*)(obj & (~1));
18725 obj_conv.is_owned = false;
18726 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
18727 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18728 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18729 CVec_u8Z_free(ret_var);
18733 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
18734 LDKu8slice ser_ref;
18735 ser_ref.datalen = *((uint32_t*)ser);
18736 ser_ref.data = (int8_t*)(ser + 4);
18737 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18738 *ret_conv = UpdateFee_read(ser_ref);
18739 return (uint64_t)ret_conv;
18742 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
18743 LDKUpdateFulfillHTLC obj_conv;
18744 obj_conv.inner = (void*)(obj & (~1));
18745 obj_conv.is_owned = false;
18746 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
18747 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18748 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18749 CVec_u8Z_free(ret_var);
18753 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
18754 LDKu8slice ser_ref;
18755 ser_ref.datalen = *((uint32_t*)ser);
18756 ser_ref.data = (int8_t*)(ser + 4);
18757 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18758 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
18759 return (uint64_t)ret_conv;
18762 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
18763 LDKUpdateAddHTLC obj_conv;
18764 obj_conv.inner = (void*)(obj & (~1));
18765 obj_conv.is_owned = false;
18766 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
18767 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18768 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18769 CVec_u8Z_free(ret_var);
18773 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
18774 LDKu8slice ser_ref;
18775 ser_ref.datalen = *((uint32_t*)ser);
18776 ser_ref.data = (int8_t*)(ser + 4);
18777 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18778 *ret_conv = UpdateAddHTLC_read(ser_ref);
18779 return (uint64_t)ret_conv;
18782 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
18784 obj_conv.inner = (void*)(obj & (~1));
18785 obj_conv.is_owned = false;
18786 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
18787 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18788 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18789 CVec_u8Z_free(ret_var);
18793 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
18794 LDKu8slice ser_ref;
18795 ser_ref.datalen = *((uint32_t*)ser);
18796 ser_ref.data = (int8_t*)(ser + 4);
18797 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18798 *ret_conv = Ping_read(ser_ref);
18799 return (uint64_t)ret_conv;
18802 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
18804 obj_conv.inner = (void*)(obj & (~1));
18805 obj_conv.is_owned = false;
18806 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
18807 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18808 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18809 CVec_u8Z_free(ret_var);
18813 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
18814 LDKu8slice ser_ref;
18815 ser_ref.datalen = *((uint32_t*)ser);
18816 ser_ref.data = (int8_t*)(ser + 4);
18817 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18818 *ret_conv = Pong_read(ser_ref);
18819 return (uint64_t)ret_conv;
18822 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
18823 LDKUnsignedChannelAnnouncement obj_conv;
18824 obj_conv.inner = (void*)(obj & (~1));
18825 obj_conv.is_owned = false;
18826 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
18827 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18828 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18829 CVec_u8Z_free(ret_var);
18833 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
18834 LDKu8slice ser_ref;
18835 ser_ref.datalen = *((uint32_t*)ser);
18836 ser_ref.data = (int8_t*)(ser + 4);
18837 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18838 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
18839 return (uint64_t)ret_conv;
18842 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
18843 LDKChannelAnnouncement obj_conv;
18844 obj_conv.inner = (void*)(obj & (~1));
18845 obj_conv.is_owned = false;
18846 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
18847 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18848 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18849 CVec_u8Z_free(ret_var);
18853 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
18854 LDKu8slice ser_ref;
18855 ser_ref.datalen = *((uint32_t*)ser);
18856 ser_ref.data = (int8_t*)(ser + 4);
18857 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18858 *ret_conv = ChannelAnnouncement_read(ser_ref);
18859 return (uint64_t)ret_conv;
18862 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
18863 LDKUnsignedChannelUpdate obj_conv;
18864 obj_conv.inner = (void*)(obj & (~1));
18865 obj_conv.is_owned = false;
18866 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
18867 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18868 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18869 CVec_u8Z_free(ret_var);
18873 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
18874 LDKu8slice ser_ref;
18875 ser_ref.datalen = *((uint32_t*)ser);
18876 ser_ref.data = (int8_t*)(ser + 4);
18877 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18878 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
18879 return (uint64_t)ret_conv;
18882 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
18883 LDKChannelUpdate obj_conv;
18884 obj_conv.inner = (void*)(obj & (~1));
18885 obj_conv.is_owned = false;
18886 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
18887 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18888 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18889 CVec_u8Z_free(ret_var);
18893 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
18894 LDKu8slice ser_ref;
18895 ser_ref.datalen = *((uint32_t*)ser);
18896 ser_ref.data = (int8_t*)(ser + 4);
18897 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18898 *ret_conv = ChannelUpdate_read(ser_ref);
18899 return (uint64_t)ret_conv;
18902 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
18903 LDKErrorMessage obj_conv;
18904 obj_conv.inner = (void*)(obj & (~1));
18905 obj_conv.is_owned = false;
18906 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
18907 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18908 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18909 CVec_u8Z_free(ret_var);
18913 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
18914 LDKu8slice ser_ref;
18915 ser_ref.datalen = *((uint32_t*)ser);
18916 ser_ref.data = (int8_t*)(ser + 4);
18917 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18918 *ret_conv = ErrorMessage_read(ser_ref);
18919 return (uint64_t)ret_conv;
18922 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
18923 LDKUnsignedNodeAnnouncement obj_conv;
18924 obj_conv.inner = (void*)(obj & (~1));
18925 obj_conv.is_owned = false;
18926 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
18927 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18928 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18929 CVec_u8Z_free(ret_var);
18933 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
18934 LDKu8slice ser_ref;
18935 ser_ref.datalen = *((uint32_t*)ser);
18936 ser_ref.data = (int8_t*)(ser + 4);
18937 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18938 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
18939 return (uint64_t)ret_conv;
18942 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
18943 LDKNodeAnnouncement obj_conv;
18944 obj_conv.inner = (void*)(obj & (~1));
18945 obj_conv.is_owned = false;
18946 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
18947 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18948 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18949 CVec_u8Z_free(ret_var);
18953 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
18954 LDKu8slice ser_ref;
18955 ser_ref.datalen = *((uint32_t*)ser);
18956 ser_ref.data = (int8_t*)(ser + 4);
18957 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18958 *ret_conv = NodeAnnouncement_read(ser_ref);
18959 return (uint64_t)ret_conv;
18962 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
18963 LDKu8slice ser_ref;
18964 ser_ref.datalen = *((uint32_t*)ser);
18965 ser_ref.data = (int8_t*)(ser + 4);
18966 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18967 *ret_conv = QueryShortChannelIds_read(ser_ref);
18968 return (uint64_t)ret_conv;
18971 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
18972 LDKQueryShortChannelIds obj_conv;
18973 obj_conv.inner = (void*)(obj & (~1));
18974 obj_conv.is_owned = false;
18975 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
18976 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18977 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18978 CVec_u8Z_free(ret_var);
18982 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
18983 LDKu8slice ser_ref;
18984 ser_ref.datalen = *((uint32_t*)ser);
18985 ser_ref.data = (int8_t*)(ser + 4);
18986 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18987 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
18988 return (uint64_t)ret_conv;
18991 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
18992 LDKReplyShortChannelIdsEnd obj_conv;
18993 obj_conv.inner = (void*)(obj & (~1));
18994 obj_conv.is_owned = false;
18995 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
18996 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18997 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18998 CVec_u8Z_free(ret_var);
19002 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
19003 LDKQueryChannelRange this_arg_conv;
19004 this_arg_conv.inner = (void*)(this_arg & (~1));
19005 this_arg_conv.is_owned = false;
19006 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
19010 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
19011 LDKu8slice ser_ref;
19012 ser_ref.datalen = *((uint32_t*)ser);
19013 ser_ref.data = (int8_t*)(ser + 4);
19014 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19015 *ret_conv = QueryChannelRange_read(ser_ref);
19016 return (uint64_t)ret_conv;
19019 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
19020 LDKQueryChannelRange obj_conv;
19021 obj_conv.inner = (void*)(obj & (~1));
19022 obj_conv.is_owned = false;
19023 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
19024 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19025 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19026 CVec_u8Z_free(ret_var);
19030 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
19031 LDKu8slice ser_ref;
19032 ser_ref.datalen = *((uint32_t*)ser);
19033 ser_ref.data = (int8_t*)(ser + 4);
19034 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19035 *ret_conv = ReplyChannelRange_read(ser_ref);
19036 return (uint64_t)ret_conv;
19039 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
19040 LDKReplyChannelRange obj_conv;
19041 obj_conv.inner = (void*)(obj & (~1));
19042 obj_conv.is_owned = false;
19043 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
19044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19046 CVec_u8Z_free(ret_var);
19050 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
19051 LDKu8slice ser_ref;
19052 ser_ref.datalen = *((uint32_t*)ser);
19053 ser_ref.data = (int8_t*)(ser + 4);
19054 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19055 *ret_conv = GossipTimestampFilter_read(ser_ref);
19056 return (uint64_t)ret_conv;
19059 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
19060 LDKGossipTimestampFilter obj_conv;
19061 obj_conv.inner = (void*)(obj & (~1));
19062 obj_conv.is_owned = false;
19063 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
19064 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19065 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19066 CVec_u8Z_free(ret_var);
19070 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
19071 LDKIgnoringMessageHandler this_obj_conv;
19072 this_obj_conv.inner = (void*)(this_obj & (~1));
19073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19074 IgnoringMessageHandler_free(this_obj_conv);
19077 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
19078 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
19079 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19080 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19081 uint64_t ret_ref = (uint64_t)ret_var.inner;
19082 if (ret_var.is_owned) {
19088 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19089 LDKIgnoringMessageHandler this_arg_conv;
19090 this_arg_conv.inner = (void*)(this_arg & (~1));
19091 this_arg_conv.is_owned = false;
19092 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19093 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19094 return (uint64_t)ret;
19097 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
19098 LDKIgnoringMessageHandler this_arg_conv;
19099 this_arg_conv.inner = (void*)(this_arg & (~1));
19100 this_arg_conv.is_owned = false;
19101 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19102 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
19103 return (uint64_t)ret;
19106 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
19107 LDKErroringMessageHandler this_obj_conv;
19108 this_obj_conv.inner = (void*)(this_obj & (~1));
19109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19110 ErroringMessageHandler_free(this_obj_conv);
19113 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
19114 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
19115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19117 uint64_t ret_ref = (uint64_t)ret_var.inner;
19118 if (ret_var.is_owned) {
19124 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19125 LDKErroringMessageHandler this_arg_conv;
19126 this_arg_conv.inner = (void*)(this_arg & (~1));
19127 this_arg_conv.is_owned = false;
19128 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19129 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19130 return (uint64_t)ret;
19133 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
19134 LDKErroringMessageHandler this_arg_conv;
19135 this_arg_conv.inner = (void*)(this_arg & (~1));
19136 this_arg_conv.is_owned = false;
19137 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
19138 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
19139 return (uint64_t)ret;
19142 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
19143 LDKMessageHandler this_obj_conv;
19144 this_obj_conv.inner = (void*)(this_obj & (~1));
19145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19146 MessageHandler_free(this_obj_conv);
19149 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
19150 LDKMessageHandler this_ptr_conv;
19151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19152 this_ptr_conv.is_owned = false;
19153 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
19157 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
19158 LDKMessageHandler this_ptr_conv;
19159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19160 this_ptr_conv.is_owned = false;
19161 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
19162 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
19165 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
19166 LDKMessageHandler this_ptr_conv;
19167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19168 this_ptr_conv.is_owned = false;
19169 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
19173 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
19174 LDKMessageHandler this_ptr_conv;
19175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19176 this_ptr_conv.is_owned = false;
19177 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
19178 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
19181 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
19182 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
19183 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
19184 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
19185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19187 uint64_t ret_ref = (uint64_t)ret_var.inner;
19188 if (ret_var.is_owned) {
19194 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
19195 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
19196 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19197 *ret = SocketDescriptor_clone(orig_conv);
19198 return (uint64_t)ret;
19201 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
19202 if ((this_ptr & 1) != 0) return;
19203 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
19204 FREE((void*)this_ptr);
19205 SocketDescriptor_free(this_ptr_conv);
19208 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
19209 LDKPeerHandleError this_obj_conv;
19210 this_obj_conv.inner = (void*)(this_obj & (~1));
19211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19212 PeerHandleError_free(this_obj_conv);
19215 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
19216 LDKPeerHandleError this_ptr_conv;
19217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19218 this_ptr_conv.is_owned = false;
19219 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
19223 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
19224 LDKPeerHandleError this_ptr_conv;
19225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19226 this_ptr_conv.is_owned = false;
19227 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
19230 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
19231 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
19232 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19233 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19234 uint64_t ret_ref = (uint64_t)ret_var.inner;
19235 if (ret_var.is_owned) {
19241 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
19242 LDKPeerHandleError orig_conv;
19243 orig_conv.inner = (void*)(orig & (~1));
19244 orig_conv.is_owned = false;
19245 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
19246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19248 uint64_t ret_ref = (uint64_t)ret_var.inner;
19249 if (ret_var.is_owned) {
19255 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
19256 LDKPeerManager this_obj_conv;
19257 this_obj_conv.inner = (void*)(this_obj & (~1));
19258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19259 PeerManager_free(this_obj_conv);
19262 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) {
19263 LDKMessageHandler message_handler_conv;
19264 message_handler_conv.inner = (void*)(message_handler & (~1));
19265 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
19266 // Warning: we need a move here but no clone is available for LDKMessageHandler
19267 LDKSecretKey our_node_secret_ref;
19268 CHECK(*((uint32_t*)our_node_secret) == 32);
19269 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
19270 unsigned char ephemeral_random_data_arr[32];
19271 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
19272 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
19273 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
19274 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19275 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
19276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19278 uint64_t ret_ref = (uint64_t)ret_var.inner;
19279 if (ret_var.is_owned) {
19285 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
19286 LDKPeerManager this_arg_conv;
19287 this_arg_conv.inner = (void*)(this_arg & (~1));
19288 this_arg_conv.is_owned = false;
19289 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
19290 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19291 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19292 for (size_t m = 0; m < ret_var.datalen; m++) {
19293 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19294 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
19295 ret_arr_ptr[m] = ret_conv_12_arr;
19297 FREE(ret_var.data);
19301 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
19302 LDKPeerManager this_arg_conv;
19303 this_arg_conv.inner = (void*)(this_arg & (~1));
19304 this_arg_conv.is_owned = false;
19305 LDKPublicKey their_node_id_ref;
19306 CHECK(*((uint32_t*)their_node_id) == 33);
19307 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
19308 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19309 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19310 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
19311 return (uint64_t)ret_conv;
19314 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
19315 LDKPeerManager this_arg_conv;
19316 this_arg_conv.inner = (void*)(this_arg & (~1));
19317 this_arg_conv.is_owned = false;
19318 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19319 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19320 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
19321 return (uint64_t)ret_conv;
19324 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
19325 LDKPeerManager this_arg_conv;
19326 this_arg_conv.inner = (void*)(this_arg & (~1));
19327 this_arg_conv.is_owned = false;
19328 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19329 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19330 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
19331 return (uint64_t)ret_conv;
19334 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
19335 LDKPeerManager this_arg_conv;
19336 this_arg_conv.inner = (void*)(this_arg & (~1));
19337 this_arg_conv.is_owned = false;
19338 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
19339 LDKu8slice data_ref;
19340 data_ref.datalen = *((uint32_t*)data);
19341 data_ref.data = (int8_t*)(data + 4);
19342 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19343 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
19344 return (uint64_t)ret_conv;
19347 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
19348 LDKPeerManager this_arg_conv;
19349 this_arg_conv.inner = (void*)(this_arg & (~1));
19350 this_arg_conv.is_owned = false;
19351 PeerManager_process_events(&this_arg_conv);
19354 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
19355 LDKPeerManager this_arg_conv;
19356 this_arg_conv.inner = (void*)(this_arg & (~1));
19357 this_arg_conv.is_owned = false;
19358 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19359 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
19362 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
19363 LDKPeerManager this_arg_conv;
19364 this_arg_conv.inner = (void*)(this_arg & (~1));
19365 this_arg_conv.is_owned = false;
19366 LDKPublicKey node_id_ref;
19367 CHECK(*((uint32_t*)node_id) == 33);
19368 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
19369 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
19372 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
19373 LDKPeerManager this_arg_conv;
19374 this_arg_conv.inner = (void*)(this_arg & (~1));
19375 this_arg_conv.is_owned = false;
19376 PeerManager_timer_tick_occurred(&this_arg_conv);
19379 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
19380 unsigned char commitment_seed_arr[32];
19381 CHECK(*((uint32_t*)commitment_seed) == 32);
19382 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
19383 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
19384 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19385 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
19389 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
19390 LDKPublicKey per_commitment_point_ref;
19391 CHECK(*((uint32_t*)per_commitment_point) == 33);
19392 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19393 unsigned char base_secret_arr[32];
19394 CHECK(*((uint32_t*)base_secret) == 32);
19395 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
19396 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
19397 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19398 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
19399 return (uint64_t)ret_conv;
19402 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
19403 LDKPublicKey per_commitment_point_ref;
19404 CHECK(*((uint32_t*)per_commitment_point) == 33);
19405 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19406 LDKPublicKey base_point_ref;
19407 CHECK(*((uint32_t*)base_point) == 33);
19408 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
19409 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19410 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
19411 return (uint64_t)ret_conv;
19414 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
19415 unsigned char per_commitment_secret_arr[32];
19416 CHECK(*((uint32_t*)per_commitment_secret) == 32);
19417 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
19418 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
19419 unsigned char countersignatory_revocation_base_secret_arr[32];
19420 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
19421 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
19422 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
19423 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19424 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
19425 return (uint64_t)ret_conv;
19428 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
19429 LDKPublicKey per_commitment_point_ref;
19430 CHECK(*((uint32_t*)per_commitment_point) == 33);
19431 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19432 LDKPublicKey countersignatory_revocation_base_point_ref;
19433 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
19434 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
19435 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19436 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
19437 return (uint64_t)ret_conv;
19440 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
19441 LDKTxCreationKeys this_obj_conv;
19442 this_obj_conv.inner = (void*)(this_obj & (~1));
19443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19444 TxCreationKeys_free(this_obj_conv);
19447 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
19448 LDKTxCreationKeys this_ptr_conv;
19449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19450 this_ptr_conv.is_owned = false;
19451 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19452 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19456 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19457 LDKTxCreationKeys this_ptr_conv;
19458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19459 this_ptr_conv.is_owned = false;
19460 LDKPublicKey val_ref;
19461 CHECK(*((uint32_t*)val) == 33);
19462 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19463 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
19466 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
19467 LDKTxCreationKeys this_ptr_conv;
19468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19469 this_ptr_conv.is_owned = false;
19470 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19471 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
19475 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
19476 LDKTxCreationKeys this_ptr_conv;
19477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19478 this_ptr_conv.is_owned = false;
19479 LDKPublicKey val_ref;
19480 CHECK(*((uint32_t*)val) == 33);
19481 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19482 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
19485 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
19486 LDKTxCreationKeys this_ptr_conv;
19487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19488 this_ptr_conv.is_owned = false;
19489 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19490 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
19494 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
19495 LDKTxCreationKeys this_ptr_conv;
19496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19497 this_ptr_conv.is_owned = false;
19498 LDKPublicKey val_ref;
19499 CHECK(*((uint32_t*)val) == 33);
19500 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19501 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
19504 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
19505 LDKTxCreationKeys this_ptr_conv;
19506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19507 this_ptr_conv.is_owned = false;
19508 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19509 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
19513 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
19514 LDKTxCreationKeys this_ptr_conv;
19515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19516 this_ptr_conv.is_owned = false;
19517 LDKPublicKey val_ref;
19518 CHECK(*((uint32_t*)val) == 33);
19519 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19520 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
19523 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
19524 LDKTxCreationKeys this_ptr_conv;
19525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19526 this_ptr_conv.is_owned = false;
19527 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19528 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
19532 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
19533 LDKTxCreationKeys this_ptr_conv;
19534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19535 this_ptr_conv.is_owned = false;
19536 LDKPublicKey val_ref;
19537 CHECK(*((uint32_t*)val) == 33);
19538 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19539 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
19542 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) {
19543 LDKPublicKey per_commitment_point_arg_ref;
19544 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
19545 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
19546 LDKPublicKey revocation_key_arg_ref;
19547 CHECK(*((uint32_t*)revocation_key_arg) == 33);
19548 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
19549 LDKPublicKey broadcaster_htlc_key_arg_ref;
19550 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
19551 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
19552 LDKPublicKey countersignatory_htlc_key_arg_ref;
19553 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
19554 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
19555 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
19556 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
19557 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
19558 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);
19559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19561 uint64_t ret_ref = (uint64_t)ret_var.inner;
19562 if (ret_var.is_owned) {
19568 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
19569 LDKTxCreationKeys orig_conv;
19570 orig_conv.inner = (void*)(orig & (~1));
19571 orig_conv.is_owned = false;
19572 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
19573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19575 uint64_t ret_ref = (uint64_t)ret_var.inner;
19576 if (ret_var.is_owned) {
19582 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
19583 LDKTxCreationKeys obj_conv;
19584 obj_conv.inner = (void*)(obj & (~1));
19585 obj_conv.is_owned = false;
19586 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
19587 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19588 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19589 CVec_u8Z_free(ret_var);
19593 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
19594 LDKu8slice ser_ref;
19595 ser_ref.datalen = *((uint32_t*)ser);
19596 ser_ref.data = (int8_t*)(ser + 4);
19597 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
19598 *ret_conv = TxCreationKeys_read(ser_ref);
19599 return (uint64_t)ret_conv;
19602 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
19603 LDKChannelPublicKeys this_obj_conv;
19604 this_obj_conv.inner = (void*)(this_obj & (~1));
19605 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19606 ChannelPublicKeys_free(this_obj_conv);
19609 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
19610 LDKChannelPublicKeys this_ptr_conv;
19611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19612 this_ptr_conv.is_owned = false;
19613 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19614 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
19618 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
19619 LDKChannelPublicKeys this_ptr_conv;
19620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19621 this_ptr_conv.is_owned = false;
19622 LDKPublicKey val_ref;
19623 CHECK(*((uint32_t*)val) == 33);
19624 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19625 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
19628 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
19629 LDKChannelPublicKeys this_ptr_conv;
19630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19631 this_ptr_conv.is_owned = false;
19632 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19633 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
19637 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
19638 LDKChannelPublicKeys this_ptr_conv;
19639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19640 this_ptr_conv.is_owned = false;
19641 LDKPublicKey val_ref;
19642 CHECK(*((uint32_t*)val) == 33);
19643 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19644 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
19647 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
19648 LDKChannelPublicKeys this_ptr_conv;
19649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19650 this_ptr_conv.is_owned = false;
19651 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19652 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
19656 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
19657 LDKChannelPublicKeys this_ptr_conv;
19658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19659 this_ptr_conv.is_owned = false;
19660 LDKPublicKey val_ref;
19661 CHECK(*((uint32_t*)val) == 33);
19662 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19663 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
19666 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
19667 LDKChannelPublicKeys this_ptr_conv;
19668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19669 this_ptr_conv.is_owned = false;
19670 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19671 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
19675 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
19676 LDKChannelPublicKeys this_ptr_conv;
19677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19678 this_ptr_conv.is_owned = false;
19679 LDKPublicKey val_ref;
19680 CHECK(*((uint32_t*)val) == 33);
19681 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19682 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19685 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
19686 LDKChannelPublicKeys this_ptr_conv;
19687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19688 this_ptr_conv.is_owned = false;
19689 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19690 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
19694 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
19695 LDKChannelPublicKeys this_ptr_conv;
19696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19697 this_ptr_conv.is_owned = false;
19698 LDKPublicKey val_ref;
19699 CHECK(*((uint32_t*)val) == 33);
19700 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19701 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
19704 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) {
19705 LDKPublicKey funding_pubkey_arg_ref;
19706 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
19707 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
19708 LDKPublicKey revocation_basepoint_arg_ref;
19709 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
19710 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
19711 LDKPublicKey payment_point_arg_ref;
19712 CHECK(*((uint32_t*)payment_point_arg) == 33);
19713 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
19714 LDKPublicKey delayed_payment_basepoint_arg_ref;
19715 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
19716 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
19717 LDKPublicKey htlc_basepoint_arg_ref;
19718 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
19719 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
19720 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);
19721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19723 uint64_t ret_ref = (uint64_t)ret_var.inner;
19724 if (ret_var.is_owned) {
19730 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
19731 LDKChannelPublicKeys orig_conv;
19732 orig_conv.inner = (void*)(orig & (~1));
19733 orig_conv.is_owned = false;
19734 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
19735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19737 uint64_t ret_ref = (uint64_t)ret_var.inner;
19738 if (ret_var.is_owned) {
19744 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
19745 LDKChannelPublicKeys obj_conv;
19746 obj_conv.inner = (void*)(obj & (~1));
19747 obj_conv.is_owned = false;
19748 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
19749 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19750 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19751 CVec_u8Z_free(ret_var);
19755 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
19756 LDKu8slice ser_ref;
19757 ser_ref.datalen = *((uint32_t*)ser);
19758 ser_ref.data = (int8_t*)(ser + 4);
19759 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
19760 *ret_conv = ChannelPublicKeys_read(ser_ref);
19761 return (uint64_t)ret_conv;
19764 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) {
19765 LDKPublicKey per_commitment_point_ref;
19766 CHECK(*((uint32_t*)per_commitment_point) == 33);
19767 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19768 LDKPublicKey broadcaster_delayed_payment_base_ref;
19769 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
19770 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
19771 LDKPublicKey broadcaster_htlc_base_ref;
19772 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
19773 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
19774 LDKPublicKey countersignatory_revocation_base_ref;
19775 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
19776 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
19777 LDKPublicKey countersignatory_htlc_base_ref;
19778 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
19779 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
19780 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
19781 *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);
19782 return (uint64_t)ret_conv;
19785 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
19786 LDKPublicKey per_commitment_point_ref;
19787 CHECK(*((uint32_t*)per_commitment_point) == 33);
19788 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19789 LDKChannelPublicKeys broadcaster_keys_conv;
19790 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
19791 broadcaster_keys_conv.is_owned = false;
19792 LDKChannelPublicKeys countersignatory_keys_conv;
19793 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
19794 countersignatory_keys_conv.is_owned = false;
19795 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
19796 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
19797 return (uint64_t)ret_conv;
19800 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
19801 LDKPublicKey revocation_key_ref;
19802 CHECK(*((uint32_t*)revocation_key) == 33);
19803 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
19804 LDKPublicKey broadcaster_delayed_payment_key_ref;
19805 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
19806 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
19807 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
19808 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19809 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19810 CVec_u8Z_free(ret_var);
19814 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
19815 LDKHTLCOutputInCommitment this_obj_conv;
19816 this_obj_conv.inner = (void*)(this_obj & (~1));
19817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19818 HTLCOutputInCommitment_free(this_obj_conv);
19821 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
19822 LDKHTLCOutputInCommitment this_ptr_conv;
19823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19824 this_ptr_conv.is_owned = false;
19825 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
19829 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
19830 LDKHTLCOutputInCommitment this_ptr_conv;
19831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19832 this_ptr_conv.is_owned = false;
19833 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
19836 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
19837 LDKHTLCOutputInCommitment this_ptr_conv;
19838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19839 this_ptr_conv.is_owned = false;
19840 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
19844 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
19845 LDKHTLCOutputInCommitment this_ptr_conv;
19846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19847 this_ptr_conv.is_owned = false;
19848 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
19851 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
19852 LDKHTLCOutputInCommitment this_ptr_conv;
19853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19854 this_ptr_conv.is_owned = false;
19855 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
19859 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
19860 LDKHTLCOutputInCommitment this_ptr_conv;
19861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19862 this_ptr_conv.is_owned = false;
19863 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
19866 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
19867 LDKHTLCOutputInCommitment this_ptr_conv;
19868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19869 this_ptr_conv.is_owned = false;
19870 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19871 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
19875 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
19876 LDKHTLCOutputInCommitment this_ptr_conv;
19877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19878 this_ptr_conv.is_owned = false;
19879 LDKThirtyTwoBytes val_ref;
19880 CHECK(*((uint32_t*)val) == 32);
19881 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19882 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
19885 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
19886 LDKHTLCOutputInCommitment this_ptr_conv;
19887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19888 this_ptr_conv.is_owned = false;
19889 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19890 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
19891 uint64_t ret_ref = (uint64_t)ret_copy;
19895 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
19896 LDKHTLCOutputInCommitment this_ptr_conv;
19897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19898 this_ptr_conv.is_owned = false;
19899 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
19900 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
19903 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) {
19904 LDKThirtyTwoBytes payment_hash_arg_ref;
19905 CHECK(*((uint32_t*)payment_hash_arg) == 32);
19906 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
19907 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
19908 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
19909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19911 uint64_t ret_ref = (uint64_t)ret_var.inner;
19912 if (ret_var.is_owned) {
19918 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
19919 LDKHTLCOutputInCommitment orig_conv;
19920 orig_conv.inner = (void*)(orig & (~1));
19921 orig_conv.is_owned = false;
19922 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
19923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19925 uint64_t ret_ref = (uint64_t)ret_var.inner;
19926 if (ret_var.is_owned) {
19932 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
19933 LDKHTLCOutputInCommitment obj_conv;
19934 obj_conv.inner = (void*)(obj & (~1));
19935 obj_conv.is_owned = false;
19936 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
19937 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19938 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19939 CVec_u8Z_free(ret_var);
19943 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
19944 LDKu8slice ser_ref;
19945 ser_ref.datalen = *((uint32_t*)ser);
19946 ser_ref.data = (int8_t*)(ser + 4);
19947 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
19948 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
19949 return (uint64_t)ret_conv;
19952 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
19953 LDKHTLCOutputInCommitment htlc_conv;
19954 htlc_conv.inner = (void*)(htlc & (~1));
19955 htlc_conv.is_owned = false;
19956 LDKTxCreationKeys keys_conv;
19957 keys_conv.inner = (void*)(keys & (~1));
19958 keys_conv.is_owned = false;
19959 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
19960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19962 CVec_u8Z_free(ret_var);
19966 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
19967 LDKPublicKey broadcaster_ref;
19968 CHECK(*((uint32_t*)broadcaster) == 33);
19969 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
19970 LDKPublicKey countersignatory_ref;
19971 CHECK(*((uint32_t*)countersignatory) == 33);
19972 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
19973 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
19974 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19975 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19976 CVec_u8Z_free(ret_var);
19980 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) {
19981 unsigned char commitment_txid_arr[32];
19982 CHECK(*((uint32_t*)commitment_txid) == 32);
19983 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
19984 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
19985 LDKHTLCOutputInCommitment htlc_conv;
19986 htlc_conv.inner = (void*)(htlc & (~1));
19987 htlc_conv.is_owned = false;
19988 LDKPublicKey broadcaster_delayed_payment_key_ref;
19989 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
19990 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
19991 LDKPublicKey revocation_key_ref;
19992 CHECK(*((uint32_t*)revocation_key) == 33);
19993 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
19994 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
19995 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19996 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19997 Transaction_free(ret_var);
20001 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
20002 LDKChannelTransactionParameters this_obj_conv;
20003 this_obj_conv.inner = (void*)(this_obj & (~1));
20004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20005 ChannelTransactionParameters_free(this_obj_conv);
20008 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
20009 LDKChannelTransactionParameters this_ptr_conv;
20010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20011 this_ptr_conv.is_owned = false;
20012 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
20013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20015 uint64_t ret_ref = (uint64_t)ret_var.inner;
20016 if (ret_var.is_owned) {
20022 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
20023 LDKChannelTransactionParameters this_ptr_conv;
20024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20025 this_ptr_conv.is_owned = false;
20026 LDKChannelPublicKeys val_conv;
20027 val_conv.inner = (void*)(val & (~1));
20028 val_conv.is_owned = (val & 1) || (val == 0);
20029 val_conv = ChannelPublicKeys_clone(&val_conv);
20030 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
20033 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
20034 LDKChannelTransactionParameters this_ptr_conv;
20035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20036 this_ptr_conv.is_owned = false;
20037 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
20041 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20042 LDKChannelTransactionParameters this_ptr_conv;
20043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20044 this_ptr_conv.is_owned = false;
20045 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
20048 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
20049 LDKChannelTransactionParameters this_ptr_conv;
20050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20051 this_ptr_conv.is_owned = false;
20052 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
20056 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
20057 LDKChannelTransactionParameters this_ptr_conv;
20058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20059 this_ptr_conv.is_owned = false;
20060 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
20063 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
20064 LDKChannelTransactionParameters this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
20068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20070 uint64_t ret_ref = (uint64_t)ret_var.inner;
20071 if (ret_var.is_owned) {
20077 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
20078 LDKChannelTransactionParameters this_ptr_conv;
20079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20080 this_ptr_conv.is_owned = false;
20081 LDKCounterpartyChannelTransactionParameters val_conv;
20082 val_conv.inner = (void*)(val & (~1));
20083 val_conv.is_owned = (val & 1) || (val == 0);
20084 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
20085 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
20088 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
20089 LDKChannelTransactionParameters this_ptr_conv;
20090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20091 this_ptr_conv.is_owned = false;
20092 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
20093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20095 uint64_t ret_ref = (uint64_t)ret_var.inner;
20096 if (ret_var.is_owned) {
20102 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
20103 LDKChannelTransactionParameters this_ptr_conv;
20104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20105 this_ptr_conv.is_owned = false;
20106 LDKOutPoint val_conv;
20107 val_conv.inner = (void*)(val & (~1));
20108 val_conv.is_owned = (val & 1) || (val == 0);
20109 val_conv = OutPoint_clone(&val_conv);
20110 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
20113 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) {
20114 LDKChannelPublicKeys holder_pubkeys_arg_conv;
20115 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
20116 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
20117 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
20118 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
20119 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
20120 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
20121 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
20122 LDKOutPoint funding_outpoint_arg_conv;
20123 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
20124 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
20125 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
20126 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);
20127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20129 uint64_t ret_ref = (uint64_t)ret_var.inner;
20130 if (ret_var.is_owned) {
20136 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
20137 LDKChannelTransactionParameters orig_conv;
20138 orig_conv.inner = (void*)(orig & (~1));
20139 orig_conv.is_owned = false;
20140 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
20141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20143 uint64_t ret_ref = (uint64_t)ret_var.inner;
20144 if (ret_var.is_owned) {
20150 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
20151 LDKCounterpartyChannelTransactionParameters this_obj_conv;
20152 this_obj_conv.inner = (void*)(this_obj & (~1));
20153 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20154 CounterpartyChannelTransactionParameters_free(this_obj_conv);
20157 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
20158 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20160 this_ptr_conv.is_owned = false;
20161 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
20162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20164 uint64_t ret_ref = (uint64_t)ret_var.inner;
20165 if (ret_var.is_owned) {
20171 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
20172 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20174 this_ptr_conv.is_owned = false;
20175 LDKChannelPublicKeys val_conv;
20176 val_conv.inner = (void*)(val & (~1));
20177 val_conv.is_owned = (val & 1) || (val == 0);
20178 val_conv = ChannelPublicKeys_clone(&val_conv);
20179 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
20182 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
20183 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20185 this_ptr_conv.is_owned = false;
20186 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
20190 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20191 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20193 this_ptr_conv.is_owned = false;
20194 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
20197 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
20198 LDKChannelPublicKeys pubkeys_arg_conv;
20199 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
20200 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
20201 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
20202 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
20203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20205 uint64_t ret_ref = (uint64_t)ret_var.inner;
20206 if (ret_var.is_owned) {
20212 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
20213 LDKCounterpartyChannelTransactionParameters orig_conv;
20214 orig_conv.inner = (void*)(orig & (~1));
20215 orig_conv.is_owned = false;
20216 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
20217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20219 uint64_t ret_ref = (uint64_t)ret_var.inner;
20220 if (ret_var.is_owned) {
20226 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
20227 LDKChannelTransactionParameters this_arg_conv;
20228 this_arg_conv.inner = (void*)(this_arg & (~1));
20229 this_arg_conv.is_owned = false;
20230 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
20234 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
20235 LDKChannelTransactionParameters this_arg_conv;
20236 this_arg_conv.inner = (void*)(this_arg & (~1));
20237 this_arg_conv.is_owned = false;
20238 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
20239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20241 uint64_t ret_ref = (uint64_t)ret_var.inner;
20242 if (ret_var.is_owned) {
20248 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
20249 LDKChannelTransactionParameters this_arg_conv;
20250 this_arg_conv.inner = (void*)(this_arg & (~1));
20251 this_arg_conv.is_owned = false;
20252 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
20253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20255 uint64_t ret_ref = (uint64_t)ret_var.inner;
20256 if (ret_var.is_owned) {
20262 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
20263 LDKCounterpartyChannelTransactionParameters obj_conv;
20264 obj_conv.inner = (void*)(obj & (~1));
20265 obj_conv.is_owned = false;
20266 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
20267 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20268 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20269 CVec_u8Z_free(ret_var);
20273 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
20274 LDKu8slice ser_ref;
20275 ser_ref.datalen = *((uint32_t*)ser);
20276 ser_ref.data = (int8_t*)(ser + 4);
20277 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
20278 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
20279 return (uint64_t)ret_conv;
20282 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
20283 LDKChannelTransactionParameters obj_conv;
20284 obj_conv.inner = (void*)(obj & (~1));
20285 obj_conv.is_owned = false;
20286 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
20287 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20288 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20289 CVec_u8Z_free(ret_var);
20293 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
20294 LDKu8slice ser_ref;
20295 ser_ref.datalen = *((uint32_t*)ser);
20296 ser_ref.data = (int8_t*)(ser + 4);
20297 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
20298 *ret_conv = ChannelTransactionParameters_read(ser_ref);
20299 return (uint64_t)ret_conv;
20302 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
20303 LDKDirectedChannelTransactionParameters this_obj_conv;
20304 this_obj_conv.inner = (void*)(this_obj & (~1));
20305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20306 DirectedChannelTransactionParameters_free(this_obj_conv);
20309 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
20310 LDKDirectedChannelTransactionParameters this_arg_conv;
20311 this_arg_conv.inner = (void*)(this_arg & (~1));
20312 this_arg_conv.is_owned = false;
20313 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
20314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20316 uint64_t ret_ref = (uint64_t)ret_var.inner;
20317 if (ret_var.is_owned) {
20323 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
20324 LDKDirectedChannelTransactionParameters this_arg_conv;
20325 this_arg_conv.inner = (void*)(this_arg & (~1));
20326 this_arg_conv.is_owned = false;
20327 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
20328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20330 uint64_t ret_ref = (uint64_t)ret_var.inner;
20331 if (ret_var.is_owned) {
20337 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
20338 LDKDirectedChannelTransactionParameters this_arg_conv;
20339 this_arg_conv.inner = (void*)(this_arg & (~1));
20340 this_arg_conv.is_owned = false;
20341 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
20345 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
20346 LDKDirectedChannelTransactionParameters this_arg_conv;
20347 this_arg_conv.inner = (void*)(this_arg & (~1));
20348 this_arg_conv.is_owned = false;
20349 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
20353 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
20354 LDKDirectedChannelTransactionParameters this_arg_conv;
20355 this_arg_conv.inner = (void*)(this_arg & (~1));
20356 this_arg_conv.is_owned = false;
20357 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
20358 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20359 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20360 uint64_t ret_ref = (uint64_t)ret_var.inner;
20361 if (ret_var.is_owned) {
20367 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
20368 LDKHolderCommitmentTransaction this_obj_conv;
20369 this_obj_conv.inner = (void*)(this_obj & (~1));
20370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20371 HolderCommitmentTransaction_free(this_obj_conv);
20374 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
20375 LDKHolderCommitmentTransaction this_ptr_conv;
20376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20377 this_ptr_conv.is_owned = false;
20378 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20379 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
20383 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
20384 LDKHolderCommitmentTransaction this_ptr_conv;
20385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20386 this_ptr_conv.is_owned = false;
20387 LDKSignature val_ref;
20388 CHECK(*((uint32_t*)val) == 64);
20389 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20390 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
20393 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
20394 LDKHolderCommitmentTransaction this_ptr_conv;
20395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20396 this_ptr_conv.is_owned = false;
20397 LDKCVec_SignatureZ val_constr;
20398 val_constr.datalen = *((uint32_t*)val);
20399 if (val_constr.datalen > 0)
20400 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20402 val_constr.data = NULL;
20403 int8_tArray* val_vals = (int8_tArray*)(val + 4);
20404 for (size_t m = 0; m < val_constr.datalen; m++) {
20405 int8_tArray val_conv_12 = val_vals[m];
20406 LDKSignature val_conv_12_ref;
20407 CHECK(*((uint32_t*)val_conv_12) == 64);
20408 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
20409 val_constr.data[m] = val_conv_12_ref;
20411 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
20414 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
20415 LDKHolderCommitmentTransaction orig_conv;
20416 orig_conv.inner = (void*)(orig & (~1));
20417 orig_conv.is_owned = false;
20418 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
20419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20421 uint64_t ret_ref = (uint64_t)ret_var.inner;
20422 if (ret_var.is_owned) {
20428 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
20429 LDKHolderCommitmentTransaction obj_conv;
20430 obj_conv.inner = (void*)(obj & (~1));
20431 obj_conv.is_owned = false;
20432 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
20433 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20434 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20435 CVec_u8Z_free(ret_var);
20439 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
20440 LDKu8slice ser_ref;
20441 ser_ref.datalen = *((uint32_t*)ser);
20442 ser_ref.data = (int8_t*)(ser + 4);
20443 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
20444 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
20445 return (uint64_t)ret_conv;
20448 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) {
20449 LDKCommitmentTransaction commitment_tx_conv;
20450 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
20451 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
20452 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
20453 LDKSignature counterparty_sig_ref;
20454 CHECK(*((uint32_t*)counterparty_sig) == 64);
20455 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
20456 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
20457 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
20458 if (counterparty_htlc_sigs_constr.datalen > 0)
20459 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20461 counterparty_htlc_sigs_constr.data = NULL;
20462 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
20463 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
20464 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
20465 LDKSignature counterparty_htlc_sigs_conv_12_ref;
20466 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
20467 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
20468 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
20470 LDKPublicKey holder_funding_key_ref;
20471 CHECK(*((uint32_t*)holder_funding_key) == 33);
20472 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
20473 LDKPublicKey counterparty_funding_key_ref;
20474 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
20475 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
20476 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
20477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20479 uint64_t ret_ref = (uint64_t)ret_var.inner;
20480 if (ret_var.is_owned) {
20486 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
20487 LDKBuiltCommitmentTransaction this_obj_conv;
20488 this_obj_conv.inner = (void*)(this_obj & (~1));
20489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20490 BuiltCommitmentTransaction_free(this_obj_conv);
20493 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
20494 LDKBuiltCommitmentTransaction this_ptr_conv;
20495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20496 this_ptr_conv.is_owned = false;
20497 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
20498 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20499 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20500 Transaction_free(ret_var);
20504 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
20505 LDKBuiltCommitmentTransaction this_ptr_conv;
20506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20507 this_ptr_conv.is_owned = false;
20508 LDKTransaction val_ref;
20509 val_ref.datalen = *((uint32_t*)val);
20510 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
20511 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
20512 val_ref.data_is_owned = true;
20513 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
20516 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
20517 LDKBuiltCommitmentTransaction this_ptr_conv;
20518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20519 this_ptr_conv.is_owned = false;
20520 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20521 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
20525 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
20526 LDKBuiltCommitmentTransaction this_ptr_conv;
20527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20528 this_ptr_conv.is_owned = false;
20529 LDKThirtyTwoBytes val_ref;
20530 CHECK(*((uint32_t*)val) == 32);
20531 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20532 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
20535 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
20536 LDKTransaction transaction_arg_ref;
20537 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
20538 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
20539 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
20540 transaction_arg_ref.data_is_owned = true;
20541 LDKThirtyTwoBytes txid_arg_ref;
20542 CHECK(*((uint32_t*)txid_arg) == 32);
20543 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
20544 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
20545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20547 uint64_t ret_ref = (uint64_t)ret_var.inner;
20548 if (ret_var.is_owned) {
20554 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
20555 LDKBuiltCommitmentTransaction orig_conv;
20556 orig_conv.inner = (void*)(orig & (~1));
20557 orig_conv.is_owned = false;
20558 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
20559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20561 uint64_t ret_ref = (uint64_t)ret_var.inner;
20562 if (ret_var.is_owned) {
20568 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
20569 LDKBuiltCommitmentTransaction obj_conv;
20570 obj_conv.inner = (void*)(obj & (~1));
20571 obj_conv.is_owned = false;
20572 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
20573 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20574 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20575 CVec_u8Z_free(ret_var);
20579 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
20580 LDKu8slice ser_ref;
20581 ser_ref.datalen = *((uint32_t*)ser);
20582 ser_ref.data = (int8_t*)(ser + 4);
20583 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
20584 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
20585 return (uint64_t)ret_conv;
20588 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
20589 LDKBuiltCommitmentTransaction this_arg_conv;
20590 this_arg_conv.inner = (void*)(this_arg & (~1));
20591 this_arg_conv.is_owned = false;
20592 LDKu8slice funding_redeemscript_ref;
20593 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
20594 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
20595 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20596 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
20600 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) {
20601 LDKBuiltCommitmentTransaction this_arg_conv;
20602 this_arg_conv.inner = (void*)(this_arg & (~1));
20603 this_arg_conv.is_owned = false;
20604 unsigned char funding_key_arr[32];
20605 CHECK(*((uint32_t*)funding_key) == 32);
20606 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
20607 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
20608 LDKu8slice funding_redeemscript_ref;
20609 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
20610 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
20611 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20612 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
20616 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
20617 LDKCommitmentTransaction this_obj_conv;
20618 this_obj_conv.inner = (void*)(this_obj & (~1));
20619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20620 CommitmentTransaction_free(this_obj_conv);
20623 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
20624 LDKCommitmentTransaction orig_conv;
20625 orig_conv.inner = (void*)(orig & (~1));
20626 orig_conv.is_owned = false;
20627 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
20628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20630 uint64_t ret_ref = (uint64_t)ret_var.inner;
20631 if (ret_var.is_owned) {
20637 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
20638 LDKCommitmentTransaction obj_conv;
20639 obj_conv.inner = (void*)(obj & (~1));
20640 obj_conv.is_owned = false;
20641 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
20642 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20643 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20644 CVec_u8Z_free(ret_var);
20648 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
20649 LDKu8slice ser_ref;
20650 ser_ref.datalen = *((uint32_t*)ser);
20651 ser_ref.data = (int8_t*)(ser + 4);
20652 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
20653 *ret_conv = CommitmentTransaction_read(ser_ref);
20654 return (uint64_t)ret_conv;
20657 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
20658 LDKCommitmentTransaction this_arg_conv;
20659 this_arg_conv.inner = (void*)(this_arg & (~1));
20660 this_arg_conv.is_owned = false;
20661 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
20665 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
20666 LDKCommitmentTransaction this_arg_conv;
20667 this_arg_conv.inner = (void*)(this_arg & (~1));
20668 this_arg_conv.is_owned = false;
20669 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
20673 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
20674 LDKCommitmentTransaction this_arg_conv;
20675 this_arg_conv.inner = (void*)(this_arg & (~1));
20676 this_arg_conv.is_owned = false;
20677 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
20681 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
20682 LDKCommitmentTransaction this_arg_conv;
20683 this_arg_conv.inner = (void*)(this_arg & (~1));
20684 this_arg_conv.is_owned = false;
20685 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
20689 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
20690 LDKCommitmentTransaction this_arg_conv;
20691 this_arg_conv.inner = (void*)(this_arg & (~1));
20692 this_arg_conv.is_owned = false;
20693 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
20694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20696 uint64_t ret_ref = (uint64_t)ret_var.inner;
20697 if (ret_var.is_owned) {
20703 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
20704 LDKCommitmentTransaction this_arg_conv;
20705 this_arg_conv.inner = (void*)(this_arg & (~1));
20706 this_arg_conv.is_owned = false;
20707 LDKDirectedChannelTransactionParameters channel_parameters_conv;
20708 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
20709 channel_parameters_conv.is_owned = false;
20710 LDKChannelPublicKeys broadcaster_keys_conv;
20711 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
20712 broadcaster_keys_conv.is_owned = false;
20713 LDKChannelPublicKeys countersignatory_keys_conv;
20714 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
20715 countersignatory_keys_conv.is_owned = false;
20716 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
20717 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
20718 return (uint64_t)ret_conv;
20721 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
20722 LDKTrustedCommitmentTransaction this_obj_conv;
20723 this_obj_conv.inner = (void*)(this_obj & (~1));
20724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20725 TrustedCommitmentTransaction_free(this_obj_conv);
20728 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
20729 LDKTrustedCommitmentTransaction this_arg_conv;
20730 this_arg_conv.inner = (void*)(this_arg & (~1));
20731 this_arg_conv.is_owned = false;
20732 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20733 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
20737 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
20738 LDKTrustedCommitmentTransaction this_arg_conv;
20739 this_arg_conv.inner = (void*)(this_arg & (~1));
20740 this_arg_conv.is_owned = false;
20741 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
20742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20744 uint64_t ret_ref = (uint64_t)ret_var.inner;
20745 if (ret_var.is_owned) {
20751 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
20752 LDKTrustedCommitmentTransaction this_arg_conv;
20753 this_arg_conv.inner = (void*)(this_arg & (~1));
20754 this_arg_conv.is_owned = false;
20755 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
20756 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20757 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20758 uint64_t ret_ref = (uint64_t)ret_var.inner;
20759 if (ret_var.is_owned) {
20765 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
20766 LDKTrustedCommitmentTransaction this_arg_conv;
20767 this_arg_conv.inner = (void*)(this_arg & (~1));
20768 this_arg_conv.is_owned = false;
20769 unsigned char htlc_base_key_arr[32];
20770 CHECK(*((uint32_t*)htlc_base_key) == 32);
20771 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
20772 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
20773 LDKDirectedChannelTransactionParameters channel_parameters_conv;
20774 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
20775 channel_parameters_conv.is_owned = false;
20776 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
20777 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
20778 return (uint64_t)ret_conv;
20781 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) {
20782 LDKPublicKey broadcaster_payment_basepoint_ref;
20783 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
20784 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
20785 LDKPublicKey countersignatory_payment_basepoint_ref;
20786 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
20787 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
20788 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
20792 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
20793 LDKInitFeatures a_conv;
20794 a_conv.inner = (void*)(a & (~1));
20795 a_conv.is_owned = false;
20796 LDKInitFeatures b_conv;
20797 b_conv.inner = (void*)(b & (~1));
20798 b_conv.is_owned = false;
20799 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
20803 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
20804 LDKNodeFeatures a_conv;
20805 a_conv.inner = (void*)(a & (~1));
20806 a_conv.is_owned = false;
20807 LDKNodeFeatures b_conv;
20808 b_conv.inner = (void*)(b & (~1));
20809 b_conv.is_owned = false;
20810 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
20814 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
20815 LDKChannelFeatures a_conv;
20816 a_conv.inner = (void*)(a & (~1));
20817 a_conv.is_owned = false;
20818 LDKChannelFeatures b_conv;
20819 b_conv.inner = (void*)(b & (~1));
20820 b_conv.is_owned = false;
20821 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
20825 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
20826 LDKInvoiceFeatures a_conv;
20827 a_conv.inner = (void*)(a & (~1));
20828 a_conv.is_owned = false;
20829 LDKInvoiceFeatures b_conv;
20830 b_conv.inner = (void*)(b & (~1));
20831 b_conv.is_owned = false;
20832 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
20836 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
20837 LDKInitFeatures orig_conv;
20838 orig_conv.inner = (void*)(orig & (~1));
20839 orig_conv.is_owned = false;
20840 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
20841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20843 uint64_t ret_ref = (uint64_t)ret_var.inner;
20844 if (ret_var.is_owned) {
20850 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
20851 LDKNodeFeatures orig_conv;
20852 orig_conv.inner = (void*)(orig & (~1));
20853 orig_conv.is_owned = false;
20854 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
20855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20857 uint64_t ret_ref = (uint64_t)ret_var.inner;
20858 if (ret_var.is_owned) {
20864 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
20865 LDKChannelFeatures orig_conv;
20866 orig_conv.inner = (void*)(orig & (~1));
20867 orig_conv.is_owned = false;
20868 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
20869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20871 uint64_t ret_ref = (uint64_t)ret_var.inner;
20872 if (ret_var.is_owned) {
20878 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
20879 LDKInvoiceFeatures orig_conv;
20880 orig_conv.inner = (void*)(orig & (~1));
20881 orig_conv.is_owned = false;
20882 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
20883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20885 uint64_t ret_ref = (uint64_t)ret_var.inner;
20886 if (ret_var.is_owned) {
20892 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
20893 LDKInitFeatures this_obj_conv;
20894 this_obj_conv.inner = (void*)(this_obj & (~1));
20895 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20896 InitFeatures_free(this_obj_conv);
20899 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
20900 LDKNodeFeatures this_obj_conv;
20901 this_obj_conv.inner = (void*)(this_obj & (~1));
20902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20903 NodeFeatures_free(this_obj_conv);
20906 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
20907 LDKChannelFeatures this_obj_conv;
20908 this_obj_conv.inner = (void*)(this_obj & (~1));
20909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20910 ChannelFeatures_free(this_obj_conv);
20913 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
20914 LDKInvoiceFeatures this_obj_conv;
20915 this_obj_conv.inner = (void*)(this_obj & (~1));
20916 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20917 InvoiceFeatures_free(this_obj_conv);
20920 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
20921 LDKInitFeatures ret_var = InitFeatures_empty();
20922 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20923 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20924 uint64_t ret_ref = (uint64_t)ret_var.inner;
20925 if (ret_var.is_owned) {
20931 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
20932 LDKInitFeatures ret_var = InitFeatures_known();
20933 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20934 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20935 uint64_t ret_ref = (uint64_t)ret_var.inner;
20936 if (ret_var.is_owned) {
20942 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
20943 LDKNodeFeatures ret_var = NodeFeatures_empty();
20944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20946 uint64_t ret_ref = (uint64_t)ret_var.inner;
20947 if (ret_var.is_owned) {
20953 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
20954 LDKNodeFeatures ret_var = NodeFeatures_known();
20955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20957 uint64_t ret_ref = (uint64_t)ret_var.inner;
20958 if (ret_var.is_owned) {
20964 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
20965 LDKChannelFeatures ret_var = ChannelFeatures_empty();
20966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20968 uint64_t ret_ref = (uint64_t)ret_var.inner;
20969 if (ret_var.is_owned) {
20975 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
20976 LDKChannelFeatures ret_var = ChannelFeatures_known();
20977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20979 uint64_t ret_ref = (uint64_t)ret_var.inner;
20980 if (ret_var.is_owned) {
20986 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
20987 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
20988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20990 uint64_t ret_ref = (uint64_t)ret_var.inner;
20991 if (ret_var.is_owned) {
20997 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
20998 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
20999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21001 uint64_t ret_ref = (uint64_t)ret_var.inner;
21002 if (ret_var.is_owned) {
21008 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
21009 LDKInitFeatures this_arg_conv;
21010 this_arg_conv.inner = (void*)(this_arg & (~1));
21011 this_arg_conv.is_owned = false;
21012 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
21016 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
21017 LDKNodeFeatures this_arg_conv;
21018 this_arg_conv.inner = (void*)(this_arg & (~1));
21019 this_arg_conv.is_owned = false;
21020 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
21024 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
21025 LDKInvoiceFeatures this_arg_conv;
21026 this_arg_conv.inner = (void*)(this_arg & (~1));
21027 this_arg_conv.is_owned = false;
21028 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
21032 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
21033 LDKInitFeatures obj_conv;
21034 obj_conv.inner = (void*)(obj & (~1));
21035 obj_conv.is_owned = false;
21036 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
21037 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21038 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21039 CVec_u8Z_free(ret_var);
21043 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
21044 LDKNodeFeatures obj_conv;
21045 obj_conv.inner = (void*)(obj & (~1));
21046 obj_conv.is_owned = false;
21047 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
21048 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21049 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21050 CVec_u8Z_free(ret_var);
21054 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
21055 LDKChannelFeatures obj_conv;
21056 obj_conv.inner = (void*)(obj & (~1));
21057 obj_conv.is_owned = false;
21058 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
21059 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21060 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21061 CVec_u8Z_free(ret_var);
21065 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
21066 LDKInvoiceFeatures obj_conv;
21067 obj_conv.inner = (void*)(obj & (~1));
21068 obj_conv.is_owned = false;
21069 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
21070 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21071 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21072 CVec_u8Z_free(ret_var);
21076 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
21077 LDKu8slice ser_ref;
21078 ser_ref.datalen = *((uint32_t*)ser);
21079 ser_ref.data = (int8_t*)(ser + 4);
21080 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21081 *ret_conv = InitFeatures_read(ser_ref);
21082 return (uint64_t)ret_conv;
21085 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
21086 LDKu8slice ser_ref;
21087 ser_ref.datalen = *((uint32_t*)ser);
21088 ser_ref.data = (int8_t*)(ser + 4);
21089 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21090 *ret_conv = NodeFeatures_read(ser_ref);
21091 return (uint64_t)ret_conv;
21094 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
21095 LDKu8slice ser_ref;
21096 ser_ref.datalen = *((uint32_t*)ser);
21097 ser_ref.data = (int8_t*)(ser + 4);
21098 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21099 *ret_conv = ChannelFeatures_read(ser_ref);
21100 return (uint64_t)ret_conv;
21103 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
21104 LDKu8slice ser_ref;
21105 ser_ref.datalen = *((uint32_t*)ser);
21106 ser_ref.data = (int8_t*)(ser + 4);
21107 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
21108 *ret_conv = InvoiceFeatures_read(ser_ref);
21109 return (uint64_t)ret_conv;
21112 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
21113 LDKRouteHop this_obj_conv;
21114 this_obj_conv.inner = (void*)(this_obj & (~1));
21115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21116 RouteHop_free(this_obj_conv);
21119 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
21120 LDKRouteHop this_ptr_conv;
21121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21122 this_ptr_conv.is_owned = false;
21123 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21124 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
21128 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
21129 LDKRouteHop this_ptr_conv;
21130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21131 this_ptr_conv.is_owned = false;
21132 LDKPublicKey val_ref;
21133 CHECK(*((uint32_t*)val) == 33);
21134 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21135 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
21138 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
21139 LDKRouteHop this_ptr_conv;
21140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21141 this_ptr_conv.is_owned = false;
21142 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
21143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21145 uint64_t ret_ref = (uint64_t)ret_var.inner;
21146 if (ret_var.is_owned) {
21152 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
21153 LDKRouteHop this_ptr_conv;
21154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21155 this_ptr_conv.is_owned = false;
21156 LDKNodeFeatures val_conv;
21157 val_conv.inner = (void*)(val & (~1));
21158 val_conv.is_owned = (val & 1) || (val == 0);
21159 val_conv = NodeFeatures_clone(&val_conv);
21160 RouteHop_set_node_features(&this_ptr_conv, val_conv);
21163 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
21164 LDKRouteHop this_ptr_conv;
21165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21166 this_ptr_conv.is_owned = false;
21167 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
21171 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21172 LDKRouteHop this_ptr_conv;
21173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21174 this_ptr_conv.is_owned = false;
21175 RouteHop_set_short_channel_id(&this_ptr_conv, val);
21178 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
21179 LDKRouteHop this_ptr_conv;
21180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21181 this_ptr_conv.is_owned = false;
21182 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
21183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21185 uint64_t ret_ref = (uint64_t)ret_var.inner;
21186 if (ret_var.is_owned) {
21192 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
21193 LDKRouteHop this_ptr_conv;
21194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21195 this_ptr_conv.is_owned = false;
21196 LDKChannelFeatures val_conv;
21197 val_conv.inner = (void*)(val & (~1));
21198 val_conv.is_owned = (val & 1) || (val == 0);
21199 val_conv = ChannelFeatures_clone(&val_conv);
21200 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
21203 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
21204 LDKRouteHop this_ptr_conv;
21205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21206 this_ptr_conv.is_owned = false;
21207 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
21211 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
21212 LDKRouteHop this_ptr_conv;
21213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21214 this_ptr_conv.is_owned = false;
21215 RouteHop_set_fee_msat(&this_ptr_conv, val);
21218 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
21219 LDKRouteHop this_ptr_conv;
21220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21221 this_ptr_conv.is_owned = false;
21222 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
21226 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
21227 LDKRouteHop this_ptr_conv;
21228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21229 this_ptr_conv.is_owned = false;
21230 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
21233 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) {
21234 LDKPublicKey pubkey_arg_ref;
21235 CHECK(*((uint32_t*)pubkey_arg) == 33);
21236 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
21237 LDKNodeFeatures node_features_arg_conv;
21238 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
21239 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
21240 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
21241 LDKChannelFeatures channel_features_arg_conv;
21242 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
21243 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
21244 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
21245 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);
21246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21248 uint64_t ret_ref = (uint64_t)ret_var.inner;
21249 if (ret_var.is_owned) {
21255 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
21256 LDKRouteHop orig_conv;
21257 orig_conv.inner = (void*)(orig & (~1));
21258 orig_conv.is_owned = false;
21259 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
21260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21262 uint64_t ret_ref = (uint64_t)ret_var.inner;
21263 if (ret_var.is_owned) {
21269 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
21270 LDKRouteHop obj_conv;
21271 obj_conv.inner = (void*)(obj & (~1));
21272 obj_conv.is_owned = false;
21273 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
21274 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21275 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21276 CVec_u8Z_free(ret_var);
21280 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
21281 LDKu8slice ser_ref;
21282 ser_ref.datalen = *((uint32_t*)ser);
21283 ser_ref.data = (int8_t*)(ser + 4);
21284 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21285 *ret_conv = RouteHop_read(ser_ref);
21286 return (uint64_t)ret_conv;
21289 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
21290 LDKRoute this_obj_conv;
21291 this_obj_conv.inner = (void*)(this_obj & (~1));
21292 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21293 Route_free(this_obj_conv);
21296 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
21297 LDKRoute this_ptr_conv;
21298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21299 this_ptr_conv.is_owned = false;
21300 LDKCVec_CVec_RouteHopZZ val_constr;
21301 val_constr.datalen = *((uint32_t*)val);
21302 if (val_constr.datalen > 0)
21303 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21305 val_constr.data = NULL;
21306 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
21307 for (size_t m = 0; m < val_constr.datalen; m++) {
21308 uint32_tArray val_conv_12 = val_vals[m];
21309 LDKCVec_RouteHopZ val_conv_12_constr;
21310 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
21311 if (val_conv_12_constr.datalen > 0)
21312 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21314 val_conv_12_constr.data = NULL;
21315 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
21316 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
21317 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
21318 LDKRouteHop val_conv_12_conv_10_conv;
21319 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
21320 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
21321 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
21322 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
21324 val_constr.data[m] = val_conv_12_constr;
21326 Route_set_paths(&this_ptr_conv, val_constr);
21329 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
21330 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
21331 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
21332 if (paths_arg_constr.datalen > 0)
21333 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21335 paths_arg_constr.data = NULL;
21336 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
21337 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
21338 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
21339 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
21340 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
21341 if (paths_arg_conv_12_constr.datalen > 0)
21342 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21344 paths_arg_conv_12_constr.data = NULL;
21345 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
21346 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
21347 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
21348 LDKRouteHop paths_arg_conv_12_conv_10_conv;
21349 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
21350 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
21351 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
21352 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
21354 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
21356 LDKRoute ret_var = Route_new(paths_arg_constr);
21357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21359 uint64_t ret_ref = (uint64_t)ret_var.inner;
21360 if (ret_var.is_owned) {
21366 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
21367 LDKRoute orig_conv;
21368 orig_conv.inner = (void*)(orig & (~1));
21369 orig_conv.is_owned = false;
21370 LDKRoute ret_var = Route_clone(&orig_conv);
21371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21373 uint64_t ret_ref = (uint64_t)ret_var.inner;
21374 if (ret_var.is_owned) {
21380 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
21382 obj_conv.inner = (void*)(obj & (~1));
21383 obj_conv.is_owned = false;
21384 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
21385 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21386 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21387 CVec_u8Z_free(ret_var);
21391 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
21392 LDKu8slice ser_ref;
21393 ser_ref.datalen = *((uint32_t*)ser);
21394 ser_ref.data = (int8_t*)(ser + 4);
21395 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21396 *ret_conv = Route_read(ser_ref);
21397 return (uint64_t)ret_conv;
21400 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
21401 LDKRouteHint this_obj_conv;
21402 this_obj_conv.inner = (void*)(this_obj & (~1));
21403 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21404 RouteHint_free(this_obj_conv);
21407 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
21408 LDKRouteHint a_conv;
21409 a_conv.inner = (void*)(a & (~1));
21410 a_conv.is_owned = false;
21411 LDKRouteHint b_conv;
21412 b_conv.inner = (void*)(b & (~1));
21413 b_conv.is_owned = false;
21414 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
21418 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
21419 LDKRouteHint orig_conv;
21420 orig_conv.inner = (void*)(orig & (~1));
21421 orig_conv.is_owned = false;
21422 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
21423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21425 uint64_t ret_ref = (uint64_t)ret_var.inner;
21426 if (ret_var.is_owned) {
21432 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
21433 LDKRouteHintHop this_obj_conv;
21434 this_obj_conv.inner = (void*)(this_obj & (~1));
21435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21436 RouteHintHop_free(this_obj_conv);
21439 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
21440 LDKRouteHintHop this_ptr_conv;
21441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21442 this_ptr_conv.is_owned = false;
21443 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21444 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
21448 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
21449 LDKRouteHintHop this_ptr_conv;
21450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21451 this_ptr_conv.is_owned = false;
21452 LDKPublicKey val_ref;
21453 CHECK(*((uint32_t*)val) == 33);
21454 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21455 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
21458 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
21459 LDKRouteHintHop this_ptr_conv;
21460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21461 this_ptr_conv.is_owned = false;
21462 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
21466 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21467 LDKRouteHintHop this_ptr_conv;
21468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21469 this_ptr_conv.is_owned = false;
21470 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
21473 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
21474 LDKRouteHintHop this_ptr_conv;
21475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21476 this_ptr_conv.is_owned = false;
21477 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
21478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21480 uint64_t ret_ref = (uint64_t)ret_var.inner;
21481 if (ret_var.is_owned) {
21487 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
21488 LDKRouteHintHop this_ptr_conv;
21489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21490 this_ptr_conv.is_owned = false;
21491 LDKRoutingFees val_conv;
21492 val_conv.inner = (void*)(val & (~1));
21493 val_conv.is_owned = (val & 1) || (val == 0);
21494 val_conv = RoutingFees_clone(&val_conv);
21495 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
21498 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
21499 LDKRouteHintHop this_ptr_conv;
21500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21501 this_ptr_conv.is_owned = false;
21502 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
21506 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21507 LDKRouteHintHop this_ptr_conv;
21508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21509 this_ptr_conv.is_owned = false;
21510 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
21513 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
21514 LDKRouteHintHop this_ptr_conv;
21515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21516 this_ptr_conv.is_owned = false;
21517 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21518 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
21519 uint64_t ret_ref = (uint64_t)ret_copy;
21523 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
21524 LDKRouteHintHop this_ptr_conv;
21525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21526 this_ptr_conv.is_owned = false;
21527 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21528 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
21531 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
21532 LDKRouteHintHop this_ptr_conv;
21533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21534 this_ptr_conv.is_owned = false;
21535 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21536 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
21537 uint64_t ret_ref = (uint64_t)ret_copy;
21541 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
21542 LDKRouteHintHop this_ptr_conv;
21543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21544 this_ptr_conv.is_owned = false;
21545 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21546 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
21549 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) {
21550 LDKPublicKey src_node_id_arg_ref;
21551 CHECK(*((uint32_t*)src_node_id_arg) == 33);
21552 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
21553 LDKRoutingFees fees_arg_conv;
21554 fees_arg_conv.inner = (void*)(fees_arg & (~1));
21555 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
21556 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
21557 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
21558 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
21559 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);
21560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21562 uint64_t ret_ref = (uint64_t)ret_var.inner;
21563 if (ret_var.is_owned) {
21569 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
21570 LDKRouteHintHop a_conv;
21571 a_conv.inner = (void*)(a & (~1));
21572 a_conv.is_owned = false;
21573 LDKRouteHintHop b_conv;
21574 b_conv.inner = (void*)(b & (~1));
21575 b_conv.is_owned = false;
21576 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
21580 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
21581 LDKRouteHintHop orig_conv;
21582 orig_conv.inner = (void*)(orig & (~1));
21583 orig_conv.is_owned = false;
21584 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
21585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21587 uint64_t ret_ref = (uint64_t)ret_var.inner;
21588 if (ret_var.is_owned) {
21594 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
21595 LDKPublicKey our_node_id_ref;
21596 CHECK(*((uint32_t*)our_node_id) == 33);
21597 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
21598 LDKNetworkGraph network_conv;
21599 network_conv.inner = (void*)(network & (~1));
21600 network_conv.is_owned = false;
21601 LDKPublicKey payee_ref;
21602 CHECK(*((uint32_t*)payee) == 33);
21603 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
21604 LDKInvoiceFeatures payee_features_conv;
21605 payee_features_conv.inner = (void*)(payee_features & (~1));
21606 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
21607 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
21608 LDKCVec_ChannelDetailsZ first_hops_constr;
21609 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
21610 if (first_hops != 0) {
21611 first_hops_constr.datalen = *((uint32_t*)first_hops);
21612 if (first_hops_constr.datalen > 0)
21613 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21615 first_hops_constr.data = NULL;
21616 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
21617 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
21618 uint32_t first_hops_conv_16 = first_hops_vals[q];
21619 LDKChannelDetails first_hops_conv_16_conv;
21620 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
21621 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
21622 first_hops_constr.data[q] = first_hops_conv_16_conv;
21624 first_hops_ptr = &first_hops_constr;
21626 LDKCVec_RouteHintZ last_hops_constr;
21627 last_hops_constr.datalen = *((uint32_t*)last_hops);
21628 if (last_hops_constr.datalen > 0)
21629 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21631 last_hops_constr.data = NULL;
21632 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
21633 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
21634 uint32_t last_hops_conv_11 = last_hops_vals[l];
21635 LDKRouteHint last_hops_conv_11_conv;
21636 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
21637 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
21638 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
21639 last_hops_constr.data[l] = last_hops_conv_11_conv;
21641 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21642 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21643 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
21644 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
21645 return (uint64_t)ret_conv;
21648 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
21649 LDKNetworkGraph this_obj_conv;
21650 this_obj_conv.inner = (void*)(this_obj & (~1));
21651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21652 NetworkGraph_free(this_obj_conv);
21655 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
21656 LDKNetworkGraph orig_conv;
21657 orig_conv.inner = (void*)(orig & (~1));
21658 orig_conv.is_owned = false;
21659 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
21660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21662 uint64_t ret_ref = (uint64_t)ret_var.inner;
21663 if (ret_var.is_owned) {
21669 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
21670 LDKLockedNetworkGraph this_obj_conv;
21671 this_obj_conv.inner = (void*)(this_obj & (~1));
21672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21673 LockedNetworkGraph_free(this_obj_conv);
21676 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
21677 LDKNetGraphMsgHandler this_obj_conv;
21678 this_obj_conv.inner = (void*)(this_obj & (~1));
21679 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21680 NetGraphMsgHandler_free(this_obj_conv);
21683 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
21684 LDKThirtyTwoBytes genesis_hash_ref;
21685 CHECK(*((uint32_t*)genesis_hash) == 32);
21686 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
21687 LDKAccess *chain_access_conv_ptr = NULL;
21688 if (chain_access != 0) {
21689 LDKAccess chain_access_conv;
21690 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21691 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21692 *chain_access_conv_ptr = chain_access_conv;
21694 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21695 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
21696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21698 uint64_t ret_ref = (uint64_t)ret_var.inner;
21699 if (ret_var.is_owned) {
21705 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
21706 LDKAccess *chain_access_conv_ptr = NULL;
21707 if (chain_access != 0) {
21708 LDKAccess chain_access_conv;
21709 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21710 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21711 *chain_access_conv_ptr = chain_access_conv;
21713 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21714 LDKNetworkGraph network_graph_conv;
21715 network_graph_conv.inner = (void*)(network_graph & (~1));
21716 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
21717 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
21718 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
21719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21721 uint64_t ret_ref = (uint64_t)ret_var.inner;
21722 if (ret_var.is_owned) {
21728 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
21729 LDKNetGraphMsgHandler this_arg_conv;
21730 this_arg_conv.inner = (void*)(this_arg & (~1));
21731 this_arg_conv.is_owned = false;
21732 LDKAccess *chain_access_conv_ptr = NULL;
21733 if (chain_access != 0) {
21734 LDKAccess chain_access_conv;
21735 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21736 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21737 *chain_access_conv_ptr = chain_access_conv;
21739 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
21742 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
21743 LDKNetGraphMsgHandler this_arg_conv;
21744 this_arg_conv.inner = (void*)(this_arg & (~1));
21745 this_arg_conv.is_owned = false;
21746 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
21747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21749 uint64_t ret_ref = (uint64_t)ret_var.inner;
21750 if (ret_var.is_owned) {
21756 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
21757 LDKLockedNetworkGraph this_arg_conv;
21758 this_arg_conv.inner = (void*)(this_arg & (~1));
21759 this_arg_conv.is_owned = false;
21760 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
21761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21763 uint64_t ret_ref = (uint64_t)ret_var.inner;
21764 if (ret_var.is_owned) {
21770 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
21771 LDKNetGraphMsgHandler this_arg_conv;
21772 this_arg_conv.inner = (void*)(this_arg & (~1));
21773 this_arg_conv.is_owned = false;
21774 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21775 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
21776 return (uint64_t)ret;
21779 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
21780 LDKNetGraphMsgHandler this_arg_conv;
21781 this_arg_conv.inner = (void*)(this_arg & (~1));
21782 this_arg_conv.is_owned = false;
21783 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21784 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
21785 return (uint64_t)ret;
21788 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
21789 LDKDirectionalChannelInfo this_obj_conv;
21790 this_obj_conv.inner = (void*)(this_obj & (~1));
21791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21792 DirectionalChannelInfo_free(this_obj_conv);
21795 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
21796 LDKDirectionalChannelInfo this_ptr_conv;
21797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21798 this_ptr_conv.is_owned = false;
21799 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
21803 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
21804 LDKDirectionalChannelInfo this_ptr_conv;
21805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21806 this_ptr_conv.is_owned = false;
21807 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
21810 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
21811 LDKDirectionalChannelInfo this_ptr_conv;
21812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21813 this_ptr_conv.is_owned = false;
21814 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
21818 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
21819 LDKDirectionalChannelInfo this_ptr_conv;
21820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21821 this_ptr_conv.is_owned = false;
21822 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
21825 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
21826 LDKDirectionalChannelInfo this_ptr_conv;
21827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21828 this_ptr_conv.is_owned = false;
21829 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
21833 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21834 LDKDirectionalChannelInfo this_ptr_conv;
21835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21836 this_ptr_conv.is_owned = false;
21837 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
21840 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
21841 LDKDirectionalChannelInfo this_ptr_conv;
21842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21843 this_ptr_conv.is_owned = false;
21844 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
21848 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
21849 LDKDirectionalChannelInfo this_ptr_conv;
21850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21851 this_ptr_conv.is_owned = false;
21852 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
21855 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
21856 LDKDirectionalChannelInfo this_ptr_conv;
21857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21858 this_ptr_conv.is_owned = false;
21859 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21860 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
21861 uint64_t ret_ref = (uint64_t)ret_copy;
21865 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
21866 LDKDirectionalChannelInfo this_ptr_conv;
21867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21868 this_ptr_conv.is_owned = false;
21869 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21870 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
21873 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
21874 LDKDirectionalChannelInfo this_ptr_conv;
21875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21876 this_ptr_conv.is_owned = false;
21877 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
21878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21880 uint64_t ret_ref = (uint64_t)ret_var.inner;
21881 if (ret_var.is_owned) {
21887 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
21888 LDKDirectionalChannelInfo this_ptr_conv;
21889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21890 this_ptr_conv.is_owned = false;
21891 LDKRoutingFees val_conv;
21892 val_conv.inner = (void*)(val & (~1));
21893 val_conv.is_owned = (val & 1) || (val == 0);
21894 val_conv = RoutingFees_clone(&val_conv);
21895 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
21898 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
21899 LDKDirectionalChannelInfo this_ptr_conv;
21900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21901 this_ptr_conv.is_owned = false;
21902 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
21903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21905 uint64_t ret_ref = (uint64_t)ret_var.inner;
21906 if (ret_var.is_owned) {
21912 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
21913 LDKDirectionalChannelInfo this_ptr_conv;
21914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21915 this_ptr_conv.is_owned = false;
21916 LDKChannelUpdate val_conv;
21917 val_conv.inner = (void*)(val & (~1));
21918 val_conv.is_owned = (val & 1) || (val == 0);
21919 val_conv = ChannelUpdate_clone(&val_conv);
21920 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
21923 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) {
21924 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
21925 LDKRoutingFees fees_arg_conv;
21926 fees_arg_conv.inner = (void*)(fees_arg & (~1));
21927 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
21928 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
21929 LDKChannelUpdate last_update_message_arg_conv;
21930 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
21931 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
21932 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
21933 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);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
21937 if (ret_var.is_owned) {
21943 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
21944 LDKDirectionalChannelInfo orig_conv;
21945 orig_conv.inner = (void*)(orig & (~1));
21946 orig_conv.is_owned = false;
21947 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
21948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21950 uint64_t ret_ref = (uint64_t)ret_var.inner;
21951 if (ret_var.is_owned) {
21957 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
21958 LDKDirectionalChannelInfo obj_conv;
21959 obj_conv.inner = (void*)(obj & (~1));
21960 obj_conv.is_owned = false;
21961 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
21962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21964 CVec_u8Z_free(ret_var);
21968 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
21969 LDKu8slice ser_ref;
21970 ser_ref.datalen = *((uint32_t*)ser);
21971 ser_ref.data = (int8_t*)(ser + 4);
21972 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
21973 *ret_conv = DirectionalChannelInfo_read(ser_ref);
21974 return (uint64_t)ret_conv;
21977 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
21978 LDKChannelInfo this_obj_conv;
21979 this_obj_conv.inner = (void*)(this_obj & (~1));
21980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21981 ChannelInfo_free(this_obj_conv);
21984 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
21985 LDKChannelInfo this_ptr_conv;
21986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21987 this_ptr_conv.is_owned = false;
21988 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
21989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21991 uint64_t ret_ref = (uint64_t)ret_var.inner;
21992 if (ret_var.is_owned) {
21998 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
21999 LDKChannelInfo this_ptr_conv;
22000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22001 this_ptr_conv.is_owned = false;
22002 LDKChannelFeatures val_conv;
22003 val_conv.inner = (void*)(val & (~1));
22004 val_conv.is_owned = (val & 1) || (val == 0);
22005 val_conv = ChannelFeatures_clone(&val_conv);
22006 ChannelInfo_set_features(&this_ptr_conv, val_conv);
22009 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
22010 LDKChannelInfo this_ptr_conv;
22011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22012 this_ptr_conv.is_owned = false;
22013 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22014 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
22018 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
22019 LDKChannelInfo this_ptr_conv;
22020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22021 this_ptr_conv.is_owned = false;
22022 LDKPublicKey val_ref;
22023 CHECK(*((uint32_t*)val) == 33);
22024 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22025 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
22028 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
22029 LDKChannelInfo this_ptr_conv;
22030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22031 this_ptr_conv.is_owned = false;
22032 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
22033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22035 uint64_t ret_ref = (uint64_t)ret_var.inner;
22036 if (ret_var.is_owned) {
22042 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
22043 LDKChannelInfo this_ptr_conv;
22044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22045 this_ptr_conv.is_owned = false;
22046 LDKDirectionalChannelInfo val_conv;
22047 val_conv.inner = (void*)(val & (~1));
22048 val_conv.is_owned = (val & 1) || (val == 0);
22049 val_conv = DirectionalChannelInfo_clone(&val_conv);
22050 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
22053 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
22054 LDKChannelInfo this_ptr_conv;
22055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22056 this_ptr_conv.is_owned = false;
22057 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22058 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
22062 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
22063 LDKChannelInfo this_ptr_conv;
22064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22065 this_ptr_conv.is_owned = false;
22066 LDKPublicKey val_ref;
22067 CHECK(*((uint32_t*)val) == 33);
22068 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22069 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
22072 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
22073 LDKChannelInfo this_ptr_conv;
22074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22075 this_ptr_conv.is_owned = false;
22076 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
22077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22079 uint64_t ret_ref = (uint64_t)ret_var.inner;
22080 if (ret_var.is_owned) {
22086 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
22087 LDKChannelInfo this_ptr_conv;
22088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22089 this_ptr_conv.is_owned = false;
22090 LDKDirectionalChannelInfo val_conv;
22091 val_conv.inner = (void*)(val & (~1));
22092 val_conv.is_owned = (val & 1) || (val == 0);
22093 val_conv = DirectionalChannelInfo_clone(&val_conv);
22094 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
22097 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
22098 LDKChannelInfo this_ptr_conv;
22099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22100 this_ptr_conv.is_owned = false;
22101 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22102 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
22103 uint64_t ret_ref = (uint64_t)ret_copy;
22107 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
22108 LDKChannelInfo this_ptr_conv;
22109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22110 this_ptr_conv.is_owned = false;
22111 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22112 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
22115 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
22116 LDKChannelInfo this_ptr_conv;
22117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22118 this_ptr_conv.is_owned = false;
22119 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
22120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22122 uint64_t ret_ref = (uint64_t)ret_var.inner;
22123 if (ret_var.is_owned) {
22129 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
22130 LDKChannelInfo this_ptr_conv;
22131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22132 this_ptr_conv.is_owned = false;
22133 LDKChannelAnnouncement val_conv;
22134 val_conv.inner = (void*)(val & (~1));
22135 val_conv.is_owned = (val & 1) || (val == 0);
22136 val_conv = ChannelAnnouncement_clone(&val_conv);
22137 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
22140 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
22141 LDKChannelFeatures features_arg_conv;
22142 features_arg_conv.inner = (void*)(features_arg & (~1));
22143 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22144 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
22145 LDKPublicKey node_one_arg_ref;
22146 CHECK(*((uint32_t*)node_one_arg) == 33);
22147 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
22148 LDKDirectionalChannelInfo one_to_two_arg_conv;
22149 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
22150 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
22151 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
22152 LDKPublicKey node_two_arg_ref;
22153 CHECK(*((uint32_t*)node_two_arg) == 33);
22154 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
22155 LDKDirectionalChannelInfo two_to_one_arg_conv;
22156 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
22157 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
22158 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
22159 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
22160 LDKChannelAnnouncement announcement_message_arg_conv;
22161 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
22162 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
22163 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
22164 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
22165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22167 uint64_t ret_ref = (uint64_t)ret_var.inner;
22168 if (ret_var.is_owned) {
22174 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
22175 LDKChannelInfo orig_conv;
22176 orig_conv.inner = (void*)(orig & (~1));
22177 orig_conv.is_owned = false;
22178 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
22179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22181 uint64_t ret_ref = (uint64_t)ret_var.inner;
22182 if (ret_var.is_owned) {
22188 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
22189 LDKChannelInfo obj_conv;
22190 obj_conv.inner = (void*)(obj & (~1));
22191 obj_conv.is_owned = false;
22192 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
22193 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22194 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22195 CVec_u8Z_free(ret_var);
22199 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
22200 LDKu8slice ser_ref;
22201 ser_ref.datalen = *((uint32_t*)ser);
22202 ser_ref.data = (int8_t*)(ser + 4);
22203 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
22204 *ret_conv = ChannelInfo_read(ser_ref);
22205 return (uint64_t)ret_conv;
22208 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
22209 LDKRoutingFees this_obj_conv;
22210 this_obj_conv.inner = (void*)(this_obj & (~1));
22211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22212 RoutingFees_free(this_obj_conv);
22215 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
22216 LDKRoutingFees this_ptr_conv;
22217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22218 this_ptr_conv.is_owned = false;
22219 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
22223 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
22224 LDKRoutingFees this_ptr_conv;
22225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22226 this_ptr_conv.is_owned = false;
22227 RoutingFees_set_base_msat(&this_ptr_conv, val);
22230 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
22231 LDKRoutingFees this_ptr_conv;
22232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22233 this_ptr_conv.is_owned = false;
22234 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
22238 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
22239 LDKRoutingFees this_ptr_conv;
22240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22241 this_ptr_conv.is_owned = false;
22242 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
22245 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
22246 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
22247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22249 uint64_t ret_ref = (uint64_t)ret_var.inner;
22250 if (ret_var.is_owned) {
22256 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
22257 LDKRoutingFees a_conv;
22258 a_conv.inner = (void*)(a & (~1));
22259 a_conv.is_owned = false;
22260 LDKRoutingFees b_conv;
22261 b_conv.inner = (void*)(b & (~1));
22262 b_conv.is_owned = false;
22263 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
22267 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
22268 LDKRoutingFees orig_conv;
22269 orig_conv.inner = (void*)(orig & (~1));
22270 orig_conv.is_owned = false;
22271 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
22272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22274 uint64_t ret_ref = (uint64_t)ret_var.inner;
22275 if (ret_var.is_owned) {
22281 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
22282 LDKRoutingFees obj_conv;
22283 obj_conv.inner = (void*)(obj & (~1));
22284 obj_conv.is_owned = false;
22285 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
22286 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22287 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22288 CVec_u8Z_free(ret_var);
22292 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
22293 LDKu8slice ser_ref;
22294 ser_ref.datalen = *((uint32_t*)ser);
22295 ser_ref.data = (int8_t*)(ser + 4);
22296 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
22297 *ret_conv = RoutingFees_read(ser_ref);
22298 return (uint64_t)ret_conv;
22301 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
22302 LDKNodeAnnouncementInfo this_obj_conv;
22303 this_obj_conv.inner = (void*)(this_obj & (~1));
22304 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22305 NodeAnnouncementInfo_free(this_obj_conv);
22308 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
22309 LDKNodeAnnouncementInfo this_ptr_conv;
22310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22311 this_ptr_conv.is_owned = false;
22312 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
22313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22315 uint64_t ret_ref = (uint64_t)ret_var.inner;
22316 if (ret_var.is_owned) {
22322 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
22323 LDKNodeAnnouncementInfo this_ptr_conv;
22324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22325 this_ptr_conv.is_owned = false;
22326 LDKNodeFeatures val_conv;
22327 val_conv.inner = (void*)(val & (~1));
22328 val_conv.is_owned = (val & 1) || (val == 0);
22329 val_conv = NodeFeatures_clone(&val_conv);
22330 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
22333 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
22334 LDKNodeAnnouncementInfo this_ptr_conv;
22335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22336 this_ptr_conv.is_owned = false;
22337 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
22341 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
22342 LDKNodeAnnouncementInfo this_ptr_conv;
22343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22344 this_ptr_conv.is_owned = false;
22345 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
22348 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
22349 LDKNodeAnnouncementInfo this_ptr_conv;
22350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22351 this_ptr_conv.is_owned = false;
22352 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
22353 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
22357 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
22358 LDKNodeAnnouncementInfo this_ptr_conv;
22359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22360 this_ptr_conv.is_owned = false;
22361 LDKThreeBytes val_ref;
22362 CHECK(*((uint32_t*)val) == 3);
22363 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
22364 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
22367 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
22368 LDKNodeAnnouncementInfo this_ptr_conv;
22369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22370 this_ptr_conv.is_owned = false;
22371 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22372 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
22376 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
22377 LDKNodeAnnouncementInfo this_ptr_conv;
22378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22379 this_ptr_conv.is_owned = false;
22380 LDKThirtyTwoBytes val_ref;
22381 CHECK(*((uint32_t*)val) == 32);
22382 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22383 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
22386 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
22387 LDKNodeAnnouncementInfo this_ptr_conv;
22388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22389 this_ptr_conv.is_owned = false;
22390 LDKCVec_NetAddressZ val_constr;
22391 val_constr.datalen = *((uint32_t*)val);
22392 if (val_constr.datalen > 0)
22393 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22395 val_constr.data = NULL;
22396 uint32_t* val_vals = (uint32_t*)(val + 4);
22397 for (size_t m = 0; m < val_constr.datalen; m++) {
22398 uint32_t val_conv_12 = val_vals[m];
22399 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
22400 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
22401 val_constr.data[m] = val_conv_12_conv;
22403 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
22406 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
22407 LDKNodeAnnouncementInfo this_ptr_conv;
22408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22409 this_ptr_conv.is_owned = false;
22410 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
22411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22413 uint64_t ret_ref = (uint64_t)ret_var.inner;
22414 if (ret_var.is_owned) {
22420 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
22421 LDKNodeAnnouncementInfo this_ptr_conv;
22422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22423 this_ptr_conv.is_owned = false;
22424 LDKNodeAnnouncement val_conv;
22425 val_conv.inner = (void*)(val & (~1));
22426 val_conv.is_owned = (val & 1) || (val == 0);
22427 val_conv = NodeAnnouncement_clone(&val_conv);
22428 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
22431 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) {
22432 LDKNodeFeatures features_arg_conv;
22433 features_arg_conv.inner = (void*)(features_arg & (~1));
22434 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22435 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
22436 LDKThreeBytes rgb_arg_ref;
22437 CHECK(*((uint32_t*)rgb_arg) == 3);
22438 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
22439 LDKThirtyTwoBytes alias_arg_ref;
22440 CHECK(*((uint32_t*)alias_arg) == 32);
22441 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
22442 LDKCVec_NetAddressZ addresses_arg_constr;
22443 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
22444 if (addresses_arg_constr.datalen > 0)
22445 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22447 addresses_arg_constr.data = NULL;
22448 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
22449 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
22450 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
22451 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
22452 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
22454 LDKNodeAnnouncement announcement_message_arg_conv;
22455 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
22456 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
22457 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
22458 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
22459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22461 uint64_t ret_ref = (uint64_t)ret_var.inner;
22462 if (ret_var.is_owned) {
22468 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
22469 LDKNodeAnnouncementInfo orig_conv;
22470 orig_conv.inner = (void*)(orig & (~1));
22471 orig_conv.is_owned = false;
22472 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
22473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22475 uint64_t ret_ref = (uint64_t)ret_var.inner;
22476 if (ret_var.is_owned) {
22482 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
22483 LDKNodeAnnouncementInfo obj_conv;
22484 obj_conv.inner = (void*)(obj & (~1));
22485 obj_conv.is_owned = false;
22486 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
22487 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22488 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22489 CVec_u8Z_free(ret_var);
22493 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
22494 LDKu8slice ser_ref;
22495 ser_ref.datalen = *((uint32_t*)ser);
22496 ser_ref.data = (int8_t*)(ser + 4);
22497 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
22498 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
22499 return (uint64_t)ret_conv;
22502 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
22503 LDKNodeInfo this_obj_conv;
22504 this_obj_conv.inner = (void*)(this_obj & (~1));
22505 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22506 NodeInfo_free(this_obj_conv);
22509 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
22510 LDKNodeInfo this_ptr_conv;
22511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22512 this_ptr_conv.is_owned = false;
22513 LDKCVec_u64Z val_constr;
22514 val_constr.datalen = *((uint32_t*)val);
22515 if (val_constr.datalen > 0)
22516 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22518 val_constr.data = NULL;
22519 int64_t* val_vals = (int64_t*)(val + 4);
22520 for (size_t i = 0; i < val_constr.datalen; i++) {
22521 int64_t val_conv_8 = val_vals[i];
22522 val_constr.data[i] = val_conv_8;
22524 NodeInfo_set_channels(&this_ptr_conv, val_constr);
22527 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
22528 LDKNodeInfo this_ptr_conv;
22529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22530 this_ptr_conv.is_owned = false;
22531 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
22532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22534 uint64_t ret_ref = (uint64_t)ret_var.inner;
22535 if (ret_var.is_owned) {
22541 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
22542 LDKNodeInfo this_ptr_conv;
22543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22544 this_ptr_conv.is_owned = false;
22545 LDKRoutingFees val_conv;
22546 val_conv.inner = (void*)(val & (~1));
22547 val_conv.is_owned = (val & 1) || (val == 0);
22548 val_conv = RoutingFees_clone(&val_conv);
22549 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
22552 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
22553 LDKNodeInfo this_ptr_conv;
22554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22555 this_ptr_conv.is_owned = false;
22556 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
22557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22559 uint64_t ret_ref = (uint64_t)ret_var.inner;
22560 if (ret_var.is_owned) {
22566 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
22567 LDKNodeInfo this_ptr_conv;
22568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22569 this_ptr_conv.is_owned = false;
22570 LDKNodeAnnouncementInfo val_conv;
22571 val_conv.inner = (void*)(val & (~1));
22572 val_conv.is_owned = (val & 1) || (val == 0);
22573 val_conv = NodeAnnouncementInfo_clone(&val_conv);
22574 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
22577 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
22578 LDKCVec_u64Z channels_arg_constr;
22579 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
22580 if (channels_arg_constr.datalen > 0)
22581 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22583 channels_arg_constr.data = NULL;
22584 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
22585 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
22586 int64_t channels_arg_conv_8 = channels_arg_vals[i];
22587 channels_arg_constr.data[i] = channels_arg_conv_8;
22589 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
22590 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
22591 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
22592 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
22593 LDKNodeAnnouncementInfo announcement_info_arg_conv;
22594 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
22595 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
22596 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
22597 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
22598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22600 uint64_t ret_ref = (uint64_t)ret_var.inner;
22601 if (ret_var.is_owned) {
22607 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
22608 LDKNodeInfo orig_conv;
22609 orig_conv.inner = (void*)(orig & (~1));
22610 orig_conv.is_owned = false;
22611 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
22612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22614 uint64_t ret_ref = (uint64_t)ret_var.inner;
22615 if (ret_var.is_owned) {
22621 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
22622 LDKNodeInfo obj_conv;
22623 obj_conv.inner = (void*)(obj & (~1));
22624 obj_conv.is_owned = false;
22625 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
22626 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22627 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22628 CVec_u8Z_free(ret_var);
22632 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
22633 LDKu8slice ser_ref;
22634 ser_ref.datalen = *((uint32_t*)ser);
22635 ser_ref.data = (int8_t*)(ser + 4);
22636 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
22637 *ret_conv = NodeInfo_read(ser_ref);
22638 return (uint64_t)ret_conv;
22641 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
22642 LDKNetworkGraph obj_conv;
22643 obj_conv.inner = (void*)(obj & (~1));
22644 obj_conv.is_owned = false;
22645 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
22646 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22647 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22648 CVec_u8Z_free(ret_var);
22652 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
22653 LDKu8slice ser_ref;
22654 ser_ref.datalen = *((uint32_t*)ser);
22655 ser_ref.data = (int8_t*)(ser + 4);
22656 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
22657 *ret_conv = NetworkGraph_read(ser_ref);
22658 return (uint64_t)ret_conv;
22661 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
22662 LDKThirtyTwoBytes genesis_hash_ref;
22663 CHECK(*((uint32_t*)genesis_hash) == 32);
22664 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
22665 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
22666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22668 uint64_t ret_ref = (uint64_t)ret_var.inner;
22669 if (ret_var.is_owned) {
22675 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
22676 LDKNetworkGraph this_arg_conv;
22677 this_arg_conv.inner = (void*)(this_arg & (~1));
22678 this_arg_conv.is_owned = false;
22679 LDKNodeAnnouncement msg_conv;
22680 msg_conv.inner = (void*)(msg & (~1));
22681 msg_conv.is_owned = false;
22682 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22683 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
22684 return (uint64_t)ret_conv;
22687 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
22688 LDKNetworkGraph this_arg_conv;
22689 this_arg_conv.inner = (void*)(this_arg & (~1));
22690 this_arg_conv.is_owned = false;
22691 LDKUnsignedNodeAnnouncement msg_conv;
22692 msg_conv.inner = (void*)(msg & (~1));
22693 msg_conv.is_owned = false;
22694 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22695 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
22696 return (uint64_t)ret_conv;
22699 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
22700 LDKNetworkGraph this_arg_conv;
22701 this_arg_conv.inner = (void*)(this_arg & (~1));
22702 this_arg_conv.is_owned = false;
22703 LDKChannelAnnouncement msg_conv;
22704 msg_conv.inner = (void*)(msg & (~1));
22705 msg_conv.is_owned = false;
22706 LDKAccess *chain_access_conv_ptr = NULL;
22707 if (chain_access != 0) {
22708 LDKAccess chain_access_conv;
22709 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22710 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22711 *chain_access_conv_ptr = chain_access_conv;
22713 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22714 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
22715 return (uint64_t)ret_conv;
22718 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
22719 LDKNetworkGraph this_arg_conv;
22720 this_arg_conv.inner = (void*)(this_arg & (~1));
22721 this_arg_conv.is_owned = false;
22722 LDKUnsignedChannelAnnouncement msg_conv;
22723 msg_conv.inner = (void*)(msg & (~1));
22724 msg_conv.is_owned = false;
22725 LDKAccess *chain_access_conv_ptr = NULL;
22726 if (chain_access != 0) {
22727 LDKAccess chain_access_conv;
22728 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22729 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22730 *chain_access_conv_ptr = chain_access_conv;
22732 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22733 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
22734 return (uint64_t)ret_conv;
22737 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
22738 LDKNetworkGraph this_arg_conv;
22739 this_arg_conv.inner = (void*)(this_arg & (~1));
22740 this_arg_conv.is_owned = false;
22741 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
22744 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
22745 LDKNetworkGraph this_arg_conv;
22746 this_arg_conv.inner = (void*)(this_arg & (~1));
22747 this_arg_conv.is_owned = false;
22748 LDKChannelUpdate msg_conv;
22749 msg_conv.inner = (void*)(msg & (~1));
22750 msg_conv.is_owned = false;
22751 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22752 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
22753 return (uint64_t)ret_conv;
22756 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
22757 LDKNetworkGraph this_arg_conv;
22758 this_arg_conv.inner = (void*)(this_arg & (~1));
22759 this_arg_conv.is_owned = false;
22760 LDKUnsignedChannelUpdate msg_conv;
22761 msg_conv.inner = (void*)(msg & (~1));
22762 msg_conv.is_owned = false;
22763 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22764 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
22765 return (uint64_t)ret_conv;
22768 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
22769 LDKFilesystemPersister this_obj_conv;
22770 this_obj_conv.inner = (void*)(this_obj & (~1));
22771 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22772 FilesystemPersister_free(this_obj_conv);
22775 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
22776 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
22777 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
22778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22780 uint64_t ret_ref = (uint64_t)ret_var.inner;
22781 if (ret_var.is_owned) {
22787 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
22788 LDKFilesystemPersister this_arg_conv;
22789 this_arg_conv.inner = (void*)(this_arg & (~1));
22790 this_arg_conv.is_owned = false;
22791 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
22792 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22797 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
22798 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
22799 LDKChannelManager manager_conv;
22800 manager_conv.inner = (void*)(manager & (~1));
22801 manager_conv.is_owned = false;
22802 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
22803 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
22804 return (uint64_t)ret_conv;
22807 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
22808 LDKFilesystemPersister this_arg_conv;
22809 this_arg_conv.inner = (void*)(this_arg & (~1));
22810 this_arg_conv.is_owned = false;
22811 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
22812 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
22813 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
22814 return (uint64_t)ret_conv;
22817 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
22818 LDKFilesystemPersister this_arg_conv;
22819 this_arg_conv.inner = (void*)(this_arg & (~1));
22820 this_arg_conv.is_owned = false;
22821 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
22822 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
22823 return (uint64_t)ret;
22826 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
22827 LDKBackgroundProcessor this_obj_conv;
22828 this_obj_conv.inner = (void*)(this_obj & (~1));
22829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22830 BackgroundProcessor_free(this_obj_conv);
22833 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
22834 if ((this_ptr & 1) != 0) return;
22835 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
22836 FREE((void*)this_ptr);
22837 ChannelManagerPersister_free(this_ptr_conv);
22840 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 peer_manager, uint32_t logger) {
22841 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
22842 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
22843 LDKChainMonitor chain_monitor_conv;
22844 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
22845 chain_monitor_conv.is_owned = false;
22846 LDKChannelManager channel_manager_conv;
22847 channel_manager_conv.inner = (void*)(channel_manager & (~1));
22848 channel_manager_conv.is_owned = false;
22849 LDKPeerManager peer_manager_conv;
22850 peer_manager_conv.inner = (void*)(peer_manager & (~1));
22851 peer_manager_conv.is_owned = false;
22852 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22853 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
22854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22856 uint64_t ret_ref = (uint64_t)ret_var.inner;
22857 if (ret_var.is_owned) {
22863 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
22864 LDKBackgroundProcessor this_arg_conv;
22865 this_arg_conv.inner = (void*)(this_arg & (~1));
22866 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
22867 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
22868 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
22869 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
22870 return (uint64_t)ret_conv;
22873 void __attribute__((visibility("default"))) TS_check_platform() {
22877 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
22878 LDKInvoice this_obj_conv;
22879 this_obj_conv.inner = (void*)(this_obj & (~1));
22880 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22881 Invoice_free(this_obj_conv);
22884 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
22886 a_conv.inner = (void*)(a & (~1));
22887 a_conv.is_owned = false;
22889 b_conv.inner = (void*)(b & (~1));
22890 b_conv.is_owned = false;
22891 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
22895 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
22896 LDKInvoice orig_conv;
22897 orig_conv.inner = (void*)(orig & (~1));
22898 orig_conv.is_owned = false;
22899 LDKInvoice ret_var = Invoice_clone(&orig_conv);
22900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22902 uint64_t ret_ref = (uint64_t)ret_var.inner;
22903 if (ret_var.is_owned) {
22909 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
22910 LDKSignedRawInvoice this_obj_conv;
22911 this_obj_conv.inner = (void*)(this_obj & (~1));
22912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22913 SignedRawInvoice_free(this_obj_conv);
22916 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
22917 LDKSignedRawInvoice a_conv;
22918 a_conv.inner = (void*)(a & (~1));
22919 a_conv.is_owned = false;
22920 LDKSignedRawInvoice b_conv;
22921 b_conv.inner = (void*)(b & (~1));
22922 b_conv.is_owned = false;
22923 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
22927 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
22928 LDKSignedRawInvoice orig_conv;
22929 orig_conv.inner = (void*)(orig & (~1));
22930 orig_conv.is_owned = false;
22931 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
22932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22934 uint64_t ret_ref = (uint64_t)ret_var.inner;
22935 if (ret_var.is_owned) {
22941 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
22942 LDKRawInvoice this_obj_conv;
22943 this_obj_conv.inner = (void*)(this_obj & (~1));
22944 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22945 RawInvoice_free(this_obj_conv);
22948 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
22949 LDKRawInvoice this_ptr_conv;
22950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22951 this_ptr_conv.is_owned = false;
22952 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
22953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22955 uint64_t ret_ref = (uint64_t)ret_var.inner;
22956 if (ret_var.is_owned) {
22962 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
22963 LDKRawInvoice this_ptr_conv;
22964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22965 this_ptr_conv.is_owned = false;
22966 LDKRawDataPart val_conv;
22967 val_conv.inner = (void*)(val & (~1));
22968 val_conv.is_owned = (val & 1) || (val == 0);
22969 val_conv = RawDataPart_clone(&val_conv);
22970 RawInvoice_set_data(&this_ptr_conv, val_conv);
22973 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
22974 LDKRawInvoice a_conv;
22975 a_conv.inner = (void*)(a & (~1));
22976 a_conv.is_owned = false;
22977 LDKRawInvoice b_conv;
22978 b_conv.inner = (void*)(b & (~1));
22979 b_conv.is_owned = false;
22980 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
22984 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
22985 LDKRawInvoice orig_conv;
22986 orig_conv.inner = (void*)(orig & (~1));
22987 orig_conv.is_owned = false;
22988 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
22989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22991 uint64_t ret_ref = (uint64_t)ret_var.inner;
22992 if (ret_var.is_owned) {
22998 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
22999 LDKRawDataPart this_obj_conv;
23000 this_obj_conv.inner = (void*)(this_obj & (~1));
23001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23002 RawDataPart_free(this_obj_conv);
23005 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
23006 LDKRawDataPart this_ptr_conv;
23007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23008 this_ptr_conv.is_owned = false;
23009 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
23010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23012 uint64_t ret_ref = (uint64_t)ret_var.inner;
23013 if (ret_var.is_owned) {
23019 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
23020 LDKRawDataPart this_ptr_conv;
23021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23022 this_ptr_conv.is_owned = false;
23023 LDKPositiveTimestamp val_conv;
23024 val_conv.inner = (void*)(val & (~1));
23025 val_conv.is_owned = (val & 1) || (val == 0);
23026 val_conv = PositiveTimestamp_clone(&val_conv);
23027 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
23030 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
23031 LDKRawDataPart a_conv;
23032 a_conv.inner = (void*)(a & (~1));
23033 a_conv.is_owned = false;
23034 LDKRawDataPart b_conv;
23035 b_conv.inner = (void*)(b & (~1));
23036 b_conv.is_owned = false;
23037 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
23041 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
23042 LDKRawDataPart orig_conv;
23043 orig_conv.inner = (void*)(orig & (~1));
23044 orig_conv.is_owned = false;
23045 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
23046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23048 uint64_t ret_ref = (uint64_t)ret_var.inner;
23049 if (ret_var.is_owned) {
23055 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
23056 LDKPositiveTimestamp this_obj_conv;
23057 this_obj_conv.inner = (void*)(this_obj & (~1));
23058 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23059 PositiveTimestamp_free(this_obj_conv);
23062 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
23063 LDKPositiveTimestamp a_conv;
23064 a_conv.inner = (void*)(a & (~1));
23065 a_conv.is_owned = false;
23066 LDKPositiveTimestamp b_conv;
23067 b_conv.inner = (void*)(b & (~1));
23068 b_conv.is_owned = false;
23069 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
23073 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
23074 LDKPositiveTimestamp orig_conv;
23075 orig_conv.inner = (void*)(orig & (~1));
23076 orig_conv.is_owned = false;
23077 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
23078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23080 uint64_t ret_ref = (uint64_t)ret_var.inner;
23081 if (ret_var.is_owned) {
23087 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
23088 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
23089 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
23093 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
23094 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
23098 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
23099 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
23103 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
23104 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
23108 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
23109 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
23113 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
23114 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
23115 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
23116 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
23120 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
23121 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
23122 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
23126 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
23127 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
23128 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
23132 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
23133 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
23137 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
23138 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
23142 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
23143 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
23147 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
23148 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
23152 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
23153 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
23157 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
23158 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
23159 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
23160 jboolean ret_val = Currency_eq(a_conv, b_conv);
23164 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
23165 LDKSha256 this_obj_conv;
23166 this_obj_conv.inner = (void*)(this_obj & (~1));
23167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23168 Sha256_free(this_obj_conv);
23171 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
23173 a_conv.inner = (void*)(a & (~1));
23174 a_conv.is_owned = false;
23176 b_conv.inner = (void*)(b & (~1));
23177 b_conv.is_owned = false;
23178 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
23182 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
23183 LDKSha256 orig_conv;
23184 orig_conv.inner = (void*)(orig & (~1));
23185 orig_conv.is_owned = false;
23186 LDKSha256 ret_var = Sha256_clone(&orig_conv);
23187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23189 uint64_t ret_ref = (uint64_t)ret_var.inner;
23190 if (ret_var.is_owned) {
23196 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
23197 LDKDescription this_obj_conv;
23198 this_obj_conv.inner = (void*)(this_obj & (~1));
23199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23200 Description_free(this_obj_conv);
23203 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
23204 LDKDescription a_conv;
23205 a_conv.inner = (void*)(a & (~1));
23206 a_conv.is_owned = false;
23207 LDKDescription b_conv;
23208 b_conv.inner = (void*)(b & (~1));
23209 b_conv.is_owned = false;
23210 jboolean ret_val = Description_eq(&a_conv, &b_conv);
23214 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
23215 LDKDescription orig_conv;
23216 orig_conv.inner = (void*)(orig & (~1));
23217 orig_conv.is_owned = false;
23218 LDKDescription ret_var = Description_clone(&orig_conv);
23219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23221 uint64_t ret_ref = (uint64_t)ret_var.inner;
23222 if (ret_var.is_owned) {
23228 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
23229 LDKPayeePubKey this_obj_conv;
23230 this_obj_conv.inner = (void*)(this_obj & (~1));
23231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23232 PayeePubKey_free(this_obj_conv);
23235 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
23236 LDKPayeePubKey a_conv;
23237 a_conv.inner = (void*)(a & (~1));
23238 a_conv.is_owned = false;
23239 LDKPayeePubKey b_conv;
23240 b_conv.inner = (void*)(b & (~1));
23241 b_conv.is_owned = false;
23242 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
23246 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
23247 LDKPayeePubKey orig_conv;
23248 orig_conv.inner = (void*)(orig & (~1));
23249 orig_conv.is_owned = false;
23250 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
23251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23253 uint64_t ret_ref = (uint64_t)ret_var.inner;
23254 if (ret_var.is_owned) {
23260 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
23261 LDKExpiryTime this_obj_conv;
23262 this_obj_conv.inner = (void*)(this_obj & (~1));
23263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23264 ExpiryTime_free(this_obj_conv);
23267 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
23268 LDKExpiryTime a_conv;
23269 a_conv.inner = (void*)(a & (~1));
23270 a_conv.is_owned = false;
23271 LDKExpiryTime b_conv;
23272 b_conv.inner = (void*)(b & (~1));
23273 b_conv.is_owned = false;
23274 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
23278 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
23279 LDKExpiryTime orig_conv;
23280 orig_conv.inner = (void*)(orig & (~1));
23281 orig_conv.is_owned = false;
23282 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
23283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23285 uint64_t ret_ref = (uint64_t)ret_var.inner;
23286 if (ret_var.is_owned) {
23292 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
23293 LDKMinFinalCltvExpiry this_obj_conv;
23294 this_obj_conv.inner = (void*)(this_obj & (~1));
23295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23296 MinFinalCltvExpiry_free(this_obj_conv);
23299 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
23300 LDKMinFinalCltvExpiry a_conv;
23301 a_conv.inner = (void*)(a & (~1));
23302 a_conv.is_owned = false;
23303 LDKMinFinalCltvExpiry b_conv;
23304 b_conv.inner = (void*)(b & (~1));
23305 b_conv.is_owned = false;
23306 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
23310 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
23311 LDKMinFinalCltvExpiry orig_conv;
23312 orig_conv.inner = (void*)(orig & (~1));
23313 orig_conv.is_owned = false;
23314 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
23315 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23316 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23317 uint64_t ret_ref = (uint64_t)ret_var.inner;
23318 if (ret_var.is_owned) {
23324 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
23325 if ((this_ptr & 1) != 0) return;
23326 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
23327 FREE((void*)this_ptr);
23328 Fallback_free(this_ptr_conv);
23331 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
23332 LDKFallback* orig_conv = (LDKFallback*)orig;
23333 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23334 *ret_copy = Fallback_clone(orig_conv);
23335 uint64_t ret_ref = (uint64_t)ret_copy;
23339 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
23341 LDKCVec_u8Z program_ref;
23342 program_ref.datalen = *((uint32_t*)program);
23343 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
23344 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
23345 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23346 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
23347 uint64_t ret_ref = (uint64_t)ret_copy;
23351 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
23352 LDKTwentyBytes a_ref;
23353 CHECK(*((uint32_t*)a) == 20);
23354 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
23355 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23356 *ret_copy = Fallback_pub_key_hash(a_ref);
23357 uint64_t ret_ref = (uint64_t)ret_copy;
23361 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
23362 LDKTwentyBytes a_ref;
23363 CHECK(*((uint32_t*)a) == 20);
23364 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
23365 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23366 *ret_copy = Fallback_script_hash(a_ref);
23367 uint64_t ret_ref = (uint64_t)ret_copy;
23371 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
23372 LDKFallback* a_conv = (LDKFallback*)a;
23373 LDKFallback* b_conv = (LDKFallback*)b;
23374 jboolean ret_val = Fallback_eq(a_conv, b_conv);
23378 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
23379 LDKInvoiceSignature this_obj_conv;
23380 this_obj_conv.inner = (void*)(this_obj & (~1));
23381 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23382 InvoiceSignature_free(this_obj_conv);
23385 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
23386 LDKInvoiceSignature a_conv;
23387 a_conv.inner = (void*)(a & (~1));
23388 a_conv.is_owned = false;
23389 LDKInvoiceSignature b_conv;
23390 b_conv.inner = (void*)(b & (~1));
23391 b_conv.is_owned = false;
23392 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
23396 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
23397 LDKInvoiceSignature orig_conv;
23398 orig_conv.inner = (void*)(orig & (~1));
23399 orig_conv.is_owned = false;
23400 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
23401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23403 uint64_t ret_ref = (uint64_t)ret_var.inner;
23404 if (ret_var.is_owned) {
23410 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
23411 LDKPrivateRoute this_obj_conv;
23412 this_obj_conv.inner = (void*)(this_obj & (~1));
23413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23414 PrivateRoute_free(this_obj_conv);
23417 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
23418 LDKPrivateRoute a_conv;
23419 a_conv.inner = (void*)(a & (~1));
23420 a_conv.is_owned = false;
23421 LDKPrivateRoute b_conv;
23422 b_conv.inner = (void*)(b & (~1));
23423 b_conv.is_owned = false;
23424 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
23428 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
23429 LDKPrivateRoute orig_conv;
23430 orig_conv.inner = (void*)(orig & (~1));
23431 orig_conv.is_owned = false;
23432 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
23433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23435 uint64_t ret_ref = (uint64_t)ret_var.inner;
23436 if (ret_var.is_owned) {
23442 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
23443 LDKSignedRawInvoice this_arg_conv;
23444 this_arg_conv.inner = (void*)(this_arg & (~1));
23445 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23446 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
23447 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
23448 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
23449 return (uint64_t)ret_ref;
23452 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
23453 LDKSignedRawInvoice this_arg_conv;
23454 this_arg_conv.inner = (void*)(this_arg & (~1));
23455 this_arg_conv.is_owned = false;
23456 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
23457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23459 uint64_t ret_ref = (uint64_t)ret_var.inner;
23460 if (ret_var.is_owned) {
23466 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
23467 LDKSignedRawInvoice this_arg_conv;
23468 this_arg_conv.inner = (void*)(this_arg & (~1));
23469 this_arg_conv.is_owned = false;
23470 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23471 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
23475 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
23476 LDKSignedRawInvoice this_arg_conv;
23477 this_arg_conv.inner = (void*)(this_arg & (~1));
23478 this_arg_conv.is_owned = false;
23479 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
23480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23482 uint64_t ret_ref = (uint64_t)ret_var.inner;
23483 if (ret_var.is_owned) {
23489 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
23490 LDKSignedRawInvoice this_arg_conv;
23491 this_arg_conv.inner = (void*)(this_arg & (~1));
23492 this_arg_conv.is_owned = false;
23493 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23494 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
23495 return (uint64_t)ret_conv;
23498 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
23499 LDKSignedRawInvoice this_arg_conv;
23500 this_arg_conv.inner = (void*)(this_arg & (~1));
23501 this_arg_conv.is_owned = false;
23502 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
23506 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
23507 LDKRawInvoice this_arg_conv;
23508 this_arg_conv.inner = (void*)(this_arg & (~1));
23509 this_arg_conv.is_owned = false;
23510 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23511 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
23515 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
23516 LDKRawInvoice this_arg_conv;
23517 this_arg_conv.inner = (void*)(this_arg & (~1));
23518 this_arg_conv.is_owned = false;
23519 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
23520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23522 uint64_t ret_ref = (uint64_t)ret_var.inner;
23523 if (ret_var.is_owned) {
23529 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
23530 LDKRawInvoice this_arg_conv;
23531 this_arg_conv.inner = (void*)(this_arg & (~1));
23532 this_arg_conv.is_owned = false;
23533 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
23534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23536 uint64_t ret_ref = (uint64_t)ret_var.inner;
23537 if (ret_var.is_owned) {
23543 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
23544 LDKRawInvoice this_arg_conv;
23545 this_arg_conv.inner = (void*)(this_arg & (~1));
23546 this_arg_conv.is_owned = false;
23547 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
23548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23550 uint64_t ret_ref = (uint64_t)ret_var.inner;
23551 if (ret_var.is_owned) {
23557 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
23558 LDKRawInvoice this_arg_conv;
23559 this_arg_conv.inner = (void*)(this_arg & (~1));
23560 this_arg_conv.is_owned = false;
23561 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
23565 if (ret_var.is_owned) {
23571 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
23572 LDKRawInvoice this_arg_conv;
23573 this_arg_conv.inner = (void*)(this_arg & (~1));
23574 this_arg_conv.is_owned = false;
23575 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
23576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23578 uint64_t ret_ref = (uint64_t)ret_var.inner;
23579 if (ret_var.is_owned) {
23585 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
23586 LDKRawInvoice this_arg_conv;
23587 this_arg_conv.inner = (void*)(this_arg & (~1));
23588 this_arg_conv.is_owned = false;
23589 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
23590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23592 uint64_t ret_ref = (uint64_t)ret_var.inner;
23593 if (ret_var.is_owned) {
23599 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
23600 LDKRawInvoice this_arg_conv;
23601 this_arg_conv.inner = (void*)(this_arg & (~1));
23602 this_arg_conv.is_owned = false;
23603 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23604 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
23608 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
23609 LDKRawInvoice this_arg_conv;
23610 this_arg_conv.inner = (void*)(this_arg & (~1));
23611 this_arg_conv.is_owned = false;
23612 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
23613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23615 uint64_t ret_ref = (uint64_t)ret_var.inner;
23616 if (ret_var.is_owned) {
23622 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
23623 LDKRawInvoice this_arg_conv;
23624 this_arg_conv.inner = (void*)(this_arg & (~1));
23625 this_arg_conv.is_owned = false;
23626 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
23627 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23628 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23629 for (size_t o = 0; o < ret_var.datalen; o++) {
23630 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
23631 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23632 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23633 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
23634 if (ret_conv_14_var.is_owned) {
23635 ret_conv_14_ref |= 1;
23637 ret_arr_ptr[o] = ret_conv_14_ref;
23639 FREE(ret_var.data);
23643 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
23644 LDKRawInvoice this_arg_conv;
23645 this_arg_conv.inner = (void*)(this_arg & (~1));
23646 this_arg_conv.is_owned = false;
23647 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23648 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
23649 uint64_t ret_ref = (uint64_t)ret_copy;
23653 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
23654 LDKRawInvoice this_arg_conv;
23655 this_arg_conv.inner = (void*)(this_arg & (~1));
23656 this_arg_conv.is_owned = false;
23657 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
23661 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
23662 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23663 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
23664 return (uint64_t)ret_conv;
23667 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
23668 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23669 *ret_conv = PositiveTimestamp_from_system_time(time);
23670 return (uint64_t)ret_conv;
23673 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
23674 LDKPositiveTimestamp this_arg_conv;
23675 this_arg_conv.inner = (void*)(this_arg & (~1));
23676 this_arg_conv.is_owned = false;
23677 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
23681 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
23682 LDKPositiveTimestamp this_arg_conv;
23683 this_arg_conv.inner = (void*)(this_arg & (~1));
23684 this_arg_conv.is_owned = false;
23685 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
23689 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
23690 LDKInvoice this_arg_conv;
23691 this_arg_conv.inner = (void*)(this_arg & (~1));
23692 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23693 this_arg_conv = Invoice_clone(&this_arg_conv);
23694 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
23695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23697 uint64_t ret_ref = (uint64_t)ret_var.inner;
23698 if (ret_var.is_owned) {
23704 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
23705 LDKInvoice this_arg_conv;
23706 this_arg_conv.inner = (void*)(this_arg & (~1));
23707 this_arg_conv.is_owned = false;
23708 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23709 *ret_conv = Invoice_check_signature(&this_arg_conv);
23710 return (uint64_t)ret_conv;
23713 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
23714 LDKSignedRawInvoice signed_invoice_conv;
23715 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
23716 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
23717 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
23718 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23719 *ret_conv = Invoice_from_signed(signed_invoice_conv);
23720 return (uint64_t)ret_conv;
23723 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
23724 LDKInvoice this_arg_conv;
23725 this_arg_conv.inner = (void*)(this_arg & (~1));
23726 this_arg_conv.is_owned = false;
23727 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
23731 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
23732 LDKInvoice this_arg_conv;
23733 this_arg_conv.inner = (void*)(this_arg & (~1));
23734 this_arg_conv.is_owned = false;
23735 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23736 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
23740 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
23741 LDKInvoice this_arg_conv;
23742 this_arg_conv.inner = (void*)(this_arg & (~1));
23743 this_arg_conv.is_owned = false;
23744 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23745 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
23749 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
23750 LDKInvoice this_arg_conv;
23751 this_arg_conv.inner = (void*)(this_arg & (~1));
23752 this_arg_conv.is_owned = false;
23753 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23754 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
23758 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
23759 LDKInvoice this_arg_conv;
23760 this_arg_conv.inner = (void*)(this_arg & (~1));
23761 this_arg_conv.is_owned = false;
23762 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
23763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23765 uint64_t ret_ref = (uint64_t)ret_var.inner;
23766 if (ret_var.is_owned) {
23772 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
23773 LDKInvoice this_arg_conv;
23774 this_arg_conv.inner = (void*)(this_arg & (~1));
23775 this_arg_conv.is_owned = false;
23776 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23777 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
23781 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
23782 LDKInvoice this_arg_conv;
23783 this_arg_conv.inner = (void*)(this_arg & (~1));
23784 this_arg_conv.is_owned = false;
23785 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
23789 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
23790 LDKInvoice this_arg_conv;
23791 this_arg_conv.inner = (void*)(this_arg & (~1));
23792 this_arg_conv.is_owned = false;
23793 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
23797 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
23798 LDKInvoice this_arg_conv;
23799 this_arg_conv.inner = (void*)(this_arg & (~1));
23800 this_arg_conv.is_owned = false;
23801 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
23802 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23803 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23804 for (size_t o = 0; o < ret_var.datalen; o++) {
23805 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
23806 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23807 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23808 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
23809 if (ret_conv_14_var.is_owned) {
23810 ret_conv_14_ref |= 1;
23812 ret_arr_ptr[o] = ret_conv_14_ref;
23814 FREE(ret_var.data);
23818 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
23819 LDKInvoice this_arg_conv;
23820 this_arg_conv.inner = (void*)(this_arg & (~1));
23821 this_arg_conv.is_owned = false;
23822 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
23823 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23824 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23825 for (size_t l = 0; l < ret_var.datalen; l++) {
23826 LDKRouteHint ret_conv_11_var = ret_var.data[l];
23827 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23828 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23829 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
23830 if (ret_conv_11_var.is_owned) {
23831 ret_conv_11_ref |= 1;
23833 ret_arr_ptr[l] = ret_conv_11_ref;
23835 FREE(ret_var.data);
23839 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
23840 LDKInvoice this_arg_conv;
23841 this_arg_conv.inner = (void*)(this_arg & (~1));
23842 this_arg_conv.is_owned = false;
23843 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
23847 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
23848 LDKInvoice this_arg_conv;
23849 this_arg_conv.inner = (void*)(this_arg & (~1));
23850 this_arg_conv.is_owned = false;
23851 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23852 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
23853 uint64_t ret_ref = (uint64_t)ret_copy;
23857 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
23858 LDKStr description_conv = str_ref_to_owned_c(description);
23859 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23860 *ret_conv = Description_new(description_conv);
23861 return (uint64_t)ret_conv;
23864 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
23865 LDKDescription this_arg_conv;
23866 this_arg_conv.inner = (void*)(this_arg & (~1));
23867 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23868 this_arg_conv = Description_clone(&this_arg_conv);
23869 LDKStr ret_str = Description_into_inner(this_arg_conv);
23870 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23875 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
23876 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
23877 *ret_conv = ExpiryTime_from_seconds(seconds);
23878 return (uint64_t)ret_conv;
23881 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
23882 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
23883 *ret_conv = ExpiryTime_from_duration(duration);
23884 return (uint64_t)ret_conv;
23887 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
23888 LDKExpiryTime this_arg_conv;
23889 this_arg_conv.inner = (void*)(this_arg & (~1));
23890 this_arg_conv.is_owned = false;
23891 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
23895 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
23896 LDKExpiryTime this_arg_conv;
23897 this_arg_conv.inner = (void*)(this_arg & (~1));
23898 this_arg_conv.is_owned = false;
23899 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
23903 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
23904 LDKRouteHint hops_conv;
23905 hops_conv.inner = (void*)(hops & (~1));
23906 hops_conv.is_owned = (hops & 1) || (hops == 0);
23907 hops_conv = RouteHint_clone(&hops_conv);
23908 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23909 *ret_conv = PrivateRoute_new(hops_conv);
23910 return (uint64_t)ret_conv;
23913 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
23914 LDKPrivateRoute this_arg_conv;
23915 this_arg_conv.inner = (void*)(this_arg & (~1));
23916 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23917 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
23918 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
23919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23921 uint64_t ret_ref = (uint64_t)ret_var.inner;
23922 if (ret_var.is_owned) {
23928 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
23929 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
23930 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
23934 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
23935 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
23939 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
23940 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
23944 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
23945 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
23949 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
23950 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
23954 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
23955 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
23956 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
23957 jboolean ret_val = CreationError_eq(a_conv, b_conv);
23961 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
23962 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
23963 LDKStr ret_str = CreationError_to_str(o_conv);
23964 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23969 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
23970 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
23971 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
23975 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
23976 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
23980 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
23981 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
23985 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
23986 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
23990 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
23991 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
23995 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
23996 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
24000 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
24001 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
24005 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
24006 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
24010 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
24011 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
24015 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
24016 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
24017 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
24018 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
24022 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
24023 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
24024 LDKStr ret_str = SemanticError_to_str(o_conv);
24025 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24030 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
24031 if ((this_ptr & 1) != 0) return;
24032 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
24033 FREE((void*)this_ptr);
24034 SignOrCreationError_free(this_ptr_conv);
24037 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
24038 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
24039 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24040 *ret_copy = SignOrCreationError_clone(orig_conv);
24041 uint64_t ret_ref = (uint64_t)ret_copy;
24045 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
24046 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24047 *ret_copy = SignOrCreationError_sign_error();
24048 uint64_t ret_ref = (uint64_t)ret_copy;
24052 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
24053 LDKCreationError a_conv = LDKCreationError_from_js(a);
24054 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24055 *ret_copy = SignOrCreationError_creation_error(a_conv);
24056 uint64_t ret_ref = (uint64_t)ret_copy;
24060 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
24061 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
24062 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
24063 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
24067 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
24068 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
24069 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
24070 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24075 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) {
24076 LDKChannelManager channelmanager_conv;
24077 channelmanager_conv.inner = (void*)(channelmanager & (~1));
24078 channelmanager_conv.is_owned = false;
24079 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24080 LDKCurrency network_conv = LDKCurrency_from_js(network);
24081 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
24082 LDKStr description_conv = str_ref_to_owned_c(description);
24083 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24084 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
24085 return (uint64_t)ret_conv;
24088 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
24089 LDKStr s_conv = str_ref_to_owned_c(s);
24090 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
24091 *ret_conv = SiPrefix_from_str(s_conv);
24092 return (uint64_t)ret_conv;
24095 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
24096 LDKStr s_conv = str_ref_to_owned_c(s);
24097 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
24098 *ret_conv = Invoice_from_str(s_conv);
24099 return (uint64_t)ret_conv;
24102 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
24103 LDKStr s_conv = str_ref_to_owned_c(s);
24104 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
24105 *ret_conv = SignedRawInvoice_from_str(s_conv);
24106 return (uint64_t)ret_conv;
24109 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
24111 o_conv.inner = (void*)(o & (~1));
24112 o_conv.is_owned = false;
24113 LDKStr ret_str = Invoice_to_str(&o_conv);
24114 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24119 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
24120 LDKSignedRawInvoice o_conv;
24121 o_conv.inner = (void*)(o & (~1));
24122 o_conv.is_owned = false;
24123 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
24124 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24129 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
24130 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
24131 LDKStr ret_str = Currency_to_str(o_conv);
24132 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24137 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
24138 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
24139 LDKStr ret_str = SiPrefix_to_str(o_conv);
24140 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);