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_NoPaymentSecret;
273 case 5: return LDKSemanticError_MultiplePaymentSecrets;
274 case 6: return LDKSemanticError_InvalidFeatures;
275 case 7: return LDKSemanticError_InvalidRecoveryId;
276 case 8: return LDKSemanticError_InvalidSignature;
277 case 9: return LDKSemanticError_ImpreciseAmount;
281 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
283 case LDKSemanticError_NoPaymentHash: return 0;
284 case LDKSemanticError_MultiplePaymentHashes: return 1;
285 case LDKSemanticError_NoDescription: return 2;
286 case LDKSemanticError_MultipleDescriptions: return 3;
287 case LDKSemanticError_NoPaymentSecret: return 4;
288 case LDKSemanticError_MultiplePaymentSecrets: return 5;
289 case LDKSemanticError_InvalidFeatures: return 6;
290 case LDKSemanticError_InvalidRecoveryId: return 7;
291 case LDKSemanticError_InvalidSignature: return 8;
292 case LDKSemanticError_ImpreciseAmount: return 9;
296 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
298 case 0: return LDKSiPrefix_Milli;
299 case 1: return LDKSiPrefix_Micro;
300 case 2: return LDKSiPrefix_Nano;
301 case 3: return LDKSiPrefix_Pico;
305 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
307 case LDKSiPrefix_Milli: return 0;
308 case LDKSiPrefix_Micro: return 1;
309 case LDKSiPrefix_Nano: return 2;
310 case LDKSiPrefix_Pico: return 3;
314 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
315 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
316 ret->datalen = *((uint32_t*)elems);
317 if (ret->datalen == 0) {
320 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
321 int8_t *java_elems = (int8_t*)(elems + 4);
322 for (size_t i = 0; i < ret->datalen; i++) {
323 ret->data[i] = java_elems[i];
326 return (uint64_t)ret;
328 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
329 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
330 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
333 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) {
334 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
335 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
336 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
337 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
338 CVec_u8Z_free(ret_var);
342 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
343 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
344 int64_t ret_val = TxOut_get_value(thing_conv);
348 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
349 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
351 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
352 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
353 CHECK(val->result_ok);
354 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
355 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
358 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
359 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
360 CHECK(!val->result_ok);
361 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
364 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
365 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
367 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
368 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
369 CHECK(val->result_ok);
370 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
371 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
374 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
375 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
376 CHECK(!val->result_ok);
377 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
380 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
381 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
383 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
384 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
385 CHECK(val->result_ok);
386 LDKTxCreationKeys res_var = (*val->contents.result);
387 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
388 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
389 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
393 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
394 CHECK(!val->result_ok);
395 LDKDecodeError err_var = (*val->contents.err);
396 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
397 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
398 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
401 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
402 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
404 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
405 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
406 CHECK(val->result_ok);
407 LDKChannelPublicKeys res_var = (*val->contents.result);
408 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
409 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
410 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
413 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
414 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
415 CHECK(!val->result_ok);
416 LDKDecodeError err_var = (*val->contents.err);
417 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
418 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
419 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
422 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
423 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
425 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
426 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
427 CHECK(val->result_ok);
428 LDKTxCreationKeys res_var = (*val->contents.result);
429 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
430 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
431 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
434 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
435 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
436 CHECK(!val->result_ok);
437 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
440 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
441 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
443 case LDKCOption_u32Z_Some: {
444 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
446 case LDKCOption_u32Z_None: {
447 return 0 /* LDKCOption_u32Z - None */;
452 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
453 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
455 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
456 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
457 CHECK(val->result_ok);
458 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
459 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
460 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
461 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
464 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
465 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
466 CHECK(!val->result_ok);
467 LDKDecodeError err_var = (*val->contents.err);
468 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
469 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
470 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
473 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
474 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
476 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
477 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
478 CHECK(val->result_ok);
479 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
480 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
481 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
482 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
485 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
486 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
487 CHECK(!val->result_ok);
488 LDKDecodeError err_var = (*val->contents.err);
489 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
490 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
491 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
494 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
495 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
497 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
498 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
499 CHECK(val->result_ok);
500 LDKChannelTransactionParameters res_var = (*val->contents.result);
501 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
502 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
503 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
506 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
507 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
508 CHECK(!val->result_ok);
509 LDKDecodeError err_var = (*val->contents.err);
510 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
511 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
512 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
515 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
516 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
518 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
519 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
520 CHECK(val->result_ok);
521 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
522 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
523 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
524 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
527 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
528 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
529 CHECK(!val->result_ok);
530 LDKDecodeError err_var = (*val->contents.err);
531 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
532 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
533 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
536 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
537 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
539 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
540 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
541 CHECK(val->result_ok);
542 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
543 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
544 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
545 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
548 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
549 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
550 CHECK(!val->result_ok);
551 LDKDecodeError err_var = (*val->contents.err);
552 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
553 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
554 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
557 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
558 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
560 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
561 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
562 CHECK(val->result_ok);
563 LDKTrustedClosingTransaction res_var = (*val->contents.result);
564 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
565 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
566 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
569 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
570 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
571 CHECK(!val->result_ok);
572 return *val->contents.err;
574 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
575 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
577 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
578 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
579 CHECK(val->result_ok);
580 LDKCommitmentTransaction res_var = (*val->contents.result);
581 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 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
587 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
588 CHECK(!val->result_ok);
589 LDKDecodeError err_var = (*val->contents.err);
590 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
591 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
592 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
595 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
596 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
598 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
599 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
600 CHECK(val->result_ok);
601 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
602 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
603 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
604 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
607 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
608 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
609 CHECK(!val->result_ok);
610 return *val->contents.err;
612 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
613 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
615 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
616 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
617 CHECK(val->result_ok);
618 LDKCVec_SignatureZ res_var = (*val->contents.result);
619 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
620 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
621 for (size_t m = 0; m < res_var.datalen; m++) {
622 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
623 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
624 res_arr_ptr[m] = res_conv_12_arr;
628 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
629 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
630 CHECK(!val->result_ok);
631 return *val->contents.err;
633 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
634 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
636 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
637 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
638 CHECK(val->result_ok);
639 LDKShutdownScript res_var = (*val->contents.result);
640 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
641 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
642 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
645 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
646 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
647 CHECK(!val->result_ok);
648 LDKDecodeError err_var = (*val->contents.err);
649 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
650 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
651 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
654 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
655 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
657 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
658 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
659 CHECK(val->result_ok);
660 LDKShutdownScript res_var = (*val->contents.result);
661 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
662 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
663 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
666 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
667 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
668 CHECK(!val->result_ok);
669 LDKInvalidShutdownScript err_var = (*val->contents.err);
670 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
671 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
672 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
675 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
676 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
678 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
679 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
680 CHECK(val->result_ok);
681 return *val->contents.result;
683 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
684 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
685 CHECK(!val->result_ok);
686 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
689 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
690 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
693 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
694 CHECK(val->result_ok);
695 LDKRouteHop res_var = (*val->contents.result);
696 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
697 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
698 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
702 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
703 CHECK(!val->result_ok);
704 LDKDecodeError err_var = (*val->contents.err);
705 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
706 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
707 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
710 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
711 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
712 ret->datalen = *((uint32_t*)elems);
713 if (ret->datalen == 0) {
716 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
717 uint32_t *java_elems = (uint32_t*)(elems + 4);
718 for (size_t i = 0; i < ret->datalen; i++) {
719 uint32_t arr_elem = java_elems[i];
720 LDKRouteHop arr_elem_conv;
721 arr_elem_conv.inner = (void*)(arr_elem & (~1));
722 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
723 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
724 ret->data[i] = arr_elem_conv;
727 return (uint64_t)ret;
729 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
730 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
731 for (size_t i = 0; i < ret.datalen; i++) {
732 ret.data[i] = RouteHop_clone(&orig->data[i]);
736 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
737 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
738 for (size_t i = 0; i < ret.datalen; i++) {
739 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
743 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
744 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
746 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
747 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
748 CHECK(val->result_ok);
749 LDKRoute res_var = (*val->contents.result);
750 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
751 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
752 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
755 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
756 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
757 CHECK(!val->result_ok);
758 LDKDecodeError err_var = (*val->contents.err);
759 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
760 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
761 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
764 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
765 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
767 case LDKCOption_u64Z_Some: {
768 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
770 case LDKCOption_u64Z_None: {
771 return 0 /* LDKCOption_u64Z - None */;
776 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
777 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
778 ret->datalen = *((uint32_t*)elems);
779 if (ret->datalen == 0) {
782 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
783 uint32_t *java_elems = (uint32_t*)(elems + 4);
784 for (size_t i = 0; i < ret->datalen; i++) {
785 uint32_t arr_elem = java_elems[i];
786 LDKChannelDetails arr_elem_conv;
787 arr_elem_conv.inner = (void*)(arr_elem & (~1));
788 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
789 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
790 ret->data[i] = arr_elem_conv;
793 return (uint64_t)ret;
795 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
796 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
797 for (size_t i = 0; i < ret.datalen; i++) {
798 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
802 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
803 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
804 ret->datalen = *((uint32_t*)elems);
805 if (ret->datalen == 0) {
808 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
809 uint32_t *java_elems = (uint32_t*)(elems + 4);
810 for (size_t i = 0; i < ret->datalen; i++) {
811 uint32_t arr_elem = java_elems[i];
812 LDKRouteHint arr_elem_conv;
813 arr_elem_conv.inner = (void*)(arr_elem & (~1));
814 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
815 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
816 ret->data[i] = arr_elem_conv;
819 return (uint64_t)ret;
821 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
822 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
823 for (size_t i = 0; i < ret.datalen; i++) {
824 ret.data[i] = RouteHint_clone(&orig->data[i]);
828 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
829 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
831 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
832 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
833 CHECK(val->result_ok);
834 LDKRoute res_var = (*val->contents.result);
835 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
836 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
837 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
840 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
841 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
842 CHECK(!val->result_ok);
843 LDKLightningError err_var = (*val->contents.err);
844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
846 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
849 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
850 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
852 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
853 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
854 CHECK(val->result_ok);
855 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
856 return (uint64_t)res_ref;
858 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
859 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
860 CHECK(!val->result_ok);
861 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
864 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
865 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
867 LDKTransaction b_ref;
868 b_ref.datalen = *((uint32_t*)b);
869 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
870 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
871 b_ref.data_is_owned = false;
873 return (uint64_t)ret;
875 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
876 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
879 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
880 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
881 LDKTransaction b_var = tuple->b;
882 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
883 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
886 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
887 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
888 ret->datalen = *((uint32_t*)elems);
889 if (ret->datalen == 0) {
892 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
893 uint32_t *java_elems = (uint32_t*)(elems + 4);
894 for (size_t i = 0; i < ret->datalen; i++) {
895 uint32_t arr_elem = java_elems[i];
896 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
897 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
898 ret->data[i] = arr_elem_conv;
901 return (uint64_t)ret;
903 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
904 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
905 for (size_t i = 0; i < ret.datalen; i++) {
906 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
910 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
911 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
912 for (size_t i = 0; i < ret.datalen; i++) {
913 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
917 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
918 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
920 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
921 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
922 CHECK(val->result_ok);
923 return *val->contents.result;
925 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
926 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
927 CHECK(!val->result_ok);
928 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
931 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
932 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
934 case LDKMonitorEvent_HTLCEvent: {
935 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
936 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
939 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
941 case LDKMonitorEvent_CommitmentTxConfirmed: {
942 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
943 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
946 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
951 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
952 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
953 ret->datalen = *((uint32_t*)elems);
954 if (ret->datalen == 0) {
957 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
958 uint32_t *java_elems = (uint32_t*)(elems + 4);
959 for (size_t i = 0; i < ret->datalen; i++) {
960 uint32_t arr_elem = java_elems[i];
961 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
962 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
963 ret->data[i] = arr_elem_conv;
966 return (uint64_t)ret;
968 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
969 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
970 for (size_t i = 0; i < ret.datalen; i++) {
971 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
975 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
976 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
978 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
979 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
980 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
982 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
983 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
988 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
989 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
991 case LDKNetworkUpdate_ChannelUpdateMessage: {
992 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
993 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
994 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
995 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
996 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
998 case LDKNetworkUpdate_ChannelClosed: {
999 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1001 case LDKNetworkUpdate_NodeFailure: {
1002 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1003 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1004 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1009 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1010 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1012 case LDKCOption_NetworkUpdateZ_Some: {
1013 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1014 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1016 case LDKCOption_NetworkUpdateZ_None: {
1017 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1022 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1023 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1025 case LDKSpendableOutputDescriptor_StaticOutput: {
1026 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1027 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1028 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1029 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1030 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1031 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1033 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1034 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1035 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1036 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1037 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1038 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1040 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1041 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1042 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1043 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1044 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1045 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1050 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1051 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1052 ret->datalen = *((uint32_t*)elems);
1053 if (ret->datalen == 0) {
1056 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1057 uint32_t *java_elems = (uint32_t*)(elems + 4);
1058 for (size_t i = 0; i < ret->datalen; i++) {
1059 uint32_t arr_elem = java_elems[i];
1060 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1061 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1062 ret->data[i] = arr_elem_conv;
1065 return (uint64_t)ret;
1067 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1068 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1069 for (size_t i = 0; i < ret.datalen; i++) {
1070 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1074 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1075 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1077 case LDKErrorAction_DisconnectPeer: {
1078 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1079 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1080 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1081 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1082 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1084 case LDKErrorAction_IgnoreError: {
1085 return 0 /* LDKErrorAction - IgnoreError */;
1087 case LDKErrorAction_IgnoreAndLog: {
1088 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1089 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1091 case LDKErrorAction_SendErrorMessage: {
1092 LDKErrorMessage msg_var = obj->send_error_message.msg;
1093 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1094 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1095 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1096 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1101 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1102 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1104 case LDKMessageSendEvent_SendAcceptChannel: {
1105 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1106 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1107 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1108 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1111 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1113 case LDKMessageSendEvent_SendOpenChannel: {
1114 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1115 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1116 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1117 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1118 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1119 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1120 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1122 case LDKMessageSendEvent_SendFundingCreated: {
1123 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1124 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1125 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1126 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1129 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1131 case LDKMessageSendEvent_SendFundingSigned: {
1132 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1133 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1134 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1135 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1136 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1137 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1138 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1140 case LDKMessageSendEvent_SendFundingLocked: {
1141 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1142 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1143 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1144 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1147 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1149 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1150 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1151 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1152 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1153 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1154 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1155 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1156 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1158 case LDKMessageSendEvent_UpdateHTLCs: {
1159 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1160 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1161 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1162 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1164 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1165 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1167 case LDKMessageSendEvent_SendRevokeAndACK: {
1168 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1169 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1170 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1171 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1172 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1173 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1174 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1176 case LDKMessageSendEvent_SendClosingSigned: {
1177 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1178 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1179 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1180 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1182 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1183 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1185 case LDKMessageSendEvent_SendShutdown: {
1186 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1187 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1188 LDKShutdown msg_var = obj->send_shutdown.msg;
1189 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1190 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1191 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1192 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1194 case LDKMessageSendEvent_SendChannelReestablish: {
1195 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1196 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1197 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1198 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1199 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1200 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1201 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1203 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1204 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1205 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1206 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1207 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1208 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1209 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1210 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1211 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1212 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1214 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1215 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1216 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1219 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1221 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1222 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1223 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1224 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1226 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1228 case LDKMessageSendEvent_SendChannelUpdate: {
1229 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1230 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1231 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1232 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1233 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1234 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1235 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1237 case LDKMessageSendEvent_HandleError: {
1238 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1239 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1240 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1241 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1243 case LDKMessageSendEvent_SendChannelRangeQuery: {
1244 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1245 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1246 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1247 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1248 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1249 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1250 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1252 case LDKMessageSendEvent_SendShortIdsQuery: {
1253 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1254 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1255 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1256 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1257 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1258 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1259 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1261 case LDKMessageSendEvent_SendReplyChannelRange: {
1262 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1263 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1264 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1265 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1266 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1267 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1268 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1273 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1274 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1275 ret->datalen = *((uint32_t*)elems);
1276 if (ret->datalen == 0) {
1279 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1280 uint32_t *java_elems = (uint32_t*)(elems + 4);
1281 for (size_t i = 0; i < ret->datalen; i++) {
1282 uint32_t arr_elem = java_elems[i];
1283 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1284 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1285 ret->data[i] = arr_elem_conv;
1288 return (uint64_t)ret;
1290 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1291 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1292 for (size_t i = 0; i < ret.datalen; i++) {
1293 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1297 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1298 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1301 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1302 CHECK(val->result_ok);
1303 LDKInitFeatures res_var = (*val->contents.result);
1304 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1305 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1306 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1309 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1310 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1311 CHECK(!val->result_ok);
1312 LDKDecodeError err_var = (*val->contents.err);
1313 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1314 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1315 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1318 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1319 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1321 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1322 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1323 CHECK(val->result_ok);
1324 LDKNodeFeatures res_var = (*val->contents.result);
1325 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1327 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1330 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1331 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1332 CHECK(!val->result_ok);
1333 LDKDecodeError err_var = (*val->contents.err);
1334 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1335 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1336 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1339 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1340 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1342 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1343 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1344 CHECK(val->result_ok);
1345 LDKChannelFeatures res_var = (*val->contents.result);
1346 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1347 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1348 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1351 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1352 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1353 CHECK(!val->result_ok);
1354 LDKDecodeError err_var = (*val->contents.err);
1355 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1356 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1357 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1360 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1361 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1364 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1365 CHECK(val->result_ok);
1366 LDKInvoiceFeatures res_var = (*val->contents.result);
1367 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1368 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1369 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1373 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1374 CHECK(!val->result_ok);
1375 LDKDecodeError err_var = (*val->contents.err);
1376 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1377 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1378 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1381 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1382 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1385 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1386 CHECK(val->result_ok);
1387 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1388 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1389 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1390 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1393 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1394 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1395 CHECK(!val->result_ok);
1396 LDKDecodeError err_var = (*val->contents.err);
1397 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1398 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1399 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1402 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1403 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1405 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1406 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1407 CHECK(val->result_ok);
1408 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1409 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1410 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1411 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1414 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1415 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1416 CHECK(!val->result_ok);
1417 LDKDecodeError err_var = (*val->contents.err);
1418 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1419 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1420 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1423 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1424 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1426 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1427 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1428 CHECK(val->result_ok);
1429 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1433 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1434 CHECK(!val->result_ok);
1435 LDKDecodeError err_var = (*val->contents.err);
1436 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1437 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1438 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1441 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1442 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1444 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1445 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1446 CHECK(val->result_ok);
1447 return *val->contents.result;
1449 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1450 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1451 CHECK(!val->result_ok);
1452 return *val->contents.err;
1454 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1455 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1457 CHECK(*((uint32_t*)a) == 64);
1458 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1460 LDKCVec_SignatureZ b_constr;
1461 b_constr.datalen = *((uint32_t*)b);
1462 if (b_constr.datalen > 0)
1463 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1465 b_constr.data = NULL;
1466 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1467 for (size_t m = 0; m < b_constr.datalen; m++) {
1468 int8_tArray b_conv_12 = b_vals[m];
1469 LDKSignature b_conv_12_ref;
1470 CHECK(*((uint32_t*)b_conv_12) == 64);
1471 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1472 b_constr.data[m] = b_conv_12_ref;
1475 return (uint64_t)ret;
1477 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1478 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1479 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1480 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1483 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1484 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1485 LDKCVec_SignatureZ b_var = tuple->b;
1486 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1487 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1488 for (size_t m = 0; m < b_var.datalen; m++) {
1489 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1490 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1491 b_arr_ptr[m] = b_conv_12_arr;
1495 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1496 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1498 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1499 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1500 CHECK(val->result_ok);
1501 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
1504 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1505 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1506 CHECK(!val->result_ok);
1507 return *val->contents.err;
1509 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1510 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1512 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1513 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1514 CHECK(val->result_ok);
1515 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1516 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1519 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1520 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1521 CHECK(!val->result_ok);
1522 return *val->contents.err;
1524 typedef struct LDKBaseSign_JCalls {
1525 atomic_size_t refcnt;
1526 uint32_t get_per_commitment_point_meth;
1527 uint32_t release_commitment_secret_meth;
1528 uint32_t validate_holder_commitment_meth;
1529 uint32_t channel_keys_id_meth;
1530 uint32_t sign_counterparty_commitment_meth;
1531 uint32_t validate_counterparty_revocation_meth;
1532 uint32_t sign_holder_commitment_and_htlcs_meth;
1533 uint32_t sign_justice_revoked_output_meth;
1534 uint32_t sign_justice_revoked_htlc_meth;
1535 uint32_t sign_counterparty_htlc_transaction_meth;
1536 uint32_t sign_closing_transaction_meth;
1537 uint32_t sign_channel_announcement_meth;
1538 uint32_t ready_channel_meth;
1539 } LDKBaseSign_JCalls;
1540 static void LDKBaseSign_JCalls_free(void* this_arg) {
1541 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1542 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1543 js_free(j_calls->get_per_commitment_point_meth);
1544 js_free(j_calls->release_commitment_secret_meth);
1545 js_free(j_calls->validate_holder_commitment_meth);
1546 js_free(j_calls->channel_keys_id_meth);
1547 js_free(j_calls->sign_counterparty_commitment_meth);
1548 js_free(j_calls->validate_counterparty_revocation_meth);
1549 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1550 js_free(j_calls->sign_justice_revoked_output_meth);
1551 js_free(j_calls->sign_justice_revoked_htlc_meth);
1552 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1553 js_free(j_calls->sign_closing_transaction_meth);
1554 js_free(j_calls->sign_channel_announcement_meth);
1555 js_free(j_calls->ready_channel_meth);
1559 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1560 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1561 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1562 LDKPublicKey ret_ref;
1563 CHECK(*((uint32_t*)ret) == 33);
1564 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1567 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1568 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1569 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1570 LDKThirtyTwoBytes ret_ref;
1571 CHECK(*((uint32_t*)ret) == 32);
1572 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1575 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1576 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1577 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1578 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1579 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1580 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1581 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
1582 if (holder_tx_var.is_owned) {
1585 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1586 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1587 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1590 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1591 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1592 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1593 LDKThirtyTwoBytes ret_ref;
1594 CHECK(*((uint32_t*)ret) == 32);
1595 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1598 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1599 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1600 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1601 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1602 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1603 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1604 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1605 if (commitment_tx_var.is_owned) {
1606 commitment_tx_ref |= 1;
1608 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1609 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1610 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1613 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1614 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1615 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1616 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1617 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1618 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1619 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1622 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1623 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1624 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1625 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1626 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1627 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1628 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1629 if (commitment_tx_var.is_owned) {
1630 commitment_tx_ref |= 1;
1632 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1633 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1634 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1637 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]) {
1638 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1639 LDKTransaction justice_tx_var = justice_tx;
1640 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1641 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1642 Transaction_free(justice_tx_var);
1643 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1644 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1645 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1646 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1647 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1650 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) {
1651 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1652 LDKTransaction justice_tx_var = justice_tx;
1653 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1654 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1655 Transaction_free(justice_tx_var);
1656 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1657 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1658 LDKHTLCOutputInCommitment htlc_var = *htlc;
1659 htlc_var = HTLCOutputInCommitment_clone(htlc);
1660 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1661 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1662 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1663 if (htlc_var.is_owned) {
1666 uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1667 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1668 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1671 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) {
1672 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1673 LDKTransaction htlc_tx_var = htlc_tx;
1674 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1675 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1676 Transaction_free(htlc_tx_var);
1677 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1678 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1679 LDKHTLCOutputInCommitment htlc_var = *htlc;
1680 htlc_var = HTLCOutputInCommitment_clone(htlc);
1681 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1682 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1683 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1684 if (htlc_var.is_owned) {
1687 uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1688 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1689 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1692 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1693 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1694 LDKClosingTransaction closing_tx_var = *closing_tx;
1695 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
1696 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1697 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1698 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
1699 if (closing_tx_var.is_owned) {
1700 closing_tx_ref |= 1;
1702 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1703 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1704 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1707 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1708 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1709 LDKUnsignedChannelAnnouncement msg_var = *msg;
1710 msg_var = UnsignedChannelAnnouncement_clone(msg);
1711 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1712 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1713 uint64_t msg_ref = (uint64_t)msg_var.inner;
1714 if (msg_var.is_owned) {
1717 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1718 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1719 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1722 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1723 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1724 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1725 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1726 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1727 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1728 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1729 if (channel_parameters_var.is_owned) {
1730 channel_parameters_ref |= 1;
1732 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1734 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1735 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1736 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1738 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1739 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1740 atomic_init(&calls->refcnt, 1);
1741 //TODO: Assign calls->o from o
1743 LDKChannelPublicKeys pubkeys_conv;
1744 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1745 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1746 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1749 .this_arg = (void*) calls,
1750 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1751 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1752 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1753 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1754 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1755 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1756 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1757 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1758 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1759 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1760 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1761 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1762 .ready_channel = ready_channel_LDKBaseSign_jcall,
1763 .free = LDKBaseSign_JCalls_free,
1764 .pubkeys = pubkeys_conv,
1765 .set_pubkeys = NULL,
1769 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1770 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1771 *res_ptr = LDKBaseSign_init(o, pubkeys);
1772 return (long)res_ptr;
1774 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1775 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1776 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1777 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1781 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1782 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1783 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1784 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1788 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1789 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1790 LDKHolderCommitmentTransaction holder_tx_conv;
1791 holder_tx_conv.inner = (void*)(holder_tx & (~1));
1792 holder_tx_conv.is_owned = false;
1793 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1794 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
1795 return (uint64_t)ret_conv;
1798 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1799 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1800 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1801 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1805 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1806 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1807 LDKCommitmentTransaction commitment_tx_conv;
1808 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1809 commitment_tx_conv.is_owned = false;
1810 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1811 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1812 return (uint64_t)ret_conv;
1815 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
1816 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1817 unsigned char secret_arr[32];
1818 CHECK(*((uint32_t*)secret) == 32);
1819 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
1820 unsigned char (*secret_ref)[32] = &secret_arr;
1821 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1822 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1823 return (uint64_t)ret_conv;
1826 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1827 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1828 LDKHolderCommitmentTransaction commitment_tx_conv;
1829 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1830 commitment_tx_conv.is_owned = false;
1831 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1832 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1833 return (uint64_t)ret_conv;
1836 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) {
1837 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1838 LDKTransaction justice_tx_ref;
1839 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1840 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1841 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1842 justice_tx_ref.data_is_owned = true;
1843 unsigned char per_commitment_key_arr[32];
1844 CHECK(*((uint32_t*)per_commitment_key) == 32);
1845 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1846 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1847 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1848 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1849 return (uint64_t)ret_conv;
1852 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) {
1853 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1854 LDKTransaction justice_tx_ref;
1855 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1856 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1857 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1858 justice_tx_ref.data_is_owned = true;
1859 unsigned char per_commitment_key_arr[32];
1860 CHECK(*((uint32_t*)per_commitment_key) == 32);
1861 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1862 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1863 LDKHTLCOutputInCommitment htlc_conv;
1864 htlc_conv.inner = (void*)(htlc & (~1));
1865 htlc_conv.is_owned = false;
1866 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1867 *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);
1868 return (uint64_t)ret_conv;
1871 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) {
1872 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1873 LDKTransaction htlc_tx_ref;
1874 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1875 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1876 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1877 htlc_tx_ref.data_is_owned = true;
1878 LDKPublicKey per_commitment_point_ref;
1879 CHECK(*((uint32_t*)per_commitment_point) == 33);
1880 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1881 LDKHTLCOutputInCommitment htlc_conv;
1882 htlc_conv.inner = (void*)(htlc & (~1));
1883 htlc_conv.is_owned = false;
1884 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1885 *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);
1886 return (uint64_t)ret_conv;
1889 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
1890 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1891 LDKClosingTransaction closing_tx_conv;
1892 closing_tx_conv.inner = (void*)(closing_tx & (~1));
1893 closing_tx_conv.is_owned = false;
1894 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1895 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1896 return (uint64_t)ret_conv;
1899 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1900 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1901 LDKUnsignedChannelAnnouncement msg_conv;
1902 msg_conv.inner = (void*)(msg & (~1));
1903 msg_conv.is_owned = false;
1904 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1905 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1906 return (uint64_t)ret_conv;
1909 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1910 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1911 LDKChannelTransactionParameters channel_parameters_conv;
1912 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1913 channel_parameters_conv.is_owned = false;
1914 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1917 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1918 if (this_arg->set_pubkeys != NULL)
1919 this_arg->set_pubkeys(this_arg);
1920 return this_arg->pubkeys;
1922 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1923 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1924 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1927 uint64_t ret_ref = (uint64_t)ret_var.inner;
1928 if (ret_var.is_owned) {
1934 typedef struct LDKSign_JCalls {
1935 atomic_size_t refcnt;
1936 LDKBaseSign_JCalls* BaseSign;
1937 uint32_t write_meth;
1939 static void LDKSign_JCalls_free(void* this_arg) {
1940 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1941 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1942 js_free(j_calls->write_meth);
1946 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1947 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1948 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1949 LDKCVec_u8Z ret_ref;
1950 ret_ref.datalen = *((uint32_t*)ret);
1951 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1952 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1955 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1956 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1957 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1958 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1960 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1961 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1962 atomic_init(&calls->refcnt, 1);
1963 //TODO: Assign calls->o from o
1965 LDKChannelPublicKeys pubkeys_conv;
1966 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1967 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1968 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1971 .this_arg = (void*) calls,
1972 .write = write_LDKSign_jcall,
1973 .cloned = LDKSign_JCalls_cloned,
1974 .free = LDKSign_JCalls_free,
1975 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1977 calls->BaseSign = ret.BaseSign.this_arg;
1980 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1981 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1982 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1983 return (long)res_ptr;
1985 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1986 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1987 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1988 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1989 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1990 CVec_u8Z_free(ret_var);
1994 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
1995 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
1997 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
1998 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1999 CHECK(val->result_ok);
2000 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2001 *res_ret = Sign_clone(&(*val->contents.result));
2002 return (uint64_t)res_ret;
2004 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2005 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2006 CHECK(!val->result_ok);
2007 LDKDecodeError err_var = (*val->contents.err);
2008 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2009 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2010 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2013 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2014 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2016 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2017 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2018 CHECK(val->result_ok);
2019 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2020 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2023 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2024 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2025 CHECK(!val->result_ok);
2026 return *val->contents.err;
2028 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2029 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2030 for (size_t i = 0; i < ret.datalen; i++) {
2031 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2035 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2036 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2038 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2039 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2040 CHECK(val->result_ok);
2041 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2042 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2043 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2044 for (size_t m = 0; m < res_var.datalen; m++) {
2045 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2046 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2047 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2048 res_arr_ptr[m] = res_conv_12_arr;
2052 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2053 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2054 CHECK(!val->result_ok);
2055 return *val->contents.err;
2057 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2058 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2061 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2062 CHECK(val->result_ok);
2063 LDKInMemorySigner res_var = (*val->contents.result);
2064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2070 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2071 CHECK(!val->result_ok);
2072 LDKDecodeError err_var = (*val->contents.err);
2073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2078 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2079 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2080 ret->datalen = *((uint32_t*)elems);
2081 if (ret->datalen == 0) {
2084 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2085 uint32_t *java_elems = (uint32_t*)(elems + 4);
2086 for (size_t i = 0; i < ret->datalen; i++) {
2087 uint32_t arr_elem = java_elems[i];
2088 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2089 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2090 ret->data[i] = arr_elem_conv;
2093 return (uint64_t)ret;
2095 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2096 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2097 for (size_t i = 0; i < ret.datalen; i++) {
2098 ret.data[i] = TxOut_clone(&orig->data[i]);
2102 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2103 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2105 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2106 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2107 CHECK(val->result_ok);
2108 LDKTransaction res_var = (*val->contents.result);
2109 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2110 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2113 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2114 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2115 CHECK(!val->result_ok);
2116 return *val->contents.err;
2118 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2119 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2120 LDKThirtyTwoBytes a_ref;
2121 CHECK(*((uint32_t*)a) == 32);
2122 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2124 LDKChannelMonitor b_conv;
2125 b_conv.inner = (void*)(b & (~1));
2126 b_conv.is_owned = (b & 1) || (b == 0);
2127 b_conv = ChannelMonitor_clone(&b_conv);
2129 return (uint64_t)ret;
2131 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2132 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2133 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2134 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2137 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2138 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2139 LDKChannelMonitor b_var = tuple->b;
2140 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2141 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2142 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2145 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2146 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2147 ret->datalen = *((uint32_t*)elems);
2148 if (ret->datalen == 0) {
2151 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2152 uint32_t *java_elems = (uint32_t*)(elems + 4);
2153 for (size_t i = 0; i < ret->datalen; i++) {
2154 uint32_t arr_elem = java_elems[i];
2155 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2156 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2157 ret->data[i] = arr_elem_conv;
2160 return (uint64_t)ret;
2162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2163 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2165 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2166 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2167 CHECK(val->result_ok);
2168 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2169 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2170 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2171 for (size_t m = 0; m < res_var.datalen; m++) {
2172 uint64_t res_conv_38_ref = (uint64_t)(&res_var.data[m]) | 1;
2173 res_arr_ptr[m] = res_conv_38_ref;
2177 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2178 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2179 CHECK(!val->result_ok);
2180 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2183 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2184 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2186 case LDKCOption_u16Z_Some: {
2187 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2189 case LDKCOption_u16Z_None: {
2190 return 0 /* LDKCOption_u16Z - None */;
2195 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2196 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2198 case LDKAPIError_APIMisuseError: {
2199 LDKStr err_str = obj->api_misuse_error.err;
2200 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2201 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2203 case LDKAPIError_FeeRateTooHigh: {
2204 LDKStr err_str = obj->fee_rate_too_high.err;
2205 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2206 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2208 case LDKAPIError_RouteError: {
2209 LDKStr err_str = obj->route_error.err;
2210 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2211 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2213 case LDKAPIError_ChannelUnavailable: {
2214 LDKStr err_str = obj->channel_unavailable.err;
2215 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2216 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2218 case LDKAPIError_MonitorUpdateFailed: {
2219 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2221 case LDKAPIError_IncompatibleShutdownScript: {
2222 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2223 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2224 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2225 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2226 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2231 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2232 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2234 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2235 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2236 CHECK(val->result_ok);
2237 return *val->contents.result;
2239 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2240 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2241 CHECK(!val->result_ok);
2242 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2245 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2246 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2247 ret->datalen = *((uint32_t*)elems);
2248 if (ret->datalen == 0) {
2251 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2252 uint32_t *java_elems = (uint32_t*)(elems + 4);
2253 for (size_t i = 0; i < ret->datalen; i++) {
2254 uint32_t arr_elem = java_elems[i];
2255 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2256 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2257 ret->data[i] = arr_elem_conv;
2260 return (uint64_t)ret;
2262 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2263 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2264 for (size_t i = 0; i < ret.datalen; i++) {
2265 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2269 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2270 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2271 ret->datalen = *((uint32_t*)elems);
2272 if (ret->datalen == 0) {
2275 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2276 uint32_t *java_elems = (uint32_t*)(elems + 4);
2277 for (size_t i = 0; i < ret->datalen; i++) {
2278 uint32_t arr_elem = java_elems[i];
2279 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2280 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2281 ret->data[i] = arr_elem_conv;
2284 return (uint64_t)ret;
2286 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2287 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2288 for (size_t i = 0; i < ret.datalen; i++) {
2289 ret.data[i] = APIError_clone(&orig->data[i]);
2293 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2294 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2296 case LDKPaymentSendFailure_ParameterError: {
2297 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2298 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2300 case LDKPaymentSendFailure_PathParameterError: {
2301 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2302 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2303 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2304 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2305 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2306 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2307 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2308 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2310 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2312 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2313 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2314 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2315 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2316 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2317 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2318 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2320 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2322 case LDKPaymentSendFailure_PartialFailure: {
2323 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2324 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2325 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2326 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2327 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2328 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2329 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2330 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2332 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2337 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2338 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2340 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2341 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2342 CHECK(val->result_ok);
2343 return *val->contents.result;
2345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2346 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2347 CHECK(!val->result_ok);
2348 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2351 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
2352 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
2354 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
2355 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2356 CHECK(val->result_ok);
2357 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2358 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
2362 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2363 CHECK(!val->result_ok);
2364 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2367 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2368 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2370 case LDKNetAddress_IPv4: {
2371 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2372 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2373 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2375 case LDKNetAddress_IPv6: {
2376 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2377 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2378 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2380 case LDKNetAddress_OnionV2: {
2381 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2382 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2383 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2385 case LDKNetAddress_OnionV3: {
2386 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2387 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2388 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2393 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2394 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2395 ret->datalen = *((uint32_t*)elems);
2396 if (ret->datalen == 0) {
2399 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2400 uint32_t *java_elems = (uint32_t*)(elems + 4);
2401 for (size_t i = 0; i < ret->datalen; i++) {
2402 uint32_t arr_elem = java_elems[i];
2403 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2404 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2405 ret->data[i] = arr_elem_conv;
2408 return (uint64_t)ret;
2410 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2411 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2412 for (size_t i = 0; i < ret.datalen; i++) {
2413 ret.data[i] = NetAddress_clone(&orig->data[i]);
2417 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2418 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2419 LDKThirtyTwoBytes a_ref;
2420 CHECK(*((uint32_t*)a) == 32);
2421 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2423 LDKThirtyTwoBytes b_ref;
2424 CHECK(*((uint32_t*)b) == 32);
2425 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2427 return (uint64_t)ret;
2429 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t ptr) {
2430 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2431 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2432 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2435 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t ptr) {
2436 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2437 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2438 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2441 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2442 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2444 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2445 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2446 CHECK(val->result_ok);
2447 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2448 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2451 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2452 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2453 CHECK(!val->result_ok);
2454 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2457 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2458 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2459 ret->datalen = *((uint32_t*)elems);
2460 if (ret->datalen == 0) {
2463 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2464 uint32_t *java_elems = (uint32_t*)(elems + 4);
2465 for (size_t i = 0; i < ret->datalen; i++) {
2466 uint32_t arr_elem = java_elems[i];
2467 LDKChannelMonitor arr_elem_conv;
2468 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2469 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2470 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2471 ret->data[i] = arr_elem_conv;
2474 return (uint64_t)ret;
2476 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2477 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2478 for (size_t i = 0; i < ret.datalen; i++) {
2479 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2483 typedef struct LDKWatch_JCalls {
2484 atomic_size_t refcnt;
2485 uint32_t watch_channel_meth;
2486 uint32_t update_channel_meth;
2487 uint32_t release_pending_monitor_events_meth;
2489 static void LDKWatch_JCalls_free(void* this_arg) {
2490 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2491 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2492 js_free(j_calls->watch_channel_meth);
2493 js_free(j_calls->update_channel_meth);
2494 js_free(j_calls->release_pending_monitor_events_meth);
2498 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2499 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2500 LDKOutPoint funding_txo_var = funding_txo;
2501 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2502 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2503 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2504 if (funding_txo_var.is_owned) {
2505 funding_txo_ref |= 1;
2507 LDKChannelMonitor monitor_var = monitor;
2508 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2509 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2510 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2511 if (monitor_var.is_owned) {
2514 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2515 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2516 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2519 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2520 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2521 LDKOutPoint funding_txo_var = funding_txo;
2522 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2523 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2524 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2525 if (funding_txo_var.is_owned) {
2526 funding_txo_ref |= 1;
2528 LDKChannelMonitorUpdate update_var = update;
2529 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2530 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2531 uint64_t update_ref = (uint64_t)update_var.inner;
2532 if (update_var.is_owned) {
2535 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2536 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2537 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2540 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2541 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2542 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2543 LDKCVec_MonitorEventZ ret_constr;
2544 ret_constr.datalen = *((uint32_t*)ret);
2545 if (ret_constr.datalen > 0)
2546 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2548 ret_constr.data = NULL;
2549 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2550 for (size_t o = 0; o < ret_constr.datalen; o++) {
2551 uint32_t ret_conv_14 = ret_vals[o];
2552 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2553 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2554 ret_constr.data[o] = ret_conv_14_conv;
2558 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2559 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2560 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2562 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2563 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2564 atomic_init(&calls->refcnt, 1);
2565 //TODO: Assign calls->o from o
2568 .this_arg = (void*) calls,
2569 .watch_channel = watch_channel_LDKWatch_jcall,
2570 .update_channel = update_channel_LDKWatch_jcall,
2571 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2572 .free = LDKWatch_JCalls_free,
2576 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2577 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2578 *res_ptr = LDKWatch_init(o);
2579 return (long)res_ptr;
2581 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2582 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2583 LDKOutPoint funding_txo_conv;
2584 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2585 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2586 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2587 LDKChannelMonitor monitor_conv;
2588 monitor_conv.inner = (void*)(monitor & (~1));
2589 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2590 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2591 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2592 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2593 return (uint64_t)ret_conv;
2596 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2597 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2598 LDKOutPoint funding_txo_conv;
2599 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2600 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2601 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2602 LDKChannelMonitorUpdate update_conv;
2603 update_conv.inner = (void*)(update & (~1));
2604 update_conv.is_owned = (update & 1) || (update == 0);
2605 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2606 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2607 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2608 return (uint64_t)ret_conv;
2611 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2612 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2613 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2614 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2615 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2616 for (size_t o = 0; o < ret_var.datalen; o++) {
2617 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2618 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2619 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2620 ret_arr_ptr[o] = ret_conv_14_ref;
2626 typedef struct LDKBroadcasterInterface_JCalls {
2627 atomic_size_t refcnt;
2628 uint32_t broadcast_transaction_meth;
2629 } LDKBroadcasterInterface_JCalls;
2630 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2631 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2633 js_free(j_calls->broadcast_transaction_meth);
2637 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2638 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2639 LDKTransaction tx_var = tx;
2640 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2641 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2642 Transaction_free(tx_var);
2643 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2645 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2646 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2647 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2649 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2650 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2651 atomic_init(&calls->refcnt, 1);
2652 //TODO: Assign calls->o from o
2654 LDKBroadcasterInterface ret = {
2655 .this_arg = (void*) calls,
2656 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2657 .free = LDKBroadcasterInterface_JCalls_free,
2661 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2662 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2663 *res_ptr = LDKBroadcasterInterface_init(o);
2664 return (long)res_ptr;
2666 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2667 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2668 LDKTransaction tx_ref;
2669 tx_ref.datalen = *((uint32_t*)tx);
2670 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2671 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2672 tx_ref.data_is_owned = true;
2673 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2676 typedef struct LDKKeysInterface_JCalls {
2677 atomic_size_t refcnt;
2678 uint32_t get_node_secret_meth;
2679 uint32_t get_destination_script_meth;
2680 uint32_t get_shutdown_scriptpubkey_meth;
2681 uint32_t get_channel_signer_meth;
2682 uint32_t get_secure_random_bytes_meth;
2683 uint32_t read_chan_signer_meth;
2684 uint32_t sign_invoice_meth;
2685 } LDKKeysInterface_JCalls;
2686 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2687 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2688 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2689 js_free(j_calls->get_node_secret_meth);
2690 js_free(j_calls->get_destination_script_meth);
2691 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2692 js_free(j_calls->get_channel_signer_meth);
2693 js_free(j_calls->get_secure_random_bytes_meth);
2694 js_free(j_calls->read_chan_signer_meth);
2695 js_free(j_calls->sign_invoice_meth);
2699 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2700 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2701 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2702 LDKSecretKey ret_ref;
2703 CHECK(*((uint32_t*)ret) == 32);
2704 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2707 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2708 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2709 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2710 LDKCVec_u8Z ret_ref;
2711 ret_ref.datalen = *((uint32_t*)ret);
2712 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2713 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2716 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2717 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2718 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2719 LDKShutdownScript ret_conv;
2720 ret_conv.inner = (void*)(ret & (~1));
2721 ret_conv.is_owned = (ret & 1) || (ret == 0);
2722 ret_conv = ShutdownScript_clone(&ret_conv);
2725 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2726 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2727 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2728 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2729 ret_conv = Sign_clone(&ret_conv);
2732 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2733 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2734 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2735 LDKThirtyTwoBytes ret_ref;
2736 CHECK(*((uint32_t*)ret) == 32);
2737 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2740 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2741 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2742 LDKu8slice reader_var = reader;
2743 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2744 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2745 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2746 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2747 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2750 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2751 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2752 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2753 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2754 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2755 CVec_u8Z_free(invoice_preimage_var);
2756 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2757 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2758 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2761 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2762 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2763 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2765 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2766 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2767 atomic_init(&calls->refcnt, 1);
2768 //TODO: Assign calls->o from o
2770 LDKKeysInterface ret = {
2771 .this_arg = (void*) calls,
2772 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2773 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2774 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2775 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2776 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2777 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2778 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2779 .free = LDKKeysInterface_JCalls_free,
2783 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2784 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2785 *res_ptr = LDKKeysInterface_init(o);
2786 return (long)res_ptr;
2788 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2789 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2790 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2791 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2795 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2796 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2797 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2798 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2799 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2800 CVec_u8Z_free(ret_var);
2804 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2805 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2806 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2809 uint64_t ret_ref = (uint64_t)ret_var.inner;
2810 if (ret_var.is_owned) {
2816 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2817 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2818 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2819 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2820 return (uint64_t)ret_ret;
2823 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2824 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2825 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2826 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2830 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2831 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2832 LDKu8slice reader_ref;
2833 reader_ref.datalen = *((uint32_t*)reader);
2834 reader_ref.data = (int8_t*)(reader + 4);
2835 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2836 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2837 return (uint64_t)ret_conv;
2840 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2841 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2842 LDKCVec_u8Z invoice_preimage_ref;
2843 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2844 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2845 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2846 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2847 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2848 return (uint64_t)ret_conv;
2851 typedef struct LDKFeeEstimator_JCalls {
2852 atomic_size_t refcnt;
2853 uint32_t get_est_sat_per_1000_weight_meth;
2854 } LDKFeeEstimator_JCalls;
2855 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2856 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2857 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2858 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2862 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2863 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2864 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2865 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2867 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2868 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2869 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2871 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2872 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2873 atomic_init(&calls->refcnt, 1);
2874 //TODO: Assign calls->o from o
2876 LDKFeeEstimator ret = {
2877 .this_arg = (void*) calls,
2878 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2879 .free = LDKFeeEstimator_JCalls_free,
2883 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2884 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2885 *res_ptr = LDKFeeEstimator_init(o);
2886 return (long)res_ptr;
2888 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2889 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2890 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2891 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2895 typedef struct LDKLogger_JCalls {
2896 atomic_size_t refcnt;
2899 static void LDKLogger_JCalls_free(void* this_arg) {
2900 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2901 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2902 js_free(j_calls->log_meth);
2906 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2907 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2908 const char* record_str = record;
2909 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2910 js_invoke_function_1(j_calls->log_meth, record_conv);
2912 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2913 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2914 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2916 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2917 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2918 atomic_init(&calls->refcnt, 1);
2919 //TODO: Assign calls->o from o
2922 .this_arg = (void*) calls,
2923 .log = log_LDKLogger_jcall,
2924 .free = LDKLogger_JCalls_free,
2928 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2929 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2930 *res_ptr = LDKLogger_init(o);
2931 return (long)res_ptr;
2933 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2934 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2935 LDKThirtyTwoBytes a_ref;
2936 CHECK(*((uint32_t*)a) == 32);
2937 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2939 LDKChannelManager b_conv;
2940 b_conv.inner = (void*)(b & (~1));
2941 b_conv.is_owned = (b & 1) || (b == 0);
2942 // Warning: we need a move here but no clone is available for LDKChannelManager
2944 return (uint64_t)ret;
2946 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2947 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2948 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2949 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2952 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2953 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2954 LDKChannelManager b_var = tuple->b;
2955 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2956 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2957 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2960 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2961 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2963 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2964 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2965 CHECK(val->result_ok);
2966 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2969 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2970 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2971 CHECK(!val->result_ok);
2972 LDKDecodeError err_var = (*val->contents.err);
2973 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2974 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2975 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2978 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
2979 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
2981 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
2982 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2983 CHECK(val->result_ok);
2984 LDKChannelConfig res_var = (*val->contents.result);
2985 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2986 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2987 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2990 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
2991 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2992 CHECK(!val->result_ok);
2993 LDKDecodeError err_var = (*val->contents.err);
2994 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2995 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2996 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2999 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3000 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3002 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3003 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3004 CHECK(val->result_ok);
3005 LDKOutPoint res_var = (*val->contents.result);
3006 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3011 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3012 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3013 CHECK(!val->result_ok);
3014 LDKDecodeError err_var = (*val->contents.err);
3015 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3016 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3017 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3020 typedef struct LDKType_JCalls {
3021 atomic_size_t refcnt;
3022 uint32_t type_id_meth;
3023 uint32_t debug_str_meth;
3024 uint32_t write_meth;
3026 static void LDKType_JCalls_free(void* this_arg) {
3027 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3028 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3029 js_free(j_calls->type_id_meth);
3030 js_free(j_calls->debug_str_meth);
3031 js_free(j_calls->write_meth);
3035 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3036 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3037 return js_invoke_function_0(j_calls->type_id_meth);
3039 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3040 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3041 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3042 LDKStr ret_conv = str_ref_to_owned_c(ret);
3045 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3046 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3047 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3048 LDKCVec_u8Z ret_ref;
3049 ret_ref.datalen = *((uint32_t*)ret);
3050 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3051 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3054 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3055 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3056 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3058 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3059 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3060 atomic_init(&calls->refcnt, 1);
3061 //TODO: Assign calls->o from o
3064 .this_arg = (void*) calls,
3065 .type_id = type_id_LDKType_jcall,
3066 .debug_str = debug_str_LDKType_jcall,
3067 .write = write_LDKType_jcall,
3068 .cloned = LDKType_JCalls_cloned,
3069 .free = LDKType_JCalls_free,
3073 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3074 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3075 *res_ptr = LDKType_init(o);
3076 return (long)res_ptr;
3078 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3079 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3080 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3084 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3085 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3086 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3087 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3092 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3093 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3094 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3095 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3096 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3097 CVec_u8Z_free(ret_var);
3101 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3102 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3104 case LDKCOption_TypeZ_Some: {
3105 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3106 *some_ret = Type_clone(&obj->some);
3107 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3109 case LDKCOption_TypeZ_None: {
3110 return 0 /* LDKCOption_TypeZ - None */;
3115 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3116 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3118 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3119 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3120 CHECK(val->result_ok);
3121 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3124 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3125 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3126 CHECK(!val->result_ok);
3127 LDKDecodeError err_var = (*val->contents.err);
3128 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3129 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3130 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3133 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3134 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3136 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3137 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3138 CHECK(val->result_ok);
3139 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3142 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3143 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3144 CHECK(!val->result_ok);
3145 return *val->contents.err;
3147 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3148 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3150 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3151 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3152 CHECK(val->result_ok);
3153 LDKInvoice res_var = (*val->contents.result);
3154 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3155 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3156 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3159 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3160 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3161 CHECK(!val->result_ok);
3162 return *val->contents.err;
3164 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3165 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3167 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3168 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3169 CHECK(val->result_ok);
3170 LDKSignedRawInvoice res_var = (*val->contents.result);
3171 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3172 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3173 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3176 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3177 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3178 CHECK(!val->result_ok);
3179 return *val->contents.err;
3181 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
3182 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
3183 LDKRawInvoice a_conv;
3184 a_conv.inner = (void*)(a & (~1));
3185 a_conv.is_owned = (a & 1) || (a == 0);
3186 a_conv = RawInvoice_clone(&a_conv);
3188 LDKThirtyTwoBytes b_ref;
3189 CHECK(*((uint32_t*)b) == 32);
3190 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
3192 LDKInvoiceSignature c_conv;
3193 c_conv.inner = (void*)(c & (~1));
3194 c_conv.is_owned = (c & 1) || (c == 0);
3195 c_conv = InvoiceSignature_clone(&c_conv);
3197 return (uint64_t)ret;
3199 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t ptr) {
3200 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3201 LDKRawInvoice a_var = tuple->a;
3202 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3203 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3204 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3207 int8_tArray __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t ptr) {
3208 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3209 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3210 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
3213 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t ptr) {
3214 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3215 LDKInvoiceSignature c_var = tuple->c;
3216 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3217 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3218 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3221 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3222 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3224 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3225 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3226 CHECK(val->result_ok);
3227 LDKPayeePubKey res_var = (*val->contents.result);
3228 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3229 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3230 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3233 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3234 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3235 CHECK(!val->result_ok);
3236 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3239 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3240 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3241 ret->datalen = *((uint32_t*)elems);
3242 if (ret->datalen == 0) {
3245 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3246 uint32_t *java_elems = (uint32_t*)(elems + 4);
3247 for (size_t i = 0; i < ret->datalen; i++) {
3248 uint32_t arr_elem = java_elems[i];
3249 LDKPrivateRoute arr_elem_conv;
3250 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3251 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3252 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3253 ret->data[i] = arr_elem_conv;
3256 return (uint64_t)ret;
3258 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3259 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3260 for (size_t i = 0; i < ret.datalen; i++) {
3261 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3265 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3266 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3268 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3269 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3270 CHECK(val->result_ok);
3271 LDKPositiveTimestamp res_var = (*val->contents.result);
3272 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3273 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3274 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3277 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3278 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3279 CHECK(!val->result_ok);
3280 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3283 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3284 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3286 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3287 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3288 CHECK(val->result_ok);
3289 return *val->contents.result;
3291 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3292 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3293 CHECK(!val->result_ok);
3294 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3297 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3298 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3301 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3302 CHECK(val->result_ok);
3303 LDKInvoice res_var = (*val->contents.result);
3304 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3305 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3306 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3309 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3310 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3311 CHECK(!val->result_ok);
3312 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3315 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3316 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3318 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3319 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3320 CHECK(val->result_ok);
3321 LDKDescription res_var = (*val->contents.result);
3322 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3323 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3324 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3327 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3328 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3329 CHECK(!val->result_ok);
3330 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3333 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3334 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3336 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3337 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3338 CHECK(val->result_ok);
3339 LDKExpiryTime res_var = (*val->contents.result);
3340 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3341 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3342 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3346 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3347 CHECK(!val->result_ok);
3348 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3351 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3352 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3355 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3356 CHECK(val->result_ok);
3357 LDKPrivateRoute res_var = (*val->contents.result);
3358 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3359 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3360 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3364 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3365 CHECK(!val->result_ok);
3366 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3369 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3370 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3372 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3373 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3374 CHECK(val->result_ok);
3375 LDKStr res_str = (*val->contents.result);
3376 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3379 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3380 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3381 CHECK(!val->result_ok);
3382 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3385 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3386 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3388 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3389 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3390 CHECK(val->result_ok);
3391 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3392 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3393 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3394 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3398 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3399 CHECK(!val->result_ok);
3400 LDKDecodeError err_var = (*val->contents.err);
3401 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3402 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3403 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3406 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3407 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3409 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3410 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3411 CHECK(val->result_ok);
3412 LDKHTLCUpdate res_var = (*val->contents.result);
3413 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3414 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3415 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3419 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3420 CHECK(!val->result_ok);
3421 LDKDecodeError err_var = (*val->contents.err);
3422 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3423 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3424 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3427 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3428 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3430 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3431 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3432 CHECK(val->result_ok);
3433 return *val->contents.result;
3435 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3436 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3437 CHECK(!val->result_ok);
3438 LDKMonitorUpdateError err_var = (*val->contents.err);
3439 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3440 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3441 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3444 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3445 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3447 a_conv.inner = (void*)(a & (~1));
3448 a_conv.is_owned = (a & 1) || (a == 0);
3449 a_conv = OutPoint_clone(&a_conv);
3452 b_ref.datalen = *((uint32_t*)b);
3453 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3454 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3456 return (uint64_t)ret;
3458 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
3459 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3460 LDKOutPoint a_var = tuple->a;
3461 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3462 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3463 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3466 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
3467 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3468 LDKCVec_u8Z b_var = tuple->b;
3469 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3470 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3473 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3474 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3477 b_ref.datalen = *((uint32_t*)b);
3478 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3479 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3481 return (uint64_t)ret;
3483 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
3484 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3487 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
3488 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3489 LDKCVec_u8Z b_var = tuple->b;
3490 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3491 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3494 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3495 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3496 ret->datalen = *((uint32_t*)elems);
3497 if (ret->datalen == 0) {
3500 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3501 uint32_t *java_elems = (uint32_t*)(elems + 4);
3502 for (size_t i = 0; i < ret->datalen; i++) {
3503 uint32_t arr_elem = java_elems[i];
3504 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3505 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3506 ret->data[i] = arr_elem_conv;
3509 return (uint64_t)ret;
3511 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3512 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3513 for (size_t i = 0; i < ret.datalen; i++) {
3514 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3518 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3519 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3520 LDKThirtyTwoBytes a_ref;
3521 CHECK(*((uint32_t*)a) == 32);
3522 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3524 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3525 b_constr.datalen = *((uint32_t*)b);
3526 if (b_constr.datalen > 0)
3527 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3529 b_constr.data = NULL;
3530 uint32_t* b_vals = (uint32_t*)(b + 4);
3531 for (size_t e = 0; e < b_constr.datalen; e++) {
3532 uint32_t b_conv_30 = b_vals[e];
3533 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
3534 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
3535 b_constr.data[e] = b_conv_30_conv;
3538 return (uint64_t)ret;
3540 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
3541 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3542 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3543 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3546 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
3547 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3548 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
3549 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3550 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3551 for (size_t e = 0; e < b_var.datalen; e++) {
3552 uint64_t b_conv_30_ref = (uint64_t)(&b_var.data[e]) | 1;
3553 b_arr_ptr[e] = b_conv_30_ref;
3557 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3558 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3559 ret->datalen = *((uint32_t*)elems);
3560 if (ret->datalen == 0) {
3563 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3564 uint32_t *java_elems = (uint32_t*)(elems + 4);
3565 for (size_t i = 0; i < ret->datalen; i++) {
3566 uint32_t arr_elem = java_elems[i];
3567 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3568 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3569 ret->data[i] = arr_elem_conv;
3572 return (uint64_t)ret;
3574 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3575 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 };
3576 for (size_t i = 0; i < ret.datalen; i++) {
3577 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3581 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3582 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3584 case LDKPaymentPurpose_InvoicePayment: {
3585 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3586 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3587 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3588 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3589 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3591 case LDKPaymentPurpose_SpontaneousPayment: {
3592 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3593 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3594 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3599 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3600 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3602 case LDKClosureReason_CounterpartyForceClosed: {
3603 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3604 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3605 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3607 case LDKClosureReason_HolderForceClosed: {
3608 return 0 /* LDKClosureReason - HolderForceClosed */;
3610 case LDKClosureReason_CooperativeClosure: {
3611 return 0 /* LDKClosureReason - CooperativeClosure */;
3613 case LDKClosureReason_CommitmentTxConfirmed: {
3614 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3616 case LDKClosureReason_ProcessingError: {
3617 LDKStr err_str = obj->processing_error.err;
3618 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3619 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3621 case LDKClosureReason_DisconnectedPeer: {
3622 return 0 /* LDKClosureReason - DisconnectedPeer */;
3624 case LDKClosureReason_OutdatedChannelManager: {
3625 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3630 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3631 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3633 case LDKEvent_FundingGenerationReady: {
3634 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3635 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3636 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3637 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3638 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3639 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;
3641 case LDKEvent_PaymentReceived: {
3642 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3643 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3644 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3645 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3647 case LDKEvent_PaymentSent: {
3648 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3649 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3650 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3652 case LDKEvent_PaymentPathFailed: {
3653 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3654 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3655 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3656 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3657 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3658 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3659 for (size_t k = 0; k < path_var.datalen; k++) {
3660 LDKRouteHop path_conv_10_var = path_var.data[k];
3661 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3662 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3663 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3664 path_arr_ptr[k] = path_conv_10_ref;
3666 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr;
3668 case LDKEvent_PendingHTLCsForwardable: {
3669 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3671 case LDKEvent_SpendableOutputs: {
3672 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3673 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3674 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3675 for (size_t b = 0; b < outputs_var.datalen; b++) {
3676 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3677 outputs_arr_ptr[b] = outputs_conv_27_ref;
3679 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3681 case LDKEvent_PaymentForwarded: {
3682 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3683 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3685 case LDKEvent_ChannelClosed: {
3686 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3687 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3688 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3689 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref;
3694 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3695 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3696 ret->datalen = *((uint32_t*)elems);
3697 if (ret->datalen == 0) {
3700 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3701 uint32_t *java_elems = (uint32_t*)(elems + 4);
3702 for (size_t i = 0; i < ret->datalen; i++) {
3703 uint32_t arr_elem = java_elems[i];
3704 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3705 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3706 ret->data[i] = arr_elem_conv;
3709 return (uint64_t)ret;
3711 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3712 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3713 for (size_t i = 0; i < ret.datalen; i++) {
3714 ret.data[i] = Event_clone(&orig->data[i]);
3718 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3719 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3721 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3722 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3724 return (uint64_t)ret;
3726 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
3727 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3730 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
3731 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3732 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
3733 return (uint64_t)b_ref;
3735 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3736 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3737 ret->datalen = *((uint32_t*)elems);
3738 if (ret->datalen == 0) {
3741 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3742 uint32_t *java_elems = (uint32_t*)(elems + 4);
3743 for (size_t i = 0; i < ret->datalen; i++) {
3744 uint32_t arr_elem = java_elems[i];
3745 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3746 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3747 ret->data[i] = arr_elem_conv;
3750 return (uint64_t)ret;
3752 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3753 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3754 for (size_t i = 0; i < ret.datalen; i++) {
3755 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3759 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3760 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3761 LDKThirtyTwoBytes a_ref;
3762 CHECK(*((uint32_t*)a) == 32);
3763 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3765 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3766 b_constr.datalen = *((uint32_t*)b);
3767 if (b_constr.datalen > 0)
3768 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3770 b_constr.data = NULL;
3771 uint32_t* b_vals = (uint32_t*)(b + 4);
3772 for (size_t z = 0; z < b_constr.datalen; z++) {
3773 uint32_t b_conv_25 = b_vals[z];
3774 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
3775 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
3776 b_constr.data[z] = b_conv_25_conv;
3779 return (uint64_t)ret;
3781 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
3782 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3783 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3784 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3787 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
3788 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3789 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
3790 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3791 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3792 for (size_t z = 0; z < b_var.datalen; z++) {
3793 uint64_t b_conv_25_ref = (uint64_t)(&b_var.data[z]) | 1;
3794 b_arr_ptr[z] = b_conv_25_ref;
3798 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3799 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3800 ret->datalen = *((uint32_t*)elems);
3801 if (ret->datalen == 0) {
3804 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3805 uint32_t *java_elems = (uint32_t*)(elems + 4);
3806 for (size_t i = 0; i < ret->datalen; i++) {
3807 uint32_t arr_elem = java_elems[i];
3808 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3809 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3810 ret->data[i] = arr_elem_conv;
3813 return (uint64_t)ret;
3815 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3816 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 };
3817 for (size_t i = 0; i < ret.datalen; i++) {
3818 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3822 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3823 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3825 case LDKBalance_ClaimableOnChannelClose: {
3826 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
3828 case LDKBalance_ClaimableAwaitingConfirmations: {
3829 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
3831 case LDKBalance_ContentiousClaimable: {
3832 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
3834 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
3835 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
3840 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
3841 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
3842 ret->datalen = *((uint32_t*)elems);
3843 if (ret->datalen == 0) {
3846 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
3847 uint32_t *java_elems = (uint32_t*)(elems + 4);
3848 for (size_t i = 0; i < ret->datalen; i++) {
3849 uint32_t arr_elem = java_elems[i];
3850 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
3851 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
3852 ret->data[i] = arr_elem_conv;
3855 return (uint64_t)ret;
3857 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
3858 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
3859 for (size_t i = 0; i < ret.datalen; i++) {
3860 ret.data[i] = Balance_clone(&orig->data[i]);
3864 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3865 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3867 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3868 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3869 CHECK(val->result_ok);
3870 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3873 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
3874 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3875 CHECK(!val->result_ok);
3876 LDKDecodeError err_var = (*val->contents.err);
3877 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3878 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3879 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3882 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
3883 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3885 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
3886 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3887 CHECK(val->result_ok);
3888 return *val->contents.result;
3890 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
3891 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3892 CHECK(!val->result_ok);
3893 LDKLightningError err_var = (*val->contents.err);
3894 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3895 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3896 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3899 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
3900 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
3902 CHECK(*((uint32_t*)a) == 33);
3903 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
3905 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
3906 b_conv = Type_clone(&b_conv);
3908 return (uint64_t)ret;
3910 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_a(uint32_t ptr) {
3911 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
3912 int8_tArray a_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
3913 memcpy((uint8_t*)(a_arr + 4), tuple->a.compressed_form, 33);
3916 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_b(uint32_t ptr) {
3917 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
3918 LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
3919 *b_ret = Type_clone(&tuple->b);
3920 return (uint64_t)b_ret;
3922 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
3923 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
3924 ret->datalen = *((uint32_t*)elems);
3925 if (ret->datalen == 0) {
3928 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
3929 uint32_t *java_elems = (uint32_t*)(elems + 4);
3930 for (size_t i = 0; i < ret->datalen; i++) {
3931 uint32_t arr_elem = java_elems[i];
3932 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
3933 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
3934 ret->data[i] = arr_elem_conv;
3937 return (uint64_t)ret;
3939 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
3940 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
3941 for (size_t i = 0; i < ret.datalen; i++) {
3942 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
3946 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
3947 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3949 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
3950 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3951 CHECK(val->result_ok);
3952 return *val->contents.result;
3954 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
3955 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3956 CHECK(!val->result_ok);
3957 LDKLightningError err_var = (*val->contents.err);
3958 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3959 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3960 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3963 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
3964 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3965 LDKChannelAnnouncement a_conv;
3966 a_conv.inner = (void*)(a & (~1));
3967 a_conv.is_owned = (a & 1) || (a == 0);
3968 a_conv = ChannelAnnouncement_clone(&a_conv);
3970 LDKChannelUpdate b_conv;
3971 b_conv.inner = (void*)(b & (~1));
3972 b_conv.is_owned = (b & 1) || (b == 0);
3973 b_conv = ChannelUpdate_clone(&b_conv);
3975 LDKChannelUpdate c_conv;
3976 c_conv.inner = (void*)(c & (~1));
3977 c_conv.is_owned = (c & 1) || (c == 0);
3978 c_conv = ChannelUpdate_clone(&c_conv);
3980 return (uint64_t)ret;
3982 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
3983 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3984 LDKChannelAnnouncement a_var = tuple->a;
3985 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3986 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3987 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3990 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
3991 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3992 LDKChannelUpdate b_var = tuple->b;
3993 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3994 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3995 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3998 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
3999 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4000 LDKChannelUpdate c_var = tuple->c;
4001 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4002 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4003 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4006 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4007 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4008 ret->datalen = *((uint32_t*)elems);
4009 if (ret->datalen == 0) {
4012 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4013 uint32_t *java_elems = (uint32_t*)(elems + 4);
4014 for (size_t i = 0; i < ret->datalen; i++) {
4015 uint32_t arr_elem = java_elems[i];
4016 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4017 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4018 ret->data[i] = arr_elem_conv;
4021 return (uint64_t)ret;
4023 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4024 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4025 for (size_t i = 0; i < ret.datalen; i++) {
4026 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4030 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4031 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4032 ret->datalen = *((uint32_t*)elems);
4033 if (ret->datalen == 0) {
4036 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4037 uint32_t *java_elems = (uint32_t*)(elems + 4);
4038 for (size_t i = 0; i < ret->datalen; i++) {
4039 uint32_t arr_elem = java_elems[i];
4040 LDKNodeAnnouncement arr_elem_conv;
4041 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4042 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4043 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4044 ret->data[i] = arr_elem_conv;
4047 return (uint64_t)ret;
4049 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4050 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4051 for (size_t i = 0; i < ret.datalen; i++) {
4052 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4056 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4057 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4059 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4060 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4061 CHECK(val->result_ok);
4062 LDKCVec_u8Z res_var = (*val->contents.result);
4063 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4064 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4067 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4068 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4069 CHECK(!val->result_ok);
4070 LDKPeerHandleError err_var = (*val->contents.err);
4071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4073 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4076 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4077 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4079 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4080 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4081 CHECK(val->result_ok);
4082 return *val->contents.result;
4084 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4085 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4086 CHECK(!val->result_ok);
4087 LDKPeerHandleError err_var = (*val->contents.err);
4088 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4089 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4090 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4093 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4094 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4096 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4097 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4098 CHECK(val->result_ok);
4099 return *val->contents.result;
4101 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4102 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4103 CHECK(!val->result_ok);
4104 LDKPeerHandleError err_var = (*val->contents.err);
4105 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4106 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4107 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4110 typedef struct LDKAccess_JCalls {
4111 atomic_size_t refcnt;
4112 uint32_t get_utxo_meth;
4114 static void LDKAccess_JCalls_free(void* this_arg) {
4115 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4117 js_free(j_calls->get_utxo_meth);
4121 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4122 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4123 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4124 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4125 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4126 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4127 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4130 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4131 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4132 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4134 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4135 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4136 atomic_init(&calls->refcnt, 1);
4137 //TODO: Assign calls->o from o
4140 .this_arg = (void*) calls,
4141 .get_utxo = get_utxo_LDKAccess_jcall,
4142 .free = LDKAccess_JCalls_free,
4146 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4147 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4148 *res_ptr = LDKAccess_init(o);
4149 return (long)res_ptr;
4151 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4152 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4153 unsigned char genesis_hash_arr[32];
4154 CHECK(*((uint32_t*)genesis_hash) == 32);
4155 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4156 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4157 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4158 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4159 return (uint64_t)ret_conv;
4162 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4163 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4165 case LDKCOption_AccessZ_Some: {
4166 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4167 *some_ret = obj->some;
4168 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4169 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4171 case LDKCOption_AccessZ_None: {
4172 return 0 /* LDKCOption_AccessZ - None */;
4177 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4178 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4180 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4181 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4182 CHECK(val->result_ok);
4183 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4184 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4185 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4186 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4189 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4190 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4191 CHECK(!val->result_ok);
4192 LDKDecodeError err_var = (*val->contents.err);
4193 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4194 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4195 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4198 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4199 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4201 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4202 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4203 CHECK(val->result_ok);
4204 LDKChannelInfo res_var = (*val->contents.result);
4205 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4206 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4207 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4210 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4211 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4212 CHECK(!val->result_ok);
4213 LDKDecodeError err_var = (*val->contents.err);
4214 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4215 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4216 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4219 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4220 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4222 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4223 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4224 CHECK(val->result_ok);
4225 LDKRoutingFees res_var = (*val->contents.result);
4226 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4227 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4228 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4231 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4232 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4233 CHECK(!val->result_ok);
4234 LDKDecodeError err_var = (*val->contents.err);
4235 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4236 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4237 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4240 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4241 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4243 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4244 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4245 CHECK(val->result_ok);
4246 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4247 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4248 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4249 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4252 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4253 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4254 CHECK(!val->result_ok);
4255 LDKDecodeError err_var = (*val->contents.err);
4256 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4257 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4258 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4261 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4262 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4263 ret->datalen = *((uint32_t*)elems);
4264 if (ret->datalen == 0) {
4267 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4268 int64_t *java_elems = (int64_t*)(elems + 4);
4269 for (size_t i = 0; i < ret->datalen; i++) {
4270 ret->data[i] = java_elems[i];
4273 return (uint64_t)ret;
4275 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4276 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4277 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4280 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4281 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4283 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4284 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4285 CHECK(val->result_ok);
4286 LDKNodeInfo res_var = (*val->contents.result);
4287 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4288 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4289 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4293 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4294 CHECK(!val->result_ok);
4295 LDKDecodeError err_var = (*val->contents.err);
4296 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4297 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4298 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4301 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4302 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4304 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4305 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4306 CHECK(val->result_ok);
4307 LDKNetworkGraph res_var = (*val->contents.result);
4308 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4309 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4310 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4314 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4315 CHECK(!val->result_ok);
4316 LDKDecodeError err_var = (*val->contents.err);
4317 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4318 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4319 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4322 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4323 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4325 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4326 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4327 CHECK(val->result_ok);
4328 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4331 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4332 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4333 CHECK(!val->result_ok);
4334 return *val->contents.err;
4336 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4337 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4340 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4341 CHECK(val->result_ok);
4342 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4343 *res_conv = (*val->contents.result);
4344 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4345 return (uint64_t)res_conv;
4347 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4348 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4349 CHECK(!val->result_ok);
4350 LDKDecodeError err_var = (*val->contents.err);
4351 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4356 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4357 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4360 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4361 CHECK(val->result_ok);
4362 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4365 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4366 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(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 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4375 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4376 ret->datalen = *((uint32_t*)elems);
4377 if (ret->datalen == 0) {
4380 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4381 uint32_t *java_elems = (uint32_t*)(elems + 4);
4382 for (size_t i = 0; i < ret->datalen; i++) {
4383 uint32_t arr_elem = java_elems[i];
4384 LDKUpdateAddHTLC arr_elem_conv;
4385 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4386 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4387 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4388 ret->data[i] = arr_elem_conv;
4391 return (uint64_t)ret;
4393 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4394 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4395 for (size_t i = 0; i < ret.datalen; i++) {
4396 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4400 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4401 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4402 ret->datalen = *((uint32_t*)elems);
4403 if (ret->datalen == 0) {
4406 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4407 uint32_t *java_elems = (uint32_t*)(elems + 4);
4408 for (size_t i = 0; i < ret->datalen; i++) {
4409 uint32_t arr_elem = java_elems[i];
4410 LDKUpdateFulfillHTLC arr_elem_conv;
4411 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4412 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4413 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4414 ret->data[i] = arr_elem_conv;
4417 return (uint64_t)ret;
4419 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4420 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4421 for (size_t i = 0; i < ret.datalen; i++) {
4422 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4426 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4427 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4428 ret->datalen = *((uint32_t*)elems);
4429 if (ret->datalen == 0) {
4432 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4433 uint32_t *java_elems = (uint32_t*)(elems + 4);
4434 for (size_t i = 0; i < ret->datalen; i++) {
4435 uint32_t arr_elem = java_elems[i];
4436 LDKUpdateFailHTLC arr_elem_conv;
4437 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4438 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4439 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4440 ret->data[i] = arr_elem_conv;
4443 return (uint64_t)ret;
4445 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4446 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4447 for (size_t i = 0; i < ret.datalen; i++) {
4448 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4452 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4453 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4454 ret->datalen = *((uint32_t*)elems);
4455 if (ret->datalen == 0) {
4458 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4459 uint32_t *java_elems = (uint32_t*)(elems + 4);
4460 for (size_t i = 0; i < ret->datalen; i++) {
4461 uint32_t arr_elem = java_elems[i];
4462 LDKUpdateFailMalformedHTLC arr_elem_conv;
4463 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4464 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4465 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4466 ret->data[i] = arr_elem_conv;
4469 return (uint64_t)ret;
4471 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4472 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4473 for (size_t i = 0; i < ret.datalen; i++) {
4474 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4478 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4479 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4482 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4483 CHECK(val->result_ok);
4484 LDKAcceptChannel res_var = (*val->contents.result);
4485 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4486 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4487 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4490 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4491 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4492 CHECK(!val->result_ok);
4493 LDKDecodeError err_var = (*val->contents.err);
4494 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4495 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4496 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4499 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4500 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4502 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4503 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4504 CHECK(val->result_ok);
4505 LDKAnnouncementSignatures res_var = (*val->contents.result);
4506 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4507 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4508 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4511 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4512 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4513 CHECK(!val->result_ok);
4514 LDKDecodeError err_var = (*val->contents.err);
4515 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4516 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4517 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4520 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4521 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4524 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4525 CHECK(val->result_ok);
4526 LDKChannelReestablish res_var = (*val->contents.result);
4527 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4528 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4529 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4532 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4533 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4534 CHECK(!val->result_ok);
4535 LDKDecodeError err_var = (*val->contents.err);
4536 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4537 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4538 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4541 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4542 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4544 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4545 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4546 CHECK(val->result_ok);
4547 LDKClosingSigned res_var = (*val->contents.result);
4548 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4549 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4550 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4553 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4554 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4555 CHECK(!val->result_ok);
4556 LDKDecodeError err_var = (*val->contents.err);
4557 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4558 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4559 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4562 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4563 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4566 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4567 CHECK(val->result_ok);
4568 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4569 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4570 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4571 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4574 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4575 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4576 CHECK(!val->result_ok);
4577 LDKDecodeError err_var = (*val->contents.err);
4578 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4579 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4580 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4583 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4584 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4587 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4588 CHECK(val->result_ok);
4589 LDKCommitmentSigned res_var = (*val->contents.result);
4590 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4591 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4592 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4595 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4596 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4597 CHECK(!val->result_ok);
4598 LDKDecodeError err_var = (*val->contents.err);
4599 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4600 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4601 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4604 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4605 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4607 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4608 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4609 CHECK(val->result_ok);
4610 LDKFundingCreated res_var = (*val->contents.result);
4611 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4612 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4613 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4616 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4617 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4618 CHECK(!val->result_ok);
4619 LDKDecodeError err_var = (*val->contents.err);
4620 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4621 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4622 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4625 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4626 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4629 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4630 CHECK(val->result_ok);
4631 LDKFundingSigned res_var = (*val->contents.result);
4632 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4633 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4634 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4637 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4638 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4639 CHECK(!val->result_ok);
4640 LDKDecodeError err_var = (*val->contents.err);
4641 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4642 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4643 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4646 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4647 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4649 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4650 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4651 CHECK(val->result_ok);
4652 LDKFundingLocked res_var = (*val->contents.result);
4653 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4654 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4655 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4658 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4659 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4660 CHECK(!val->result_ok);
4661 LDKDecodeError err_var = (*val->contents.err);
4662 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4663 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4664 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4667 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4668 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4671 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4672 CHECK(val->result_ok);
4673 LDKInit res_var = (*val->contents.result);
4674 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4675 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4676 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4680 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4681 CHECK(!val->result_ok);
4682 LDKDecodeError err_var = (*val->contents.err);
4683 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4684 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4685 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4688 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4689 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4691 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4692 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4693 CHECK(val->result_ok);
4694 LDKOpenChannel res_var = (*val->contents.result);
4695 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4696 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4697 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4700 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4701 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4702 CHECK(!val->result_ok);
4703 LDKDecodeError err_var = (*val->contents.err);
4704 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4705 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4706 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4709 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4710 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4712 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4713 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4714 CHECK(val->result_ok);
4715 LDKRevokeAndACK res_var = (*val->contents.result);
4716 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4717 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4718 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4721 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4722 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4723 CHECK(!val->result_ok);
4724 LDKDecodeError err_var = (*val->contents.err);
4725 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4726 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4727 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4730 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4731 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4733 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4734 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4735 CHECK(val->result_ok);
4736 LDKShutdown res_var = (*val->contents.result);
4737 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4738 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4739 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4742 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4743 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4744 CHECK(!val->result_ok);
4745 LDKDecodeError err_var = (*val->contents.err);
4746 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4747 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4748 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4751 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4752 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4754 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4755 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4756 CHECK(val->result_ok);
4757 LDKUpdateFailHTLC res_var = (*val->contents.result);
4758 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4759 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4760 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4763 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4764 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4765 CHECK(!val->result_ok);
4766 LDKDecodeError err_var = (*val->contents.err);
4767 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4768 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4769 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4772 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4773 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4776 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4777 CHECK(val->result_ok);
4778 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4779 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4780 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4781 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4784 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4785 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4786 CHECK(!val->result_ok);
4787 LDKDecodeError err_var = (*val->contents.err);
4788 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4789 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4790 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4793 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4794 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4796 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4797 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4798 CHECK(val->result_ok);
4799 LDKUpdateFee res_var = (*val->contents.result);
4800 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4801 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4802 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4805 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4806 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4807 CHECK(!val->result_ok);
4808 LDKDecodeError err_var = (*val->contents.err);
4809 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4810 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4811 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4814 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4815 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4817 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4818 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4819 CHECK(val->result_ok);
4820 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4821 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4822 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4823 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4826 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4827 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4828 CHECK(!val->result_ok);
4829 LDKDecodeError err_var = (*val->contents.err);
4830 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4831 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4832 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4835 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4836 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4838 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4839 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4840 CHECK(val->result_ok);
4841 LDKUpdateAddHTLC res_var = (*val->contents.result);
4842 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4843 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4844 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4847 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4848 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4849 CHECK(!val->result_ok);
4850 LDKDecodeError err_var = (*val->contents.err);
4851 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4852 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4853 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4856 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
4857 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4860 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4861 CHECK(val->result_ok);
4862 LDKPing res_var = (*val->contents.result);
4863 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4864 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4865 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4868 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4869 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4870 CHECK(!val->result_ok);
4871 LDKDecodeError err_var = (*val->contents.err);
4872 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4873 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4874 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4877 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
4878 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4881 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4882 CHECK(val->result_ok);
4883 LDKPong res_var = (*val->contents.result);
4884 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4885 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4886 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4889 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4890 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4891 CHECK(!val->result_ok);
4892 LDKDecodeError err_var = (*val->contents.err);
4893 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4894 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4895 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4898 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4899 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4901 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4902 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4903 CHECK(val->result_ok);
4904 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4905 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4906 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4907 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4910 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4911 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4912 CHECK(!val->result_ok);
4913 LDKDecodeError err_var = (*val->contents.err);
4914 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4915 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4916 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4919 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4920 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4922 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4923 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4924 CHECK(val->result_ok);
4925 LDKChannelAnnouncement res_var = (*val->contents.result);
4926 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4927 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4928 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4931 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4932 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4933 CHECK(!val->result_ok);
4934 LDKDecodeError err_var = (*val->contents.err);
4935 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4936 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4937 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4940 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4941 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4943 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4944 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4945 CHECK(val->result_ok);
4946 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4947 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4948 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4949 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4952 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4953 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4954 CHECK(!val->result_ok);
4955 LDKDecodeError err_var = (*val->contents.err);
4956 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4957 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4958 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4961 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4962 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4964 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4965 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4966 CHECK(val->result_ok);
4967 LDKChannelUpdate res_var = (*val->contents.result);
4968 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4969 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4970 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4973 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4974 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4975 CHECK(!val->result_ok);
4976 LDKDecodeError err_var = (*val->contents.err);
4977 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4978 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4979 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4982 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
4983 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4985 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
4986 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4987 CHECK(val->result_ok);
4988 LDKErrorMessage res_var = (*val->contents.result);
4989 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4990 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4991 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4994 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
4995 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4996 CHECK(!val->result_ok);
4997 LDKDecodeError err_var = (*val->contents.err);
4998 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4999 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5000 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5003 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5004 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5006 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5007 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5008 CHECK(val->result_ok);
5009 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5010 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5011 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5012 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5015 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5016 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5017 CHECK(!val->result_ok);
5018 LDKDecodeError err_var = (*val->contents.err);
5019 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5020 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5021 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5024 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5025 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5027 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5028 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5029 CHECK(val->result_ok);
5030 LDKNodeAnnouncement res_var = (*val->contents.result);
5031 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5032 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5033 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5036 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5037 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5038 CHECK(!val->result_ok);
5039 LDKDecodeError err_var = (*val->contents.err);
5040 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5045 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5046 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5048 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5049 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5050 CHECK(val->result_ok);
5051 LDKQueryShortChannelIds res_var = (*val->contents.result);
5052 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5053 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5054 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5057 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5058 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5059 CHECK(!val->result_ok);
5060 LDKDecodeError err_var = (*val->contents.err);
5061 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5062 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5063 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5066 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5067 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5070 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5071 CHECK(val->result_ok);
5072 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5073 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5078 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5079 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5080 CHECK(!val->result_ok);
5081 LDKDecodeError err_var = (*val->contents.err);
5082 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5083 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5084 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5087 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5088 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5091 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5092 CHECK(val->result_ok);
5093 LDKQueryChannelRange res_var = (*val->contents.result);
5094 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5095 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5096 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5100 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5101 CHECK(!val->result_ok);
5102 LDKDecodeError err_var = (*val->contents.err);
5103 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5104 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5105 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5108 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5109 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5111 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5112 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5113 CHECK(val->result_ok);
5114 LDKReplyChannelRange res_var = (*val->contents.result);
5115 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5116 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5117 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5120 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5121 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5122 CHECK(!val->result_ok);
5123 LDKDecodeError err_var = (*val->contents.err);
5124 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5125 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5126 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5129 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5130 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5133 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5134 CHECK(val->result_ok);
5135 LDKGossipTimestampFilter res_var = (*val->contents.result);
5136 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5137 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5138 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5141 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5142 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5143 CHECK(!val->result_ok);
5144 LDKDecodeError err_var = (*val->contents.err);
5145 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5146 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5147 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5150 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5151 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5153 case LDKSignOrCreationError_SignError: {
5154 return 0 /* LDKSignOrCreationError - SignError */;
5156 case LDKSignOrCreationError_CreationError: {
5157 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5158 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5163 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5164 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5166 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5167 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5168 CHECK(val->result_ok);
5169 LDKInvoice res_var = (*val->contents.result);
5170 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5171 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5172 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5175 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5176 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5177 CHECK(!val->result_ok);
5178 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5181 typedef struct LDKFilter_JCalls {
5182 atomic_size_t refcnt;
5183 uint32_t register_tx_meth;
5184 uint32_t register_output_meth;
5186 static void LDKFilter_JCalls_free(void* this_arg) {
5187 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5188 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5189 js_free(j_calls->register_tx_meth);
5190 js_free(j_calls->register_output_meth);
5194 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5195 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5196 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5197 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5198 LDKu8slice script_pubkey_var = script_pubkey;
5199 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5200 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5201 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5203 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5204 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5205 LDKWatchedOutput output_var = output;
5206 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5207 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5208 uint64_t output_ref = (uint64_t)output_var.inner;
5209 if (output_var.is_owned) {
5212 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5213 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5214 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5217 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5218 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5219 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5221 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5222 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5223 atomic_init(&calls->refcnt, 1);
5224 //TODO: Assign calls->o from o
5227 .this_arg = (void*) calls,
5228 .register_tx = register_tx_LDKFilter_jcall,
5229 .register_output = register_output_LDKFilter_jcall,
5230 .free = LDKFilter_JCalls_free,
5234 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5235 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5236 *res_ptr = LDKFilter_init(o);
5237 return (long)res_ptr;
5239 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5240 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5241 unsigned char txid_arr[32];
5242 CHECK(*((uint32_t*)txid) == 32);
5243 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5244 unsigned char (*txid_ref)[32] = &txid_arr;
5245 LDKu8slice script_pubkey_ref;
5246 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5247 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5248 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5251 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5252 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5253 LDKWatchedOutput output_conv;
5254 output_conv.inner = (void*)(output & (~1));
5255 output_conv.is_owned = (output & 1) || (output == 0);
5256 output_conv = WatchedOutput_clone(&output_conv);
5257 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5258 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5259 uint64_t ret_ref = (uint64_t)ret_copy;
5263 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5264 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5266 case LDKCOption_FilterZ_Some: {
5267 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5268 *some_ret = obj->some;
5269 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5270 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5272 case LDKCOption_FilterZ_None: {
5273 return 0 /* LDKCOption_FilterZ - None */;
5278 typedef struct LDKMessageSendEventsProvider_JCalls {
5279 atomic_size_t refcnt;
5280 uint32_t get_and_clear_pending_msg_events_meth;
5281 } LDKMessageSendEventsProvider_JCalls;
5282 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5283 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5284 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5285 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5289 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5290 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5291 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5292 LDKCVec_MessageSendEventZ ret_constr;
5293 ret_constr.datalen = *((uint32_t*)ret);
5294 if (ret_constr.datalen > 0)
5295 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5297 ret_constr.data = NULL;
5298 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5299 for (size_t s = 0; s < ret_constr.datalen; s++) {
5300 uint32_t ret_conv_18 = ret_vals[s];
5301 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5302 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5303 ret_constr.data[s] = ret_conv_18_conv;
5307 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5308 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5309 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5311 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5312 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5313 atomic_init(&calls->refcnt, 1);
5314 //TODO: Assign calls->o from o
5316 LDKMessageSendEventsProvider ret = {
5317 .this_arg = (void*) calls,
5318 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5319 .free = LDKMessageSendEventsProvider_JCalls_free,
5323 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5324 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5325 *res_ptr = LDKMessageSendEventsProvider_init(o);
5326 return (long)res_ptr;
5328 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5329 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
5330 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5331 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5332 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5333 for (size_t s = 0; s < ret_var.datalen; s++) {
5334 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5335 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
5336 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5337 ret_arr_ptr[s] = ret_conv_18_ref;
5343 typedef struct LDKEventHandler_JCalls {
5344 atomic_size_t refcnt;
5345 uint32_t handle_event_meth;
5346 } LDKEventHandler_JCalls;
5347 static void LDKEventHandler_JCalls_free(void* this_arg) {
5348 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5349 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5350 js_free(j_calls->handle_event_meth);
5354 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5355 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5356 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5357 *ret_event = Event_clone(event);
5358 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5360 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5361 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5362 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5364 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5365 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5366 atomic_init(&calls->refcnt, 1);
5367 //TODO: Assign calls->o from o
5369 LDKEventHandler ret = {
5370 .this_arg = (void*) calls,
5371 .handle_event = handle_event_LDKEventHandler_jcall,
5372 .free = LDKEventHandler_JCalls_free,
5376 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5377 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5378 *res_ptr = LDKEventHandler_init(o);
5379 return (long)res_ptr;
5381 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5382 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
5383 LDKEvent* event_conv = (LDKEvent*)event;
5384 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5387 typedef struct LDKEventsProvider_JCalls {
5388 atomic_size_t refcnt;
5389 uint32_t process_pending_events_meth;
5390 } LDKEventsProvider_JCalls;
5391 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5392 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5393 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5394 js_free(j_calls->process_pending_events_meth);
5398 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5399 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5400 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5401 *handler_ret = handler;
5402 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5404 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5405 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5406 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5408 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5409 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5410 atomic_init(&calls->refcnt, 1);
5411 //TODO: Assign calls->o from o
5413 LDKEventsProvider ret = {
5414 .this_arg = (void*) calls,
5415 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5416 .free = LDKEventsProvider_JCalls_free,
5420 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5421 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5422 *res_ptr = LDKEventsProvider_init(o);
5423 return (long)res_ptr;
5425 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5426 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
5427 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
5428 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5431 typedef struct LDKListen_JCalls {
5432 atomic_size_t refcnt;
5433 uint32_t block_connected_meth;
5434 uint32_t block_disconnected_meth;
5436 static void LDKListen_JCalls_free(void* this_arg) {
5437 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5438 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5439 js_free(j_calls->block_connected_meth);
5440 js_free(j_calls->block_disconnected_meth);
5444 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5445 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5446 LDKu8slice block_var = block;
5447 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5448 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5449 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5451 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5452 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5453 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5454 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5455 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5457 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5458 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5461 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5462 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5463 atomic_init(&calls->refcnt, 1);
5464 //TODO: Assign calls->o from o
5467 .this_arg = (void*) calls,
5468 .block_connected = block_connected_LDKListen_jcall,
5469 .block_disconnected = block_disconnected_LDKListen_jcall,
5470 .free = LDKListen_JCalls_free,
5474 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5475 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5476 *res_ptr = LDKListen_init(o);
5477 return (long)res_ptr;
5479 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5480 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5481 LDKu8slice block_ref;
5482 block_ref.datalen = *((uint32_t*)block);
5483 block_ref.data = (int8_t*)(block + 4);
5484 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5487 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5488 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5489 unsigned char header_arr[80];
5490 CHECK(*((uint32_t*)header) == 80);
5491 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5492 unsigned char (*header_ref)[80] = &header_arr;
5493 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5496 typedef struct LDKConfirm_JCalls {
5497 atomic_size_t refcnt;
5498 uint32_t transactions_confirmed_meth;
5499 uint32_t transaction_unconfirmed_meth;
5500 uint32_t best_block_updated_meth;
5501 uint32_t get_relevant_txids_meth;
5502 } LDKConfirm_JCalls;
5503 static void LDKConfirm_JCalls_free(void* this_arg) {
5504 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5505 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5506 js_free(j_calls->transactions_confirmed_meth);
5507 js_free(j_calls->transaction_unconfirmed_meth);
5508 js_free(j_calls->best_block_updated_meth);
5509 js_free(j_calls->get_relevant_txids_meth);
5513 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5514 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5515 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5516 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5517 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5518 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5519 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5520 for (size_t e = 0; e < txdata_var.datalen; e++) {
5521 LDKC2Tuple_usizeTransactionZ* txdata_conv_30_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5522 *txdata_conv_30_ref = txdata_var.data[e];
5523 txdata_arr_ptr[e] = (uint64_t)txdata_conv_30_ref;
5525 FREE(txdata_var.data);
5526 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5528 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5529 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5530 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5531 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5532 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5534 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5535 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5536 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5537 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5538 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5540 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5541 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5542 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5543 LDKCVec_TxidZ ret_constr;
5544 ret_constr.datalen = *((uint32_t*)ret);
5545 if (ret_constr.datalen > 0)
5546 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5548 ret_constr.data = NULL;
5549 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5550 for (size_t m = 0; m < ret_constr.datalen; m++) {
5551 int8_tArray ret_conv_12 = ret_vals[m];
5552 LDKThirtyTwoBytes ret_conv_12_ref;
5553 CHECK(*((uint32_t*)ret_conv_12) == 32);
5554 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5555 ret_constr.data[m] = ret_conv_12_ref;
5559 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5560 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5561 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5563 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5564 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5565 atomic_init(&calls->refcnt, 1);
5566 //TODO: Assign calls->o from o
5569 .this_arg = (void*) calls,
5570 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5571 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5572 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5573 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5574 .free = LDKConfirm_JCalls_free,
5578 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5579 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5580 *res_ptr = LDKConfirm_init(o);
5581 return (long)res_ptr;
5583 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5584 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5585 unsigned char header_arr[80];
5586 CHECK(*((uint32_t*)header) == 80);
5587 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5588 unsigned char (*header_ref)[80] = &header_arr;
5589 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5590 txdata_constr.datalen = *((uint32_t*)txdata);
5591 if (txdata_constr.datalen > 0)
5592 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5594 txdata_constr.data = NULL;
5595 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5596 for (size_t e = 0; e < txdata_constr.datalen; e++) {
5597 uint32_t txdata_conv_30 = txdata_vals[e];
5598 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
5599 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
5600 txdata_constr.data[e] = txdata_conv_30_conv;
5602 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5605 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5606 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5607 unsigned char txid_arr[32];
5608 CHECK(*((uint32_t*)txid) == 32);
5609 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5610 unsigned char (*txid_ref)[32] = &txid_arr;
5611 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5614 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5615 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5616 unsigned char header_arr[80];
5617 CHECK(*((uint32_t*)header) == 80);
5618 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5619 unsigned char (*header_ref)[80] = &header_arr;
5620 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5623 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5624 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5625 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5626 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5627 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5628 for (size_t m = 0; m < ret_var.datalen; m++) {
5629 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5630 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5631 ret_arr_ptr[m] = ret_conv_12_arr;
5637 typedef struct LDKPersist_JCalls {
5638 atomic_size_t refcnt;
5639 uint32_t persist_new_channel_meth;
5640 uint32_t update_persisted_channel_meth;
5641 } LDKPersist_JCalls;
5642 static void LDKPersist_JCalls_free(void* this_arg) {
5643 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5644 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5645 js_free(j_calls->persist_new_channel_meth);
5646 js_free(j_calls->update_persisted_channel_meth);
5650 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5651 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5652 LDKOutPoint id_var = id;
5653 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5654 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5655 uint64_t id_ref = (uint64_t)id_var.inner;
5656 if (id_var.is_owned) {
5659 LDKChannelMonitor data_var = *data;
5660 data_var = ChannelMonitor_clone(data);
5661 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5662 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5663 uint64_t data_ref = (uint64_t)data_var.inner;
5664 if (data_var.is_owned) {
5667 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5668 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5669 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5672 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5673 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5674 LDKOutPoint id_var = id;
5675 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5676 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5677 uint64_t id_ref = (uint64_t)id_var.inner;
5678 if (id_var.is_owned) {
5681 LDKChannelMonitorUpdate update_var = *update;
5682 update_var = ChannelMonitorUpdate_clone(update);
5683 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5684 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5685 uint64_t update_ref = (uint64_t)update_var.inner;
5686 if (update_var.is_owned) {
5689 LDKChannelMonitor data_var = *data;
5690 data_var = ChannelMonitor_clone(data);
5691 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5692 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5693 uint64_t data_ref = (uint64_t)data_var.inner;
5694 if (data_var.is_owned) {
5697 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5698 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5699 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5702 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5703 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5704 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5706 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5707 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5708 atomic_init(&calls->refcnt, 1);
5709 //TODO: Assign calls->o from o
5712 .this_arg = (void*) calls,
5713 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5714 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5715 .free = LDKPersist_JCalls_free,
5719 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5720 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5721 *res_ptr = LDKPersist_init(o);
5722 return (long)res_ptr;
5724 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5725 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5726 LDKOutPoint id_conv;
5727 id_conv.inner = (void*)(id & (~1));
5728 id_conv.is_owned = (id & 1) || (id == 0);
5729 id_conv = OutPoint_clone(&id_conv);
5730 LDKChannelMonitor data_conv;
5731 data_conv.inner = (void*)(data & (~1));
5732 data_conv.is_owned = false;
5733 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5734 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5735 return (uint64_t)ret_conv;
5738 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5739 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5740 LDKOutPoint id_conv;
5741 id_conv.inner = (void*)(id & (~1));
5742 id_conv.is_owned = (id & 1) || (id == 0);
5743 id_conv = OutPoint_clone(&id_conv);
5744 LDKChannelMonitorUpdate update_conv;
5745 update_conv.inner = (void*)(update & (~1));
5746 update_conv.is_owned = false;
5747 LDKChannelMonitor data_conv;
5748 data_conv.inner = (void*)(data & (~1));
5749 data_conv.is_owned = false;
5750 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5751 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5752 return (uint64_t)ret_conv;
5755 typedef struct LDKChannelMessageHandler_JCalls {
5756 atomic_size_t refcnt;
5757 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5758 uint32_t handle_open_channel_meth;
5759 uint32_t handle_accept_channel_meth;
5760 uint32_t handle_funding_created_meth;
5761 uint32_t handle_funding_signed_meth;
5762 uint32_t handle_funding_locked_meth;
5763 uint32_t handle_shutdown_meth;
5764 uint32_t handle_closing_signed_meth;
5765 uint32_t handle_update_add_htlc_meth;
5766 uint32_t handle_update_fulfill_htlc_meth;
5767 uint32_t handle_update_fail_htlc_meth;
5768 uint32_t handle_update_fail_malformed_htlc_meth;
5769 uint32_t handle_commitment_signed_meth;
5770 uint32_t handle_revoke_and_ack_meth;
5771 uint32_t handle_update_fee_meth;
5772 uint32_t handle_announcement_signatures_meth;
5773 uint32_t peer_disconnected_meth;
5774 uint32_t peer_connected_meth;
5775 uint32_t handle_channel_reestablish_meth;
5776 uint32_t handle_channel_update_meth;
5777 uint32_t handle_error_meth;
5778 } LDKChannelMessageHandler_JCalls;
5779 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5780 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5781 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5782 js_free(j_calls->handle_open_channel_meth);
5783 js_free(j_calls->handle_accept_channel_meth);
5784 js_free(j_calls->handle_funding_created_meth);
5785 js_free(j_calls->handle_funding_signed_meth);
5786 js_free(j_calls->handle_funding_locked_meth);
5787 js_free(j_calls->handle_shutdown_meth);
5788 js_free(j_calls->handle_closing_signed_meth);
5789 js_free(j_calls->handle_update_add_htlc_meth);
5790 js_free(j_calls->handle_update_fulfill_htlc_meth);
5791 js_free(j_calls->handle_update_fail_htlc_meth);
5792 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5793 js_free(j_calls->handle_commitment_signed_meth);
5794 js_free(j_calls->handle_revoke_and_ack_meth);
5795 js_free(j_calls->handle_update_fee_meth);
5796 js_free(j_calls->handle_announcement_signatures_meth);
5797 js_free(j_calls->peer_disconnected_meth);
5798 js_free(j_calls->peer_connected_meth);
5799 js_free(j_calls->handle_channel_reestablish_meth);
5800 js_free(j_calls->handle_channel_update_meth);
5801 js_free(j_calls->handle_error_meth);
5805 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5806 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5807 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5808 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5809 LDKInitFeatures their_features_var = their_features;
5810 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5811 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5812 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5813 if (their_features_var.is_owned) {
5814 their_features_ref |= 1;
5816 LDKOpenChannel msg_var = *msg;
5817 msg_var = OpenChannel_clone(msg);
5818 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5819 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5820 uint64_t msg_ref = (uint64_t)msg_var.inner;
5821 if (msg_var.is_owned) {
5824 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5826 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5827 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5828 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5829 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5830 LDKInitFeatures their_features_var = their_features;
5831 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5832 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5833 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5834 if (their_features_var.is_owned) {
5835 their_features_ref |= 1;
5837 LDKAcceptChannel msg_var = *msg;
5838 msg_var = AcceptChannel_clone(msg);
5839 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5840 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5841 uint64_t msg_ref = (uint64_t)msg_var.inner;
5842 if (msg_var.is_owned) {
5845 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5847 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5848 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5849 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5850 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5851 LDKFundingCreated msg_var = *msg;
5852 msg_var = FundingCreated_clone(msg);
5853 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5854 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5855 uint64_t msg_ref = (uint64_t)msg_var.inner;
5856 if (msg_var.is_owned) {
5859 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5861 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5862 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5863 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5864 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5865 LDKFundingSigned msg_var = *msg;
5866 msg_var = FundingSigned_clone(msg);
5867 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5868 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5869 uint64_t msg_ref = (uint64_t)msg_var.inner;
5870 if (msg_var.is_owned) {
5873 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5875 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5876 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5877 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5878 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5879 LDKFundingLocked msg_var = *msg;
5880 msg_var = FundingLocked_clone(msg);
5881 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5882 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5883 uint64_t msg_ref = (uint64_t)msg_var.inner;
5884 if (msg_var.is_owned) {
5887 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5889 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5890 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5891 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5892 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5893 LDKInitFeatures their_features_var = *their_features;
5894 their_features_var = InitFeatures_clone(their_features);
5895 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5896 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5897 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5898 if (their_features_var.is_owned) {
5899 their_features_ref |= 1;
5901 LDKShutdown msg_var = *msg;
5902 msg_var = Shutdown_clone(msg);
5903 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5904 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5905 uint64_t msg_ref = (uint64_t)msg_var.inner;
5906 if (msg_var.is_owned) {
5909 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5911 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5912 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5913 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5914 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5915 LDKClosingSigned msg_var = *msg;
5916 msg_var = ClosingSigned_clone(msg);
5917 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5918 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5919 uint64_t msg_ref = (uint64_t)msg_var.inner;
5920 if (msg_var.is_owned) {
5923 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5925 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5926 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5927 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5928 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5929 LDKUpdateAddHTLC msg_var = *msg;
5930 msg_var = UpdateAddHTLC_clone(msg);
5931 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5932 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5933 uint64_t msg_ref = (uint64_t)msg_var.inner;
5934 if (msg_var.is_owned) {
5937 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5939 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5940 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5941 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5942 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5943 LDKUpdateFulfillHTLC msg_var = *msg;
5944 msg_var = UpdateFulfillHTLC_clone(msg);
5945 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5946 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5947 uint64_t msg_ref = (uint64_t)msg_var.inner;
5948 if (msg_var.is_owned) {
5951 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5953 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5954 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5955 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5956 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5957 LDKUpdateFailHTLC msg_var = *msg;
5958 msg_var = UpdateFailHTLC_clone(msg);
5959 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5960 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5961 uint64_t msg_ref = (uint64_t)msg_var.inner;
5962 if (msg_var.is_owned) {
5965 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5967 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5968 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5969 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5970 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5971 LDKUpdateFailMalformedHTLC msg_var = *msg;
5972 msg_var = UpdateFailMalformedHTLC_clone(msg);
5973 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5974 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5975 uint64_t msg_ref = (uint64_t)msg_var.inner;
5976 if (msg_var.is_owned) {
5979 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5981 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5983 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5984 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5985 LDKCommitmentSigned msg_var = *msg;
5986 msg_var = CommitmentSigned_clone(msg);
5987 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5988 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5989 uint64_t msg_ref = (uint64_t)msg_var.inner;
5990 if (msg_var.is_owned) {
5993 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5995 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5996 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5997 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5998 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5999 LDKRevokeAndACK msg_var = *msg;
6000 msg_var = RevokeAndACK_clone(msg);
6001 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6002 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6003 uint64_t msg_ref = (uint64_t)msg_var.inner;
6004 if (msg_var.is_owned) {
6007 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6009 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6010 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6011 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6012 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6013 LDKUpdateFee msg_var = *msg;
6014 msg_var = UpdateFee_clone(msg);
6015 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6016 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6017 uint64_t msg_ref = (uint64_t)msg_var.inner;
6018 if (msg_var.is_owned) {
6021 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6023 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6024 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6025 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6026 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6027 LDKAnnouncementSignatures msg_var = *msg;
6028 msg_var = AnnouncementSignatures_clone(msg);
6029 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6030 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6031 uint64_t msg_ref = (uint64_t)msg_var.inner;
6032 if (msg_var.is_owned) {
6035 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6037 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6038 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6039 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6040 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6041 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6043 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6044 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6045 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6046 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6047 LDKInit msg_var = *msg;
6048 msg_var = Init_clone(msg);
6049 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6050 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6051 uint64_t msg_ref = (uint64_t)msg_var.inner;
6052 if (msg_var.is_owned) {
6055 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6057 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6059 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6060 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6061 LDKChannelReestablish msg_var = *msg;
6062 msg_var = ChannelReestablish_clone(msg);
6063 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6064 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6065 uint64_t msg_ref = (uint64_t)msg_var.inner;
6066 if (msg_var.is_owned) {
6069 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6071 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6073 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6074 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6075 LDKChannelUpdate msg_var = *msg;
6076 msg_var = ChannelUpdate_clone(msg);
6077 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6078 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6079 uint64_t msg_ref = (uint64_t)msg_var.inner;
6080 if (msg_var.is_owned) {
6083 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6085 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6086 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6087 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6088 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6089 LDKErrorMessage msg_var = *msg;
6090 msg_var = ErrorMessage_clone(msg);
6091 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6092 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6093 uint64_t msg_ref = (uint64_t)msg_var.inner;
6094 if (msg_var.is_owned) {
6097 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6099 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6100 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6101 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6102 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6104 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6105 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6106 atomic_init(&calls->refcnt, 1);
6107 //TODO: Assign calls->o from o
6109 LDKChannelMessageHandler ret = {
6110 .this_arg = (void*) calls,
6111 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6112 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6113 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6114 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6115 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6116 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6117 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6118 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6119 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6120 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6121 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6122 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6123 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6124 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6125 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6126 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6127 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6128 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6129 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6130 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6131 .free = LDKChannelMessageHandler_JCalls_free,
6132 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6134 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6137 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6138 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6139 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6140 return (long)res_ptr;
6142 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) {
6143 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6144 LDKPublicKey their_node_id_ref;
6145 CHECK(*((uint32_t*)their_node_id) == 33);
6146 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6147 LDKInitFeatures their_features_conv;
6148 their_features_conv.inner = (void*)(their_features & (~1));
6149 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6150 their_features_conv = InitFeatures_clone(&their_features_conv);
6151 LDKOpenChannel msg_conv;
6152 msg_conv.inner = (void*)(msg & (~1));
6153 msg_conv.is_owned = false;
6154 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6157 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) {
6158 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6159 LDKPublicKey their_node_id_ref;
6160 CHECK(*((uint32_t*)their_node_id) == 33);
6161 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6162 LDKInitFeatures their_features_conv;
6163 their_features_conv.inner = (void*)(their_features & (~1));
6164 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6165 their_features_conv = InitFeatures_clone(&their_features_conv);
6166 LDKAcceptChannel msg_conv;
6167 msg_conv.inner = (void*)(msg & (~1));
6168 msg_conv.is_owned = false;
6169 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6172 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6173 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6174 LDKPublicKey their_node_id_ref;
6175 CHECK(*((uint32_t*)their_node_id) == 33);
6176 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6177 LDKFundingCreated msg_conv;
6178 msg_conv.inner = (void*)(msg & (~1));
6179 msg_conv.is_owned = false;
6180 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6183 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6184 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6185 LDKPublicKey their_node_id_ref;
6186 CHECK(*((uint32_t*)their_node_id) == 33);
6187 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6188 LDKFundingSigned msg_conv;
6189 msg_conv.inner = (void*)(msg & (~1));
6190 msg_conv.is_owned = false;
6191 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6194 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6195 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6196 LDKPublicKey their_node_id_ref;
6197 CHECK(*((uint32_t*)their_node_id) == 33);
6198 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6199 LDKFundingLocked msg_conv;
6200 msg_conv.inner = (void*)(msg & (~1));
6201 msg_conv.is_owned = false;
6202 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6205 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6206 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6207 LDKPublicKey their_node_id_ref;
6208 CHECK(*((uint32_t*)their_node_id) == 33);
6209 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6210 LDKInitFeatures their_features_conv;
6211 their_features_conv.inner = (void*)(their_features & (~1));
6212 their_features_conv.is_owned = false;
6213 LDKShutdown msg_conv;
6214 msg_conv.inner = (void*)(msg & (~1));
6215 msg_conv.is_owned = false;
6216 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6219 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6220 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6221 LDKPublicKey their_node_id_ref;
6222 CHECK(*((uint32_t*)their_node_id) == 33);
6223 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6224 LDKClosingSigned msg_conv;
6225 msg_conv.inner = (void*)(msg & (~1));
6226 msg_conv.is_owned = false;
6227 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6230 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6231 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6232 LDKPublicKey their_node_id_ref;
6233 CHECK(*((uint32_t*)their_node_id) == 33);
6234 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6235 LDKUpdateAddHTLC msg_conv;
6236 msg_conv.inner = (void*)(msg & (~1));
6237 msg_conv.is_owned = false;
6238 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6241 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6242 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6243 LDKPublicKey their_node_id_ref;
6244 CHECK(*((uint32_t*)their_node_id) == 33);
6245 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6246 LDKUpdateFulfillHTLC msg_conv;
6247 msg_conv.inner = (void*)(msg & (~1));
6248 msg_conv.is_owned = false;
6249 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6252 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6253 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6254 LDKPublicKey their_node_id_ref;
6255 CHECK(*((uint32_t*)their_node_id) == 33);
6256 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6257 LDKUpdateFailHTLC msg_conv;
6258 msg_conv.inner = (void*)(msg & (~1));
6259 msg_conv.is_owned = false;
6260 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6263 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6264 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6265 LDKPublicKey their_node_id_ref;
6266 CHECK(*((uint32_t*)their_node_id) == 33);
6267 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6268 LDKUpdateFailMalformedHTLC msg_conv;
6269 msg_conv.inner = (void*)(msg & (~1));
6270 msg_conv.is_owned = false;
6271 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6274 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6275 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6276 LDKPublicKey their_node_id_ref;
6277 CHECK(*((uint32_t*)their_node_id) == 33);
6278 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6279 LDKCommitmentSigned msg_conv;
6280 msg_conv.inner = (void*)(msg & (~1));
6281 msg_conv.is_owned = false;
6282 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6285 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6286 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6287 LDKPublicKey their_node_id_ref;
6288 CHECK(*((uint32_t*)their_node_id) == 33);
6289 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6290 LDKRevokeAndACK msg_conv;
6291 msg_conv.inner = (void*)(msg & (~1));
6292 msg_conv.is_owned = false;
6293 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6296 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6297 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6298 LDKPublicKey their_node_id_ref;
6299 CHECK(*((uint32_t*)their_node_id) == 33);
6300 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6301 LDKUpdateFee msg_conv;
6302 msg_conv.inner = (void*)(msg & (~1));
6303 msg_conv.is_owned = false;
6304 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6307 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6308 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6309 LDKPublicKey their_node_id_ref;
6310 CHECK(*((uint32_t*)their_node_id) == 33);
6311 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6312 LDKAnnouncementSignatures msg_conv;
6313 msg_conv.inner = (void*)(msg & (~1));
6314 msg_conv.is_owned = false;
6315 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6318 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6319 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6320 LDKPublicKey their_node_id_ref;
6321 CHECK(*((uint32_t*)their_node_id) == 33);
6322 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6323 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6326 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6327 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6328 LDKPublicKey their_node_id_ref;
6329 CHECK(*((uint32_t*)their_node_id) == 33);
6330 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6332 msg_conv.inner = (void*)(msg & (~1));
6333 msg_conv.is_owned = false;
6334 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6337 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6338 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6339 LDKPublicKey their_node_id_ref;
6340 CHECK(*((uint32_t*)their_node_id) == 33);
6341 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6342 LDKChannelReestablish msg_conv;
6343 msg_conv.inner = (void*)(msg & (~1));
6344 msg_conv.is_owned = false;
6345 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6348 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6349 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6350 LDKPublicKey their_node_id_ref;
6351 CHECK(*((uint32_t*)their_node_id) == 33);
6352 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6353 LDKChannelUpdate msg_conv;
6354 msg_conv.inner = (void*)(msg & (~1));
6355 msg_conv.is_owned = false;
6356 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6359 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6360 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6361 LDKPublicKey their_node_id_ref;
6362 CHECK(*((uint32_t*)their_node_id) == 33);
6363 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6364 LDKErrorMessage msg_conv;
6365 msg_conv.inner = (void*)(msg & (~1));
6366 msg_conv.is_owned = false;
6367 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6370 typedef struct LDKRoutingMessageHandler_JCalls {
6371 atomic_size_t refcnt;
6372 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6373 uint32_t handle_node_announcement_meth;
6374 uint32_t handle_channel_announcement_meth;
6375 uint32_t handle_channel_update_meth;
6376 uint32_t get_next_channel_announcements_meth;
6377 uint32_t get_next_node_announcements_meth;
6378 uint32_t sync_routing_table_meth;
6379 uint32_t handle_reply_channel_range_meth;
6380 uint32_t handle_reply_short_channel_ids_end_meth;
6381 uint32_t handle_query_channel_range_meth;
6382 uint32_t handle_query_short_channel_ids_meth;
6383 } LDKRoutingMessageHandler_JCalls;
6384 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6385 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6386 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6387 js_free(j_calls->handle_node_announcement_meth);
6388 js_free(j_calls->handle_channel_announcement_meth);
6389 js_free(j_calls->handle_channel_update_meth);
6390 js_free(j_calls->get_next_channel_announcements_meth);
6391 js_free(j_calls->get_next_node_announcements_meth);
6392 js_free(j_calls->sync_routing_table_meth);
6393 js_free(j_calls->handle_reply_channel_range_meth);
6394 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6395 js_free(j_calls->handle_query_channel_range_meth);
6396 js_free(j_calls->handle_query_short_channel_ids_meth);
6400 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6401 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6402 LDKNodeAnnouncement msg_var = *msg;
6403 msg_var = NodeAnnouncement_clone(msg);
6404 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6405 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6406 uint64_t msg_ref = (uint64_t)msg_var.inner;
6407 if (msg_var.is_owned) {
6410 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6411 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6412 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6415 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6416 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6417 LDKChannelAnnouncement msg_var = *msg;
6418 msg_var = ChannelAnnouncement_clone(msg);
6419 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6420 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6421 uint64_t msg_ref = (uint64_t)msg_var.inner;
6422 if (msg_var.is_owned) {
6425 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6426 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6427 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6430 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6431 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6432 LDKChannelUpdate msg_var = *msg;
6433 msg_var = ChannelUpdate_clone(msg);
6434 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6435 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6436 uint64_t msg_ref = (uint64_t)msg_var.inner;
6437 if (msg_var.is_owned) {
6440 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6441 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6442 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6445 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6446 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6447 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6448 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6449 ret_constr.datalen = *((uint32_t*)ret);
6450 if (ret_constr.datalen > 0)
6451 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6453 ret_constr.data = NULL;
6454 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6455 for (size_t l = 0; l < ret_constr.datalen; l++) {
6456 uint32_t ret_conv_63 = ret_vals[l];
6457 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
6458 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
6459 ret_constr.data[l] = ret_conv_63_conv;
6463 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6464 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6465 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6466 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6467 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6468 LDKCVec_NodeAnnouncementZ ret_constr;
6469 ret_constr.datalen = *((uint32_t*)ret);
6470 if (ret_constr.datalen > 0)
6471 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6473 ret_constr.data = NULL;
6474 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6475 for (size_t s = 0; s < ret_constr.datalen; s++) {
6476 uint32_t ret_conv_18 = ret_vals[s];
6477 LDKNodeAnnouncement ret_conv_18_conv;
6478 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6479 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6480 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6481 ret_constr.data[s] = ret_conv_18_conv;
6485 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6486 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6487 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6488 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6489 LDKInit init_var = *init;
6490 init_var = Init_clone(init);
6491 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6492 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6493 uint64_t init_ref = (uint64_t)init_var.inner;
6494 if (init_var.is_owned) {
6497 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6499 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6500 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6501 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6502 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6503 LDKReplyChannelRange msg_var = msg;
6504 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6505 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6506 uint64_t msg_ref = (uint64_t)msg_var.inner;
6507 if (msg_var.is_owned) {
6510 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6511 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6512 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6515 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6516 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6517 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6518 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6519 LDKReplyShortChannelIdsEnd msg_var = msg;
6520 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6521 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6522 uint64_t msg_ref = (uint64_t)msg_var.inner;
6523 if (msg_var.is_owned) {
6526 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6527 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6528 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6531 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6532 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6533 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6534 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6535 LDKQueryChannelRange msg_var = msg;
6536 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6537 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6538 uint64_t msg_ref = (uint64_t)msg_var.inner;
6539 if (msg_var.is_owned) {
6542 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6543 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6544 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6547 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6548 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6549 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6550 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6551 LDKQueryShortChannelIds msg_var = msg;
6552 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6553 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6554 uint64_t msg_ref = (uint64_t)msg_var.inner;
6555 if (msg_var.is_owned) {
6558 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6559 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6560 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6563 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6564 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6565 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6566 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6568 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6569 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6570 atomic_init(&calls->refcnt, 1);
6571 //TODO: Assign calls->o from o
6573 LDKRoutingMessageHandler ret = {
6574 .this_arg = (void*) calls,
6575 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6576 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6577 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6578 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6579 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6580 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6581 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6582 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6583 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6584 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6585 .free = LDKRoutingMessageHandler_JCalls_free,
6586 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6588 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6591 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6592 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6593 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6594 return (long)res_ptr;
6596 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6597 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6598 LDKNodeAnnouncement msg_conv;
6599 msg_conv.inner = (void*)(msg & (~1));
6600 msg_conv.is_owned = false;
6601 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6602 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6603 return (uint64_t)ret_conv;
6606 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6607 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6608 LDKChannelAnnouncement msg_conv;
6609 msg_conv.inner = (void*)(msg & (~1));
6610 msg_conv.is_owned = false;
6611 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6612 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6613 return (uint64_t)ret_conv;
6616 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6617 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6618 LDKChannelUpdate msg_conv;
6619 msg_conv.inner = (void*)(msg & (~1));
6620 msg_conv.is_owned = false;
6621 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6622 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6623 return (uint64_t)ret_conv;
6626 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6627 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6628 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6629 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6630 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6631 for (size_t l = 0; l < ret_var.datalen; l++) {
6632 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6633 *ret_conv_63_ref = ret_var.data[l];
6634 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
6640 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6641 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6642 LDKPublicKey starting_point_ref;
6643 CHECK(*((uint32_t*)starting_point) == 33);
6644 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6645 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6646 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6647 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6648 for (size_t s = 0; s < ret_var.datalen; s++) {
6649 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6650 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6651 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6652 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6653 if (ret_conv_18_var.is_owned) {
6654 ret_conv_18_ref |= 1;
6656 ret_arr_ptr[s] = ret_conv_18_ref;
6662 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6663 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6664 LDKPublicKey their_node_id_ref;
6665 CHECK(*((uint32_t*)their_node_id) == 33);
6666 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6668 init_conv.inner = (void*)(init & (~1));
6669 init_conv.is_owned = false;
6670 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6673 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6674 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6675 LDKPublicKey their_node_id_ref;
6676 CHECK(*((uint32_t*)their_node_id) == 33);
6677 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6678 LDKReplyChannelRange msg_conv;
6679 msg_conv.inner = (void*)(msg & (~1));
6680 msg_conv.is_owned = (msg & 1) || (msg == 0);
6681 msg_conv = ReplyChannelRange_clone(&msg_conv);
6682 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6683 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6684 return (uint64_t)ret_conv;
6687 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) {
6688 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6689 LDKPublicKey their_node_id_ref;
6690 CHECK(*((uint32_t*)their_node_id) == 33);
6691 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6692 LDKReplyShortChannelIdsEnd msg_conv;
6693 msg_conv.inner = (void*)(msg & (~1));
6694 msg_conv.is_owned = (msg & 1) || (msg == 0);
6695 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6696 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6697 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6698 return (uint64_t)ret_conv;
6701 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6702 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6703 LDKPublicKey their_node_id_ref;
6704 CHECK(*((uint32_t*)their_node_id) == 33);
6705 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6706 LDKQueryChannelRange msg_conv;
6707 msg_conv.inner = (void*)(msg & (~1));
6708 msg_conv.is_owned = (msg & 1) || (msg == 0);
6709 msg_conv = QueryChannelRange_clone(&msg_conv);
6710 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6711 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6712 return (uint64_t)ret_conv;
6715 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6716 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6717 LDKPublicKey their_node_id_ref;
6718 CHECK(*((uint32_t*)their_node_id) == 33);
6719 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6720 LDKQueryShortChannelIds msg_conv;
6721 msg_conv.inner = (void*)(msg & (~1));
6722 msg_conv.is_owned = (msg & 1) || (msg == 0);
6723 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6724 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6725 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6726 return (uint64_t)ret_conv;
6729 typedef struct LDKCustomMessageReader_JCalls {
6730 atomic_size_t refcnt;
6732 } LDKCustomMessageReader_JCalls;
6733 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
6734 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6735 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6736 js_free(j_calls->read_meth);
6740 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
6741 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6742 LDKu8slice buffer_var = buffer;
6743 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6744 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
6745 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
6746 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
6747 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
6750 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
6751 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
6752 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6754 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
6755 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
6756 atomic_init(&calls->refcnt, 1);
6757 //TODO: Assign calls->o from o
6759 LDKCustomMessageReader ret = {
6760 .this_arg = (void*) calls,
6761 .read = read_LDKCustomMessageReader_jcall,
6762 .free = LDKCustomMessageReader_JCalls_free,
6766 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
6767 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
6768 *res_ptr = LDKCustomMessageReader_init(o);
6769 return (long)res_ptr;
6771 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
6772 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
6773 LDKu8slice buffer_ref;
6774 buffer_ref.datalen = *((uint32_t*)buffer);
6775 buffer_ref.data = (int8_t*)(buffer + 4);
6776 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
6777 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
6778 return (uint64_t)ret_conv;
6781 typedef struct LDKCustomMessageHandler_JCalls {
6782 atomic_size_t refcnt;
6783 LDKCustomMessageReader_JCalls* CustomMessageReader;
6784 uint32_t handle_custom_message_meth;
6785 uint32_t get_and_clear_pending_msg_meth;
6786 } LDKCustomMessageHandler_JCalls;
6787 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
6788 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6789 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6790 js_free(j_calls->handle_custom_message_meth);
6791 js_free(j_calls->get_and_clear_pending_msg_meth);
6795 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
6796 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6797 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
6799 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6800 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
6801 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
6802 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6803 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6806 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
6807 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6808 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
6809 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
6810 ret_constr.datalen = *((uint32_t*)ret);
6811 if (ret_constr.datalen > 0)
6812 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
6814 ret_constr.data = NULL;
6815 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6816 for (size_t c = 0; c < ret_constr.datalen; c++) {
6817 uint32_t ret_conv_28 = ret_vals[c];
6818 LDKC2Tuple_PublicKeyTypeZ ret_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1);
6819 ret_conv_28_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1));
6820 ret_constr.data[c] = ret_conv_28_conv;
6824 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
6825 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
6826 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6827 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
6829 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
6830 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
6831 atomic_init(&calls->refcnt, 1);
6832 //TODO: Assign calls->o from o
6834 LDKCustomMessageHandler ret = {
6835 .this_arg = (void*) calls,
6836 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
6837 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
6838 .free = LDKCustomMessageHandler_JCalls_free,
6839 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
6841 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
6844 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
6845 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
6846 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
6847 return (long)res_ptr;
6849 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
6850 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
6851 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
6852 LDKPublicKey sender_node_id_ref;
6853 CHECK(*((uint32_t*)sender_node_id) == 33);
6854 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
6855 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6856 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
6857 return (uint64_t)ret_conv;
6860 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
6861 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
6862 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
6863 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6864 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6865 for (size_t c = 0; c < ret_var.datalen; c++) {
6866 LDKC2Tuple_PublicKeyTypeZ* ret_conv_28_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
6867 *ret_conv_28_ref = ret_var.data[c];
6868 ret_arr_ptr[c] = (uint64_t)ret_conv_28_ref;
6874 typedef struct LDKSocketDescriptor_JCalls {
6875 atomic_size_t refcnt;
6876 uint32_t send_data_meth;
6877 uint32_t disconnect_socket_meth;
6880 } LDKSocketDescriptor_JCalls;
6881 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6882 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6883 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6884 js_free(j_calls->send_data_meth);
6885 js_free(j_calls->disconnect_socket_meth);
6886 js_free(j_calls->eq_meth);
6887 js_free(j_calls->hash_meth);
6891 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6892 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6893 LDKu8slice data_var = data;
6894 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6895 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
6896 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
6898 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6899 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6900 js_invoke_function_0(j_calls->disconnect_socket_meth);
6902 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6903 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6904 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6905 *other_arg_clone = SocketDescriptor_clone(other_arg);
6906 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
6908 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6909 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6910 return js_invoke_function_0(j_calls->hash_meth);
6912 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
6913 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
6914 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6916 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
6917 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6918 atomic_init(&calls->refcnt, 1);
6919 //TODO: Assign calls->o from o
6921 LDKSocketDescriptor ret = {
6922 .this_arg = (void*) calls,
6923 .send_data = send_data_LDKSocketDescriptor_jcall,
6924 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6925 .eq = eq_LDKSocketDescriptor_jcall,
6926 .hash = hash_LDKSocketDescriptor_jcall,
6927 .cloned = LDKSocketDescriptor_JCalls_cloned,
6928 .free = LDKSocketDescriptor_JCalls_free,
6932 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
6933 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6934 *res_ptr = LDKSocketDescriptor_init(o);
6935 return (long)res_ptr;
6937 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
6938 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6939 LDKu8slice data_ref;
6940 data_ref.datalen = *((uint32_t*)data);
6941 data_ref.data = (int8_t*)(data + 4);
6942 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6946 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
6947 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6948 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6951 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
6952 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6953 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6957 typedef struct LDKChannelManagerPersister_JCalls {
6958 atomic_size_t refcnt;
6959 uint32_t persist_manager_meth;
6960 } LDKChannelManagerPersister_JCalls;
6961 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
6962 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6963 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6964 js_free(j_calls->persist_manager_meth);
6968 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
6969 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6970 LDKChannelManager channel_manager_var = *channel_manager;
6971 // Warning: we may need a move here but no clone is available for LDKChannelManager
6972 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6973 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6974 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
6975 if (channel_manager_var.is_owned) {
6976 channel_manager_ref |= 1;
6978 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
6979 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
6980 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
6983 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
6984 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
6985 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6987 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
6988 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
6989 atomic_init(&calls->refcnt, 1);
6990 //TODO: Assign calls->o from o
6992 LDKChannelManagerPersister ret = {
6993 .this_arg = (void*) calls,
6994 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
6995 .free = LDKChannelManagerPersister_JCalls_free,
6999 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7000 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7001 *res_ptr = LDKChannelManagerPersister_init(o);
7002 return (long)res_ptr;
7004 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7005 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
7006 LDKChannelManager channel_manager_conv;
7007 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7008 channel_manager_conv.is_owned = false;
7009 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7010 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7011 return (uint64_t)ret_conv;
7014 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7015 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7017 case LDKFallback_SegWitProgram: {
7018 uint8_t version_val = obj->seg_wit_program.version._0;
7019 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7020 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7021 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7022 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7024 case LDKFallback_PubKeyHash: {
7025 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7026 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7027 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7029 case LDKFallback_ScriptHash: {
7030 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7031 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7032 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7037 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7038 LDKStr ret_str = _ldk_get_compiled_version();
7039 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7044 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7045 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7046 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7051 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7052 LDKTransaction _res_ref;
7053 _res_ref.datalen = *((uint32_t*)_res);
7054 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7055 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7056 _res_ref.data_is_owned = true;
7057 Transaction_free(_res_ref);
7060 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7061 LDKCVec_u8Z script_pubkey_ref;
7062 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7063 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7064 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7065 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7066 *ret_ref = TxOut_new(script_pubkey_ref, value);
7067 return (uint64_t)ret_ref;
7070 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7071 if ((_res & 1) != 0) return;
7072 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
7074 TxOut_free(_res_conv);
7077 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7078 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7079 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7080 *ret_ref = TxOut_clone(orig_conv);
7081 return (uint64_t)ret_ref;
7084 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7085 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7089 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7091 CHECK(*((uint32_t*)o) == 32);
7092 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7093 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7094 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7095 return (uint64_t)ret_conv;
7098 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7099 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7100 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7101 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7102 return (uint64_t)ret_conv;
7105 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7106 if ((_res & 1) != 0) return;
7107 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
7109 CResult_SecretKeyErrorZ_free(_res_conv);
7112 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7114 CHECK(*((uint32_t*)o) == 33);
7115 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7116 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7117 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7118 return (uint64_t)ret_conv;
7121 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7122 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7123 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7124 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7125 return (uint64_t)ret_conv;
7128 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7129 if ((_res & 1) != 0) return;
7130 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
7132 CResult_PublicKeyErrorZ_free(_res_conv);
7135 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7136 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7137 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7138 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7139 return (uint64_t)ret_conv;
7142 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7143 LDKTxCreationKeys o_conv;
7144 o_conv.inner = (void*)(o & (~1));
7145 o_conv.is_owned = (o & 1) || (o == 0);
7146 o_conv = TxCreationKeys_clone(&o_conv);
7147 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7148 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7149 return (uint64_t)ret_conv;
7152 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7153 LDKDecodeError e_conv;
7154 e_conv.inner = (void*)(e & (~1));
7155 e_conv.is_owned = (e & 1) || (e == 0);
7156 e_conv = DecodeError_clone(&e_conv);
7157 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7158 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7159 return (uint64_t)ret_conv;
7162 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7163 if ((_res & 1) != 0) return;
7164 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7166 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7169 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7170 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7171 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7172 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7173 return (uint64_t)ret_conv;
7176 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7177 LDKChannelPublicKeys o_conv;
7178 o_conv.inner = (void*)(o & (~1));
7179 o_conv.is_owned = (o & 1) || (o == 0);
7180 o_conv = ChannelPublicKeys_clone(&o_conv);
7181 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7182 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7183 return (uint64_t)ret_conv;
7186 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7187 LDKDecodeError e_conv;
7188 e_conv.inner = (void*)(e & (~1));
7189 e_conv.is_owned = (e & 1) || (e == 0);
7190 e_conv = DecodeError_clone(&e_conv);
7191 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7192 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7193 return (uint64_t)ret_conv;
7196 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7197 if ((_res & 1) != 0) return;
7198 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7200 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7203 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7204 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7205 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7206 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7207 return (uint64_t)ret_conv;
7210 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7211 LDKTxCreationKeys o_conv;
7212 o_conv.inner = (void*)(o & (~1));
7213 o_conv.is_owned = (o & 1) || (o == 0);
7214 o_conv = TxCreationKeys_clone(&o_conv);
7215 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7216 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7217 return (uint64_t)ret_conv;
7220 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7221 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7222 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7223 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7224 return (uint64_t)ret_conv;
7227 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7228 if ((_res & 1) != 0) return;
7229 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
7231 CResult_TxCreationKeysErrorZ_free(_res_conv);
7234 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7235 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7236 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7237 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7238 return (uint64_t)ret_conv;
7241 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7242 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7243 *ret_copy = COption_u32Z_some(o);
7244 uint64_t ret_ref = (uint64_t)ret_copy;
7248 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7249 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7250 *ret_copy = COption_u32Z_none();
7251 uint64_t ret_ref = (uint64_t)ret_copy;
7255 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7256 if ((_res & 1) != 0) return;
7257 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
7259 COption_u32Z_free(_res_conv);
7262 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7263 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7264 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7265 *ret_copy = COption_u32Z_clone(orig_conv);
7266 uint64_t ret_ref = (uint64_t)ret_copy;
7270 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7271 LDKHTLCOutputInCommitment o_conv;
7272 o_conv.inner = (void*)(o & (~1));
7273 o_conv.is_owned = (o & 1) || (o == 0);
7274 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7275 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7276 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7277 return (uint64_t)ret_conv;
7280 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7281 LDKDecodeError e_conv;
7282 e_conv.inner = (void*)(e & (~1));
7283 e_conv.is_owned = (e & 1) || (e == 0);
7284 e_conv = DecodeError_clone(&e_conv);
7285 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7286 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7287 return (uint64_t)ret_conv;
7290 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7291 if ((_res & 1) != 0) return;
7292 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
7294 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7297 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7298 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7299 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7300 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7301 return (uint64_t)ret_conv;
7304 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7305 LDKCounterpartyChannelTransactionParameters o_conv;
7306 o_conv.inner = (void*)(o & (~1));
7307 o_conv.is_owned = (o & 1) || (o == 0);
7308 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7309 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7310 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7311 return (uint64_t)ret_conv;
7314 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7315 LDKDecodeError e_conv;
7316 e_conv.inner = (void*)(e & (~1));
7317 e_conv.is_owned = (e & 1) || (e == 0);
7318 e_conv = DecodeError_clone(&e_conv);
7319 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7320 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7321 return (uint64_t)ret_conv;
7324 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7325 if ((_res & 1) != 0) return;
7326 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7328 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7331 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7332 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7333 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7334 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7335 return (uint64_t)ret_conv;
7338 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7339 LDKChannelTransactionParameters o_conv;
7340 o_conv.inner = (void*)(o & (~1));
7341 o_conv.is_owned = (o & 1) || (o == 0);
7342 o_conv = ChannelTransactionParameters_clone(&o_conv);
7343 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7344 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7345 return (uint64_t)ret_conv;
7348 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7349 LDKDecodeError e_conv;
7350 e_conv.inner = (void*)(e & (~1));
7351 e_conv.is_owned = (e & 1) || (e == 0);
7352 e_conv = DecodeError_clone(&e_conv);
7353 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7354 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7355 return (uint64_t)ret_conv;
7358 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7359 if ((_res & 1) != 0) return;
7360 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7362 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7365 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7366 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7367 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7368 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7369 return (uint64_t)ret_conv;
7372 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7373 LDKCVec_SignatureZ _res_constr;
7374 _res_constr.datalen = *((uint32_t*)_res);
7375 if (_res_constr.datalen > 0)
7376 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7378 _res_constr.data = NULL;
7379 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7380 for (size_t m = 0; m < _res_constr.datalen; m++) {
7381 int8_tArray _res_conv_12 = _res_vals[m];
7382 LDKSignature _res_conv_12_ref;
7383 CHECK(*((uint32_t*)_res_conv_12) == 64);
7384 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7385 _res_constr.data[m] = _res_conv_12_ref;
7387 CVec_SignatureZ_free(_res_constr);
7390 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7391 LDKHolderCommitmentTransaction o_conv;
7392 o_conv.inner = (void*)(o & (~1));
7393 o_conv.is_owned = (o & 1) || (o == 0);
7394 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7395 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7396 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7397 return (uint64_t)ret_conv;
7400 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7401 LDKDecodeError e_conv;
7402 e_conv.inner = (void*)(e & (~1));
7403 e_conv.is_owned = (e & 1) || (e == 0);
7404 e_conv = DecodeError_clone(&e_conv);
7405 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7406 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7407 return (uint64_t)ret_conv;
7410 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7411 if ((_res & 1) != 0) return;
7412 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7414 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7417 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7418 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7419 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7420 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7421 return (uint64_t)ret_conv;
7424 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7425 LDKBuiltCommitmentTransaction o_conv;
7426 o_conv.inner = (void*)(o & (~1));
7427 o_conv.is_owned = (o & 1) || (o == 0);
7428 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7429 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7430 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7431 return (uint64_t)ret_conv;
7434 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7435 LDKDecodeError e_conv;
7436 e_conv.inner = (void*)(e & (~1));
7437 e_conv.is_owned = (e & 1) || (e == 0);
7438 e_conv = DecodeError_clone(&e_conv);
7439 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7440 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7441 return (uint64_t)ret_conv;
7444 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7445 if ((_res & 1) != 0) return;
7446 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7448 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7451 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7452 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7453 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7454 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7455 return (uint64_t)ret_conv;
7458 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7459 LDKTrustedClosingTransaction o_conv;
7460 o_conv.inner = (void*)(o & (~1));
7461 o_conv.is_owned = (o & 1) || (o == 0);
7462 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7463 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7464 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7465 return (uint64_t)ret_conv;
7468 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7469 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7470 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7471 return (uint64_t)ret_conv;
7474 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7475 if ((_res & 1) != 0) return;
7476 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
7478 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7481 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7482 LDKCommitmentTransaction o_conv;
7483 o_conv.inner = (void*)(o & (~1));
7484 o_conv.is_owned = (o & 1) || (o == 0);
7485 o_conv = CommitmentTransaction_clone(&o_conv);
7486 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7487 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7488 return (uint64_t)ret_conv;
7491 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7492 LDKDecodeError e_conv;
7493 e_conv.inner = (void*)(e & (~1));
7494 e_conv.is_owned = (e & 1) || (e == 0);
7495 e_conv = DecodeError_clone(&e_conv);
7496 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7497 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7498 return (uint64_t)ret_conv;
7501 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7502 if ((_res & 1) != 0) return;
7503 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7505 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7508 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7509 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7510 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7511 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7512 return (uint64_t)ret_conv;
7515 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7516 LDKTrustedCommitmentTransaction o_conv;
7517 o_conv.inner = (void*)(o & (~1));
7518 o_conv.is_owned = (o & 1) || (o == 0);
7519 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7520 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7521 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7522 return (uint64_t)ret_conv;
7525 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
7526 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7527 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7528 return (uint64_t)ret_conv;
7531 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
7532 if ((_res & 1) != 0) return;
7533 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7535 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7538 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
7539 LDKCVec_SignatureZ o_constr;
7540 o_constr.datalen = *((uint32_t*)o);
7541 if (o_constr.datalen > 0)
7542 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7544 o_constr.data = NULL;
7545 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7546 for (size_t m = 0; m < o_constr.datalen; m++) {
7547 int8_tArray o_conv_12 = o_vals[m];
7548 LDKSignature o_conv_12_ref;
7549 CHECK(*((uint32_t*)o_conv_12) == 64);
7550 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
7551 o_constr.data[m] = o_conv_12_ref;
7553 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7554 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7555 return (uint64_t)ret_conv;
7558 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
7559 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7560 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7561 return (uint64_t)ret_conv;
7564 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
7565 if ((_res & 1) != 0) return;
7566 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7568 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7571 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
7572 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7573 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7574 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7575 return (uint64_t)ret_conv;
7578 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
7579 LDKShutdownScript o_conv;
7580 o_conv.inner = (void*)(o & (~1));
7581 o_conv.is_owned = (o & 1) || (o == 0);
7582 o_conv = ShutdownScript_clone(&o_conv);
7583 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7584 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
7585 return (uint64_t)ret_conv;
7588 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
7589 LDKDecodeError e_conv;
7590 e_conv.inner = (void*)(e & (~1));
7591 e_conv.is_owned = (e & 1) || (e == 0);
7592 e_conv = DecodeError_clone(&e_conv);
7593 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7594 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
7595 return (uint64_t)ret_conv;
7598 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
7599 if ((_res & 1) != 0) return;
7600 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
7602 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
7605 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
7606 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
7607 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7608 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
7609 return (uint64_t)ret_conv;
7612 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
7613 LDKShutdownScript o_conv;
7614 o_conv.inner = (void*)(o & (~1));
7615 o_conv.is_owned = (o & 1) || (o == 0);
7616 o_conv = ShutdownScript_clone(&o_conv);
7617 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7618 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
7619 return (uint64_t)ret_conv;
7622 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
7623 LDKInvalidShutdownScript e_conv;
7624 e_conv.inner = (void*)(e & (~1));
7625 e_conv.is_owned = (e & 1) || (e == 0);
7626 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
7627 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7628 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
7629 return (uint64_t)ret_conv;
7632 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
7633 if ((_res & 1) != 0) return;
7634 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
7636 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
7639 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
7640 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7641 *ret_conv = CResult_NoneErrorZ_ok();
7642 return (uint64_t)ret_conv;
7645 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
7646 LDKIOError e_conv = LDKIOError_from_js(e);
7647 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7648 *ret_conv = CResult_NoneErrorZ_err(e_conv);
7649 return (uint64_t)ret_conv;
7652 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
7653 if ((_res & 1) != 0) return;
7654 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
7656 CResult_NoneErrorZ_free(_res_conv);
7659 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
7660 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
7661 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7662 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
7663 return (uint64_t)ret_conv;
7666 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
7668 o_conv.inner = (void*)(o & (~1));
7669 o_conv.is_owned = (o & 1) || (o == 0);
7670 o_conv = RouteHop_clone(&o_conv);
7671 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7672 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
7673 return (uint64_t)ret_conv;
7676 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
7677 LDKDecodeError e_conv;
7678 e_conv.inner = (void*)(e & (~1));
7679 e_conv.is_owned = (e & 1) || (e == 0);
7680 e_conv = DecodeError_clone(&e_conv);
7681 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7682 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
7683 return (uint64_t)ret_conv;
7686 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
7687 if ((_res & 1) != 0) return;
7688 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
7690 CResult_RouteHopDecodeErrorZ_free(_res_conv);
7693 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
7694 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
7695 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7696 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
7697 return (uint64_t)ret_conv;
7700 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7701 LDKCVec_RouteHopZ _res_constr;
7702 _res_constr.datalen = *((uint32_t*)_res);
7703 if (_res_constr.datalen > 0)
7704 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7706 _res_constr.data = NULL;
7707 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7708 for (size_t k = 0; k < _res_constr.datalen; k++) {
7709 uint32_t _res_conv_10 = _res_vals[k];
7710 LDKRouteHop _res_conv_10_conv;
7711 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7712 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7713 _res_constr.data[k] = _res_conv_10_conv;
7715 CVec_RouteHopZ_free(_res_constr);
7718 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7719 LDKCVec_CVec_RouteHopZZ _res_constr;
7720 _res_constr.datalen = *((uint32_t*)_res);
7721 if (_res_constr.datalen > 0)
7722 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7724 _res_constr.data = NULL;
7725 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7726 for (size_t m = 0; m < _res_constr.datalen; m++) {
7727 uint32_tArray _res_conv_12 = _res_vals[m];
7728 LDKCVec_RouteHopZ _res_conv_12_constr;
7729 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7730 if (_res_conv_12_constr.datalen > 0)
7731 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7733 _res_conv_12_constr.data = NULL;
7734 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7735 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7736 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7737 LDKRouteHop _res_conv_12_conv_10_conv;
7738 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7739 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7740 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7742 _res_constr.data[m] = _res_conv_12_constr;
7744 CVec_CVec_RouteHopZZ_free(_res_constr);
7747 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7749 o_conv.inner = (void*)(o & (~1));
7750 o_conv.is_owned = (o & 1) || (o == 0);
7751 o_conv = Route_clone(&o_conv);
7752 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7753 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7754 return (uint64_t)ret_conv;
7757 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7758 LDKDecodeError e_conv;
7759 e_conv.inner = (void*)(e & (~1));
7760 e_conv.is_owned = (e & 1) || (e == 0);
7761 e_conv = DecodeError_clone(&e_conv);
7762 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7763 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7764 return (uint64_t)ret_conv;
7767 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7768 if ((_res & 1) != 0) return;
7769 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7771 CResult_RouteDecodeErrorZ_free(_res_conv);
7774 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7775 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7776 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7777 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7778 return (uint64_t)ret_conv;
7781 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7782 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7783 *ret_copy = COption_u64Z_some(o);
7784 uint64_t ret_ref = (uint64_t)ret_copy;
7788 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7789 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7790 *ret_copy = COption_u64Z_none();
7791 uint64_t ret_ref = (uint64_t)ret_copy;
7795 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7796 if ((_res & 1) != 0) return;
7797 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7799 COption_u64Z_free(_res_conv);
7802 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7803 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7804 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7805 *ret_copy = COption_u64Z_clone(orig_conv);
7806 uint64_t ret_ref = (uint64_t)ret_copy;
7810 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7811 LDKCVec_ChannelDetailsZ _res_constr;
7812 _res_constr.datalen = *((uint32_t*)_res);
7813 if (_res_constr.datalen > 0)
7814 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7816 _res_constr.data = NULL;
7817 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7818 for (size_t q = 0; q < _res_constr.datalen; q++) {
7819 uint32_t _res_conv_16 = _res_vals[q];
7820 LDKChannelDetails _res_conv_16_conv;
7821 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7822 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7823 _res_constr.data[q] = _res_conv_16_conv;
7825 CVec_ChannelDetailsZ_free(_res_constr);
7828 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7829 LDKCVec_RouteHintZ _res_constr;
7830 _res_constr.datalen = *((uint32_t*)_res);
7831 if (_res_constr.datalen > 0)
7832 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7834 _res_constr.data = NULL;
7835 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7836 for (size_t l = 0; l < _res_constr.datalen; l++) {
7837 uint32_t _res_conv_11 = _res_vals[l];
7838 LDKRouteHint _res_conv_11_conv;
7839 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7840 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7841 _res_constr.data[l] = _res_conv_11_conv;
7843 CVec_RouteHintZ_free(_res_constr);
7846 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7848 o_conv.inner = (void*)(o & (~1));
7849 o_conv.is_owned = (o & 1) || (o == 0);
7850 o_conv = Route_clone(&o_conv);
7851 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7852 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7853 return (uint64_t)ret_conv;
7856 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7857 LDKLightningError e_conv;
7858 e_conv.inner = (void*)(e & (~1));
7859 e_conv.is_owned = (e & 1) || (e == 0);
7860 e_conv = LightningError_clone(&e_conv);
7861 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7862 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7863 return (uint64_t)ret_conv;
7866 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7867 if ((_res & 1) != 0) return;
7868 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7870 CResult_RouteLightningErrorZ_free(_res_conv);
7873 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7874 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7875 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7876 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7877 return (uint64_t)ret_conv;
7880 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7881 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7882 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
7883 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7884 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7885 return (uint64_t)ret_conv;
7888 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7889 LDKAccessError e_conv = LDKAccessError_from_js(e);
7890 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7891 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7892 return (uint64_t)ret_conv;
7895 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7896 if ((_res & 1) != 0) return;
7897 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7899 CResult_TxOutAccessErrorZ_free(_res_conv);
7902 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7903 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7904 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7905 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7906 return (uint64_t)ret_conv;
7909 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
7910 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
7911 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7912 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
7913 return (uint64_t)ret_ref;
7916 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
7917 LDKTransaction b_ref;
7918 b_ref.datalen = *((uint32_t*)b);
7919 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7920 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
7921 b_ref.data_is_owned = true;
7922 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7923 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7924 return (uint64_t)ret_ref;
7927 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
7928 if ((_res & 1) != 0) return;
7929 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7931 C2Tuple_usizeTransactionZ_free(_res_conv);
7934 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
7935 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7936 _res_constr.datalen = *((uint32_t*)_res);
7937 if (_res_constr.datalen > 0)
7938 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7940 _res_constr.data = NULL;
7941 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7942 for (size_t e = 0; e < _res_constr.datalen; e++) {
7943 uint32_t _res_conv_30 = _res_vals[e];
7944 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
7945 FREE((void*)_res_conv_30);
7946 _res_constr.data[e] = _res_conv_30_conv;
7948 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7951 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
7952 LDKCVec_TxidZ _res_constr;
7953 _res_constr.datalen = *((uint32_t*)_res);
7954 if (_res_constr.datalen > 0)
7955 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7957 _res_constr.data = NULL;
7958 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7959 for (size_t m = 0; m < _res_constr.datalen; m++) {
7960 int8_tArray _res_conv_12 = _res_vals[m];
7961 LDKThirtyTwoBytes _res_conv_12_ref;
7962 CHECK(*((uint32_t*)_res_conv_12) == 32);
7963 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
7964 _res_constr.data[m] = _res_conv_12_ref;
7966 CVec_TxidZ_free(_res_constr);
7969 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
7970 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7971 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7972 return (uint64_t)ret_conv;
7975 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
7976 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
7977 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7978 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7979 return (uint64_t)ret_conv;
7982 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
7983 if ((_res & 1) != 0) return;
7984 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7986 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7989 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
7990 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7991 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7992 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7993 return (uint64_t)ret_conv;
7996 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
7997 LDKCVec_MonitorEventZ _res_constr;
7998 _res_constr.datalen = *((uint32_t*)_res);
7999 if (_res_constr.datalen > 0)
8000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8002 _res_constr.data = NULL;
8003 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8004 for (size_t o = 0; o < _res_constr.datalen; o++) {
8005 uint32_t _res_conv_14 = _res_vals[o];
8006 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
8007 FREE((void*)_res_conv_14);
8008 _res_constr.data[o] = _res_conv_14_conv;
8010 CVec_MonitorEventZ_free(_res_constr);
8013 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8014 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
8015 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8016 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8017 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8018 uint64_t ret_ref = (uint64_t)ret_copy;
8022 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8023 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8024 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8025 uint64_t ret_ref = (uint64_t)ret_copy;
8029 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8030 if ((_res & 1) != 0) return;
8031 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
8033 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8036 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8037 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8038 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8039 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8040 uint64_t ret_ref = (uint64_t)ret_copy;
8044 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8045 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
8046 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8047 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8048 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8049 uint64_t ret_ref = (uint64_t)ret_copy;
8053 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8054 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8055 *ret_copy = COption_NetworkUpdateZ_none();
8056 uint64_t ret_ref = (uint64_t)ret_copy;
8060 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8061 if ((_res & 1) != 0) return;
8062 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
8064 COption_NetworkUpdateZ_free(_res_conv);
8067 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8068 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8069 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8070 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8071 uint64_t ret_ref = (uint64_t)ret_copy;
8075 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8076 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8077 _res_constr.datalen = *((uint32_t*)_res);
8078 if (_res_constr.datalen > 0)
8079 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8081 _res_constr.data = NULL;
8082 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8083 for (size_t b = 0; b < _res_constr.datalen; b++) {
8084 uint32_t _res_conv_27 = _res_vals[b];
8085 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8086 FREE((void*)_res_conv_27);
8087 _res_constr.data[b] = _res_conv_27_conv;
8089 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8092 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8093 LDKCVec_MessageSendEventZ _res_constr;
8094 _res_constr.datalen = *((uint32_t*)_res);
8095 if (_res_constr.datalen > 0)
8096 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8098 _res_constr.data = NULL;
8099 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8100 for (size_t s = 0; s < _res_constr.datalen; s++) {
8101 uint32_t _res_conv_18 = _res_vals[s];
8102 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
8103 FREE((void*)_res_conv_18);
8104 _res_constr.data[s] = _res_conv_18_conv;
8106 CVec_MessageSendEventZ_free(_res_constr);
8109 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8110 LDKInitFeatures o_conv;
8111 o_conv.inner = (void*)(o & (~1));
8112 o_conv.is_owned = (o & 1) || (o == 0);
8113 o_conv = InitFeatures_clone(&o_conv);
8114 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8115 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8116 return (uint64_t)ret_conv;
8119 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8120 LDKDecodeError e_conv;
8121 e_conv.inner = (void*)(e & (~1));
8122 e_conv.is_owned = (e & 1) || (e == 0);
8123 e_conv = DecodeError_clone(&e_conv);
8124 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8125 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8126 return (uint64_t)ret_conv;
8129 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8130 if ((_res & 1) != 0) return;
8131 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8133 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8136 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8137 LDKNodeFeatures o_conv;
8138 o_conv.inner = (void*)(o & (~1));
8139 o_conv.is_owned = (o & 1) || (o == 0);
8140 o_conv = NodeFeatures_clone(&o_conv);
8141 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8142 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8143 return (uint64_t)ret_conv;
8146 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8147 LDKDecodeError e_conv;
8148 e_conv.inner = (void*)(e & (~1));
8149 e_conv.is_owned = (e & 1) || (e == 0);
8150 e_conv = DecodeError_clone(&e_conv);
8151 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8152 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8153 return (uint64_t)ret_conv;
8156 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8157 if ((_res & 1) != 0) return;
8158 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8160 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8163 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8164 LDKChannelFeatures o_conv;
8165 o_conv.inner = (void*)(o & (~1));
8166 o_conv.is_owned = (o & 1) || (o == 0);
8167 o_conv = ChannelFeatures_clone(&o_conv);
8168 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8169 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8170 return (uint64_t)ret_conv;
8173 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8174 LDKDecodeError e_conv;
8175 e_conv.inner = (void*)(e & (~1));
8176 e_conv.is_owned = (e & 1) || (e == 0);
8177 e_conv = DecodeError_clone(&e_conv);
8178 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8179 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8180 return (uint64_t)ret_conv;
8183 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8184 if ((_res & 1) != 0) return;
8185 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8187 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8190 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8191 LDKInvoiceFeatures o_conv;
8192 o_conv.inner = (void*)(o & (~1));
8193 o_conv.is_owned = (o & 1) || (o == 0);
8194 o_conv = InvoiceFeatures_clone(&o_conv);
8195 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8196 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8197 return (uint64_t)ret_conv;
8200 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8201 LDKDecodeError e_conv;
8202 e_conv.inner = (void*)(e & (~1));
8203 e_conv.is_owned = (e & 1) || (e == 0);
8204 e_conv = DecodeError_clone(&e_conv);
8205 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8206 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8207 return (uint64_t)ret_conv;
8210 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8211 if ((_res & 1) != 0) return;
8212 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8214 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8217 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8218 LDKDelayedPaymentOutputDescriptor o_conv;
8219 o_conv.inner = (void*)(o & (~1));
8220 o_conv.is_owned = (o & 1) || (o == 0);
8221 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8222 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8223 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8224 return (uint64_t)ret_conv;
8227 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8228 LDKDecodeError e_conv;
8229 e_conv.inner = (void*)(e & (~1));
8230 e_conv.is_owned = (e & 1) || (e == 0);
8231 e_conv = DecodeError_clone(&e_conv);
8232 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8233 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8234 return (uint64_t)ret_conv;
8237 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8238 if ((_res & 1) != 0) return;
8239 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8241 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8244 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8245 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8246 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8247 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8248 return (uint64_t)ret_conv;
8251 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8252 LDKStaticPaymentOutputDescriptor o_conv;
8253 o_conv.inner = (void*)(o & (~1));
8254 o_conv.is_owned = (o & 1) || (o == 0);
8255 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8256 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8257 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8258 return (uint64_t)ret_conv;
8261 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8262 LDKDecodeError e_conv;
8263 e_conv.inner = (void*)(e & (~1));
8264 e_conv.is_owned = (e & 1) || (e == 0);
8265 e_conv = DecodeError_clone(&e_conv);
8266 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8267 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8268 return (uint64_t)ret_conv;
8271 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8272 if ((_res & 1) != 0) return;
8273 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8275 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8278 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8279 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8280 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8281 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8282 return (uint64_t)ret_conv;
8285 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8286 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8287 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8288 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8289 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8290 return (uint64_t)ret_conv;
8293 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8294 LDKDecodeError e_conv;
8295 e_conv.inner = (void*)(e & (~1));
8296 e_conv.is_owned = (e & 1) || (e == 0);
8297 e_conv = DecodeError_clone(&e_conv);
8298 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8299 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8300 return (uint64_t)ret_conv;
8303 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8304 if ((_res & 1) != 0) return;
8305 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8307 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8310 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8311 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8312 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8313 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8314 return (uint64_t)ret_conv;
8317 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8318 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8319 *ret_conv = CResult_NoneNoneZ_ok();
8320 return (uint64_t)ret_conv;
8323 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8324 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8325 *ret_conv = CResult_NoneNoneZ_err();
8326 return (uint64_t)ret_conv;
8329 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8330 if ((_res & 1) != 0) return;
8331 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
8333 CResult_NoneNoneZ_free(_res_conv);
8336 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8337 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8338 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8339 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8340 return (uint64_t)ret_conv;
8343 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8344 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8345 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8346 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8347 return (uint64_t)ret_ref;
8350 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8352 CHECK(*((uint32_t*)a) == 64);
8353 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8354 LDKCVec_SignatureZ b_constr;
8355 b_constr.datalen = *((uint32_t*)b);
8356 if (b_constr.datalen > 0)
8357 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8359 b_constr.data = NULL;
8360 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8361 for (size_t m = 0; m < b_constr.datalen; m++) {
8362 int8_tArray b_conv_12 = b_vals[m];
8363 LDKSignature b_conv_12_ref;
8364 CHECK(*((uint32_t*)b_conv_12) == 64);
8365 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8366 b_constr.data[m] = b_conv_12_ref;
8368 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8369 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8370 return (uint64_t)ret_ref;
8373 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8374 if ((_res & 1) != 0) return;
8375 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8377 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8380 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8381 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8382 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8383 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8384 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8385 return (uint64_t)ret_conv;
8388 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8389 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8390 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8391 return (uint64_t)ret_conv;
8394 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8395 if ((_res & 1) != 0) return;
8396 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8398 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8401 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8402 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8403 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8404 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8405 return (uint64_t)ret_conv;
8408 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8410 CHECK(*((uint32_t*)o) == 64);
8411 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8412 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8413 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8414 return (uint64_t)ret_conv;
8417 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8418 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8419 *ret_conv = CResult_SignatureNoneZ_err();
8420 return (uint64_t)ret_conv;
8423 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8424 if ((_res & 1) != 0) return;
8425 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8427 CResult_SignatureNoneZ_free(_res_conv);
8430 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8431 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8432 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8433 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8434 return (uint64_t)ret_conv;
8437 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8438 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8439 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8440 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8441 return (uint64_t)ret_conv;
8444 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8445 LDKDecodeError e_conv;
8446 e_conv.inner = (void*)(e & (~1));
8447 e_conv.is_owned = (e & 1) || (e == 0);
8448 e_conv = DecodeError_clone(&e_conv);
8449 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8450 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8451 return (uint64_t)ret_conv;
8454 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8455 if ((_res & 1) != 0) return;
8456 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8458 CResult_SignDecodeErrorZ_free(_res_conv);
8461 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8462 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8463 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8464 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8465 return (uint64_t)ret_conv;
8468 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
8469 LDKCVec_u8Z _res_ref;
8470 _res_ref.datalen = *((uint32_t*)_res);
8471 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
8472 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8473 CVec_u8Z_free(_res_ref);
8476 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
8477 LDKRecoverableSignature arg_ref;
8478 CHECK(*((uint32_t*)arg) == 68);
8479 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
8480 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8481 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
8482 return (uint64_t)ret_conv;
8485 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
8486 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8487 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
8488 return (uint64_t)ret_conv;
8491 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
8492 if ((_res & 1) != 0) return;
8493 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
8495 CResult_RecoverableSignatureNoneZ_free(_res_conv);
8498 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
8499 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
8500 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8501 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
8502 return (uint64_t)ret_conv;
8505 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8506 LDKCVec_CVec_u8ZZ _res_constr;
8507 _res_constr.datalen = *((uint32_t*)_res);
8508 if (_res_constr.datalen > 0)
8509 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8511 _res_constr.data = NULL;
8512 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8513 for (size_t m = 0; m < _res_constr.datalen; m++) {
8514 int8_tArray _res_conv_12 = _res_vals[m];
8515 LDKCVec_u8Z _res_conv_12_ref;
8516 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8517 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8518 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8519 _res_constr.data[m] = _res_conv_12_ref;
8521 CVec_CVec_u8ZZ_free(_res_constr);
8524 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8525 LDKCVec_CVec_u8ZZ o_constr;
8526 o_constr.datalen = *((uint32_t*)o);
8527 if (o_constr.datalen > 0)
8528 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8530 o_constr.data = NULL;
8531 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8532 for (size_t m = 0; m < o_constr.datalen; m++) {
8533 int8_tArray o_conv_12 = o_vals[m];
8534 LDKCVec_u8Z o_conv_12_ref;
8535 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8536 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8537 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8538 o_constr.data[m] = o_conv_12_ref;
8540 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8541 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8542 return (uint64_t)ret_conv;
8545 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8546 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8547 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8548 return (uint64_t)ret_conv;
8551 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8552 if ((_res & 1) != 0) return;
8553 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8555 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8558 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8559 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8560 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8561 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8562 return (uint64_t)ret_conv;
8565 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8566 LDKInMemorySigner o_conv;
8567 o_conv.inner = (void*)(o & (~1));
8568 o_conv.is_owned = (o & 1) || (o == 0);
8569 o_conv = InMemorySigner_clone(&o_conv);
8570 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8571 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8572 return (uint64_t)ret_conv;
8575 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8576 LDKDecodeError e_conv;
8577 e_conv.inner = (void*)(e & (~1));
8578 e_conv.is_owned = (e & 1) || (e == 0);
8579 e_conv = DecodeError_clone(&e_conv);
8580 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8581 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8582 return (uint64_t)ret_conv;
8585 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8586 if ((_res & 1) != 0) return;
8587 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8589 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8592 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8593 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8594 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8595 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8596 return (uint64_t)ret_conv;
8599 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8600 LDKCVec_TxOutZ _res_constr;
8601 _res_constr.datalen = *((uint32_t*)_res);
8602 if (_res_constr.datalen > 0)
8603 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8605 _res_constr.data = NULL;
8606 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8607 for (size_t h = 0; h < _res_constr.datalen; h++) {
8608 uint32_t _res_conv_7 = _res_vals[h];
8609 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8610 FREE((void*)_res_conv_7);
8611 _res_constr.data[h] = _res_conv_7_conv;
8613 CVec_TxOutZ_free(_res_constr);
8616 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8617 LDKTransaction o_ref;
8618 o_ref.datalen = *((uint32_t*)o);
8619 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8620 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8621 o_ref.data_is_owned = true;
8622 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8623 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8624 return (uint64_t)ret_conv;
8627 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8628 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8629 *ret_conv = CResult_TransactionNoneZ_err();
8630 return (uint64_t)ret_conv;
8633 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8634 if ((_res & 1) != 0) return;
8635 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8637 CResult_TransactionNoneZ_free(_res_conv);
8640 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
8641 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
8642 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8643 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
8644 return (uint64_t)ret_conv;
8647 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
8648 LDKThirtyTwoBytes a_ref;
8649 CHECK(*((uint32_t*)a) == 32);
8650 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8651 LDKChannelMonitor b_conv;
8652 b_conv.inner = (void*)(b & (~1));
8653 b_conv.is_owned = (b & 1) || (b == 0);
8654 b_conv = ChannelMonitor_clone(&b_conv);
8655 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8656 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
8657 return (uint64_t)ret_ref;
8660 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
8661 if ((_res & 1) != 0) return;
8662 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
8664 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
8667 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8668 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8669 _res_constr.datalen = *((uint32_t*)_res);
8670 if (_res_constr.datalen > 0)
8671 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8673 _res_constr.data = NULL;
8674 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8675 for (size_t m = 0; m < _res_constr.datalen; m++) {
8676 uint32_t _res_conv_38 = _res_vals[m];
8677 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
8678 FREE((void*)_res_conv_38);
8679 _res_constr.data[m] = _res_conv_38_conv;
8681 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8684 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8685 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8686 o_constr.datalen = *((uint32_t*)o);
8687 if (o_constr.datalen > 0)
8688 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8690 o_constr.data = NULL;
8691 uint32_t* o_vals = (uint32_t*)(o + 4);
8692 for (size_t m = 0; m < o_constr.datalen; m++) {
8693 uint32_t o_conv_38 = o_vals[m];
8694 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
8695 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
8696 o_constr.data[m] = o_conv_38_conv;
8698 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8699 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8700 return (uint64_t)ret_conv;
8703 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8704 LDKIOError e_conv = LDKIOError_from_js(e);
8705 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8706 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8707 return (uint64_t)ret_conv;
8710 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8711 if ((_res & 1) != 0) return;
8712 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8714 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8717 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
8718 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8719 *ret_copy = COption_u16Z_some(o);
8720 uint64_t ret_ref = (uint64_t)ret_copy;
8724 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
8725 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8726 *ret_copy = COption_u16Z_none();
8727 uint64_t ret_ref = (uint64_t)ret_copy;
8731 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
8732 if ((_res & 1) != 0) return;
8733 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
8735 COption_u16Z_free(_res_conv);
8738 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
8739 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
8740 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8741 *ret_copy = COption_u16Z_clone(orig_conv);
8742 uint64_t ret_ref = (uint64_t)ret_copy;
8746 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8747 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8748 *ret_conv = CResult_NoneAPIErrorZ_ok();
8749 return (uint64_t)ret_conv;
8752 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8753 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8754 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
8755 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8756 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8757 return (uint64_t)ret_conv;
8760 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8761 if ((_res & 1) != 0) return;
8762 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8764 CResult_NoneAPIErrorZ_free(_res_conv);
8767 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8768 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8769 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8770 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8771 return (uint64_t)ret_conv;
8774 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8775 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8776 _res_constr.datalen = *((uint32_t*)_res);
8777 if (_res_constr.datalen > 0)
8778 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8780 _res_constr.data = NULL;
8781 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8782 for (size_t w = 0; w < _res_constr.datalen; w++) {
8783 uint32_t _res_conv_22 = _res_vals[w];
8784 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8785 FREE((void*)_res_conv_22);
8786 _res_constr.data[w] = _res_conv_22_conv;
8788 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8791 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8792 LDKCVec_APIErrorZ _res_constr;
8793 _res_constr.datalen = *((uint32_t*)_res);
8794 if (_res_constr.datalen > 0)
8795 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8797 _res_constr.data = NULL;
8798 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8799 for (size_t k = 0; k < _res_constr.datalen; k++) {
8800 uint32_t _res_conv_10 = _res_vals[k];
8801 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8802 FREE((void*)_res_conv_10);
8803 _res_constr.data[k] = _res_conv_10_conv;
8805 CVec_APIErrorZ_free(_res_constr);
8808 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8809 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8810 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8811 return (uint64_t)ret_conv;
8814 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8815 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8816 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
8817 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8818 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8819 return (uint64_t)ret_conv;
8822 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8823 if ((_res & 1) != 0) return;
8824 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8826 CResult_NonePaymentSendFailureZ_free(_res_conv);
8829 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
8830 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8831 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8832 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8833 return (uint64_t)ret_conv;
8836 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
8837 LDKThirtyTwoBytes o_ref;
8838 CHECK(*((uint32_t*)o) == 32);
8839 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8840 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8841 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
8842 return (uint64_t)ret_conv;
8845 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
8846 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8847 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
8848 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8849 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
8850 return (uint64_t)ret_conv;
8853 void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
8854 if ((_res & 1) != 0) return;
8855 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8857 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
8860 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
8861 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
8862 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8863 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
8864 return (uint64_t)ret_conv;
8867 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
8868 LDKCVec_NetAddressZ _res_constr;
8869 _res_constr.datalen = *((uint32_t*)_res);
8870 if (_res_constr.datalen > 0)
8871 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8873 _res_constr.data = NULL;
8874 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8875 for (size_t m = 0; m < _res_constr.datalen; m++) {
8876 uint32_t _res_conv_12 = _res_vals[m];
8877 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
8878 FREE((void*)_res_conv_12);
8879 _res_constr.data[m] = _res_conv_12_conv;
8881 CVec_NetAddressZ_free(_res_constr);
8884 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
8885 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
8886 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8887 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
8888 return (uint64_t)ret_ref;
8891 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
8892 LDKThirtyTwoBytes a_ref;
8893 CHECK(*((uint32_t*)a) == 32);
8894 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8895 LDKThirtyTwoBytes b_ref;
8896 CHECK(*((uint32_t*)b) == 32);
8897 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8898 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8899 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
8900 return (uint64_t)ret_ref;
8903 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
8904 if ((_res & 1) != 0) return;
8905 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
8907 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
8910 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
8911 LDKThirtyTwoBytes o_ref;
8912 CHECK(*((uint32_t*)o) == 32);
8913 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8914 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8915 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
8916 return (uint64_t)ret_conv;
8919 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
8920 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8921 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
8922 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8923 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
8924 return (uint64_t)ret_conv;
8927 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
8928 if ((_res & 1) != 0) return;
8929 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
8931 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
8934 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
8935 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
8936 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8937 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
8938 return (uint64_t)ret_conv;
8941 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
8942 LDKCVec_ChannelMonitorZ _res_constr;
8943 _res_constr.datalen = *((uint32_t*)_res);
8944 if (_res_constr.datalen > 0)
8945 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8947 _res_constr.data = NULL;
8948 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8949 for (size_t q = 0; q < _res_constr.datalen; q++) {
8950 uint32_t _res_conv_16 = _res_vals[q];
8951 LDKChannelMonitor _res_conv_16_conv;
8952 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8953 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8954 _res_constr.data[q] = _res_conv_16_conv;
8956 CVec_ChannelMonitorZ_free(_res_constr);
8959 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
8960 LDKThirtyTwoBytes a_ref;
8961 CHECK(*((uint32_t*)a) == 32);
8962 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8963 LDKChannelManager b_conv;
8964 b_conv.inner = (void*)(b & (~1));
8965 b_conv.is_owned = (b & 1) || (b == 0);
8966 // Warning: we need a move here but no clone is available for LDKChannelManager
8967 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8968 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8969 return (uint64_t)ret_ref;
8972 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
8973 if ((_res & 1) != 0) return;
8974 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8976 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8979 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
8980 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8981 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
8982 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8983 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8984 return (uint64_t)ret_conv;
8987 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
8988 LDKDecodeError e_conv;
8989 e_conv.inner = (void*)(e & (~1));
8990 e_conv.is_owned = (e & 1) || (e == 0);
8991 e_conv = DecodeError_clone(&e_conv);
8992 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8993 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8994 return (uint64_t)ret_conv;
8997 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
8998 if ((_res & 1) != 0) return;
8999 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9001 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9004 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9005 LDKChannelConfig o_conv;
9006 o_conv.inner = (void*)(o & (~1));
9007 o_conv.is_owned = (o & 1) || (o == 0);
9008 o_conv = ChannelConfig_clone(&o_conv);
9009 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9010 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9011 return (uint64_t)ret_conv;
9014 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9015 LDKDecodeError e_conv;
9016 e_conv.inner = (void*)(e & (~1));
9017 e_conv.is_owned = (e & 1) || (e == 0);
9018 e_conv = DecodeError_clone(&e_conv);
9019 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9020 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9021 return (uint64_t)ret_conv;
9024 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9025 if ((_res & 1) != 0) return;
9026 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
9028 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9031 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9032 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9033 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9034 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9035 return (uint64_t)ret_conv;
9038 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9040 o_conv.inner = (void*)(o & (~1));
9041 o_conv.is_owned = (o & 1) || (o == 0);
9042 o_conv = OutPoint_clone(&o_conv);
9043 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9044 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9045 return (uint64_t)ret_conv;
9048 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9049 LDKDecodeError e_conv;
9050 e_conv.inner = (void*)(e & (~1));
9051 e_conv.is_owned = (e & 1) || (e == 0);
9052 e_conv = DecodeError_clone(&e_conv);
9053 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9054 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9055 return (uint64_t)ret_conv;
9058 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9059 if ((_res & 1) != 0) return;
9060 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
9062 CResult_OutPointDecodeErrorZ_free(_res_conv);
9065 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9066 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9067 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9068 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9069 return (uint64_t)ret_conv;
9072 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9073 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
9074 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9075 *ret_copy = COption_TypeZ_some(o_conv);
9076 uint64_t ret_ref = (uint64_t)ret_copy;
9080 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9081 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9082 *ret_copy = COption_TypeZ_none();
9083 uint64_t ret_ref = (uint64_t)ret_copy;
9087 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9088 if ((_res & 1) != 0) return;
9089 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
9091 COption_TypeZ_free(_res_conv);
9094 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9095 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9096 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9097 *ret_copy = COption_TypeZ_clone(orig_conv);
9098 uint64_t ret_ref = (uint64_t)ret_copy;
9102 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9103 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
9104 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9105 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9106 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9107 return (uint64_t)ret_conv;
9110 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9111 LDKDecodeError e_conv;
9112 e_conv.inner = (void*)(e & (~1));
9113 e_conv.is_owned = (e & 1) || (e == 0);
9114 e_conv = DecodeError_clone(&e_conv);
9115 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9116 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9117 return (uint64_t)ret_conv;
9120 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9121 if ((_res & 1) != 0) return;
9122 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9124 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9127 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9128 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9129 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9130 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9131 return (uint64_t)ret_conv;
9134 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9135 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9136 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9137 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9138 return (uint64_t)ret_conv;
9141 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9142 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9143 *ret_conv = CResult_SiPrefixNoneZ_err();
9144 return (uint64_t)ret_conv;
9147 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9148 if ((_res & 1) != 0) return;
9149 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
9151 CResult_SiPrefixNoneZ_free(_res_conv);
9154 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9155 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9156 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9157 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9158 return (uint64_t)ret_conv;
9161 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9163 o_conv.inner = (void*)(o & (~1));
9164 o_conv.is_owned = (o & 1) || (o == 0);
9165 o_conv = Invoice_clone(&o_conv);
9166 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9167 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9168 return (uint64_t)ret_conv;
9171 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9172 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9173 *ret_conv = CResult_InvoiceNoneZ_err();
9174 return (uint64_t)ret_conv;
9177 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9178 if ((_res & 1) != 0) return;
9179 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
9181 CResult_InvoiceNoneZ_free(_res_conv);
9184 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9185 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9186 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9187 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9188 return (uint64_t)ret_conv;
9191 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9192 LDKSignedRawInvoice o_conv;
9193 o_conv.inner = (void*)(o & (~1));
9194 o_conv.is_owned = (o & 1) || (o == 0);
9195 o_conv = SignedRawInvoice_clone(&o_conv);
9196 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9197 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9198 return (uint64_t)ret_conv;
9201 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9202 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9203 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9204 return (uint64_t)ret_conv;
9207 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9208 if ((_res & 1) != 0) return;
9209 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
9211 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9214 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9215 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9216 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9217 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9218 return (uint64_t)ret_conv;
9221 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9222 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
9223 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9224 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
9225 return (uint64_t)ret_ref;
9228 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
9229 LDKRawInvoice a_conv;
9230 a_conv.inner = (void*)(a & (~1));
9231 a_conv.is_owned = (a & 1) || (a == 0);
9232 a_conv = RawInvoice_clone(&a_conv);
9233 LDKThirtyTwoBytes b_ref;
9234 CHECK(*((uint32_t*)b) == 32);
9235 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9236 LDKInvoiceSignature c_conv;
9237 c_conv.inner = (void*)(c & (~1));
9238 c_conv.is_owned = (c & 1) || (c == 0);
9239 c_conv = InvoiceSignature_clone(&c_conv);
9240 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9241 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
9242 return (uint64_t)ret_ref;
9245 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
9246 if ((_res & 1) != 0) return;
9247 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
9249 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
9252 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
9253 LDKPayeePubKey o_conv;
9254 o_conv.inner = (void*)(o & (~1));
9255 o_conv.is_owned = (o & 1) || (o == 0);
9256 o_conv = PayeePubKey_clone(&o_conv);
9257 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9258 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
9259 return (uint64_t)ret_conv;
9262 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
9263 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9264 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9265 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
9266 return (uint64_t)ret_conv;
9269 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
9270 if ((_res & 1) != 0) return;
9271 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
9273 CResult_PayeePubKeyErrorZ_free(_res_conv);
9276 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
9277 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
9278 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9279 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
9280 return (uint64_t)ret_conv;
9283 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
9284 LDKCVec_PrivateRouteZ _res_constr;
9285 _res_constr.datalen = *((uint32_t*)_res);
9286 if (_res_constr.datalen > 0)
9287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
9289 _res_constr.data = NULL;
9290 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9291 for (size_t o = 0; o < _res_constr.datalen; o++) {
9292 uint32_t _res_conv_14 = _res_vals[o];
9293 LDKPrivateRoute _res_conv_14_conv;
9294 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9295 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9296 _res_constr.data[o] = _res_conv_14_conv;
9298 CVec_PrivateRouteZ_free(_res_constr);
9301 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
9302 LDKPositiveTimestamp o_conv;
9303 o_conv.inner = (void*)(o & (~1));
9304 o_conv.is_owned = (o & 1) || (o == 0);
9305 o_conv = PositiveTimestamp_clone(&o_conv);
9306 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9307 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
9308 return (uint64_t)ret_conv;
9311 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
9312 LDKCreationError e_conv = LDKCreationError_from_js(e);
9313 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9314 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
9315 return (uint64_t)ret_conv;
9318 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
9319 if ((_res & 1) != 0) return;
9320 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
9322 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
9325 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
9326 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
9327 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9328 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
9329 return (uint64_t)ret_conv;
9332 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
9333 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9334 *ret_conv = CResult_NoneSemanticErrorZ_ok();
9335 return (uint64_t)ret_conv;
9338 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
9339 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9340 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9341 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
9342 return (uint64_t)ret_conv;
9345 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
9346 if ((_res & 1) != 0) return;
9347 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
9349 CResult_NoneSemanticErrorZ_free(_res_conv);
9352 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
9353 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
9354 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9355 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
9356 return (uint64_t)ret_conv;
9359 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
9361 o_conv.inner = (void*)(o & (~1));
9362 o_conv.is_owned = (o & 1) || (o == 0);
9363 o_conv = Invoice_clone(&o_conv);
9364 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9365 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
9366 return (uint64_t)ret_conv;
9369 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
9370 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9371 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9372 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
9373 return (uint64_t)ret_conv;
9376 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
9377 if ((_res & 1) != 0) return;
9378 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
9380 CResult_InvoiceSemanticErrorZ_free(_res_conv);
9383 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
9384 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
9385 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9386 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
9387 return (uint64_t)ret_conv;
9390 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
9391 LDKDescription o_conv;
9392 o_conv.inner = (void*)(o & (~1));
9393 o_conv.is_owned = (o & 1) || (o == 0);
9394 o_conv = Description_clone(&o_conv);
9395 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9396 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
9397 return (uint64_t)ret_conv;
9400 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
9401 LDKCreationError e_conv = LDKCreationError_from_js(e);
9402 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9403 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
9404 return (uint64_t)ret_conv;
9407 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
9408 if ((_res & 1) != 0) return;
9409 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
9411 CResult_DescriptionCreationErrorZ_free(_res_conv);
9414 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
9415 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
9416 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9417 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
9418 return (uint64_t)ret_conv;
9421 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
9422 LDKExpiryTime o_conv;
9423 o_conv.inner = (void*)(o & (~1));
9424 o_conv.is_owned = (o & 1) || (o == 0);
9425 o_conv = ExpiryTime_clone(&o_conv);
9426 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9427 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
9428 return (uint64_t)ret_conv;
9431 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
9432 LDKCreationError e_conv = LDKCreationError_from_js(e);
9433 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9434 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
9435 return (uint64_t)ret_conv;
9438 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
9439 if ((_res & 1) != 0) return;
9440 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
9442 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
9445 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
9446 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
9447 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9448 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
9449 return (uint64_t)ret_conv;
9452 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
9453 LDKPrivateRoute o_conv;
9454 o_conv.inner = (void*)(o & (~1));
9455 o_conv.is_owned = (o & 1) || (o == 0);
9456 o_conv = PrivateRoute_clone(&o_conv);
9457 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9458 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
9459 return (uint64_t)ret_conv;
9462 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
9463 LDKCreationError e_conv = LDKCreationError_from_js(e);
9464 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9465 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
9466 return (uint64_t)ret_conv;
9469 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
9470 if ((_res & 1) != 0) return;
9471 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
9473 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
9476 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
9477 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
9478 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9479 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
9480 return (uint64_t)ret_conv;
9483 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
9484 LDKStr o_conv = str_ref_to_owned_c(o);
9485 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9486 *ret_conv = CResult_StringErrorZ_ok(o_conv);
9487 return (uint64_t)ret_conv;
9490 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
9491 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9492 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9493 *ret_conv = CResult_StringErrorZ_err(e_conv);
9494 return (uint64_t)ret_conv;
9497 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
9498 if ((_res & 1) != 0) return;
9499 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
9501 CResult_StringErrorZ_free(_res_conv);
9504 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
9505 LDKChannelMonitorUpdate o_conv;
9506 o_conv.inner = (void*)(o & (~1));
9507 o_conv.is_owned = (o & 1) || (o == 0);
9508 o_conv = ChannelMonitorUpdate_clone(&o_conv);
9509 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9510 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
9511 return (uint64_t)ret_conv;
9514 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
9515 LDKDecodeError e_conv;
9516 e_conv.inner = (void*)(e & (~1));
9517 e_conv.is_owned = (e & 1) || (e == 0);
9518 e_conv = DecodeError_clone(&e_conv);
9519 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9520 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
9521 return (uint64_t)ret_conv;
9524 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
9525 if ((_res & 1) != 0) return;
9526 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9528 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
9531 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
9532 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
9533 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9534 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
9535 return (uint64_t)ret_conv;
9538 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
9539 LDKHTLCUpdate o_conv;
9540 o_conv.inner = (void*)(o & (~1));
9541 o_conv.is_owned = (o & 1) || (o == 0);
9542 o_conv = HTLCUpdate_clone(&o_conv);
9543 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9544 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
9545 return (uint64_t)ret_conv;
9548 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
9549 LDKDecodeError e_conv;
9550 e_conv.inner = (void*)(e & (~1));
9551 e_conv.is_owned = (e & 1) || (e == 0);
9552 e_conv = DecodeError_clone(&e_conv);
9553 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9554 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
9555 return (uint64_t)ret_conv;
9558 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
9559 if ((_res & 1) != 0) return;
9560 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9562 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
9565 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
9566 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
9567 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9568 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
9569 return (uint64_t)ret_conv;
9572 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
9573 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9574 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
9575 return (uint64_t)ret_conv;
9578 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
9579 LDKMonitorUpdateError e_conv;
9580 e_conv.inner = (void*)(e & (~1));
9581 e_conv.is_owned = (e & 1) || (e == 0);
9582 e_conv = MonitorUpdateError_clone(&e_conv);
9583 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9584 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
9585 return (uint64_t)ret_conv;
9588 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
9589 if ((_res & 1) != 0) return;
9590 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
9592 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
9595 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
9596 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
9597 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9598 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
9599 return (uint64_t)ret_conv;
9602 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
9603 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
9604 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9605 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
9606 return (uint64_t)ret_ref;
9609 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
9611 a_conv.inner = (void*)(a & (~1));
9612 a_conv.is_owned = (a & 1) || (a == 0);
9613 a_conv = OutPoint_clone(&a_conv);
9615 b_ref.datalen = *((uint32_t*)b);
9616 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9617 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9618 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9619 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
9620 return (uint64_t)ret_ref;
9623 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
9624 if ((_res & 1) != 0) return;
9625 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
9627 C2Tuple_OutPointScriptZ_free(_res_conv);
9630 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
9631 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
9632 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9633 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
9634 return (uint64_t)ret_ref;
9637 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
9639 b_ref.datalen = *((uint32_t*)b);
9640 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9641 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9642 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9643 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
9644 return (uint64_t)ret_ref;
9647 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
9648 if ((_res & 1) != 0) return;
9649 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
9651 C2Tuple_u32ScriptZ_free(_res_conv);
9654 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
9655 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
9656 _res_constr.datalen = *((uint32_t*)_res);
9657 if (_res_constr.datalen > 0)
9658 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9660 _res_constr.data = NULL;
9661 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9662 for (size_t e = 0; e < _res_constr.datalen; e++) {
9663 uint32_t _res_conv_30 = _res_vals[e];
9664 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
9665 FREE((void*)_res_conv_30);
9666 _res_constr.data[e] = _res_conv_30_conv;
9668 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
9671 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
9672 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
9673 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9674 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
9675 return (uint64_t)ret_ref;
9678 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
9679 LDKThirtyTwoBytes a_ref;
9680 CHECK(*((uint32_t*)a) == 32);
9681 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9682 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
9683 b_constr.datalen = *((uint32_t*)b);
9684 if (b_constr.datalen > 0)
9685 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9687 b_constr.data = NULL;
9688 uint32_t* b_vals = (uint32_t*)(b + 4);
9689 for (size_t e = 0; e < b_constr.datalen; e++) {
9690 uint32_t b_conv_30 = b_vals[e];
9691 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
9692 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
9693 b_constr.data[e] = b_conv_30_conv;
9695 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9696 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
9697 return (uint64_t)ret_ref;
9700 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
9701 if ((_res & 1) != 0) return;
9702 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
9704 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
9707 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
9708 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
9709 _res_constr.datalen = *((uint32_t*)_res);
9710 if (_res_constr.datalen > 0)
9711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
9713 _res_constr.data = NULL;
9714 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9715 for (size_t c = 0; c < _res_constr.datalen; c++) {
9716 uint32_t _res_conv_54 = _res_vals[c];
9717 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
9718 FREE((void*)_res_conv_54);
9719 _res_constr.data[c] = _res_conv_54_conv;
9721 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
9724 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
9725 LDKCVec_EventZ _res_constr;
9726 _res_constr.datalen = *((uint32_t*)_res);
9727 if (_res_constr.datalen > 0)
9728 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
9730 _res_constr.data = NULL;
9731 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9732 for (size_t h = 0; h < _res_constr.datalen; h++) {
9733 uint32_t _res_conv_7 = _res_vals[h];
9734 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
9735 FREE((void*)_res_conv_7);
9736 _res_constr.data[h] = _res_conv_7_conv;
9738 CVec_EventZ_free(_res_constr);
9741 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
9742 LDKCVec_TransactionZ _res_constr;
9743 _res_constr.datalen = *((uint32_t*)_res);
9744 if (_res_constr.datalen > 0)
9745 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9747 _res_constr.data = NULL;
9748 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9749 for (size_t m = 0; m < _res_constr.datalen; m++) {
9750 int8_tArray _res_conv_12 = _res_vals[m];
9751 LDKTransaction _res_conv_12_ref;
9752 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9753 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
9754 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9755 _res_conv_12_ref.data_is_owned = true;
9756 _res_constr.data[m] = _res_conv_12_ref;
9758 CVec_TransactionZ_free(_res_constr);
9761 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
9762 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
9763 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9764 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
9765 return (uint64_t)ret_ref;
9768 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
9769 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
9770 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
9771 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9772 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
9773 return (uint64_t)ret_ref;
9776 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
9777 if ((_res & 1) != 0) return;
9778 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
9780 C2Tuple_u32TxOutZ_free(_res_conv);
9783 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
9784 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
9785 _res_constr.datalen = *((uint32_t*)_res);
9786 if (_res_constr.datalen > 0)
9787 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9789 _res_constr.data = NULL;
9790 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9791 for (size_t z = 0; z < _res_constr.datalen; z++) {
9792 uint32_t _res_conv_25 = _res_vals[z];
9793 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
9794 FREE((void*)_res_conv_25);
9795 _res_constr.data[z] = _res_conv_25_conv;
9797 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
9800 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
9801 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
9802 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9803 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
9804 return (uint64_t)ret_ref;
9807 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
9808 LDKThirtyTwoBytes a_ref;
9809 CHECK(*((uint32_t*)a) == 32);
9810 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9811 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
9812 b_constr.datalen = *((uint32_t*)b);
9813 if (b_constr.datalen > 0)
9814 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9816 b_constr.data = NULL;
9817 uint32_t* b_vals = (uint32_t*)(b + 4);
9818 for (size_t z = 0; z < b_constr.datalen; z++) {
9819 uint32_t b_conv_25 = b_vals[z];
9820 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
9821 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
9822 b_constr.data[z] = b_conv_25_conv;
9824 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9825 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
9826 return (uint64_t)ret_ref;
9829 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
9830 if ((_res & 1) != 0) return;
9831 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
9833 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
9836 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
9837 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
9838 _res_constr.datalen = *((uint32_t*)_res);
9839 if (_res_constr.datalen > 0)
9840 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
9842 _res_constr.data = NULL;
9843 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9844 for (size_t x = 0; x < _res_constr.datalen; x++) {
9845 uint32_t _res_conv_49 = _res_vals[x];
9846 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
9847 FREE((void*)_res_conv_49);
9848 _res_constr.data[x] = _res_conv_49_conv;
9850 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
9853 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
9854 LDKCVec_BalanceZ _res_constr;
9855 _res_constr.datalen = *((uint32_t*)_res);
9856 if (_res_constr.datalen > 0)
9857 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
9859 _res_constr.data = NULL;
9860 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9861 for (size_t j = 0; j < _res_constr.datalen; j++) {
9862 uint32_t _res_conv_9 = _res_vals[j];
9863 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
9864 FREE((void*)_res_conv_9);
9865 _res_constr.data[j] = _res_conv_9_conv;
9867 CVec_BalanceZ_free(_res_constr);
9870 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
9871 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
9872 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
9873 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9874 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
9875 return (uint64_t)ret_conv;
9878 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
9879 LDKDecodeError e_conv;
9880 e_conv.inner = (void*)(e & (~1));
9881 e_conv.is_owned = (e & 1) || (e == 0);
9882 e_conv = DecodeError_clone(&e_conv);
9883 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9884 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
9885 return (uint64_t)ret_conv;
9888 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
9889 if ((_res & 1) != 0) return;
9890 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9892 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
9895 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
9896 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9897 *ret_conv = CResult_NoneLightningErrorZ_ok();
9898 return (uint64_t)ret_conv;
9901 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
9902 LDKLightningError e_conv;
9903 e_conv.inner = (void*)(e & (~1));
9904 e_conv.is_owned = (e & 1) || (e == 0);
9905 e_conv = LightningError_clone(&e_conv);
9906 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9907 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
9908 return (uint64_t)ret_conv;
9911 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
9912 if ((_res & 1) != 0) return;
9913 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
9915 CResult_NoneLightningErrorZ_free(_res_conv);
9918 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
9919 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
9920 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9921 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
9922 return (uint64_t)ret_conv;
9925 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
9926 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
9927 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9928 *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
9929 return (uint64_t)ret_ref;
9932 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
9934 CHECK(*((uint32_t*)a) == 33);
9935 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
9936 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
9937 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9938 *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
9939 return (uint64_t)ret_ref;
9942 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
9943 if ((_res & 1) != 0) return;
9944 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
9946 C2Tuple_PublicKeyTypeZ_free(_res_conv);
9949 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
9950 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
9951 _res_constr.datalen = *((uint32_t*)_res);
9952 if (_res_constr.datalen > 0)
9953 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9955 _res_constr.data = NULL;
9956 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9957 for (size_t c = 0; c < _res_constr.datalen; c++) {
9958 uint32_t _res_conv_28 = _res_vals[c];
9959 LDKC2Tuple_PublicKeyTypeZ _res_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_28) & ~1);
9960 FREE((void*)_res_conv_28);
9961 _res_constr.data[c] = _res_conv_28_conv;
9963 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
9966 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
9967 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9968 *ret_conv = CResult_boolLightningErrorZ_ok(o);
9969 return (uint64_t)ret_conv;
9972 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
9973 LDKLightningError e_conv;
9974 e_conv.inner = (void*)(e & (~1));
9975 e_conv.is_owned = (e & 1) || (e == 0);
9976 e_conv = LightningError_clone(&e_conv);
9977 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9978 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
9979 return (uint64_t)ret_conv;
9982 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
9983 if ((_res & 1) != 0) return;
9984 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
9986 CResult_boolLightningErrorZ_free(_res_conv);
9989 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
9990 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
9991 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9992 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
9993 return (uint64_t)ret_conv;
9996 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
9997 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
9998 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9999 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
10000 return (uint64_t)ret_ref;
10003 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10004 LDKChannelAnnouncement a_conv;
10005 a_conv.inner = (void*)(a & (~1));
10006 a_conv.is_owned = (a & 1) || (a == 0);
10007 a_conv = ChannelAnnouncement_clone(&a_conv);
10008 LDKChannelUpdate b_conv;
10009 b_conv.inner = (void*)(b & (~1));
10010 b_conv.is_owned = (b & 1) || (b == 0);
10011 b_conv = ChannelUpdate_clone(&b_conv);
10012 LDKChannelUpdate c_conv;
10013 c_conv.inner = (void*)(c & (~1));
10014 c_conv.is_owned = (c & 1) || (c == 0);
10015 c_conv = ChannelUpdate_clone(&c_conv);
10016 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10017 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10018 return (uint64_t)ret_ref;
10021 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10022 if ((_res & 1) != 0) return;
10023 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
10025 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10028 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10029 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10030 _res_constr.datalen = *((uint32_t*)_res);
10031 if (_res_constr.datalen > 0)
10032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10034 _res_constr.data = NULL;
10035 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10036 for (size_t l = 0; l < _res_constr.datalen; l++) {
10037 uint32_t _res_conv_63 = _res_vals[l];
10038 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
10039 FREE((void*)_res_conv_63);
10040 _res_constr.data[l] = _res_conv_63_conv;
10042 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10045 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10046 LDKCVec_NodeAnnouncementZ _res_constr;
10047 _res_constr.datalen = *((uint32_t*)_res);
10048 if (_res_constr.datalen > 0)
10049 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10051 _res_constr.data = NULL;
10052 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10053 for (size_t s = 0; s < _res_constr.datalen; s++) {
10054 uint32_t _res_conv_18 = _res_vals[s];
10055 LDKNodeAnnouncement _res_conv_18_conv;
10056 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10057 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10058 _res_constr.data[s] = _res_conv_18_conv;
10060 CVec_NodeAnnouncementZ_free(_res_constr);
10063 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10064 LDKCVec_PublicKeyZ _res_constr;
10065 _res_constr.datalen = *((uint32_t*)_res);
10066 if (_res_constr.datalen > 0)
10067 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10069 _res_constr.data = NULL;
10070 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10071 for (size_t m = 0; m < _res_constr.datalen; m++) {
10072 int8_tArray _res_conv_12 = _res_vals[m];
10073 LDKPublicKey _res_conv_12_ref;
10074 CHECK(*((uint32_t*)_res_conv_12) == 33);
10075 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10076 _res_constr.data[m] = _res_conv_12_ref;
10078 CVec_PublicKeyZ_free(_res_constr);
10081 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10083 o_ref.datalen = *((uint32_t*)o);
10084 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10085 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10086 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10087 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10088 return (uint64_t)ret_conv;
10091 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10092 LDKPeerHandleError e_conv;
10093 e_conv.inner = (void*)(e & (~1));
10094 e_conv.is_owned = (e & 1) || (e == 0);
10095 e_conv = PeerHandleError_clone(&e_conv);
10096 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10097 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10098 return (uint64_t)ret_conv;
10101 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10102 if ((_res & 1) != 0) return;
10103 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10105 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10108 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10109 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10110 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10111 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10112 return (uint64_t)ret_conv;
10115 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10116 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10117 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10118 return (uint64_t)ret_conv;
10121 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10122 LDKPeerHandleError e_conv;
10123 e_conv.inner = (void*)(e & (~1));
10124 e_conv.is_owned = (e & 1) || (e == 0);
10125 e_conv = PeerHandleError_clone(&e_conv);
10126 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10127 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10128 return (uint64_t)ret_conv;
10131 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10132 if ((_res & 1) != 0) return;
10133 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10135 CResult_NonePeerHandleErrorZ_free(_res_conv);
10138 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10139 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10140 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10141 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
10142 return (uint64_t)ret_conv;
10145 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
10146 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10147 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
10148 return (uint64_t)ret_conv;
10151 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
10152 LDKPeerHandleError e_conv;
10153 e_conv.inner = (void*)(e & (~1));
10154 e_conv.is_owned = (e & 1) || (e == 0);
10155 e_conv = PeerHandleError_clone(&e_conv);
10156 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10157 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
10158 return (uint64_t)ret_conv;
10161 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
10162 if ((_res & 1) != 0) return;
10163 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10165 CResult_boolPeerHandleErrorZ_free(_res_conv);
10168 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
10169 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
10170 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10171 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
10172 return (uint64_t)ret_conv;
10175 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
10176 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
10177 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10178 *ret_copy = COption_AccessZ_some(o_conv);
10179 uint64_t ret_ref = (uint64_t)ret_copy;
10183 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
10184 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10185 *ret_copy = COption_AccessZ_none();
10186 uint64_t ret_ref = (uint64_t)ret_copy;
10190 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
10191 if ((_res & 1) != 0) return;
10192 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
10194 COption_AccessZ_free(_res_conv);
10197 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
10198 LDKDirectionalChannelInfo o_conv;
10199 o_conv.inner = (void*)(o & (~1));
10200 o_conv.is_owned = (o & 1) || (o == 0);
10201 o_conv = DirectionalChannelInfo_clone(&o_conv);
10202 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10203 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
10204 return (uint64_t)ret_conv;
10207 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
10208 LDKDecodeError e_conv;
10209 e_conv.inner = (void*)(e & (~1));
10210 e_conv.is_owned = (e & 1) || (e == 0);
10211 e_conv = DecodeError_clone(&e_conv);
10212 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10213 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
10214 return (uint64_t)ret_conv;
10217 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
10218 if ((_res & 1) != 0) return;
10219 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10221 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
10224 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10225 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
10226 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10227 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
10228 return (uint64_t)ret_conv;
10231 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
10232 LDKChannelInfo o_conv;
10233 o_conv.inner = (void*)(o & (~1));
10234 o_conv.is_owned = (o & 1) || (o == 0);
10235 o_conv = ChannelInfo_clone(&o_conv);
10236 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10237 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
10238 return (uint64_t)ret_conv;
10241 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
10242 LDKDecodeError e_conv;
10243 e_conv.inner = (void*)(e & (~1));
10244 e_conv.is_owned = (e & 1) || (e == 0);
10245 e_conv = DecodeError_clone(&e_conv);
10246 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10247 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
10248 return (uint64_t)ret_conv;
10251 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
10252 if ((_res & 1) != 0) return;
10253 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10255 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
10258 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10259 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
10260 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10261 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
10262 return (uint64_t)ret_conv;
10265 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
10266 LDKRoutingFees o_conv;
10267 o_conv.inner = (void*)(o & (~1));
10268 o_conv.is_owned = (o & 1) || (o == 0);
10269 o_conv = RoutingFees_clone(&o_conv);
10270 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10271 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
10272 return (uint64_t)ret_conv;
10275 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
10276 LDKDecodeError e_conv;
10277 e_conv.inner = (void*)(e & (~1));
10278 e_conv.is_owned = (e & 1) || (e == 0);
10279 e_conv = DecodeError_clone(&e_conv);
10280 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10281 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
10282 return (uint64_t)ret_conv;
10285 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
10286 if ((_res & 1) != 0) return;
10287 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10289 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
10292 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
10293 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
10294 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10295 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
10296 return (uint64_t)ret_conv;
10299 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
10300 LDKNodeAnnouncementInfo o_conv;
10301 o_conv.inner = (void*)(o & (~1));
10302 o_conv.is_owned = (o & 1) || (o == 0);
10303 o_conv = NodeAnnouncementInfo_clone(&o_conv);
10304 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10305 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
10306 return (uint64_t)ret_conv;
10309 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
10310 LDKDecodeError e_conv;
10311 e_conv.inner = (void*)(e & (~1));
10312 e_conv.is_owned = (e & 1) || (e == 0);
10313 e_conv = DecodeError_clone(&e_conv);
10314 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10315 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
10316 return (uint64_t)ret_conv;
10319 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
10320 if ((_res & 1) != 0) return;
10321 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10323 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
10326 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
10327 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
10328 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10329 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
10330 return (uint64_t)ret_conv;
10333 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
10334 LDKCVec_u64Z _res_constr;
10335 _res_constr.datalen = *((uint32_t*)_res);
10336 if (_res_constr.datalen > 0)
10337 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10339 _res_constr.data = NULL;
10340 int64_t* _res_vals = (int64_t*)(_res + 4);
10341 for (size_t i = 0; i < _res_constr.datalen; i++) {
10342 int64_t _res_conv_8 = _res_vals[i];
10343 _res_constr.data[i] = _res_conv_8;
10345 CVec_u64Z_free(_res_constr);
10348 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
10349 LDKNodeInfo o_conv;
10350 o_conv.inner = (void*)(o & (~1));
10351 o_conv.is_owned = (o & 1) || (o == 0);
10352 o_conv = NodeInfo_clone(&o_conv);
10353 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10354 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
10355 return (uint64_t)ret_conv;
10358 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
10359 LDKDecodeError e_conv;
10360 e_conv.inner = (void*)(e & (~1));
10361 e_conv.is_owned = (e & 1) || (e == 0);
10362 e_conv = DecodeError_clone(&e_conv);
10363 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10364 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
10365 return (uint64_t)ret_conv;
10368 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
10369 if ((_res & 1) != 0) return;
10370 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10372 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
10375 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
10376 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
10377 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10378 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
10379 return (uint64_t)ret_conv;
10382 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
10383 LDKNetworkGraph o_conv;
10384 o_conv.inner = (void*)(o & (~1));
10385 o_conv.is_owned = (o & 1) || (o == 0);
10386 // Warning: we need a move here but no clone is available for LDKNetworkGraph
10387 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10388 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
10389 return (uint64_t)ret_conv;
10392 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
10393 LDKDecodeError e_conv;
10394 e_conv.inner = (void*)(e & (~1));
10395 e_conv.is_owned = (e & 1) || (e == 0);
10396 e_conv = DecodeError_clone(&e_conv);
10397 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10398 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
10399 return (uint64_t)ret_conv;
10402 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
10403 if ((_res & 1) != 0) return;
10404 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
10406 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
10409 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
10410 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10411 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10412 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10413 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
10414 return (uint64_t)ret_conv;
10417 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
10418 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10419 *ret_conv = CResult_NetAddressu8Z_err(e);
10420 return (uint64_t)ret_conv;
10423 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
10424 if ((_res & 1) != 0) return;
10425 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
10427 CResult_NetAddressu8Z_free(_res_conv);
10430 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
10431 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
10432 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10433 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
10434 return (uint64_t)ret_conv;
10437 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
10438 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
10439 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
10440 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10441 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
10442 return (uint64_t)ret_conv;
10445 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
10446 LDKDecodeError e_conv;
10447 e_conv.inner = (void*)(e & (~1));
10448 e_conv.is_owned = (e & 1) || (e == 0);
10449 e_conv = DecodeError_clone(&e_conv);
10450 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10451 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
10452 return (uint64_t)ret_conv;
10455 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
10456 if ((_res & 1) != 0) return;
10457 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10459 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
10462 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
10463 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
10464 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10465 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
10466 return (uint64_t)ret_conv;
10469 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
10470 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10471 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10472 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10473 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
10474 return (uint64_t)ret_conv;
10477 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
10478 LDKDecodeError e_conv;
10479 e_conv.inner = (void*)(e & (~1));
10480 e_conv.is_owned = (e & 1) || (e == 0);
10481 e_conv = DecodeError_clone(&e_conv);
10482 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10483 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
10484 return (uint64_t)ret_conv;
10487 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
10488 if ((_res & 1) != 0) return;
10489 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
10491 CResult_NetAddressDecodeErrorZ_free(_res_conv);
10494 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
10495 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
10496 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10497 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
10498 return (uint64_t)ret_conv;
10501 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
10502 LDKCVec_UpdateAddHTLCZ _res_constr;
10503 _res_constr.datalen = *((uint32_t*)_res);
10504 if (_res_constr.datalen > 0)
10505 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10507 _res_constr.data = NULL;
10508 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10509 for (size_t p = 0; p < _res_constr.datalen; p++) {
10510 uint32_t _res_conv_15 = _res_vals[p];
10511 LDKUpdateAddHTLC _res_conv_15_conv;
10512 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
10513 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
10514 _res_constr.data[p] = _res_conv_15_conv;
10516 CVec_UpdateAddHTLCZ_free(_res_constr);
10519 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
10520 LDKCVec_UpdateFulfillHTLCZ _res_constr;
10521 _res_constr.datalen = *((uint32_t*)_res);
10522 if (_res_constr.datalen > 0)
10523 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10525 _res_constr.data = NULL;
10526 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10527 for (size_t t = 0; t < _res_constr.datalen; t++) {
10528 uint32_t _res_conv_19 = _res_vals[t];
10529 LDKUpdateFulfillHTLC _res_conv_19_conv;
10530 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
10531 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
10532 _res_constr.data[t] = _res_conv_19_conv;
10534 CVec_UpdateFulfillHTLCZ_free(_res_constr);
10537 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
10538 LDKCVec_UpdateFailHTLCZ _res_constr;
10539 _res_constr.datalen = *((uint32_t*)_res);
10540 if (_res_constr.datalen > 0)
10541 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10543 _res_constr.data = NULL;
10544 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10545 for (size_t q = 0; q < _res_constr.datalen; q++) {
10546 uint32_t _res_conv_16 = _res_vals[q];
10547 LDKUpdateFailHTLC _res_conv_16_conv;
10548 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10549 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10550 _res_constr.data[q] = _res_conv_16_conv;
10552 CVec_UpdateFailHTLCZ_free(_res_constr);
10555 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
10556 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
10557 _res_constr.datalen = *((uint32_t*)_res);
10558 if (_res_constr.datalen > 0)
10559 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10561 _res_constr.data = NULL;
10562 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10563 for (size_t z = 0; z < _res_constr.datalen; z++) {
10564 uint32_t _res_conv_25 = _res_vals[z];
10565 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
10566 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
10567 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
10568 _res_constr.data[z] = _res_conv_25_conv;
10570 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
10573 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
10574 LDKAcceptChannel o_conv;
10575 o_conv.inner = (void*)(o & (~1));
10576 o_conv.is_owned = (o & 1) || (o == 0);
10577 o_conv = AcceptChannel_clone(&o_conv);
10578 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10579 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
10580 return (uint64_t)ret_conv;
10583 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
10584 LDKDecodeError e_conv;
10585 e_conv.inner = (void*)(e & (~1));
10586 e_conv.is_owned = (e & 1) || (e == 0);
10587 e_conv = DecodeError_clone(&e_conv);
10588 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10589 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
10590 return (uint64_t)ret_conv;
10593 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
10594 if ((_res & 1) != 0) return;
10595 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10597 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
10600 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
10601 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
10602 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10603 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
10604 return (uint64_t)ret_conv;
10607 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
10608 LDKAnnouncementSignatures o_conv;
10609 o_conv.inner = (void*)(o & (~1));
10610 o_conv.is_owned = (o & 1) || (o == 0);
10611 o_conv = AnnouncementSignatures_clone(&o_conv);
10612 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10613 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
10614 return (uint64_t)ret_conv;
10617 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
10618 LDKDecodeError e_conv;
10619 e_conv.inner = (void*)(e & (~1));
10620 e_conv.is_owned = (e & 1) || (e == 0);
10621 e_conv = DecodeError_clone(&e_conv);
10622 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10623 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
10624 return (uint64_t)ret_conv;
10627 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
10628 if ((_res & 1) != 0) return;
10629 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10631 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
10634 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
10635 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
10636 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10637 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
10638 return (uint64_t)ret_conv;
10641 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
10642 LDKChannelReestablish o_conv;
10643 o_conv.inner = (void*)(o & (~1));
10644 o_conv.is_owned = (o & 1) || (o == 0);
10645 o_conv = ChannelReestablish_clone(&o_conv);
10646 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10647 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
10648 return (uint64_t)ret_conv;
10651 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
10652 LDKDecodeError e_conv;
10653 e_conv.inner = (void*)(e & (~1));
10654 e_conv.is_owned = (e & 1) || (e == 0);
10655 e_conv = DecodeError_clone(&e_conv);
10656 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10657 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
10658 return (uint64_t)ret_conv;
10661 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
10662 if ((_res & 1) != 0) return;
10663 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
10665 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
10668 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
10669 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
10670 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10671 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
10672 return (uint64_t)ret_conv;
10675 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
10676 LDKClosingSigned o_conv;
10677 o_conv.inner = (void*)(o & (~1));
10678 o_conv.is_owned = (o & 1) || (o == 0);
10679 o_conv = ClosingSigned_clone(&o_conv);
10680 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10681 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
10682 return (uint64_t)ret_conv;
10685 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
10686 LDKDecodeError e_conv;
10687 e_conv.inner = (void*)(e & (~1));
10688 e_conv.is_owned = (e & 1) || (e == 0);
10689 e_conv = DecodeError_clone(&e_conv);
10690 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10691 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
10692 return (uint64_t)ret_conv;
10695 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
10696 if ((_res & 1) != 0) return;
10697 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10699 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
10702 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
10703 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
10704 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10705 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
10706 return (uint64_t)ret_conv;
10709 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
10710 LDKClosingSignedFeeRange o_conv;
10711 o_conv.inner = (void*)(o & (~1));
10712 o_conv.is_owned = (o & 1) || (o == 0);
10713 o_conv = ClosingSignedFeeRange_clone(&o_conv);
10714 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10715 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
10716 return (uint64_t)ret_conv;
10719 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
10720 LDKDecodeError e_conv;
10721 e_conv.inner = (void*)(e & (~1));
10722 e_conv.is_owned = (e & 1) || (e == 0);
10723 e_conv = DecodeError_clone(&e_conv);
10724 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10725 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
10726 return (uint64_t)ret_conv;
10729 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
10730 if ((_res & 1) != 0) return;
10731 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10733 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
10736 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
10737 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
10738 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10739 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
10740 return (uint64_t)ret_conv;
10743 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
10744 LDKCommitmentSigned o_conv;
10745 o_conv.inner = (void*)(o & (~1));
10746 o_conv.is_owned = (o & 1) || (o == 0);
10747 o_conv = CommitmentSigned_clone(&o_conv);
10748 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10749 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
10750 return (uint64_t)ret_conv;
10753 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
10754 LDKDecodeError e_conv;
10755 e_conv.inner = (void*)(e & (~1));
10756 e_conv.is_owned = (e & 1) || (e == 0);
10757 e_conv = DecodeError_clone(&e_conv);
10758 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10759 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
10760 return (uint64_t)ret_conv;
10763 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
10764 if ((_res & 1) != 0) return;
10765 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10767 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
10770 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
10771 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
10772 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10773 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
10774 return (uint64_t)ret_conv;
10777 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
10778 LDKFundingCreated o_conv;
10779 o_conv.inner = (void*)(o & (~1));
10780 o_conv.is_owned = (o & 1) || (o == 0);
10781 o_conv = FundingCreated_clone(&o_conv);
10782 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10783 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
10784 return (uint64_t)ret_conv;
10787 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
10788 LDKDecodeError e_conv;
10789 e_conv.inner = (void*)(e & (~1));
10790 e_conv.is_owned = (e & 1) || (e == 0);
10791 e_conv = DecodeError_clone(&e_conv);
10792 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10793 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
10794 return (uint64_t)ret_conv;
10797 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
10798 if ((_res & 1) != 0) return;
10799 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10801 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
10804 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
10805 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
10806 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10807 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
10808 return (uint64_t)ret_conv;
10811 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
10812 LDKFundingSigned o_conv;
10813 o_conv.inner = (void*)(o & (~1));
10814 o_conv.is_owned = (o & 1) || (o == 0);
10815 o_conv = FundingSigned_clone(&o_conv);
10816 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10817 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
10818 return (uint64_t)ret_conv;
10821 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
10822 LDKDecodeError e_conv;
10823 e_conv.inner = (void*)(e & (~1));
10824 e_conv.is_owned = (e & 1) || (e == 0);
10825 e_conv = DecodeError_clone(&e_conv);
10826 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10827 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
10828 return (uint64_t)ret_conv;
10831 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
10832 if ((_res & 1) != 0) return;
10833 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10835 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
10838 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
10839 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
10840 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10841 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
10842 return (uint64_t)ret_conv;
10845 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
10846 LDKFundingLocked o_conv;
10847 o_conv.inner = (void*)(o & (~1));
10848 o_conv.is_owned = (o & 1) || (o == 0);
10849 o_conv = FundingLocked_clone(&o_conv);
10850 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10851 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
10852 return (uint64_t)ret_conv;
10855 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
10856 LDKDecodeError e_conv;
10857 e_conv.inner = (void*)(e & (~1));
10858 e_conv.is_owned = (e & 1) || (e == 0);
10859 e_conv = DecodeError_clone(&e_conv);
10860 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10861 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
10862 return (uint64_t)ret_conv;
10865 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
10866 if ((_res & 1) != 0) return;
10867 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10869 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
10872 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
10873 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
10874 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10875 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
10876 return (uint64_t)ret_conv;
10879 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
10881 o_conv.inner = (void*)(o & (~1));
10882 o_conv.is_owned = (o & 1) || (o == 0);
10883 o_conv = Init_clone(&o_conv);
10884 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10885 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
10886 return (uint64_t)ret_conv;
10889 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
10890 LDKDecodeError e_conv;
10891 e_conv.inner = (void*)(e & (~1));
10892 e_conv.is_owned = (e & 1) || (e == 0);
10893 e_conv = DecodeError_clone(&e_conv);
10894 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10895 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
10896 return (uint64_t)ret_conv;
10899 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
10900 if ((_res & 1) != 0) return;
10901 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
10903 CResult_InitDecodeErrorZ_free(_res_conv);
10906 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
10907 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
10908 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10909 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
10910 return (uint64_t)ret_conv;
10913 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
10914 LDKOpenChannel o_conv;
10915 o_conv.inner = (void*)(o & (~1));
10916 o_conv.is_owned = (o & 1) || (o == 0);
10917 o_conv = OpenChannel_clone(&o_conv);
10918 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10919 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
10920 return (uint64_t)ret_conv;
10923 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
10924 LDKDecodeError e_conv;
10925 e_conv.inner = (void*)(e & (~1));
10926 e_conv.is_owned = (e & 1) || (e == 0);
10927 e_conv = DecodeError_clone(&e_conv);
10928 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10929 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
10930 return (uint64_t)ret_conv;
10933 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
10934 if ((_res & 1) != 0) return;
10935 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10937 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
10940 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
10941 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
10942 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10943 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
10944 return (uint64_t)ret_conv;
10947 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
10948 LDKRevokeAndACK o_conv;
10949 o_conv.inner = (void*)(o & (~1));
10950 o_conv.is_owned = (o & 1) || (o == 0);
10951 o_conv = RevokeAndACK_clone(&o_conv);
10952 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10953 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
10954 return (uint64_t)ret_conv;
10957 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
10958 LDKDecodeError e_conv;
10959 e_conv.inner = (void*)(e & (~1));
10960 e_conv.is_owned = (e & 1) || (e == 0);
10961 e_conv = DecodeError_clone(&e_conv);
10962 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10963 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
10964 return (uint64_t)ret_conv;
10967 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
10968 if ((_res & 1) != 0) return;
10969 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
10971 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
10974 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
10975 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
10976 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10977 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
10978 return (uint64_t)ret_conv;
10981 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
10982 LDKShutdown o_conv;
10983 o_conv.inner = (void*)(o & (~1));
10984 o_conv.is_owned = (o & 1) || (o == 0);
10985 o_conv = Shutdown_clone(&o_conv);
10986 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10987 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
10988 return (uint64_t)ret_conv;
10991 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
10992 LDKDecodeError e_conv;
10993 e_conv.inner = (void*)(e & (~1));
10994 e_conv.is_owned = (e & 1) || (e == 0);
10995 e_conv = DecodeError_clone(&e_conv);
10996 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10997 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
10998 return (uint64_t)ret_conv;
11001 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
11002 if ((_res & 1) != 0) return;
11003 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
11005 CResult_ShutdownDecodeErrorZ_free(_res_conv);
11008 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
11009 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
11010 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11011 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
11012 return (uint64_t)ret_conv;
11015 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
11016 LDKUpdateFailHTLC o_conv;
11017 o_conv.inner = (void*)(o & (~1));
11018 o_conv.is_owned = (o & 1) || (o == 0);
11019 o_conv = UpdateFailHTLC_clone(&o_conv);
11020 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11021 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
11022 return (uint64_t)ret_conv;
11025 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
11026 LDKDecodeError e_conv;
11027 e_conv.inner = (void*)(e & (~1));
11028 e_conv.is_owned = (e & 1) || (e == 0);
11029 e_conv = DecodeError_clone(&e_conv);
11030 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11031 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
11032 return (uint64_t)ret_conv;
11035 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
11036 if ((_res & 1) != 0) return;
11037 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11039 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
11042 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
11043 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
11044 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11045 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
11046 return (uint64_t)ret_conv;
11049 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
11050 LDKUpdateFailMalformedHTLC o_conv;
11051 o_conv.inner = (void*)(o & (~1));
11052 o_conv.is_owned = (o & 1) || (o == 0);
11053 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
11054 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11055 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
11056 return (uint64_t)ret_conv;
11059 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
11060 LDKDecodeError e_conv;
11061 e_conv.inner = (void*)(e & (~1));
11062 e_conv.is_owned = (e & 1) || (e == 0);
11063 e_conv = DecodeError_clone(&e_conv);
11064 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11065 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
11066 return (uint64_t)ret_conv;
11069 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
11070 if ((_res & 1) != 0) return;
11071 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11073 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
11076 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
11077 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
11078 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11079 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
11080 return (uint64_t)ret_conv;
11083 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
11084 LDKUpdateFee o_conv;
11085 o_conv.inner = (void*)(o & (~1));
11086 o_conv.is_owned = (o & 1) || (o == 0);
11087 o_conv = UpdateFee_clone(&o_conv);
11088 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11089 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
11090 return (uint64_t)ret_conv;
11093 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
11094 LDKDecodeError e_conv;
11095 e_conv.inner = (void*)(e & (~1));
11096 e_conv.is_owned = (e & 1) || (e == 0);
11097 e_conv = DecodeError_clone(&e_conv);
11098 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11099 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
11100 return (uint64_t)ret_conv;
11103 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
11104 if ((_res & 1) != 0) return;
11105 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11107 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
11110 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
11111 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
11112 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11113 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
11114 return (uint64_t)ret_conv;
11117 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
11118 LDKUpdateFulfillHTLC o_conv;
11119 o_conv.inner = (void*)(o & (~1));
11120 o_conv.is_owned = (o & 1) || (o == 0);
11121 o_conv = UpdateFulfillHTLC_clone(&o_conv);
11122 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11123 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
11124 return (uint64_t)ret_conv;
11127 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
11128 LDKDecodeError e_conv;
11129 e_conv.inner = (void*)(e & (~1));
11130 e_conv.is_owned = (e & 1) || (e == 0);
11131 e_conv = DecodeError_clone(&e_conv);
11132 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11133 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
11134 return (uint64_t)ret_conv;
11137 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
11138 if ((_res & 1) != 0) return;
11139 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11141 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
11144 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
11145 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
11146 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11147 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
11148 return (uint64_t)ret_conv;
11151 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
11152 LDKUpdateAddHTLC o_conv;
11153 o_conv.inner = (void*)(o & (~1));
11154 o_conv.is_owned = (o & 1) || (o == 0);
11155 o_conv = UpdateAddHTLC_clone(&o_conv);
11156 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11157 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
11158 return (uint64_t)ret_conv;
11161 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
11162 LDKDecodeError e_conv;
11163 e_conv.inner = (void*)(e & (~1));
11164 e_conv.is_owned = (e & 1) || (e == 0);
11165 e_conv = DecodeError_clone(&e_conv);
11166 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11167 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
11168 return (uint64_t)ret_conv;
11171 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
11172 if ((_res & 1) != 0) return;
11173 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11175 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
11178 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
11179 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
11180 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11181 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
11182 return (uint64_t)ret_conv;
11185 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
11187 o_conv.inner = (void*)(o & (~1));
11188 o_conv.is_owned = (o & 1) || (o == 0);
11189 o_conv = Ping_clone(&o_conv);
11190 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11191 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
11192 return (uint64_t)ret_conv;
11195 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
11196 LDKDecodeError e_conv;
11197 e_conv.inner = (void*)(e & (~1));
11198 e_conv.is_owned = (e & 1) || (e == 0);
11199 e_conv = DecodeError_clone(&e_conv);
11200 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11201 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
11202 return (uint64_t)ret_conv;
11205 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
11206 if ((_res & 1) != 0) return;
11207 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
11209 CResult_PingDecodeErrorZ_free(_res_conv);
11212 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
11213 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
11214 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11215 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
11216 return (uint64_t)ret_conv;
11219 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
11221 o_conv.inner = (void*)(o & (~1));
11222 o_conv.is_owned = (o & 1) || (o == 0);
11223 o_conv = Pong_clone(&o_conv);
11224 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11225 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
11226 return (uint64_t)ret_conv;
11229 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
11230 LDKDecodeError e_conv;
11231 e_conv.inner = (void*)(e & (~1));
11232 e_conv.is_owned = (e & 1) || (e == 0);
11233 e_conv = DecodeError_clone(&e_conv);
11234 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11235 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
11236 return (uint64_t)ret_conv;
11239 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
11240 if ((_res & 1) != 0) return;
11241 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
11243 CResult_PongDecodeErrorZ_free(_res_conv);
11246 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
11247 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
11248 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11249 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
11250 return (uint64_t)ret_conv;
11253 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11254 LDKUnsignedChannelAnnouncement o_conv;
11255 o_conv.inner = (void*)(o & (~1));
11256 o_conv.is_owned = (o & 1) || (o == 0);
11257 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
11258 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11259 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
11260 return (uint64_t)ret_conv;
11263 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11264 LDKDecodeError e_conv;
11265 e_conv.inner = (void*)(e & (~1));
11266 e_conv.is_owned = (e & 1) || (e == 0);
11267 e_conv = DecodeError_clone(&e_conv);
11268 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11269 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
11270 return (uint64_t)ret_conv;
11273 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11274 if ((_res & 1) != 0) return;
11275 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11277 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
11280 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11281 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11282 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11283 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11284 return (uint64_t)ret_conv;
11287 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11288 LDKChannelAnnouncement o_conv;
11289 o_conv.inner = (void*)(o & (~1));
11290 o_conv.is_owned = (o & 1) || (o == 0);
11291 o_conv = ChannelAnnouncement_clone(&o_conv);
11292 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11293 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
11294 return (uint64_t)ret_conv;
11297 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11298 LDKDecodeError e_conv;
11299 e_conv.inner = (void*)(e & (~1));
11300 e_conv.is_owned = (e & 1) || (e == 0);
11301 e_conv = DecodeError_clone(&e_conv);
11302 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11303 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
11304 return (uint64_t)ret_conv;
11307 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11308 if ((_res & 1) != 0) return;
11309 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11311 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
11314 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11315 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11316 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11317 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11318 return (uint64_t)ret_conv;
11321 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11322 LDKUnsignedChannelUpdate o_conv;
11323 o_conv.inner = (void*)(o & (~1));
11324 o_conv.is_owned = (o & 1) || (o == 0);
11325 o_conv = UnsignedChannelUpdate_clone(&o_conv);
11326 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11327 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
11328 return (uint64_t)ret_conv;
11331 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
11332 LDKDecodeError e_conv;
11333 e_conv.inner = (void*)(e & (~1));
11334 e_conv.is_owned = (e & 1) || (e == 0);
11335 e_conv = DecodeError_clone(&e_conv);
11336 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11337 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
11338 return (uint64_t)ret_conv;
11341 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11342 if ((_res & 1) != 0) return;
11343 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11345 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
11348 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11349 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
11350 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11351 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
11352 return (uint64_t)ret_conv;
11355 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11356 LDKChannelUpdate o_conv;
11357 o_conv.inner = (void*)(o & (~1));
11358 o_conv.is_owned = (o & 1) || (o == 0);
11359 o_conv = ChannelUpdate_clone(&o_conv);
11360 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11361 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
11362 return (uint64_t)ret_conv;
11365 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
11366 LDKDecodeError e_conv;
11367 e_conv.inner = (void*)(e & (~1));
11368 e_conv.is_owned = (e & 1) || (e == 0);
11369 e_conv = DecodeError_clone(&e_conv);
11370 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11371 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
11372 return (uint64_t)ret_conv;
11375 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11376 if ((_res & 1) != 0) return;
11377 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11379 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
11382 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11383 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
11384 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11385 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
11386 return (uint64_t)ret_conv;
11389 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
11390 LDKErrorMessage o_conv;
11391 o_conv.inner = (void*)(o & (~1));
11392 o_conv.is_owned = (o & 1) || (o == 0);
11393 o_conv = ErrorMessage_clone(&o_conv);
11394 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11395 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
11396 return (uint64_t)ret_conv;
11399 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
11400 LDKDecodeError e_conv;
11401 e_conv.inner = (void*)(e & (~1));
11402 e_conv.is_owned = (e & 1) || (e == 0);
11403 e_conv = DecodeError_clone(&e_conv);
11404 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11405 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
11406 return (uint64_t)ret_conv;
11409 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
11410 if ((_res & 1) != 0) return;
11411 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
11413 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
11416 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
11417 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
11418 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11419 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
11420 return (uint64_t)ret_conv;
11423 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11424 LDKUnsignedNodeAnnouncement o_conv;
11425 o_conv.inner = (void*)(o & (~1));
11426 o_conv.is_owned = (o & 1) || (o == 0);
11427 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
11428 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11429 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
11430 return (uint64_t)ret_conv;
11433 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11434 LDKDecodeError e_conv;
11435 e_conv.inner = (void*)(e & (~1));
11436 e_conv.is_owned = (e & 1) || (e == 0);
11437 e_conv = DecodeError_clone(&e_conv);
11438 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11439 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
11440 return (uint64_t)ret_conv;
11443 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11444 if ((_res & 1) != 0) return;
11445 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11447 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
11450 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11451 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
11452 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11453 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
11454 return (uint64_t)ret_conv;
11457 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11458 LDKNodeAnnouncement o_conv;
11459 o_conv.inner = (void*)(o & (~1));
11460 o_conv.is_owned = (o & 1) || (o == 0);
11461 o_conv = NodeAnnouncement_clone(&o_conv);
11462 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11463 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
11464 return (uint64_t)ret_conv;
11467 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11468 LDKDecodeError e_conv;
11469 e_conv.inner = (void*)(e & (~1));
11470 e_conv.is_owned = (e & 1) || (e == 0);
11471 e_conv = DecodeError_clone(&e_conv);
11472 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11473 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
11474 return (uint64_t)ret_conv;
11477 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11478 if ((_res & 1) != 0) return;
11479 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11481 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
11484 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11485 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
11486 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11487 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
11488 return (uint64_t)ret_conv;
11491 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
11492 LDKQueryShortChannelIds o_conv;
11493 o_conv.inner = (void*)(o & (~1));
11494 o_conv.is_owned = (o & 1) || (o == 0);
11495 o_conv = QueryShortChannelIds_clone(&o_conv);
11496 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11497 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
11498 return (uint64_t)ret_conv;
11501 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
11502 LDKDecodeError e_conv;
11503 e_conv.inner = (void*)(e & (~1));
11504 e_conv.is_owned = (e & 1) || (e == 0);
11505 e_conv = DecodeError_clone(&e_conv);
11506 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11507 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
11508 return (uint64_t)ret_conv;
11511 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
11512 if ((_res & 1) != 0) return;
11513 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
11515 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
11518 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
11519 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
11520 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11521 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
11522 return (uint64_t)ret_conv;
11525 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
11526 LDKReplyShortChannelIdsEnd o_conv;
11527 o_conv.inner = (void*)(o & (~1));
11528 o_conv.is_owned = (o & 1) || (o == 0);
11529 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
11530 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11531 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
11532 return (uint64_t)ret_conv;
11535 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
11536 LDKDecodeError e_conv;
11537 e_conv.inner = (void*)(e & (~1));
11538 e_conv.is_owned = (e & 1) || (e == 0);
11539 e_conv = DecodeError_clone(&e_conv);
11540 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11541 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
11542 return (uint64_t)ret_conv;
11545 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
11546 if ((_res & 1) != 0) return;
11547 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
11549 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
11552 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
11553 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
11554 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11555 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
11556 return (uint64_t)ret_conv;
11559 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
11560 LDKQueryChannelRange o_conv;
11561 o_conv.inner = (void*)(o & (~1));
11562 o_conv.is_owned = (o & 1) || (o == 0);
11563 o_conv = QueryChannelRange_clone(&o_conv);
11564 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11565 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
11566 return (uint64_t)ret_conv;
11569 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
11570 LDKDecodeError e_conv;
11571 e_conv.inner = (void*)(e & (~1));
11572 e_conv.is_owned = (e & 1) || (e == 0);
11573 e_conv = DecodeError_clone(&e_conv);
11574 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11575 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
11576 return (uint64_t)ret_conv;
11579 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
11580 if ((_res & 1) != 0) return;
11581 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11583 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
11586 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11587 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
11588 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11589 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
11590 return (uint64_t)ret_conv;
11593 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
11594 LDKReplyChannelRange o_conv;
11595 o_conv.inner = (void*)(o & (~1));
11596 o_conv.is_owned = (o & 1) || (o == 0);
11597 o_conv = ReplyChannelRange_clone(&o_conv);
11598 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11599 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
11600 return (uint64_t)ret_conv;
11603 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
11604 LDKDecodeError e_conv;
11605 e_conv.inner = (void*)(e & (~1));
11606 e_conv.is_owned = (e & 1) || (e == 0);
11607 e_conv = DecodeError_clone(&e_conv);
11608 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11609 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
11610 return (uint64_t)ret_conv;
11613 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
11614 if ((_res & 1) != 0) return;
11615 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11617 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
11620 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11621 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
11622 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11623 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
11624 return (uint64_t)ret_conv;
11627 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
11628 LDKGossipTimestampFilter o_conv;
11629 o_conv.inner = (void*)(o & (~1));
11630 o_conv.is_owned = (o & 1) || (o == 0);
11631 o_conv = GossipTimestampFilter_clone(&o_conv);
11632 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11633 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
11634 return (uint64_t)ret_conv;
11637 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
11638 LDKDecodeError e_conv;
11639 e_conv.inner = (void*)(e & (~1));
11640 e_conv.is_owned = (e & 1) || (e == 0);
11641 e_conv = DecodeError_clone(&e_conv);
11642 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11643 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
11644 return (uint64_t)ret_conv;
11647 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
11648 if ((_res & 1) != 0) return;
11649 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
11651 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
11654 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
11655 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
11656 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11657 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
11658 return (uint64_t)ret_conv;
11661 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
11663 o_conv.inner = (void*)(o & (~1));
11664 o_conv.is_owned = (o & 1) || (o == 0);
11665 o_conv = Invoice_clone(&o_conv);
11666 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11667 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
11668 return (uint64_t)ret_conv;
11671 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
11672 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
11673 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
11674 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11675 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
11676 return (uint64_t)ret_conv;
11679 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
11680 if ((_res & 1) != 0) return;
11681 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
11683 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
11686 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
11687 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
11688 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11689 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
11690 return (uint64_t)ret_conv;
11693 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
11694 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
11695 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11696 *ret_copy = COption_FilterZ_some(o_conv);
11697 uint64_t ret_ref = (uint64_t)ret_copy;
11701 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
11702 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11703 *ret_copy = COption_FilterZ_none();
11704 uint64_t ret_ref = (uint64_t)ret_copy;
11708 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
11709 if ((_res & 1) != 0) return;
11710 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
11712 COption_FilterZ_free(_res_conv);
11715 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
11716 if ((this_ptr & 1) != 0) return;
11717 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
11718 FREE((void*)this_ptr);
11719 PaymentPurpose_free(this_ptr_conv);
11722 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
11723 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
11724 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11725 *ret_copy = PaymentPurpose_clone(orig_conv);
11726 uint64_t ret_ref = (uint64_t)ret_copy;
11730 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
11731 LDKThirtyTwoBytes payment_preimage_ref;
11732 CHECK(*((uint32_t*)payment_preimage) == 32);
11733 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11734 LDKThirtyTwoBytes payment_secret_ref;
11735 CHECK(*((uint32_t*)payment_secret) == 32);
11736 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11737 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11738 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
11739 uint64_t ret_ref = (uint64_t)ret_copy;
11743 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
11744 LDKThirtyTwoBytes a_ref;
11745 CHECK(*((uint32_t*)a) == 32);
11746 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11747 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11748 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
11749 uint64_t ret_ref = (uint64_t)ret_copy;
11753 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
11754 if ((this_ptr & 1) != 0) return;
11755 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
11756 FREE((void*)this_ptr);
11757 ClosureReason_free(this_ptr_conv);
11760 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
11761 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
11762 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11763 *ret_copy = ClosureReason_clone(orig_conv);
11764 uint64_t ret_ref = (uint64_t)ret_copy;
11768 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
11769 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
11770 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11771 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
11772 uint64_t ret_ref = (uint64_t)ret_copy;
11776 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
11777 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11778 *ret_copy = ClosureReason_holder_force_closed();
11779 uint64_t ret_ref = (uint64_t)ret_copy;
11783 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
11784 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11785 *ret_copy = ClosureReason_cooperative_closure();
11786 uint64_t ret_ref = (uint64_t)ret_copy;
11790 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
11791 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11792 *ret_copy = ClosureReason_commitment_tx_confirmed();
11793 uint64_t ret_ref = (uint64_t)ret_copy;
11797 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
11798 LDKStr err_conv = str_ref_to_owned_c(err);
11799 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11800 *ret_copy = ClosureReason_processing_error(err_conv);
11801 uint64_t ret_ref = (uint64_t)ret_copy;
11805 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
11806 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11807 *ret_copy = ClosureReason_disconnected_peer();
11808 uint64_t ret_ref = (uint64_t)ret_copy;
11812 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
11813 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11814 *ret_copy = ClosureReason_outdated_channel_manager();
11815 uint64_t ret_ref = (uint64_t)ret_copy;
11819 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
11820 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
11821 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
11822 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11823 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11824 CVec_u8Z_free(ret_var);
11828 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
11829 if ((this_ptr & 1) != 0) return;
11830 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
11831 FREE((void*)this_ptr);
11832 Event_free(this_ptr_conv);
11835 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
11836 LDKEvent* orig_conv = (LDKEvent*)orig;
11837 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11838 *ret_copy = Event_clone(orig_conv);
11839 uint64_t ret_ref = (uint64_t)ret_copy;
11843 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) {
11844 LDKThirtyTwoBytes temporary_channel_id_ref;
11845 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11846 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
11847 LDKCVec_u8Z output_script_ref;
11848 output_script_ref.datalen = *((uint32_t*)output_script);
11849 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
11850 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
11851 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11852 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
11853 uint64_t ret_ref = (uint64_t)ret_copy;
11857 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
11858 LDKThirtyTwoBytes payment_hash_ref;
11859 CHECK(*((uint32_t*)payment_hash) == 32);
11860 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11861 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
11862 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
11863 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11864 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
11865 uint64_t ret_ref = (uint64_t)ret_copy;
11869 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
11870 LDKThirtyTwoBytes payment_preimage_ref;
11871 CHECK(*((uint32_t*)payment_preimage) == 32);
11872 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11873 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11874 *ret_copy = Event_payment_sent(payment_preimage_ref);
11875 uint64_t ret_ref = (uint64_t)ret_copy;
11879 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) {
11880 LDKThirtyTwoBytes payment_hash_ref;
11881 CHECK(*((uint32_t*)payment_hash) == 32);
11882 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11883 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
11884 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
11885 LDKCVec_RouteHopZ path_constr;
11886 path_constr.datalen = *((uint32_t*)path);
11887 if (path_constr.datalen > 0)
11888 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11890 path_constr.data = NULL;
11891 uint32_t* path_vals = (uint32_t*)(path + 4);
11892 for (size_t k = 0; k < path_constr.datalen; k++) {
11893 uint32_t path_conv_10 = path_vals[k];
11894 LDKRouteHop path_conv_10_conv;
11895 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
11896 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
11897 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11898 path_constr.data[k] = path_conv_10_conv;
11900 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11901 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
11902 uint64_t ret_ref = (uint64_t)ret_copy;
11906 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
11907 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11908 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
11909 uint64_t ret_ref = (uint64_t)ret_copy;
11913 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
11914 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
11915 outputs_constr.datalen = *((uint32_t*)outputs);
11916 if (outputs_constr.datalen > 0)
11917 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11919 outputs_constr.data = NULL;
11920 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
11921 for (size_t b = 0; b < outputs_constr.datalen; b++) {
11922 uint32_t outputs_conv_27 = outputs_vals[b];
11923 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
11924 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
11925 outputs_constr.data[b] = outputs_conv_27_conv;
11927 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11928 *ret_copy = Event_spendable_outputs(outputs_constr);
11929 uint64_t ret_ref = (uint64_t)ret_copy;
11933 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
11934 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
11935 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
11936 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11937 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
11938 uint64_t ret_ref = (uint64_t)ret_copy;
11942 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) {
11943 LDKThirtyTwoBytes channel_id_ref;
11944 CHECK(*((uint32_t*)channel_id) == 32);
11945 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
11946 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
11947 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
11948 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11949 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
11950 uint64_t ret_ref = (uint64_t)ret_copy;
11954 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
11955 LDKEvent* obj_conv = (LDKEvent*)obj;
11956 LDKCVec_u8Z ret_var = Event_write(obj_conv);
11957 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11958 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11959 CVec_u8Z_free(ret_var);
11963 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
11964 if ((this_ptr & 1) != 0) return;
11965 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
11966 FREE((void*)this_ptr);
11967 MessageSendEvent_free(this_ptr_conv);
11970 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
11971 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
11972 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11973 *ret_copy = MessageSendEvent_clone(orig_conv);
11974 uint64_t ret_ref = (uint64_t)ret_copy;
11978 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
11979 LDKPublicKey node_id_ref;
11980 CHECK(*((uint32_t*)node_id) == 33);
11981 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11982 LDKAcceptChannel msg_conv;
11983 msg_conv.inner = (void*)(msg & (~1));
11984 msg_conv.is_owned = (msg & 1) || (msg == 0);
11985 msg_conv = AcceptChannel_clone(&msg_conv);
11986 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11987 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
11988 uint64_t ret_ref = (uint64_t)ret_copy;
11992 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
11993 LDKPublicKey node_id_ref;
11994 CHECK(*((uint32_t*)node_id) == 33);
11995 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11996 LDKOpenChannel msg_conv;
11997 msg_conv.inner = (void*)(msg & (~1));
11998 msg_conv.is_owned = (msg & 1) || (msg == 0);
11999 msg_conv = OpenChannel_clone(&msg_conv);
12000 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12001 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
12002 uint64_t ret_ref = (uint64_t)ret_copy;
12006 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
12007 LDKPublicKey node_id_ref;
12008 CHECK(*((uint32_t*)node_id) == 33);
12009 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12010 LDKFundingCreated msg_conv;
12011 msg_conv.inner = (void*)(msg & (~1));
12012 msg_conv.is_owned = (msg & 1) || (msg == 0);
12013 msg_conv = FundingCreated_clone(&msg_conv);
12014 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12015 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
12016 uint64_t ret_ref = (uint64_t)ret_copy;
12020 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
12021 LDKPublicKey node_id_ref;
12022 CHECK(*((uint32_t*)node_id) == 33);
12023 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12024 LDKFundingSigned msg_conv;
12025 msg_conv.inner = (void*)(msg & (~1));
12026 msg_conv.is_owned = (msg & 1) || (msg == 0);
12027 msg_conv = FundingSigned_clone(&msg_conv);
12028 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12029 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
12030 uint64_t ret_ref = (uint64_t)ret_copy;
12034 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
12035 LDKPublicKey node_id_ref;
12036 CHECK(*((uint32_t*)node_id) == 33);
12037 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12038 LDKFundingLocked msg_conv;
12039 msg_conv.inner = (void*)(msg & (~1));
12040 msg_conv.is_owned = (msg & 1) || (msg == 0);
12041 msg_conv = FundingLocked_clone(&msg_conv);
12042 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12043 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
12044 uint64_t ret_ref = (uint64_t)ret_copy;
12048 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
12049 LDKPublicKey node_id_ref;
12050 CHECK(*((uint32_t*)node_id) == 33);
12051 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12052 LDKAnnouncementSignatures msg_conv;
12053 msg_conv.inner = (void*)(msg & (~1));
12054 msg_conv.is_owned = (msg & 1) || (msg == 0);
12055 msg_conv = AnnouncementSignatures_clone(&msg_conv);
12056 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12057 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
12058 uint64_t ret_ref = (uint64_t)ret_copy;
12062 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
12063 LDKPublicKey node_id_ref;
12064 CHECK(*((uint32_t*)node_id) == 33);
12065 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12066 LDKCommitmentUpdate updates_conv;
12067 updates_conv.inner = (void*)(updates & (~1));
12068 updates_conv.is_owned = (updates & 1) || (updates == 0);
12069 updates_conv = CommitmentUpdate_clone(&updates_conv);
12070 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12071 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
12072 uint64_t ret_ref = (uint64_t)ret_copy;
12076 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
12077 LDKPublicKey node_id_ref;
12078 CHECK(*((uint32_t*)node_id) == 33);
12079 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12080 LDKRevokeAndACK msg_conv;
12081 msg_conv.inner = (void*)(msg & (~1));
12082 msg_conv.is_owned = (msg & 1) || (msg == 0);
12083 msg_conv = RevokeAndACK_clone(&msg_conv);
12084 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12085 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
12086 uint64_t ret_ref = (uint64_t)ret_copy;
12090 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
12091 LDKPublicKey node_id_ref;
12092 CHECK(*((uint32_t*)node_id) == 33);
12093 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12094 LDKClosingSigned msg_conv;
12095 msg_conv.inner = (void*)(msg & (~1));
12096 msg_conv.is_owned = (msg & 1) || (msg == 0);
12097 msg_conv = ClosingSigned_clone(&msg_conv);
12098 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12099 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
12100 uint64_t ret_ref = (uint64_t)ret_copy;
12104 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
12105 LDKPublicKey node_id_ref;
12106 CHECK(*((uint32_t*)node_id) == 33);
12107 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12108 LDKShutdown msg_conv;
12109 msg_conv.inner = (void*)(msg & (~1));
12110 msg_conv.is_owned = (msg & 1) || (msg == 0);
12111 msg_conv = Shutdown_clone(&msg_conv);
12112 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12113 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
12114 uint64_t ret_ref = (uint64_t)ret_copy;
12118 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
12119 LDKPublicKey node_id_ref;
12120 CHECK(*((uint32_t*)node_id) == 33);
12121 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12122 LDKChannelReestablish msg_conv;
12123 msg_conv.inner = (void*)(msg & (~1));
12124 msg_conv.is_owned = (msg & 1) || (msg == 0);
12125 msg_conv = ChannelReestablish_clone(&msg_conv);
12126 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12127 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
12128 uint64_t ret_ref = (uint64_t)ret_copy;
12132 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
12133 LDKChannelAnnouncement msg_conv;
12134 msg_conv.inner = (void*)(msg & (~1));
12135 msg_conv.is_owned = (msg & 1) || (msg == 0);
12136 msg_conv = ChannelAnnouncement_clone(&msg_conv);
12137 LDKChannelUpdate update_msg_conv;
12138 update_msg_conv.inner = (void*)(update_msg & (~1));
12139 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
12140 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
12141 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12142 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
12143 uint64_t ret_ref = (uint64_t)ret_copy;
12147 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
12148 LDKNodeAnnouncement msg_conv;
12149 msg_conv.inner = (void*)(msg & (~1));
12150 msg_conv.is_owned = (msg & 1) || (msg == 0);
12151 msg_conv = NodeAnnouncement_clone(&msg_conv);
12152 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12153 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
12154 uint64_t ret_ref = (uint64_t)ret_copy;
12158 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
12159 LDKChannelUpdate msg_conv;
12160 msg_conv.inner = (void*)(msg & (~1));
12161 msg_conv.is_owned = (msg & 1) || (msg == 0);
12162 msg_conv = ChannelUpdate_clone(&msg_conv);
12163 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12164 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
12165 uint64_t ret_ref = (uint64_t)ret_copy;
12169 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
12170 LDKPublicKey node_id_ref;
12171 CHECK(*((uint32_t*)node_id) == 33);
12172 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12173 LDKChannelUpdate msg_conv;
12174 msg_conv.inner = (void*)(msg & (~1));
12175 msg_conv.is_owned = (msg & 1) || (msg == 0);
12176 msg_conv = ChannelUpdate_clone(&msg_conv);
12177 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12178 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
12179 uint64_t ret_ref = (uint64_t)ret_copy;
12183 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
12184 LDKPublicKey node_id_ref;
12185 CHECK(*((uint32_t*)node_id) == 33);
12186 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12187 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
12188 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
12189 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12190 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
12191 uint64_t ret_ref = (uint64_t)ret_copy;
12195 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
12196 LDKPublicKey node_id_ref;
12197 CHECK(*((uint32_t*)node_id) == 33);
12198 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12199 LDKQueryChannelRange msg_conv;
12200 msg_conv.inner = (void*)(msg & (~1));
12201 msg_conv.is_owned = (msg & 1) || (msg == 0);
12202 msg_conv = QueryChannelRange_clone(&msg_conv);
12203 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12204 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
12205 uint64_t ret_ref = (uint64_t)ret_copy;
12209 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
12210 LDKPublicKey node_id_ref;
12211 CHECK(*((uint32_t*)node_id) == 33);
12212 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12213 LDKQueryShortChannelIds msg_conv;
12214 msg_conv.inner = (void*)(msg & (~1));
12215 msg_conv.is_owned = (msg & 1) || (msg == 0);
12216 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12217 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12218 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
12219 uint64_t ret_ref = (uint64_t)ret_copy;
12223 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
12224 LDKPublicKey node_id_ref;
12225 CHECK(*((uint32_t*)node_id) == 33);
12226 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12227 LDKReplyChannelRange msg_conv;
12228 msg_conv.inner = (void*)(msg & (~1));
12229 msg_conv.is_owned = (msg & 1) || (msg == 0);
12230 msg_conv = ReplyChannelRange_clone(&msg_conv);
12231 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12232 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
12233 uint64_t ret_ref = (uint64_t)ret_copy;
12237 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
12238 if ((this_ptr & 1) != 0) return;
12239 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12240 FREE((void*)this_ptr);
12241 MessageSendEventsProvider_free(this_ptr_conv);
12244 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
12245 if ((this_ptr & 1) != 0) return;
12246 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12247 FREE((void*)this_ptr);
12248 EventsProvider_free(this_ptr_conv);
12251 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
12252 if ((this_ptr & 1) != 0) return;
12253 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12254 FREE((void*)this_ptr);
12255 EventHandler_free(this_ptr_conv);
12258 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
12259 if ((this_ptr & 1) != 0) return;
12260 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12261 FREE((void*)this_ptr);
12262 APIError_free(this_ptr_conv);
12265 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
12266 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12267 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12268 *ret_copy = APIError_clone(orig_conv);
12269 uint64_t ret_ref = (uint64_t)ret_copy;
12273 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
12274 LDKStr err_conv = str_ref_to_owned_c(err);
12275 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12276 *ret_copy = APIError_apimisuse_error(err_conv);
12277 uint64_t ret_ref = (uint64_t)ret_copy;
12281 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
12282 LDKStr err_conv = str_ref_to_owned_c(err);
12283 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12284 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
12285 uint64_t ret_ref = (uint64_t)ret_copy;
12289 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
12290 LDKStr err_conv = str_ref_to_owned_c(err);
12291 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12292 *ret_copy = APIError_route_error(err_conv);
12293 uint64_t ret_ref = (uint64_t)ret_copy;
12297 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
12298 LDKStr err_conv = str_ref_to_owned_c(err);
12299 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12300 *ret_copy = APIError_channel_unavailable(err_conv);
12301 uint64_t ret_ref = (uint64_t)ret_copy;
12305 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
12306 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12307 *ret_copy = APIError_monitor_update_failed();
12308 uint64_t ret_ref = (uint64_t)ret_copy;
12312 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
12313 LDKShutdownScript script_conv;
12314 script_conv.inner = (void*)(script & (~1));
12315 script_conv.is_owned = (script & 1) || (script == 0);
12316 script_conv = ShutdownScript_clone(&script_conv);
12317 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12318 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
12319 uint64_t ret_ref = (uint64_t)ret_copy;
12323 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
12324 LDKu8slice msg_ref;
12325 msg_ref.datalen = *((uint32_t*)msg);
12326 msg_ref.data = (int8_t*)(msg + 4);
12327 unsigned char sk_arr[32];
12328 CHECK(*((uint32_t*)sk) == 32);
12329 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
12330 unsigned char (*sk_ref)[32] = &sk_arr;
12331 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12332 *ret_conv = sign(msg_ref, sk_ref);
12333 return (uint64_t)ret_conv;
12336 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
12337 LDKu8slice msg_ref;
12338 msg_ref.datalen = *((uint32_t*)msg);
12339 msg_ref.data = (int8_t*)(msg + 4);
12340 LDKStr sig_conv = str_ref_to_owned_c(sig);
12341 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12342 *ret_conv = recover_pk(msg_ref, sig_conv);
12343 return (uint64_t)ret_conv;
12346 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
12347 LDKu8slice msg_ref;
12348 msg_ref.datalen = *((uint32_t*)msg);
12349 msg_ref.data = (int8_t*)(msg + 4);
12350 LDKStr sig_conv = str_ref_to_owned_c(sig);
12351 LDKPublicKey pk_ref;
12352 CHECK(*((uint32_t*)pk) == 33);
12353 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
12354 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12358 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
12359 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12360 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
12364 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
12365 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
12369 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
12370 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
12374 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
12375 uint32_t ret_conv = LDKLevel_to_js(Level_info());
12379 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
12380 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
12384 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
12385 uint32_t ret_conv = LDKLevel_to_js(Level_error());
12389 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
12390 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12391 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12392 jboolean ret_val = Level_eq(a_conv, b_conv);
12396 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
12397 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
12398 int64_t ret_val = Level_hash(o_conv);
12402 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
12403 uint32_t ret_conv = LDKLevel_to_js(Level_max());
12407 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
12408 if ((this_ptr & 1) != 0) return;
12409 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
12410 FREE((void*)this_ptr);
12411 Logger_free(this_ptr_conv);
12414 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
12415 LDKChannelHandshakeConfig this_obj_conv;
12416 this_obj_conv.inner = (void*)(this_obj & (~1));
12417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12418 ChannelHandshakeConfig_free(this_obj_conv);
12421 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
12422 LDKChannelHandshakeConfig this_ptr_conv;
12423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12424 this_ptr_conv.is_owned = false;
12425 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
12429 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12430 LDKChannelHandshakeConfig this_ptr_conv;
12431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12432 this_ptr_conv.is_owned = false;
12433 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
12436 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
12437 LDKChannelHandshakeConfig this_ptr_conv;
12438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12439 this_ptr_conv.is_owned = false;
12440 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
12444 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
12445 LDKChannelHandshakeConfig this_ptr_conv;
12446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12447 this_ptr_conv.is_owned = false;
12448 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
12451 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
12452 LDKChannelHandshakeConfig this_ptr_conv;
12453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12454 this_ptr_conv.is_owned = false;
12455 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
12459 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12460 LDKChannelHandshakeConfig this_ptr_conv;
12461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12462 this_ptr_conv.is_owned = false;
12463 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
12466 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) {
12467 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
12468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12470 uint64_t ret_ref = (uint64_t)ret_var.inner;
12471 if (ret_var.is_owned) {
12477 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
12478 LDKChannelHandshakeConfig orig_conv;
12479 orig_conv.inner = (void*)(orig & (~1));
12480 orig_conv.is_owned = false;
12481 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
12482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12484 uint64_t ret_ref = (uint64_t)ret_var.inner;
12485 if (ret_var.is_owned) {
12491 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
12492 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
12493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12495 uint64_t ret_ref = (uint64_t)ret_var.inner;
12496 if (ret_var.is_owned) {
12502 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
12503 LDKChannelHandshakeLimits this_obj_conv;
12504 this_obj_conv.inner = (void*)(this_obj & (~1));
12505 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12506 ChannelHandshakeLimits_free(this_obj_conv);
12509 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
12510 LDKChannelHandshakeLimits this_ptr_conv;
12511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12512 this_ptr_conv.is_owned = false;
12513 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
12517 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
12518 LDKChannelHandshakeLimits this_ptr_conv;
12519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12520 this_ptr_conv.is_owned = false;
12521 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
12524 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
12525 LDKChannelHandshakeLimits this_ptr_conv;
12526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12527 this_ptr_conv.is_owned = false;
12528 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
12532 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12533 LDKChannelHandshakeLimits this_ptr_conv;
12534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12535 this_ptr_conv.is_owned = false;
12536 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
12539 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12540 LDKChannelHandshakeLimits this_ptr_conv;
12541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12542 this_ptr_conv.is_owned = false;
12543 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
12547 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12548 LDKChannelHandshakeLimits this_ptr_conv;
12549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12550 this_ptr_conv.is_owned = false;
12551 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12554 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
12555 LDKChannelHandshakeLimits this_ptr_conv;
12556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12557 this_ptr_conv.is_owned = false;
12558 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
12562 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12563 LDKChannelHandshakeLimits this_ptr_conv;
12564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12565 this_ptr_conv.is_owned = false;
12566 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
12569 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
12570 LDKChannelHandshakeLimits this_ptr_conv;
12571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12572 this_ptr_conv.is_owned = false;
12573 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
12577 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12578 LDKChannelHandshakeLimits this_ptr_conv;
12579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12580 this_ptr_conv.is_owned = false;
12581 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
12584 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
12585 LDKChannelHandshakeLimits this_ptr_conv;
12586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12587 this_ptr_conv.is_owned = false;
12588 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
12592 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
12593 LDKChannelHandshakeLimits this_ptr_conv;
12594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12595 this_ptr_conv.is_owned = false;
12596 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
12599 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
12600 LDKChannelHandshakeLimits this_ptr_conv;
12601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12602 this_ptr_conv.is_owned = false;
12603 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
12607 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
12608 LDKChannelHandshakeLimits this_ptr_conv;
12609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12610 this_ptr_conv.is_owned = false;
12611 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
12614 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
12615 LDKChannelHandshakeLimits this_ptr_conv;
12616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12617 this_ptr_conv.is_owned = false;
12618 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
12622 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
12623 LDKChannelHandshakeLimits this_ptr_conv;
12624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12625 this_ptr_conv.is_owned = false;
12626 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
12629 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) {
12630 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);
12631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12633 uint64_t ret_ref = (uint64_t)ret_var.inner;
12634 if (ret_var.is_owned) {
12640 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
12641 LDKChannelHandshakeLimits orig_conv;
12642 orig_conv.inner = (void*)(orig & (~1));
12643 orig_conv.is_owned = false;
12644 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
12645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12647 uint64_t ret_ref = (uint64_t)ret_var.inner;
12648 if (ret_var.is_owned) {
12654 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
12655 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
12656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12658 uint64_t ret_ref = (uint64_t)ret_var.inner;
12659 if (ret_var.is_owned) {
12665 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
12666 LDKChannelConfig this_obj_conv;
12667 this_obj_conv.inner = (void*)(this_obj & (~1));
12668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12669 ChannelConfig_free(this_obj_conv);
12672 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
12673 LDKChannelConfig this_ptr_conv;
12674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12675 this_ptr_conv.is_owned = false;
12676 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
12680 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
12681 LDKChannelConfig this_ptr_conv;
12682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12683 this_ptr_conv.is_owned = false;
12684 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
12687 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
12688 LDKChannelConfig this_ptr_conv;
12689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12690 this_ptr_conv.is_owned = false;
12691 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
12695 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
12696 LDKChannelConfig this_ptr_conv;
12697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12698 this_ptr_conv.is_owned = false;
12699 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
12702 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
12703 LDKChannelConfig this_ptr_conv;
12704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12705 this_ptr_conv.is_owned = false;
12706 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
12710 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
12711 LDKChannelConfig this_ptr_conv;
12712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12713 this_ptr_conv.is_owned = false;
12714 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
12717 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
12718 LDKChannelConfig this_ptr_conv;
12719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12720 this_ptr_conv.is_owned = false;
12721 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
12725 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
12726 LDKChannelConfig this_ptr_conv;
12727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12728 this_ptr_conv.is_owned = false;
12729 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
12732 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
12733 LDKChannelConfig this_ptr_conv;
12734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12735 this_ptr_conv.is_owned = false;
12736 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
12740 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
12741 LDKChannelConfig this_ptr_conv;
12742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12743 this_ptr_conv.is_owned = false;
12744 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
12747 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
12748 LDKChannelConfig this_ptr_conv;
12749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12750 this_ptr_conv.is_owned = false;
12751 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
12755 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
12756 LDKChannelConfig this_ptr_conv;
12757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12758 this_ptr_conv.is_owned = false;
12759 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
12762 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
12763 LDKChannelConfig this_ptr_conv;
12764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12765 this_ptr_conv.is_owned = false;
12766 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
12770 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
12771 LDKChannelConfig this_ptr_conv;
12772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12773 this_ptr_conv.is_owned = false;
12774 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
12777 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
12778 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
12779 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12780 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12781 uint64_t ret_ref = (uint64_t)ret_var.inner;
12782 if (ret_var.is_owned) {
12788 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
12789 LDKChannelConfig orig_conv;
12790 orig_conv.inner = (void*)(orig & (~1));
12791 orig_conv.is_owned = false;
12792 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
12793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12795 uint64_t ret_ref = (uint64_t)ret_var.inner;
12796 if (ret_var.is_owned) {
12802 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
12803 LDKChannelConfig ret_var = ChannelConfig_default();
12804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12806 uint64_t ret_ref = (uint64_t)ret_var.inner;
12807 if (ret_var.is_owned) {
12813 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
12814 LDKChannelConfig obj_conv;
12815 obj_conv.inner = (void*)(obj & (~1));
12816 obj_conv.is_owned = false;
12817 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
12818 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12819 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12820 CVec_u8Z_free(ret_var);
12824 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
12825 LDKu8slice ser_ref;
12826 ser_ref.datalen = *((uint32_t*)ser);
12827 ser_ref.data = (int8_t*)(ser + 4);
12828 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12829 *ret_conv = ChannelConfig_read(ser_ref);
12830 return (uint64_t)ret_conv;
12833 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
12834 LDKUserConfig this_obj_conv;
12835 this_obj_conv.inner = (void*)(this_obj & (~1));
12836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12837 UserConfig_free(this_obj_conv);
12840 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
12841 LDKUserConfig this_ptr_conv;
12842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12843 this_ptr_conv.is_owned = false;
12844 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
12845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12847 uint64_t ret_ref = (uint64_t)ret_var.inner;
12848 if (ret_var.is_owned) {
12854 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
12855 LDKUserConfig this_ptr_conv;
12856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12857 this_ptr_conv.is_owned = false;
12858 LDKChannelHandshakeConfig val_conv;
12859 val_conv.inner = (void*)(val & (~1));
12860 val_conv.is_owned = (val & 1) || (val == 0);
12861 val_conv = ChannelHandshakeConfig_clone(&val_conv);
12862 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
12865 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
12866 LDKUserConfig this_ptr_conv;
12867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12868 this_ptr_conv.is_owned = false;
12869 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
12870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12872 uint64_t ret_ref = (uint64_t)ret_var.inner;
12873 if (ret_var.is_owned) {
12879 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
12880 LDKUserConfig this_ptr_conv;
12881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12882 this_ptr_conv.is_owned = false;
12883 LDKChannelHandshakeLimits val_conv;
12884 val_conv.inner = (void*)(val & (~1));
12885 val_conv.is_owned = (val & 1) || (val == 0);
12886 val_conv = ChannelHandshakeLimits_clone(&val_conv);
12887 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
12890 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
12891 LDKUserConfig this_ptr_conv;
12892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12893 this_ptr_conv.is_owned = false;
12894 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
12895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12897 uint64_t ret_ref = (uint64_t)ret_var.inner;
12898 if (ret_var.is_owned) {
12904 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
12905 LDKUserConfig this_ptr_conv;
12906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12907 this_ptr_conv.is_owned = false;
12908 LDKChannelConfig val_conv;
12909 val_conv.inner = (void*)(val & (~1));
12910 val_conv.is_owned = (val & 1) || (val == 0);
12911 val_conv = ChannelConfig_clone(&val_conv);
12912 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
12915 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
12916 LDKUserConfig this_ptr_conv;
12917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12918 this_ptr_conv.is_owned = false;
12919 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
12923 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
12924 LDKUserConfig this_ptr_conv;
12925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12926 this_ptr_conv.is_owned = false;
12927 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
12930 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) {
12931 LDKChannelHandshakeConfig own_channel_config_arg_conv;
12932 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
12933 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
12934 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
12935 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
12936 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
12937 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
12938 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
12939 LDKChannelConfig channel_options_arg_conv;
12940 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
12941 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
12942 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
12943 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);
12944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12946 uint64_t ret_ref = (uint64_t)ret_var.inner;
12947 if (ret_var.is_owned) {
12953 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
12954 LDKUserConfig orig_conv;
12955 orig_conv.inner = (void*)(orig & (~1));
12956 orig_conv.is_owned = false;
12957 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
12958 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12959 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12960 uint64_t ret_ref = (uint64_t)ret_var.inner;
12961 if (ret_var.is_owned) {
12967 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
12968 LDKUserConfig ret_var = UserConfig_default();
12969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12971 uint64_t ret_ref = (uint64_t)ret_var.inner;
12972 if (ret_var.is_owned) {
12978 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
12979 LDKBestBlock this_obj_conv;
12980 this_obj_conv.inner = (void*)(this_obj & (~1));
12981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12982 BestBlock_free(this_obj_conv);
12985 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
12986 LDKBestBlock orig_conv;
12987 orig_conv.inner = (void*)(orig & (~1));
12988 orig_conv.is_owned = false;
12989 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
12990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12992 uint64_t ret_ref = (uint64_t)ret_var.inner;
12993 if (ret_var.is_owned) {
12999 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
13000 LDKNetwork network_conv = LDKNetwork_from_js(network);
13001 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
13002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13004 uint64_t ret_ref = (uint64_t)ret_var.inner;
13005 if (ret_var.is_owned) {
13011 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
13012 LDKThirtyTwoBytes block_hash_ref;
13013 CHECK(*((uint32_t*)block_hash) == 32);
13014 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
13015 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
13016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13018 uint64_t ret_ref = (uint64_t)ret_var.inner;
13019 if (ret_var.is_owned) {
13025 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
13026 LDKBestBlock this_arg_conv;
13027 this_arg_conv.inner = (void*)(this_arg & (~1));
13028 this_arg_conv.is_owned = false;
13029 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13030 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
13034 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
13035 LDKBestBlock this_arg_conv;
13036 this_arg_conv.inner = (void*)(this_arg & (~1));
13037 this_arg_conv.is_owned = false;
13038 int32_t ret_val = BestBlock_height(&this_arg_conv);
13042 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
13043 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13044 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
13048 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
13049 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
13053 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
13054 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
13058 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
13059 if ((this_ptr & 1) != 0) return;
13060 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13061 FREE((void*)this_ptr);
13062 Access_free(this_ptr_conv);
13065 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
13066 if ((this_ptr & 1) != 0) return;
13067 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13068 FREE((void*)this_ptr);
13069 Listen_free(this_ptr_conv);
13072 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
13073 if ((this_ptr & 1) != 0) return;
13074 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13075 FREE((void*)this_ptr);
13076 Confirm_free(this_ptr_conv);
13079 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
13080 if ((this_ptr & 1) != 0) return;
13081 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13082 FREE((void*)this_ptr);
13083 Watch_free(this_ptr_conv);
13086 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
13087 if ((this_ptr & 1) != 0) return;
13088 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13089 FREE((void*)this_ptr);
13090 Filter_free(this_ptr_conv);
13093 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
13094 LDKWatchedOutput this_obj_conv;
13095 this_obj_conv.inner = (void*)(this_obj & (~1));
13096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13097 WatchedOutput_free(this_obj_conv);
13100 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
13101 LDKWatchedOutput this_ptr_conv;
13102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13103 this_ptr_conv.is_owned = false;
13104 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13105 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
13109 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
13110 LDKWatchedOutput this_ptr_conv;
13111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13112 this_ptr_conv.is_owned = false;
13113 LDKThirtyTwoBytes val_ref;
13114 CHECK(*((uint32_t*)val) == 32);
13115 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13116 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13119 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
13120 LDKWatchedOutput this_ptr_conv;
13121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13122 this_ptr_conv.is_owned = false;
13123 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13126 uint64_t ret_ref = (uint64_t)ret_var.inner;
13127 if (ret_var.is_owned) {
13133 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
13134 LDKWatchedOutput this_ptr_conv;
13135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13136 this_ptr_conv.is_owned = false;
13137 LDKOutPoint val_conv;
13138 val_conv.inner = (void*)(val & (~1));
13139 val_conv.is_owned = (val & 1) || (val == 0);
13140 val_conv = OutPoint_clone(&val_conv);
13141 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13144 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
13145 LDKWatchedOutput this_ptr_conv;
13146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13147 this_ptr_conv.is_owned = false;
13148 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13149 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13150 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13154 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
13155 LDKWatchedOutput this_ptr_conv;
13156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13157 this_ptr_conv.is_owned = false;
13158 LDKCVec_u8Z val_ref;
13159 val_ref.datalen = *((uint32_t*)val);
13160 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13161 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13162 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13165 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
13166 LDKThirtyTwoBytes block_hash_arg_ref;
13167 CHECK(*((uint32_t*)block_hash_arg) == 32);
13168 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
13169 LDKOutPoint outpoint_arg_conv;
13170 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13171 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13172 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13173 LDKCVec_u8Z script_pubkey_arg_ref;
13174 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
13175 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13176 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
13177 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13180 uint64_t ret_ref = (uint64_t)ret_var.inner;
13181 if (ret_var.is_owned) {
13187 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
13188 LDKWatchedOutput orig_conv;
13189 orig_conv.inner = (void*)(orig & (~1));
13190 orig_conv.is_owned = false;
13191 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13194 uint64_t ret_ref = (uint64_t)ret_var.inner;
13195 if (ret_var.is_owned) {
13201 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
13202 LDKWatchedOutput o_conv;
13203 o_conv.inner = (void*)(o & (~1));
13204 o_conv.is_owned = false;
13205 int64_t ret_val = WatchedOutput_hash(&o_conv);
13209 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
13210 if ((this_ptr & 1) != 0) return;
13211 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13212 FREE((void*)this_ptr);
13213 BroadcasterInterface_free(this_ptr_conv);
13216 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
13217 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13218 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
13222 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
13223 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
13227 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
13228 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
13232 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
13233 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
13237 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
13238 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
13239 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
13240 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
13244 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
13245 if ((this_ptr & 1) != 0) return;
13246 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13247 FREE((void*)this_ptr);
13248 FeeEstimator_free(this_ptr_conv);
13251 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
13252 LDKChainMonitor this_obj_conv;
13253 this_obj_conv.inner = (void*)(this_obj & (~1));
13254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13255 ChainMonitor_free(this_obj_conv);
13258 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
13259 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
13260 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
13261 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
13262 // Manually implement clone for Java trait instances
13264 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13265 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13266 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13267 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13268 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13271 uint64_t ret_ref = (uint64_t)ret_var.inner;
13272 if (ret_var.is_owned) {
13278 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
13279 LDKChainMonitor this_arg_conv;
13280 this_arg_conv.inner = (void*)(this_arg & (~1));
13281 this_arg_conv.is_owned = false;
13282 LDKCVec_ChannelDetailsZ ignored_channels_constr;
13283 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
13284 if (ignored_channels_constr.datalen > 0)
13285 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13287 ignored_channels_constr.data = NULL;
13288 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
13289 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
13290 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
13291 LDKChannelDetails ignored_channels_conv_16_conv;
13292 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
13293 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
13294 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
13295 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
13297 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
13298 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13299 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13300 for (size_t j = 0; j < ret_var.datalen; j++) {
13301 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13302 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
13303 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
13304 ret_arr_ptr[j] = ret_conv_9_ref;
13306 FREE(ret_var.data);
13310 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
13311 LDKChainMonitor this_arg_conv;
13312 this_arg_conv.inner = (void*)(this_arg & (~1));
13313 this_arg_conv.is_owned = false;
13314 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
13315 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
13316 return (uint64_t)ret_ret;
13319 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
13320 LDKChainMonitor this_arg_conv;
13321 this_arg_conv.inner = (void*)(this_arg & (~1));
13322 this_arg_conv.is_owned = false;
13323 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13324 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
13325 return (uint64_t)ret_ret;
13328 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
13329 LDKChainMonitor this_arg_conv;
13330 this_arg_conv.inner = (void*)(this_arg & (~1));
13331 this_arg_conv.is_owned = false;
13332 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
13333 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
13334 return (uint64_t)ret_ret;
13337 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
13338 LDKChainMonitor this_arg_conv;
13339 this_arg_conv.inner = (void*)(this_arg & (~1));
13340 this_arg_conv.is_owned = false;
13341 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13342 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13343 return (uint64_t)ret_ret;
13346 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
13347 LDKChannelMonitorUpdate this_obj_conv;
13348 this_obj_conv.inner = (void*)(this_obj & (~1));
13349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13350 ChannelMonitorUpdate_free(this_obj_conv);
13353 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
13354 LDKChannelMonitorUpdate this_ptr_conv;
13355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13356 this_ptr_conv.is_owned = false;
13357 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13361 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
13362 LDKChannelMonitorUpdate this_ptr_conv;
13363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13364 this_ptr_conv.is_owned = false;
13365 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13368 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
13369 LDKChannelMonitorUpdate orig_conv;
13370 orig_conv.inner = (void*)(orig & (~1));
13371 orig_conv.is_owned = false;
13372 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13375 uint64_t ret_ref = (uint64_t)ret_var.inner;
13376 if (ret_var.is_owned) {
13382 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
13383 LDKChannelMonitorUpdate obj_conv;
13384 obj_conv.inner = (void*)(obj & (~1));
13385 obj_conv.is_owned = false;
13386 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13387 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13388 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13389 CVec_u8Z_free(ret_var);
13393 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
13394 LDKu8slice ser_ref;
13395 ser_ref.datalen = *((uint32_t*)ser);
13396 ser_ref.data = (int8_t*)(ser + 4);
13397 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13398 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13399 return (uint64_t)ret_conv;
13402 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
13403 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13404 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
13408 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
13409 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
13413 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
13414 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
13418 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
13419 LDKMonitorUpdateError this_obj_conv;
13420 this_obj_conv.inner = (void*)(this_obj & (~1));
13421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13422 MonitorUpdateError_free(this_obj_conv);
13425 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
13426 LDKMonitorUpdateError orig_conv;
13427 orig_conv.inner = (void*)(orig & (~1));
13428 orig_conv.is_owned = false;
13429 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13432 uint64_t ret_ref = (uint64_t)ret_var.inner;
13433 if (ret_var.is_owned) {
13439 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
13440 if ((this_ptr & 1) != 0) return;
13441 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13442 FREE((void*)this_ptr);
13443 MonitorEvent_free(this_ptr_conv);
13446 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
13447 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13448 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13449 *ret_copy = MonitorEvent_clone(orig_conv);
13450 uint64_t ret_ref = (uint64_t)ret_copy;
13454 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
13455 LDKHTLCUpdate a_conv;
13456 a_conv.inner = (void*)(a & (~1));
13457 a_conv.is_owned = (a & 1) || (a == 0);
13458 a_conv = HTLCUpdate_clone(&a_conv);
13459 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13460 *ret_copy = MonitorEvent_htlcevent(a_conv);
13461 uint64_t ret_ref = (uint64_t)ret_copy;
13465 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
13466 LDKOutPoint a_conv;
13467 a_conv.inner = (void*)(a & (~1));
13468 a_conv.is_owned = (a & 1) || (a == 0);
13469 a_conv = OutPoint_clone(&a_conv);
13470 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13471 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
13472 uint64_t ret_ref = (uint64_t)ret_copy;
13476 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
13477 LDKHTLCUpdate this_obj_conv;
13478 this_obj_conv.inner = (void*)(this_obj & (~1));
13479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13480 HTLCUpdate_free(this_obj_conv);
13483 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
13484 LDKHTLCUpdate orig_conv;
13485 orig_conv.inner = (void*)(orig & (~1));
13486 orig_conv.is_owned = false;
13487 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13490 uint64_t ret_ref = (uint64_t)ret_var.inner;
13491 if (ret_var.is_owned) {
13497 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
13498 LDKHTLCUpdate obj_conv;
13499 obj_conv.inner = (void*)(obj & (~1));
13500 obj_conv.is_owned = false;
13501 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13502 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13503 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13504 CVec_u8Z_free(ret_var);
13508 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
13509 LDKu8slice ser_ref;
13510 ser_ref.datalen = *((uint32_t*)ser);
13511 ser_ref.data = (int8_t*)(ser + 4);
13512 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13513 *ret_conv = HTLCUpdate_read(ser_ref);
13514 return (uint64_t)ret_conv;
13517 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
13518 if ((this_ptr & 1) != 0) return;
13519 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
13520 FREE((void*)this_ptr);
13521 Balance_free(this_ptr_conv);
13524 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
13525 LDKBalance* orig_conv = (LDKBalance*)orig;
13526 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13527 *ret_copy = Balance_clone(orig_conv);
13528 uint64_t ret_ref = (uint64_t)ret_copy;
13532 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
13533 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13534 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
13535 uint64_t ret_ref = (uint64_t)ret_copy;
13539 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
13540 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13541 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
13542 uint64_t ret_ref = (uint64_t)ret_copy;
13546 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
13547 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13548 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
13549 uint64_t ret_ref = (uint64_t)ret_copy;
13553 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
13554 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13555 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
13556 uint64_t ret_ref = (uint64_t)ret_copy;
13560 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
13561 LDKBalance* a_conv = (LDKBalance*)a;
13562 LDKBalance* b_conv = (LDKBalance*)b;
13563 jboolean ret_val = Balance_eq(a_conv, b_conv);
13567 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
13568 LDKChannelMonitor this_obj_conv;
13569 this_obj_conv.inner = (void*)(this_obj & (~1));
13570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13571 ChannelMonitor_free(this_obj_conv);
13574 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
13575 LDKChannelMonitor orig_conv;
13576 orig_conv.inner = (void*)(orig & (~1));
13577 orig_conv.is_owned = false;
13578 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13581 uint64_t ret_ref = (uint64_t)ret_var.inner;
13582 if (ret_var.is_owned) {
13588 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
13589 LDKChannelMonitor obj_conv;
13590 obj_conv.inner = (void*)(obj & (~1));
13591 obj_conv.is_owned = false;
13592 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13593 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13594 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13595 CVec_u8Z_free(ret_var);
13599 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) {
13600 LDKChannelMonitor this_arg_conv;
13601 this_arg_conv.inner = (void*)(this_arg & (~1));
13602 this_arg_conv.is_owned = false;
13603 LDKChannelMonitorUpdate updates_conv;
13604 updates_conv.inner = (void*)(updates & (~1));
13605 updates_conv.is_owned = false;
13606 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13607 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13608 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13609 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13610 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13611 return (uint64_t)ret_conv;
13614 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
13615 LDKChannelMonitor this_arg_conv;
13616 this_arg_conv.inner = (void*)(this_arg & (~1));
13617 this_arg_conv.is_owned = false;
13618 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13622 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
13623 LDKChannelMonitor this_arg_conv;
13624 this_arg_conv.inner = (void*)(this_arg & (~1));
13625 this_arg_conv.is_owned = false;
13626 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13627 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13628 return (uint64_t)ret_ref;
13631 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
13632 LDKChannelMonitor this_arg_conv;
13633 this_arg_conv.inner = (void*)(this_arg & (~1));
13634 this_arg_conv.is_owned = false;
13635 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13636 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13637 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13638 for (size_t c = 0; c < ret_var.datalen; c++) {
13639 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13640 *ret_conv_54_ref = ret_var.data[c];
13641 ret_arr_ptr[c] = (uint64_t)ret_conv_54_ref;
13643 FREE(ret_var.data);
13647 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
13648 LDKChannelMonitor this_arg_conv;
13649 this_arg_conv.inner = (void*)(this_arg & (~1));
13650 this_arg_conv.is_owned = false;
13651 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
13652 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
13655 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
13656 LDKChannelMonitor this_arg_conv;
13657 this_arg_conv.inner = (void*)(this_arg & (~1));
13658 this_arg_conv.is_owned = false;
13659 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
13660 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13661 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13662 for (size_t o = 0; o < ret_var.datalen; o++) {
13663 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13664 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
13665 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
13666 ret_arr_ptr[o] = ret_conv_14_ref;
13668 FREE(ret_var.data);
13672 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
13673 LDKChannelMonitor this_arg_conv;
13674 this_arg_conv.inner = (void*)(this_arg & (~1));
13675 this_arg_conv.is_owned = false;
13676 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
13677 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13678 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13679 for (size_t h = 0; h < ret_var.datalen; h++) {
13680 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13681 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
13682 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
13683 ret_arr_ptr[h] = ret_conv_7_ref;
13685 FREE(ret_var.data);
13689 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
13690 LDKChannelMonitor this_arg_conv;
13691 this_arg_conv.inner = (void*)(this_arg & (~1));
13692 this_arg_conv.is_owned = false;
13693 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13694 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
13695 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
13696 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
13697 for (size_t m = 0; m < ret_var.datalen; m++) {
13698 LDKTransaction ret_conv_12_var = ret_var.data[m];
13699 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13700 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
13701 Transaction_free(ret_conv_12_var);
13702 ret_arr_ptr[m] = ret_conv_12_arr;
13704 FREE(ret_var.data);
13708 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) {
13709 LDKChannelMonitor this_arg_conv;
13710 this_arg_conv.inner = (void*)(this_arg & (~1));
13711 this_arg_conv.is_owned = false;
13712 unsigned char header_arr[80];
13713 CHECK(*((uint32_t*)header) == 80);
13714 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13715 unsigned char (*header_ref)[80] = &header_arr;
13716 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13717 txdata_constr.datalen = *((uint32_t*)txdata);
13718 if (txdata_constr.datalen > 0)
13719 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13721 txdata_constr.data = NULL;
13722 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13723 for (size_t e = 0; e < txdata_constr.datalen; e++) {
13724 uint32_t txdata_conv_30 = txdata_vals[e];
13725 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
13726 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
13727 txdata_constr.data[e] = txdata_conv_30_conv;
13729 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13730 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13731 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13732 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);
13733 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13734 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13735 for (size_t x = 0; x < ret_var.datalen; x++) {
13736 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13737 *ret_conv_49_ref = ret_var.data[x];
13738 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13740 FREE(ret_var.data);
13744 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) {
13745 LDKChannelMonitor this_arg_conv;
13746 this_arg_conv.inner = (void*)(this_arg & (~1));
13747 this_arg_conv.is_owned = false;
13748 unsigned char header_arr[80];
13749 CHECK(*((uint32_t*)header) == 80);
13750 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13751 unsigned char (*header_ref)[80] = &header_arr;
13752 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13753 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13754 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13755 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
13758 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) {
13759 LDKChannelMonitor this_arg_conv;
13760 this_arg_conv.inner = (void*)(this_arg & (~1));
13761 this_arg_conv.is_owned = false;
13762 unsigned char header_arr[80];
13763 CHECK(*((uint32_t*)header) == 80);
13764 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13765 unsigned char (*header_ref)[80] = &header_arr;
13766 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13767 txdata_constr.datalen = *((uint32_t*)txdata);
13768 if (txdata_constr.datalen > 0)
13769 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13771 txdata_constr.data = NULL;
13772 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13773 for (size_t e = 0; e < txdata_constr.datalen; e++) {
13774 uint32_t txdata_conv_30 = txdata_vals[e];
13775 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
13776 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
13777 txdata_constr.data[e] = txdata_conv_30_conv;
13779 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13780 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13781 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13782 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);
13783 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13784 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13785 for (size_t x = 0; x < ret_var.datalen; x++) {
13786 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13787 *ret_conv_49_ref = ret_var.data[x];
13788 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13790 FREE(ret_var.data);
13794 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) {
13795 LDKChannelMonitor this_arg_conv;
13796 this_arg_conv.inner = (void*)(this_arg & (~1));
13797 this_arg_conv.is_owned = false;
13798 unsigned char txid_arr[32];
13799 CHECK(*((uint32_t*)txid) == 32);
13800 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
13801 unsigned char (*txid_ref)[32] = &txid_arr;
13802 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13803 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13804 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13805 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
13808 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) {
13809 LDKChannelMonitor this_arg_conv;
13810 this_arg_conv.inner = (void*)(this_arg & (~1));
13811 this_arg_conv.is_owned = false;
13812 unsigned char header_arr[80];
13813 CHECK(*((uint32_t*)header) == 80);
13814 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13815 unsigned char (*header_ref)[80] = &header_arr;
13816 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13817 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13818 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13819 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
13820 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13821 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13822 for (size_t x = 0; x < ret_var.datalen; x++) {
13823 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13824 *ret_conv_49_ref = ret_var.data[x];
13825 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13827 FREE(ret_var.data);
13831 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
13832 LDKChannelMonitor this_arg_conv;
13833 this_arg_conv.inner = (void*)(this_arg & (~1));
13834 this_arg_conv.is_owned = false;
13835 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
13836 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
13837 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
13838 for (size_t m = 0; m < ret_var.datalen; m++) {
13839 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13840 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
13841 ret_arr_ptr[m] = ret_conv_12_arr;
13843 FREE(ret_var.data);
13847 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
13848 LDKChannelMonitor this_arg_conv;
13849 this_arg_conv.inner = (void*)(this_arg & (~1));
13850 this_arg_conv.is_owned = false;
13851 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
13852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13854 uint64_t ret_ref = (uint64_t)ret_var.inner;
13855 if (ret_var.is_owned) {
13861 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
13862 LDKChannelMonitor this_arg_conv;
13863 this_arg_conv.inner = (void*)(this_arg & (~1));
13864 this_arg_conv.is_owned = false;
13865 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
13866 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13867 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13868 for (size_t j = 0; j < ret_var.datalen; j++) {
13869 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13870 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
13871 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
13872 ret_arr_ptr[j] = ret_conv_9_ref;
13874 FREE(ret_var.data);
13878 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
13879 if ((this_ptr & 1) != 0) return;
13880 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
13881 FREE((void*)this_ptr);
13882 Persist_free(this_ptr_conv);
13885 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
13886 LDKu8slice ser_ref;
13887 ser_ref.datalen = *((uint32_t*)ser);
13888 ser_ref.data = (int8_t*)(ser + 4);
13889 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
13890 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13891 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
13892 return (uint64_t)ret_conv;
13895 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
13896 LDKOutPoint this_obj_conv;
13897 this_obj_conv.inner = (void*)(this_obj & (~1));
13898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13899 OutPoint_free(this_obj_conv);
13902 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
13903 LDKOutPoint this_ptr_conv;
13904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13905 this_ptr_conv.is_owned = false;
13906 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13907 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
13911 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
13912 LDKOutPoint this_ptr_conv;
13913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13914 this_ptr_conv.is_owned = false;
13915 LDKThirtyTwoBytes val_ref;
13916 CHECK(*((uint32_t*)val) == 32);
13917 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13918 OutPoint_set_txid(&this_ptr_conv, val_ref);
13921 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
13922 LDKOutPoint this_ptr_conv;
13923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13924 this_ptr_conv.is_owned = false;
13925 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
13929 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
13930 LDKOutPoint this_ptr_conv;
13931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13932 this_ptr_conv.is_owned = false;
13933 OutPoint_set_index(&this_ptr_conv, val);
13936 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
13937 LDKThirtyTwoBytes txid_arg_ref;
13938 CHECK(*((uint32_t*)txid_arg) == 32);
13939 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
13940 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
13941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13943 uint64_t ret_ref = (uint64_t)ret_var.inner;
13944 if (ret_var.is_owned) {
13950 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
13951 LDKOutPoint orig_conv;
13952 orig_conv.inner = (void*)(orig & (~1));
13953 orig_conv.is_owned = false;
13954 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
13955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13957 uint64_t ret_ref = (uint64_t)ret_var.inner;
13958 if (ret_var.is_owned) {
13964 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
13965 LDKOutPoint a_conv;
13966 a_conv.inner = (void*)(a & (~1));
13967 a_conv.is_owned = false;
13968 LDKOutPoint b_conv;
13969 b_conv.inner = (void*)(b & (~1));
13970 b_conv.is_owned = false;
13971 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
13975 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
13976 LDKOutPoint o_conv;
13977 o_conv.inner = (void*)(o & (~1));
13978 o_conv.is_owned = false;
13979 int64_t ret_val = OutPoint_hash(&o_conv);
13983 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
13984 LDKOutPoint this_arg_conv;
13985 this_arg_conv.inner = (void*)(this_arg & (~1));
13986 this_arg_conv.is_owned = false;
13987 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13988 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
13992 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
13993 LDKOutPoint obj_conv;
13994 obj_conv.inner = (void*)(obj & (~1));
13995 obj_conv.is_owned = false;
13996 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
13997 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13998 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13999 CVec_u8Z_free(ret_var);
14003 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
14004 LDKu8slice ser_ref;
14005 ser_ref.datalen = *((uint32_t*)ser);
14006 ser_ref.data = (int8_t*)(ser + 4);
14007 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14008 *ret_conv = OutPoint_read(ser_ref);
14009 return (uint64_t)ret_conv;
14012 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
14013 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14014 this_obj_conv.inner = (void*)(this_obj & (~1));
14015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14016 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14019 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14020 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14022 this_ptr_conv.is_owned = false;
14023 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14026 uint64_t ret_ref = (uint64_t)ret_var.inner;
14027 if (ret_var.is_owned) {
14033 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14034 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14036 this_ptr_conv.is_owned = false;
14037 LDKOutPoint val_conv;
14038 val_conv.inner = (void*)(val & (~1));
14039 val_conv.is_owned = (val & 1) || (val == 0);
14040 val_conv = OutPoint_clone(&val_conv);
14041 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14044 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
14045 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14047 this_ptr_conv.is_owned = false;
14048 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14049 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14053 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14054 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14056 this_ptr_conv.is_owned = false;
14057 LDKPublicKey val_ref;
14058 CHECK(*((uint32_t*)val) == 33);
14059 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14060 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14063 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
14064 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14066 this_ptr_conv.is_owned = false;
14067 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14071 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
14072 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14074 this_ptr_conv.is_owned = false;
14075 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14078 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14079 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14081 this_ptr_conv.is_owned = false;
14082 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14083 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14084 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14087 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
14088 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14090 this_ptr_conv.is_owned = false;
14091 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14092 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
14096 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
14097 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14099 this_ptr_conv.is_owned = false;
14100 LDKPublicKey val_ref;
14101 CHECK(*((uint32_t*)val) == 33);
14102 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14103 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14106 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14107 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14109 this_ptr_conv.is_owned = false;
14110 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14111 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14115 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14116 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14118 this_ptr_conv.is_owned = false;
14119 LDKThirtyTwoBytes val_ref;
14120 CHECK(*((uint32_t*)val) == 32);
14121 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14122 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14125 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14126 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14128 this_ptr_conv.is_owned = false;
14129 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14133 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14134 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14136 this_ptr_conv.is_owned = false;
14137 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14140 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) {
14141 LDKOutPoint outpoint_arg_conv;
14142 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14143 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14144 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14145 LDKPublicKey per_commitment_point_arg_ref;
14146 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
14147 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
14148 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14149 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14150 LDKPublicKey revocation_pubkey_arg_ref;
14151 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
14152 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
14153 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14154 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14155 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14156 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);
14157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14159 uint64_t ret_ref = (uint64_t)ret_var.inner;
14160 if (ret_var.is_owned) {
14166 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
14167 LDKDelayedPaymentOutputDescriptor orig_conv;
14168 orig_conv.inner = (void*)(orig & (~1));
14169 orig_conv.is_owned = false;
14170 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14173 uint64_t ret_ref = (uint64_t)ret_var.inner;
14174 if (ret_var.is_owned) {
14180 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
14181 LDKDelayedPaymentOutputDescriptor obj_conv;
14182 obj_conv.inner = (void*)(obj & (~1));
14183 obj_conv.is_owned = false;
14184 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14185 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14186 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14187 CVec_u8Z_free(ret_var);
14191 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
14192 LDKu8slice ser_ref;
14193 ser_ref.datalen = *((uint32_t*)ser);
14194 ser_ref.data = (int8_t*)(ser + 4);
14195 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14196 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14197 return (uint64_t)ret_conv;
14200 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
14201 LDKStaticPaymentOutputDescriptor this_obj_conv;
14202 this_obj_conv.inner = (void*)(this_obj & (~1));
14203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14204 StaticPaymentOutputDescriptor_free(this_obj_conv);
14207 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14208 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14210 this_ptr_conv.is_owned = false;
14211 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14214 uint64_t ret_ref = (uint64_t)ret_var.inner;
14215 if (ret_var.is_owned) {
14221 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14222 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14224 this_ptr_conv.is_owned = false;
14225 LDKOutPoint val_conv;
14226 val_conv.inner = (void*)(val & (~1));
14227 val_conv.is_owned = (val & 1) || (val == 0);
14228 val_conv = OutPoint_clone(&val_conv);
14229 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14232 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14233 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14235 this_ptr_conv.is_owned = false;
14236 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14237 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14238 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14241 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14242 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14244 this_ptr_conv.is_owned = false;
14245 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14246 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14250 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14251 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14253 this_ptr_conv.is_owned = false;
14254 LDKThirtyTwoBytes val_ref;
14255 CHECK(*((uint32_t*)val) == 32);
14256 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14257 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14260 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14261 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14263 this_ptr_conv.is_owned = false;
14264 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14268 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14269 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14271 this_ptr_conv.is_owned = false;
14272 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14275 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) {
14276 LDKOutPoint outpoint_arg_conv;
14277 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14278 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14279 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14280 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14281 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14282 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14283 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14284 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14285 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14288 uint64_t ret_ref = (uint64_t)ret_var.inner;
14289 if (ret_var.is_owned) {
14295 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
14296 LDKStaticPaymentOutputDescriptor orig_conv;
14297 orig_conv.inner = (void*)(orig & (~1));
14298 orig_conv.is_owned = false;
14299 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14302 uint64_t ret_ref = (uint64_t)ret_var.inner;
14303 if (ret_var.is_owned) {
14309 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
14310 LDKStaticPaymentOutputDescriptor obj_conv;
14311 obj_conv.inner = (void*)(obj & (~1));
14312 obj_conv.is_owned = false;
14313 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14314 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14315 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14316 CVec_u8Z_free(ret_var);
14320 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
14321 LDKu8slice ser_ref;
14322 ser_ref.datalen = *((uint32_t*)ser);
14323 ser_ref.data = (int8_t*)(ser + 4);
14324 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14325 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14326 return (uint64_t)ret_conv;
14329 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
14330 if ((this_ptr & 1) != 0) return;
14331 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14332 FREE((void*)this_ptr);
14333 SpendableOutputDescriptor_free(this_ptr_conv);
14336 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
14337 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14338 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14339 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14340 uint64_t ret_ref = (uint64_t)ret_copy;
14344 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
14345 LDKOutPoint outpoint_conv;
14346 outpoint_conv.inner = (void*)(outpoint & (~1));
14347 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
14348 outpoint_conv = OutPoint_clone(&outpoint_conv);
14349 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
14350 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
14351 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14352 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
14353 uint64_t ret_ref = (uint64_t)ret_copy;
14357 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
14358 LDKDelayedPaymentOutputDescriptor a_conv;
14359 a_conv.inner = (void*)(a & (~1));
14360 a_conv.is_owned = (a & 1) || (a == 0);
14361 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
14362 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14363 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
14364 uint64_t ret_ref = (uint64_t)ret_copy;
14368 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
14369 LDKStaticPaymentOutputDescriptor a_conv;
14370 a_conv.inner = (void*)(a & (~1));
14371 a_conv.is_owned = (a & 1) || (a == 0);
14372 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
14373 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14374 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
14375 uint64_t ret_ref = (uint64_t)ret_copy;
14379 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
14380 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14381 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14382 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14383 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14384 CVec_u8Z_free(ret_var);
14388 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
14389 LDKu8slice ser_ref;
14390 ser_ref.datalen = *((uint32_t*)ser);
14391 ser_ref.data = (int8_t*)(ser + 4);
14392 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14393 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14394 return (uint64_t)ret_conv;
14397 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
14398 if ((this_ptr & 1) != 0) return;
14399 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14400 FREE((void*)this_ptr);
14401 BaseSign_free(this_ptr_conv);
14404 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
14405 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14406 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14407 *ret_ret = Sign_clone(orig_conv);
14408 return (uint64_t)ret_ret;
14411 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
14412 if ((this_ptr & 1) != 0) return;
14413 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14414 FREE((void*)this_ptr);
14415 Sign_free(this_ptr_conv);
14418 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
14419 if ((this_ptr & 1) != 0) return;
14420 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14421 FREE((void*)this_ptr);
14422 KeysInterface_free(this_ptr_conv);
14425 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
14426 LDKInMemorySigner this_obj_conv;
14427 this_obj_conv.inner = (void*)(this_obj & (~1));
14428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14429 InMemorySigner_free(this_obj_conv);
14432 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
14433 LDKInMemorySigner this_ptr_conv;
14434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14435 this_ptr_conv.is_owned = false;
14436 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14437 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
14441 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
14442 LDKInMemorySigner this_ptr_conv;
14443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14444 this_ptr_conv.is_owned = false;
14445 LDKSecretKey val_ref;
14446 CHECK(*((uint32_t*)val) == 32);
14447 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14448 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14451 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
14452 LDKInMemorySigner this_ptr_conv;
14453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14454 this_ptr_conv.is_owned = false;
14455 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14456 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
14460 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
14461 LDKInMemorySigner this_ptr_conv;
14462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14463 this_ptr_conv.is_owned = false;
14464 LDKSecretKey val_ref;
14465 CHECK(*((uint32_t*)val) == 32);
14466 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14467 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14470 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
14471 LDKInMemorySigner this_ptr_conv;
14472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14473 this_ptr_conv.is_owned = false;
14474 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14475 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
14479 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
14480 LDKInMemorySigner this_ptr_conv;
14481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14482 this_ptr_conv.is_owned = false;
14483 LDKSecretKey val_ref;
14484 CHECK(*((uint32_t*)val) == 32);
14485 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14486 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14489 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
14490 LDKInMemorySigner this_ptr_conv;
14491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14492 this_ptr_conv.is_owned = false;
14493 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14494 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
14498 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
14499 LDKInMemorySigner this_ptr_conv;
14500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14501 this_ptr_conv.is_owned = false;
14502 LDKSecretKey val_ref;
14503 CHECK(*((uint32_t*)val) == 32);
14504 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14505 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14508 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
14509 LDKInMemorySigner this_ptr_conv;
14510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14511 this_ptr_conv.is_owned = false;
14512 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14513 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
14517 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
14518 LDKInMemorySigner this_ptr_conv;
14519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14520 this_ptr_conv.is_owned = false;
14521 LDKSecretKey val_ref;
14522 CHECK(*((uint32_t*)val) == 32);
14523 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14524 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14527 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
14528 LDKInMemorySigner this_ptr_conv;
14529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14530 this_ptr_conv.is_owned = false;
14531 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14532 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
14536 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
14537 LDKInMemorySigner this_ptr_conv;
14538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14539 this_ptr_conv.is_owned = false;
14540 LDKThirtyTwoBytes val_ref;
14541 CHECK(*((uint32_t*)val) == 32);
14542 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14543 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14546 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
14547 LDKInMemorySigner orig_conv;
14548 orig_conv.inner = (void*)(orig & (~1));
14549 orig_conv.is_owned = false;
14550 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14553 uint64_t ret_ref = (uint64_t)ret_var.inner;
14554 if (ret_var.is_owned) {
14560 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) {
14561 LDKSecretKey funding_key_ref;
14562 CHECK(*((uint32_t*)funding_key) == 32);
14563 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
14564 LDKSecretKey revocation_base_key_ref;
14565 CHECK(*((uint32_t*)revocation_base_key) == 32);
14566 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
14567 LDKSecretKey payment_key_ref;
14568 CHECK(*((uint32_t*)payment_key) == 32);
14569 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
14570 LDKSecretKey delayed_payment_base_key_ref;
14571 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
14572 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
14573 LDKSecretKey htlc_base_key_ref;
14574 CHECK(*((uint32_t*)htlc_base_key) == 32);
14575 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
14576 LDKThirtyTwoBytes commitment_seed_ref;
14577 CHECK(*((uint32_t*)commitment_seed) == 32);
14578 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
14579 LDKThirtyTwoBytes channel_keys_id_ref;
14580 CHECK(*((uint32_t*)channel_keys_id) == 32);
14581 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
14582 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);
14583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14585 uint64_t ret_ref = (uint64_t)ret_var.inner;
14586 if (ret_var.is_owned) {
14592 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
14593 LDKInMemorySigner this_arg_conv;
14594 this_arg_conv.inner = (void*)(this_arg & (~1));
14595 this_arg_conv.is_owned = false;
14596 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14599 uint64_t ret_ref = (uint64_t)ret_var.inner;
14600 if (ret_var.is_owned) {
14606 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
14607 LDKInMemorySigner this_arg_conv;
14608 this_arg_conv.inner = (void*)(this_arg & (~1));
14609 this_arg_conv.is_owned = false;
14610 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14614 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
14615 LDKInMemorySigner this_arg_conv;
14616 this_arg_conv.inner = (void*)(this_arg & (~1));
14617 this_arg_conv.is_owned = false;
14618 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14622 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
14623 LDKInMemorySigner this_arg_conv;
14624 this_arg_conv.inner = (void*)(this_arg & (~1));
14625 this_arg_conv.is_owned = false;
14626 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14630 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
14631 LDKInMemorySigner this_arg_conv;
14632 this_arg_conv.inner = (void*)(this_arg & (~1));
14633 this_arg_conv.is_owned = false;
14634 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14637 uint64_t ret_ref = (uint64_t)ret_var.inner;
14638 if (ret_var.is_owned) {
14644 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
14645 LDKInMemorySigner this_arg_conv;
14646 this_arg_conv.inner = (void*)(this_arg & (~1));
14647 this_arg_conv.is_owned = false;
14648 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
14649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14651 uint64_t ret_ref = (uint64_t)ret_var.inner;
14652 if (ret_var.is_owned) {
14658 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) {
14659 LDKInMemorySigner this_arg_conv;
14660 this_arg_conv.inner = (void*)(this_arg & (~1));
14661 this_arg_conv.is_owned = false;
14662 LDKTransaction spend_tx_ref;
14663 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14664 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14665 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14666 spend_tx_ref.data_is_owned = true;
14667 LDKStaticPaymentOutputDescriptor descriptor_conv;
14668 descriptor_conv.inner = (void*)(descriptor & (~1));
14669 descriptor_conv.is_owned = false;
14670 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14671 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14672 return (uint64_t)ret_conv;
14675 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) {
14676 LDKInMemorySigner this_arg_conv;
14677 this_arg_conv.inner = (void*)(this_arg & (~1));
14678 this_arg_conv.is_owned = false;
14679 LDKTransaction spend_tx_ref;
14680 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14681 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14682 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14683 spend_tx_ref.data_is_owned = true;
14684 LDKDelayedPaymentOutputDescriptor descriptor_conv;
14685 descriptor_conv.inner = (void*)(descriptor & (~1));
14686 descriptor_conv.is_owned = false;
14687 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14688 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14689 return (uint64_t)ret_conv;
14692 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
14693 LDKInMemorySigner this_arg_conv;
14694 this_arg_conv.inner = (void*)(this_arg & (~1));
14695 this_arg_conv.is_owned = false;
14696 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
14697 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
14698 return (uint64_t)ret_ret;
14701 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
14702 LDKInMemorySigner this_arg_conv;
14703 this_arg_conv.inner = (void*)(this_arg & (~1));
14704 this_arg_conv.is_owned = false;
14705 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14706 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
14707 return (uint64_t)ret_ret;
14710 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
14711 LDKInMemorySigner obj_conv;
14712 obj_conv.inner = (void*)(obj & (~1));
14713 obj_conv.is_owned = false;
14714 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
14715 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14716 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14717 CVec_u8Z_free(ret_var);
14721 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
14722 LDKu8slice ser_ref;
14723 ser_ref.datalen = *((uint32_t*)ser);
14724 ser_ref.data = (int8_t*)(ser + 4);
14725 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14726 *ret_conv = InMemorySigner_read(ser_ref);
14727 return (uint64_t)ret_conv;
14730 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
14731 LDKKeysManager this_obj_conv;
14732 this_obj_conv.inner = (void*)(this_obj & (~1));
14733 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14734 KeysManager_free(this_obj_conv);
14737 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
14738 unsigned char seed_arr[32];
14739 CHECK(*((uint32_t*)seed) == 32);
14740 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
14741 unsigned char (*seed_ref)[32] = &seed_arr;
14742 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
14743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14745 uint64_t ret_ref = (uint64_t)ret_var.inner;
14746 if (ret_var.is_owned) {
14752 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
14753 LDKKeysManager this_arg_conv;
14754 this_arg_conv.inner = (void*)(this_arg & (~1));
14755 this_arg_conv.is_owned = false;
14756 unsigned char params_arr[32];
14757 CHECK(*((uint32_t*)params) == 32);
14758 memcpy(params_arr, (uint8_t*)(params + 4), 32);
14759 unsigned char (*params_ref)[32] = ¶ms_arr;
14760 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
14761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14763 uint64_t ret_ref = (uint64_t)ret_var.inner;
14764 if (ret_var.is_owned) {
14770 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) {
14771 LDKKeysManager this_arg_conv;
14772 this_arg_conv.inner = (void*)(this_arg & (~1));
14773 this_arg_conv.is_owned = false;
14774 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
14775 descriptors_constr.datalen = *((uint32_t*)descriptors);
14776 if (descriptors_constr.datalen > 0)
14777 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14779 descriptors_constr.data = NULL;
14780 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
14781 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
14782 uint32_t descriptors_conv_27 = descriptors_vals[b];
14783 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
14784 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
14785 descriptors_constr.data[b] = descriptors_conv_27_conv;
14787 LDKCVec_TxOutZ outputs_constr;
14788 outputs_constr.datalen = *((uint32_t*)outputs);
14789 if (outputs_constr.datalen > 0)
14790 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14792 outputs_constr.data = NULL;
14793 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
14794 for (size_t h = 0; h < outputs_constr.datalen; h++) {
14795 uint32_t outputs_conv_7 = outputs_vals[h];
14796 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
14797 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
14798 outputs_constr.data[h] = outputs_conv_7_conv;
14800 LDKCVec_u8Z change_destination_script_ref;
14801 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
14802 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
14803 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
14804 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14805 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
14806 return (uint64_t)ret_conv;
14809 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
14810 LDKKeysManager this_arg_conv;
14811 this_arg_conv.inner = (void*)(this_arg & (~1));
14812 this_arg_conv.is_owned = false;
14813 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
14814 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
14815 return (uint64_t)ret_ret;
14818 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
14819 LDKChannelManager this_obj_conv;
14820 this_obj_conv.inner = (void*)(this_obj & (~1));
14821 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14822 ChannelManager_free(this_obj_conv);
14825 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
14826 LDKChainParameters this_obj_conv;
14827 this_obj_conv.inner = (void*)(this_obj & (~1));
14828 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14829 ChainParameters_free(this_obj_conv);
14832 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
14833 LDKChainParameters this_ptr_conv;
14834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14835 this_ptr_conv.is_owned = false;
14836 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
14840 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
14841 LDKChainParameters this_ptr_conv;
14842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14843 this_ptr_conv.is_owned = false;
14844 LDKNetwork val_conv = LDKNetwork_from_js(val);
14845 ChainParameters_set_network(&this_ptr_conv, val_conv);
14848 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
14849 LDKChainParameters this_ptr_conv;
14850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14851 this_ptr_conv.is_owned = false;
14852 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
14853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14855 uint64_t ret_ref = (uint64_t)ret_var.inner;
14856 if (ret_var.is_owned) {
14862 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
14863 LDKChainParameters this_ptr_conv;
14864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14865 this_ptr_conv.is_owned = false;
14866 LDKBestBlock val_conv;
14867 val_conv.inner = (void*)(val & (~1));
14868 val_conv.is_owned = (val & 1) || (val == 0);
14869 val_conv = BestBlock_clone(&val_conv);
14870 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
14873 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
14874 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
14875 LDKBestBlock best_block_arg_conv;
14876 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
14877 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
14878 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
14879 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
14880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14882 uint64_t ret_ref = (uint64_t)ret_var.inner;
14883 if (ret_var.is_owned) {
14889 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
14890 LDKChainParameters orig_conv;
14891 orig_conv.inner = (void*)(orig & (~1));
14892 orig_conv.is_owned = false;
14893 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
14894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14896 uint64_t ret_ref = (uint64_t)ret_var.inner;
14897 if (ret_var.is_owned) {
14903 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
14904 LDKCounterpartyForwardingInfo this_obj_conv;
14905 this_obj_conv.inner = (void*)(this_obj & (~1));
14906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14907 CounterpartyForwardingInfo_free(this_obj_conv);
14910 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
14911 LDKCounterpartyForwardingInfo this_ptr_conv;
14912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14913 this_ptr_conv.is_owned = false;
14914 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
14918 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14919 LDKCounterpartyForwardingInfo this_ptr_conv;
14920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14921 this_ptr_conv.is_owned = false;
14922 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
14925 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
14926 LDKCounterpartyForwardingInfo this_ptr_conv;
14927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14928 this_ptr_conv.is_owned = false;
14929 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
14933 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14934 LDKCounterpartyForwardingInfo this_ptr_conv;
14935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14936 this_ptr_conv.is_owned = false;
14937 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
14940 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
14941 LDKCounterpartyForwardingInfo this_ptr_conv;
14942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14943 this_ptr_conv.is_owned = false;
14944 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
14948 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14949 LDKCounterpartyForwardingInfo this_ptr_conv;
14950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14951 this_ptr_conv.is_owned = false;
14952 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
14955 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
14956 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
14957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14959 uint64_t ret_ref = (uint64_t)ret_var.inner;
14960 if (ret_var.is_owned) {
14966 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
14967 LDKCounterpartyForwardingInfo orig_conv;
14968 orig_conv.inner = (void*)(orig & (~1));
14969 orig_conv.is_owned = false;
14970 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
14971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14973 uint64_t ret_ref = (uint64_t)ret_var.inner;
14974 if (ret_var.is_owned) {
14980 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
14981 LDKChannelCounterparty this_obj_conv;
14982 this_obj_conv.inner = (void*)(this_obj & (~1));
14983 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14984 ChannelCounterparty_free(this_obj_conv);
14987 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
14988 LDKChannelCounterparty this_ptr_conv;
14989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14990 this_ptr_conv.is_owned = false;
14991 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14992 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
14996 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
14997 LDKChannelCounterparty this_ptr_conv;
14998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14999 this_ptr_conv.is_owned = false;
15000 LDKPublicKey val_ref;
15001 CHECK(*((uint32_t*)val) == 33);
15002 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15003 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
15006 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
15007 LDKChannelCounterparty this_ptr_conv;
15008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15009 this_ptr_conv.is_owned = false;
15010 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
15011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15013 uint64_t ret_ref = (uint64_t)ret_var.inner;
15014 if (ret_var.is_owned) {
15020 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
15021 LDKChannelCounterparty this_ptr_conv;
15022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15023 this_ptr_conv.is_owned = false;
15024 LDKInitFeatures val_conv;
15025 val_conv.inner = (void*)(val & (~1));
15026 val_conv.is_owned = (val & 1) || (val == 0);
15027 val_conv = InitFeatures_clone(&val_conv);
15028 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
15031 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15032 LDKChannelCounterparty this_ptr_conv;
15033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15034 this_ptr_conv.is_owned = false;
15035 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
15039 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
15040 LDKChannelCounterparty this_ptr_conv;
15041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15042 this_ptr_conv.is_owned = false;
15043 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
15046 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
15047 LDKChannelCounterparty this_ptr_conv;
15048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15049 this_ptr_conv.is_owned = false;
15050 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
15051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15053 uint64_t ret_ref = (uint64_t)ret_var.inner;
15054 if (ret_var.is_owned) {
15060 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
15061 LDKChannelCounterparty this_ptr_conv;
15062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15063 this_ptr_conv.is_owned = false;
15064 LDKCounterpartyForwardingInfo val_conv;
15065 val_conv.inner = (void*)(val & (~1));
15066 val_conv.is_owned = (val & 1) || (val == 0);
15067 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
15068 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
15071 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
15072 LDKPublicKey node_id_arg_ref;
15073 CHECK(*((uint32_t*)node_id_arg) == 33);
15074 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
15075 LDKInitFeatures features_arg_conv;
15076 features_arg_conv.inner = (void*)(features_arg & (~1));
15077 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15078 features_arg_conv = InitFeatures_clone(&features_arg_conv);
15079 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
15080 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
15081 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
15082 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
15083 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
15084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15086 uint64_t ret_ref = (uint64_t)ret_var.inner;
15087 if (ret_var.is_owned) {
15093 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
15094 LDKChannelCounterparty orig_conv;
15095 orig_conv.inner = (void*)(orig & (~1));
15096 orig_conv.is_owned = false;
15097 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
15098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15100 uint64_t ret_ref = (uint64_t)ret_var.inner;
15101 if (ret_var.is_owned) {
15107 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
15108 LDKChannelDetails this_obj_conv;
15109 this_obj_conv.inner = (void*)(this_obj & (~1));
15110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15111 ChannelDetails_free(this_obj_conv);
15114 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
15115 LDKChannelDetails this_ptr_conv;
15116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15117 this_ptr_conv.is_owned = false;
15118 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15119 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
15123 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15124 LDKChannelDetails this_ptr_conv;
15125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15126 this_ptr_conv.is_owned = false;
15127 LDKThirtyTwoBytes val_ref;
15128 CHECK(*((uint32_t*)val) == 32);
15129 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15130 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15133 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
15134 LDKChannelDetails this_ptr_conv;
15135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15136 this_ptr_conv.is_owned = false;
15137 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
15138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15140 uint64_t ret_ref = (uint64_t)ret_var.inner;
15141 if (ret_var.is_owned) {
15147 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
15148 LDKChannelDetails this_ptr_conv;
15149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15150 this_ptr_conv.is_owned = false;
15151 LDKChannelCounterparty val_conv;
15152 val_conv.inner = (void*)(val & (~1));
15153 val_conv.is_owned = (val & 1) || (val == 0);
15154 val_conv = ChannelCounterparty_clone(&val_conv);
15155 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
15158 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
15159 LDKChannelDetails this_ptr_conv;
15160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15161 this_ptr_conv.is_owned = false;
15162 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15165 uint64_t ret_ref = (uint64_t)ret_var.inner;
15166 if (ret_var.is_owned) {
15172 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
15173 LDKChannelDetails this_ptr_conv;
15174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15175 this_ptr_conv.is_owned = false;
15176 LDKOutPoint val_conv;
15177 val_conv.inner = (void*)(val & (~1));
15178 val_conv.is_owned = (val & 1) || (val == 0);
15179 val_conv = OutPoint_clone(&val_conv);
15180 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15183 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
15184 LDKChannelDetails this_ptr_conv;
15185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15186 this_ptr_conv.is_owned = false;
15187 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15188 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15189 uint64_t ret_ref = (uint64_t)ret_copy;
15193 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
15194 LDKChannelDetails this_ptr_conv;
15195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15196 this_ptr_conv.is_owned = false;
15197 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15198 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15199 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15202 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
15203 LDKChannelDetails this_ptr_conv;
15204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15205 this_ptr_conv.is_owned = false;
15206 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15210 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15211 LDKChannelDetails this_ptr_conv;
15212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15213 this_ptr_conv.is_owned = false;
15214 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15217 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15218 LDKChannelDetails this_ptr_conv;
15219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15220 this_ptr_conv.is_owned = false;
15221 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15222 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
15223 uint64_t ret_ref = (uint64_t)ret_copy;
15227 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
15228 LDKChannelDetails this_ptr_conv;
15229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15230 this_ptr_conv.is_owned = false;
15231 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15232 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15233 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
15236 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
15237 LDKChannelDetails this_ptr_conv;
15238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15239 this_ptr_conv.is_owned = false;
15240 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15244 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
15245 LDKChannelDetails this_ptr_conv;
15246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15247 this_ptr_conv.is_owned = false;
15248 ChannelDetails_set_user_id(&this_ptr_conv, val);
15251 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
15252 LDKChannelDetails this_ptr_conv;
15253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15254 this_ptr_conv.is_owned = false;
15255 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15259 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15260 LDKChannelDetails this_ptr_conv;
15261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15262 this_ptr_conv.is_owned = false;
15263 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15266 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
15267 LDKChannelDetails this_ptr_conv;
15268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15269 this_ptr_conv.is_owned = false;
15270 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15274 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15275 LDKChannelDetails this_ptr_conv;
15276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15277 this_ptr_conv.is_owned = false;
15278 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15281 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
15282 LDKChannelDetails this_ptr_conv;
15283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15284 this_ptr_conv.is_owned = false;
15285 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15286 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
15287 uint64_t ret_ref = (uint64_t)ret_copy;
15291 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
15292 LDKChannelDetails this_ptr_conv;
15293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15294 this_ptr_conv.is_owned = false;
15295 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
15296 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
15297 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
15300 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
15301 LDKChannelDetails this_ptr_conv;
15302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15303 this_ptr_conv.is_owned = false;
15304 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15305 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
15306 uint64_t ret_ref = (uint64_t)ret_copy;
15310 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
15311 LDKChannelDetails this_ptr_conv;
15312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15313 this_ptr_conv.is_owned = false;
15314 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
15315 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
15316 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
15319 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
15320 LDKChannelDetails this_ptr_conv;
15321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15322 this_ptr_conv.is_owned = false;
15323 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15327 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
15328 LDKChannelDetails this_ptr_conv;
15329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15330 this_ptr_conv.is_owned = false;
15331 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15334 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
15335 LDKChannelDetails this_ptr_conv;
15336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15337 this_ptr_conv.is_owned = false;
15338 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15342 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
15343 LDKChannelDetails this_ptr_conv;
15344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15345 this_ptr_conv.is_owned = false;
15346 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15349 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
15350 LDKChannelDetails this_ptr_conv;
15351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15352 this_ptr_conv.is_owned = false;
15353 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15357 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
15358 LDKChannelDetails this_ptr_conv;
15359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15360 this_ptr_conv.is_owned = false;
15361 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15364 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
15365 LDKChannelDetails this_ptr_conv;
15366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15367 this_ptr_conv.is_owned = false;
15368 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15372 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
15373 LDKChannelDetails this_ptr_conv;
15374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15375 this_ptr_conv.is_owned = false;
15376 ChannelDetails_set_is_public(&this_ptr_conv, val);
15379 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) {
15380 LDKThirtyTwoBytes channel_id_arg_ref;
15381 CHECK(*((uint32_t*)channel_id_arg) == 32);
15382 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15383 LDKChannelCounterparty counterparty_arg_conv;
15384 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
15385 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
15386 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
15387 LDKOutPoint funding_txo_arg_conv;
15388 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
15389 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
15390 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
15391 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
15392 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
15393 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
15394 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
15395 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
15396 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
15397 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
15398 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);
15399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15401 uint64_t ret_ref = (uint64_t)ret_var.inner;
15402 if (ret_var.is_owned) {
15408 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
15409 LDKChannelDetails orig_conv;
15410 orig_conv.inner = (void*)(orig & (~1));
15411 orig_conv.is_owned = false;
15412 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15415 uint64_t ret_ref = (uint64_t)ret_var.inner;
15416 if (ret_var.is_owned) {
15422 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
15423 if ((this_ptr & 1) != 0) return;
15424 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15425 FREE((void*)this_ptr);
15426 PaymentSendFailure_free(this_ptr_conv);
15429 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
15430 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15431 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15432 *ret_copy = PaymentSendFailure_clone(orig_conv);
15433 uint64_t ret_ref = (uint64_t)ret_copy;
15437 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
15438 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
15439 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
15440 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15441 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
15442 uint64_t ret_ref = (uint64_t)ret_copy;
15446 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
15447 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15448 a_constr.datalen = *((uint32_t*)a);
15449 if (a_constr.datalen > 0)
15450 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15452 a_constr.data = NULL;
15453 uint32_t* a_vals = (uint32_t*)(a + 4);
15454 for (size_t w = 0; w < a_constr.datalen; w++) {
15455 uint32_t a_conv_22 = a_vals[w];
15456 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15457 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15458 a_constr.data[w] = a_conv_22_conv;
15460 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15461 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
15462 uint64_t ret_ref = (uint64_t)ret_copy;
15466 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
15467 LDKCVec_APIErrorZ a_constr;
15468 a_constr.datalen = *((uint32_t*)a);
15469 if (a_constr.datalen > 0)
15470 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15472 a_constr.data = NULL;
15473 uint32_t* a_vals = (uint32_t*)(a + 4);
15474 for (size_t k = 0; k < a_constr.datalen; k++) {
15475 uint32_t a_conv_10 = a_vals[k];
15476 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
15477 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
15478 a_constr.data[k] = a_conv_10_conv;
15480 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15481 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
15482 uint64_t ret_ref = (uint64_t)ret_copy;
15486 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
15487 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15488 a_constr.datalen = *((uint32_t*)a);
15489 if (a_constr.datalen > 0)
15490 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15492 a_constr.data = NULL;
15493 uint32_t* a_vals = (uint32_t*)(a + 4);
15494 for (size_t w = 0; w < a_constr.datalen; w++) {
15495 uint32_t a_conv_22 = a_vals[w];
15496 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15497 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15498 a_constr.data[w] = a_conv_22_conv;
15500 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15501 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
15502 uint64_t ret_ref = (uint64_t)ret_copy;
15506 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) {
15507 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15508 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15509 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15510 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15511 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15512 LDKUserConfig config_conv;
15513 config_conv.inner = (void*)(config & (~1));
15514 config_conv.is_owned = (config & 1) || (config == 0);
15515 config_conv = UserConfig_clone(&config_conv);
15516 LDKChainParameters params_conv;
15517 params_conv.inner = (void*)(params & (~1));
15518 params_conv.is_owned = (params & 1) || (params == 0);
15519 params_conv = ChainParameters_clone(¶ms_conv);
15520 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15523 uint64_t ret_ref = (uint64_t)ret_var.inner;
15524 if (ret_var.is_owned) {
15530 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
15531 LDKChannelManager this_arg_conv;
15532 this_arg_conv.inner = (void*)(this_arg & (~1));
15533 this_arg_conv.is_owned = false;
15534 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15537 uint64_t ret_ref = (uint64_t)ret_var.inner;
15538 if (ret_var.is_owned) {
15544 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) {
15545 LDKChannelManager this_arg_conv;
15546 this_arg_conv.inner = (void*)(this_arg & (~1));
15547 this_arg_conv.is_owned = false;
15548 LDKPublicKey their_network_key_ref;
15549 CHECK(*((uint32_t*)their_network_key) == 33);
15550 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
15551 LDKUserConfig override_config_conv;
15552 override_config_conv.inner = (void*)(override_config & (~1));
15553 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15554 override_config_conv = UserConfig_clone(&override_config_conv);
15555 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15556 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15557 return (uint64_t)ret_conv;
15560 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
15561 LDKChannelManager this_arg_conv;
15562 this_arg_conv.inner = (void*)(this_arg & (~1));
15563 this_arg_conv.is_owned = false;
15564 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15565 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15566 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15567 for (size_t q = 0; q < ret_var.datalen; q++) {
15568 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15569 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15570 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15571 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15572 if (ret_conv_16_var.is_owned) {
15573 ret_conv_16_ref |= 1;
15575 ret_arr_ptr[q] = ret_conv_16_ref;
15577 FREE(ret_var.data);
15581 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
15582 LDKChannelManager this_arg_conv;
15583 this_arg_conv.inner = (void*)(this_arg & (~1));
15584 this_arg_conv.is_owned = false;
15585 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15586 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15587 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15588 for (size_t q = 0; q < ret_var.datalen; q++) {
15589 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15590 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15591 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15592 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15593 if (ret_conv_16_var.is_owned) {
15594 ret_conv_16_ref |= 1;
15596 ret_arr_ptr[q] = ret_conv_16_ref;
15598 FREE(ret_var.data);
15602 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15603 LDKChannelManager this_arg_conv;
15604 this_arg_conv.inner = (void*)(this_arg & (~1));
15605 this_arg_conv.is_owned = false;
15606 unsigned char channel_id_arr[32];
15607 CHECK(*((uint32_t*)channel_id) == 32);
15608 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15609 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15610 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15611 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15612 return (uint64_t)ret_conv;
15615 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
15616 LDKChannelManager this_arg_conv;
15617 this_arg_conv.inner = (void*)(this_arg & (~1));
15618 this_arg_conv.is_owned = false;
15619 unsigned char channel_id_arr[32];
15620 CHECK(*((uint32_t*)channel_id) == 32);
15621 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15622 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15623 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15624 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
15625 return (uint64_t)ret_conv;
15628 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15629 LDKChannelManager this_arg_conv;
15630 this_arg_conv.inner = (void*)(this_arg & (~1));
15631 this_arg_conv.is_owned = false;
15632 unsigned char channel_id_arr[32];
15633 CHECK(*((uint32_t*)channel_id) == 32);
15634 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15635 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15636 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15637 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15638 return (uint64_t)ret_conv;
15641 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
15642 LDKChannelManager this_arg_conv;
15643 this_arg_conv.inner = (void*)(this_arg & (~1));
15644 this_arg_conv.is_owned = false;
15645 ChannelManager_force_close_all_channels(&this_arg_conv);
15648 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
15649 LDKChannelManager this_arg_conv;
15650 this_arg_conv.inner = (void*)(this_arg & (~1));
15651 this_arg_conv.is_owned = false;
15652 LDKRoute route_conv;
15653 route_conv.inner = (void*)(route & (~1));
15654 route_conv.is_owned = false;
15655 LDKThirtyTwoBytes payment_hash_ref;
15656 CHECK(*((uint32_t*)payment_hash) == 32);
15657 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15658 LDKThirtyTwoBytes payment_secret_ref;
15659 CHECK(*((uint32_t*)payment_secret) == 32);
15660 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
15661 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15662 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15663 return (uint64_t)ret_conv;
15666 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
15667 LDKChannelManager this_arg_conv;
15668 this_arg_conv.inner = (void*)(this_arg & (~1));
15669 this_arg_conv.is_owned = false;
15670 LDKRoute route_conv;
15671 route_conv.inner = (void*)(route & (~1));
15672 route_conv.is_owned = false;
15673 LDKThirtyTwoBytes payment_preimage_ref;
15674 CHECK(*((uint32_t*)payment_preimage) == 32);
15675 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15676 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
15677 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
15678 return (uint64_t)ret_conv;
15681 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
15682 LDKChannelManager this_arg_conv;
15683 this_arg_conv.inner = (void*)(this_arg & (~1));
15684 this_arg_conv.is_owned = false;
15685 unsigned char temporary_channel_id_arr[32];
15686 CHECK(*((uint32_t*)temporary_channel_id) == 32);
15687 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
15688 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15689 LDKTransaction funding_transaction_ref;
15690 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
15691 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15692 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
15693 funding_transaction_ref.data_is_owned = true;
15694 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15695 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15696 return (uint64_t)ret_conv;
15699 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
15700 LDKChannelManager this_arg_conv;
15701 this_arg_conv.inner = (void*)(this_arg & (~1));
15702 this_arg_conv.is_owned = false;
15703 LDKThreeBytes rgb_ref;
15704 CHECK(*((uint32_t*)rgb) == 3);
15705 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
15706 LDKThirtyTwoBytes alias_ref;
15707 CHECK(*((uint32_t*)alias) == 32);
15708 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
15709 LDKCVec_NetAddressZ addresses_constr;
15710 addresses_constr.datalen = *((uint32_t*)addresses);
15711 if (addresses_constr.datalen > 0)
15712 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15714 addresses_constr.data = NULL;
15715 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
15716 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15717 uint32_t addresses_conv_12 = addresses_vals[m];
15718 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15719 addresses_constr.data[m] = addresses_conv_12_conv;
15721 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15724 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
15725 LDKChannelManager this_arg_conv;
15726 this_arg_conv.inner = (void*)(this_arg & (~1));
15727 this_arg_conv.is_owned = false;
15728 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15731 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
15732 LDKChannelManager this_arg_conv;
15733 this_arg_conv.inner = (void*)(this_arg & (~1));
15734 this_arg_conv.is_owned = false;
15735 ChannelManager_timer_tick_occurred(&this_arg_conv);
15738 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
15739 LDKChannelManager this_arg_conv;
15740 this_arg_conv.inner = (void*)(this_arg & (~1));
15741 this_arg_conv.is_owned = false;
15742 unsigned char payment_hash_arr[32];
15743 CHECK(*((uint32_t*)payment_hash) == 32);
15744 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
15745 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15746 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15750 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
15751 LDKChannelManager this_arg_conv;
15752 this_arg_conv.inner = (void*)(this_arg & (~1));
15753 this_arg_conv.is_owned = false;
15754 LDKThirtyTwoBytes payment_preimage_ref;
15755 CHECK(*((uint32_t*)payment_preimage) == 32);
15756 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15757 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15761 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
15762 LDKChannelManager this_arg_conv;
15763 this_arg_conv.inner = (void*)(this_arg & (~1));
15764 this_arg_conv.is_owned = false;
15765 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15766 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
15770 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
15771 LDKChannelManager this_arg_conv;
15772 this_arg_conv.inner = (void*)(this_arg & (~1));
15773 this_arg_conv.is_owned = false;
15774 LDKOutPoint funding_txo_conv;
15775 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15776 funding_txo_conv.is_owned = false;
15777 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15780 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) {
15781 LDKChannelManager this_arg_conv;
15782 this_arg_conv.inner = (void*)(this_arg & (~1));
15783 this_arg_conv.is_owned = false;
15784 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15785 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15786 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15787 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15788 return (uint64_t)ret_ref;
15791 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) {
15792 LDKChannelManager this_arg_conv;
15793 this_arg_conv.inner = (void*)(this_arg & (~1));
15794 this_arg_conv.is_owned = false;
15795 LDKThirtyTwoBytes payment_hash_ref;
15796 CHECK(*((uint32_t*)payment_hash) == 32);
15797 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15798 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15799 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15800 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15801 *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);
15802 return (uint64_t)ret_conv;
15805 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
15806 LDKChannelManager this_arg_conv;
15807 this_arg_conv.inner = (void*)(this_arg & (~1));
15808 this_arg_conv.is_owned = false;
15809 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15810 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15811 return (uint64_t)ret_ret;
15814 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
15815 LDKChannelManager this_arg_conv;
15816 this_arg_conv.inner = (void*)(this_arg & (~1));
15817 this_arg_conv.is_owned = false;
15818 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15819 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15820 return (uint64_t)ret_ret;
15823 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
15824 LDKChannelManager this_arg_conv;
15825 this_arg_conv.inner = (void*)(this_arg & (~1));
15826 this_arg_conv.is_owned = false;
15827 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
15828 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
15829 return (uint64_t)ret_ret;
15832 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
15833 LDKChannelManager this_arg_conv;
15834 this_arg_conv.inner = (void*)(this_arg & (~1));
15835 this_arg_conv.is_owned = false;
15836 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15837 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
15838 return (uint64_t)ret_ret;
15841 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
15842 LDKChannelManager this_arg_conv;
15843 this_arg_conv.inner = (void*)(this_arg & (~1));
15844 this_arg_conv.is_owned = false;
15845 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15849 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
15850 LDKChannelManager this_arg_conv;
15851 this_arg_conv.inner = (void*)(this_arg & (~1));
15852 this_arg_conv.is_owned = false;
15853 ChannelManager_await_persistable_update(&this_arg_conv);
15856 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
15857 LDKChannelManager this_arg_conv;
15858 this_arg_conv.inner = (void*)(this_arg & (~1));
15859 this_arg_conv.is_owned = false;
15860 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
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_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
15871 LDKChannelManager this_arg_conv;
15872 this_arg_conv.inner = (void*)(this_arg & (~1));
15873 this_arg_conv.is_owned = false;
15874 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15875 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15876 return (uint64_t)ret_ret;
15879 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
15880 LDKChannelManager obj_conv;
15881 obj_conv.inner = (void*)(obj & (~1));
15882 obj_conv.is_owned = false;
15883 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15884 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15885 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15886 CVec_u8Z_free(ret_var);
15890 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
15891 LDKChannelManagerReadArgs this_obj_conv;
15892 this_obj_conv.inner = (void*)(this_obj & (~1));
15893 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15894 ChannelManagerReadArgs_free(this_obj_conv);
15897 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
15898 LDKChannelManagerReadArgs this_ptr_conv;
15899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15900 this_ptr_conv.is_owned = false;
15901 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15905 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
15906 LDKChannelManagerReadArgs this_ptr_conv;
15907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15908 this_ptr_conv.is_owned = false;
15909 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15910 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15913 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
15914 LDKChannelManagerReadArgs this_ptr_conv;
15915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15916 this_ptr_conv.is_owned = false;
15917 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15921 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
15922 LDKChannelManagerReadArgs this_ptr_conv;
15923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15924 this_ptr_conv.is_owned = false;
15925 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
15926 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
15929 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
15930 LDKChannelManagerReadArgs this_ptr_conv;
15931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15932 this_ptr_conv.is_owned = false;
15933 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
15937 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
15938 LDKChannelManagerReadArgs this_ptr_conv;
15939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15940 this_ptr_conv.is_owned = false;
15941 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
15942 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
15945 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
15946 LDKChannelManagerReadArgs this_ptr_conv;
15947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15948 this_ptr_conv.is_owned = false;
15949 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
15953 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
15954 LDKChannelManagerReadArgs this_ptr_conv;
15955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15956 this_ptr_conv.is_owned = false;
15957 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
15958 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
15961 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
15962 LDKChannelManagerReadArgs this_ptr_conv;
15963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15964 this_ptr_conv.is_owned = false;
15965 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
15969 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
15970 LDKChannelManagerReadArgs this_ptr_conv;
15971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15972 this_ptr_conv.is_owned = false;
15973 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
15974 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
15977 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
15978 LDKChannelManagerReadArgs this_ptr_conv;
15979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15980 this_ptr_conv.is_owned = false;
15981 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
15982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15984 uint64_t ret_ref = (uint64_t)ret_var.inner;
15985 if (ret_var.is_owned) {
15991 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
15992 LDKChannelManagerReadArgs this_ptr_conv;
15993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15994 this_ptr_conv.is_owned = false;
15995 LDKUserConfig val_conv;
15996 val_conv.inner = (void*)(val & (~1));
15997 val_conv.is_owned = (val & 1) || (val == 0);
15998 val_conv = UserConfig_clone(&val_conv);
15999 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16002 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) {
16003 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16004 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16005 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16006 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16007 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16008 LDKUserConfig default_config_conv;
16009 default_config_conv.inner = (void*)(default_config & (~1));
16010 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16011 default_config_conv = UserConfig_clone(&default_config_conv);
16012 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16013 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
16014 if (channel_monitors_constr.datalen > 0)
16015 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16017 channel_monitors_constr.data = NULL;
16018 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
16019 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16020 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
16021 LDKChannelMonitor channel_monitors_conv_16_conv;
16022 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16023 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16024 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16026 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);
16027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16029 uint64_t ret_ref = (uint64_t)ret_var.inner;
16030 if (ret_var.is_owned) {
16036 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
16037 LDKu8slice ser_ref;
16038 ser_ref.datalen = *((uint32_t*)ser);
16039 ser_ref.data = (int8_t*)(ser + 4);
16040 LDKChannelManagerReadArgs arg_conv;
16041 arg_conv.inner = (void*)(arg & (~1));
16042 arg_conv.is_owned = (arg & 1) || (arg == 0);
16043 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16044 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16045 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16046 return (uint64_t)ret_conv;
16049 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
16050 LDKDecodeError this_obj_conv;
16051 this_obj_conv.inner = (void*)(this_obj & (~1));
16052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16053 DecodeError_free(this_obj_conv);
16056 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
16057 LDKDecodeError orig_conv;
16058 orig_conv.inner = (void*)(orig & (~1));
16059 orig_conv.is_owned = false;
16060 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16063 uint64_t ret_ref = (uint64_t)ret_var.inner;
16064 if (ret_var.is_owned) {
16070 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
16071 LDKInit this_obj_conv;
16072 this_obj_conv.inner = (void*)(this_obj & (~1));
16073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16074 Init_free(this_obj_conv);
16077 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
16078 LDKInit this_ptr_conv;
16079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16080 this_ptr_conv.is_owned = false;
16081 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16084 uint64_t ret_ref = (uint64_t)ret_var.inner;
16085 if (ret_var.is_owned) {
16091 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
16092 LDKInit this_ptr_conv;
16093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16094 this_ptr_conv.is_owned = false;
16095 LDKInitFeatures val_conv;
16096 val_conv.inner = (void*)(val & (~1));
16097 val_conv.is_owned = (val & 1) || (val == 0);
16098 val_conv = InitFeatures_clone(&val_conv);
16099 Init_set_features(&this_ptr_conv, val_conv);
16102 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
16103 LDKInitFeatures features_arg_conv;
16104 features_arg_conv.inner = (void*)(features_arg & (~1));
16105 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16106 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16107 LDKInit ret_var = Init_new(features_arg_conv);
16108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16110 uint64_t ret_ref = (uint64_t)ret_var.inner;
16111 if (ret_var.is_owned) {
16117 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
16119 orig_conv.inner = (void*)(orig & (~1));
16120 orig_conv.is_owned = false;
16121 LDKInit ret_var = Init_clone(&orig_conv);
16122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16124 uint64_t ret_ref = (uint64_t)ret_var.inner;
16125 if (ret_var.is_owned) {
16131 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
16132 LDKErrorMessage this_obj_conv;
16133 this_obj_conv.inner = (void*)(this_obj & (~1));
16134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16135 ErrorMessage_free(this_obj_conv);
16138 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
16139 LDKErrorMessage this_ptr_conv;
16140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16141 this_ptr_conv.is_owned = false;
16142 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16143 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
16147 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16148 LDKErrorMessage this_ptr_conv;
16149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16150 this_ptr_conv.is_owned = false;
16151 LDKThirtyTwoBytes val_ref;
16152 CHECK(*((uint32_t*)val) == 32);
16153 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16154 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16157 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
16158 LDKErrorMessage this_ptr_conv;
16159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16160 this_ptr_conv.is_owned = false;
16161 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16162 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16167 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
16168 LDKErrorMessage this_ptr_conv;
16169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16170 this_ptr_conv.is_owned = false;
16171 LDKStr val_conv = str_ref_to_owned_c(val);
16172 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16175 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
16176 LDKThirtyTwoBytes channel_id_arg_ref;
16177 CHECK(*((uint32_t*)channel_id_arg) == 32);
16178 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16179 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
16180 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16183 uint64_t ret_ref = (uint64_t)ret_var.inner;
16184 if (ret_var.is_owned) {
16190 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
16191 LDKErrorMessage orig_conv;
16192 orig_conv.inner = (void*)(orig & (~1));
16193 orig_conv.is_owned = false;
16194 LDKErrorMessage ret_var = ErrorMessage_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_Ping_free(uint32_t this_obj) {
16205 LDKPing 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 Ping_free(this_obj_conv);
16211 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
16212 LDKPing this_ptr_conv;
16213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16214 this_ptr_conv.is_owned = false;
16215 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16219 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
16220 LDKPing this_ptr_conv;
16221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16222 this_ptr_conv.is_owned = false;
16223 Ping_set_ponglen(&this_ptr_conv, val);
16226 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
16227 LDKPing this_ptr_conv;
16228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16229 this_ptr_conv.is_owned = false;
16230 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16234 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
16235 LDKPing this_ptr_conv;
16236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16237 this_ptr_conv.is_owned = false;
16238 Ping_set_byteslen(&this_ptr_conv, val);
16241 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
16242 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16245 uint64_t ret_ref = (uint64_t)ret_var.inner;
16246 if (ret_var.is_owned) {
16252 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
16254 orig_conv.inner = (void*)(orig & (~1));
16255 orig_conv.is_owned = false;
16256 LDKPing ret_var = Ping_clone(&orig_conv);
16257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16259 uint64_t ret_ref = (uint64_t)ret_var.inner;
16260 if (ret_var.is_owned) {
16266 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
16267 LDKPong this_obj_conv;
16268 this_obj_conv.inner = (void*)(this_obj & (~1));
16269 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16270 Pong_free(this_obj_conv);
16273 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
16274 LDKPong this_ptr_conv;
16275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16276 this_ptr_conv.is_owned = false;
16277 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16281 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
16282 LDKPong this_ptr_conv;
16283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16284 this_ptr_conv.is_owned = false;
16285 Pong_set_byteslen(&this_ptr_conv, val);
16288 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
16289 LDKPong ret_var = Pong_new(byteslen_arg);
16290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16292 uint64_t ret_ref = (uint64_t)ret_var.inner;
16293 if (ret_var.is_owned) {
16299 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
16301 orig_conv.inner = (void*)(orig & (~1));
16302 orig_conv.is_owned = false;
16303 LDKPong ret_var = Pong_clone(&orig_conv);
16304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16306 uint64_t ret_ref = (uint64_t)ret_var.inner;
16307 if (ret_var.is_owned) {
16313 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
16314 LDKOpenChannel this_obj_conv;
16315 this_obj_conv.inner = (void*)(this_obj & (~1));
16316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16317 OpenChannel_free(this_obj_conv);
16320 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
16321 LDKOpenChannel this_ptr_conv;
16322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16323 this_ptr_conv.is_owned = false;
16324 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16325 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
16329 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
16330 LDKOpenChannel this_ptr_conv;
16331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16332 this_ptr_conv.is_owned = false;
16333 LDKThirtyTwoBytes val_ref;
16334 CHECK(*((uint32_t*)val) == 32);
16335 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16336 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16339 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
16340 LDKOpenChannel this_ptr_conv;
16341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16342 this_ptr_conv.is_owned = false;
16343 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16344 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16348 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16349 LDKOpenChannel this_ptr_conv;
16350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16351 this_ptr_conv.is_owned = false;
16352 LDKThirtyTwoBytes val_ref;
16353 CHECK(*((uint32_t*)val) == 32);
16354 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16355 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16358 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
16359 LDKOpenChannel this_ptr_conv;
16360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16361 this_ptr_conv.is_owned = false;
16362 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16366 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
16367 LDKOpenChannel this_ptr_conv;
16368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16369 this_ptr_conv.is_owned = false;
16370 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16373 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
16374 LDKOpenChannel this_ptr_conv;
16375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16376 this_ptr_conv.is_owned = false;
16377 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16381 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
16382 LDKOpenChannel this_ptr_conv;
16383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16384 this_ptr_conv.is_owned = false;
16385 OpenChannel_set_push_msat(&this_ptr_conv, val);
16388 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16389 LDKOpenChannel this_ptr_conv;
16390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16391 this_ptr_conv.is_owned = false;
16392 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16396 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16397 LDKOpenChannel this_ptr_conv;
16398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16399 this_ptr_conv.is_owned = false;
16400 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16403 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16404 LDKOpenChannel this_ptr_conv;
16405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16406 this_ptr_conv.is_owned = false;
16407 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16411 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16412 LDKOpenChannel this_ptr_conv;
16413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16414 this_ptr_conv.is_owned = false;
16415 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16418 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16419 LDKOpenChannel this_ptr_conv;
16420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16421 this_ptr_conv.is_owned = false;
16422 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16426 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16427 LDKOpenChannel this_ptr_conv;
16428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16429 this_ptr_conv.is_owned = false;
16430 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16433 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16434 LDKOpenChannel this_ptr_conv;
16435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16436 this_ptr_conv.is_owned = false;
16437 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16441 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16442 LDKOpenChannel this_ptr_conv;
16443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16444 this_ptr_conv.is_owned = false;
16445 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16448 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
16449 LDKOpenChannel this_ptr_conv;
16450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16451 this_ptr_conv.is_owned = false;
16452 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16456 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16457 LDKOpenChannel this_ptr_conv;
16458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16459 this_ptr_conv.is_owned = false;
16460 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16463 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
16464 LDKOpenChannel this_ptr_conv;
16465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16466 this_ptr_conv.is_owned = false;
16467 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16471 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16472 LDKOpenChannel this_ptr_conv;
16473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16474 this_ptr_conv.is_owned = false;
16475 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16478 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16479 LDKOpenChannel this_ptr_conv;
16480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16481 this_ptr_conv.is_owned = false;
16482 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16486 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16487 LDKOpenChannel this_ptr_conv;
16488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16489 this_ptr_conv.is_owned = false;
16490 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16493 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
16494 LDKOpenChannel this_ptr_conv;
16495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16496 this_ptr_conv.is_owned = false;
16497 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16498 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16502 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16503 LDKOpenChannel this_ptr_conv;
16504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16505 this_ptr_conv.is_owned = false;
16506 LDKPublicKey val_ref;
16507 CHECK(*((uint32_t*)val) == 33);
16508 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16509 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16512 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
16513 LDKOpenChannel this_ptr_conv;
16514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16515 this_ptr_conv.is_owned = false;
16516 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16517 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16521 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16522 LDKOpenChannel this_ptr_conv;
16523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16524 this_ptr_conv.is_owned = false;
16525 LDKPublicKey val_ref;
16526 CHECK(*((uint32_t*)val) == 33);
16527 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16528 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16531 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
16532 LDKOpenChannel this_ptr_conv;
16533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16534 this_ptr_conv.is_owned = false;
16535 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16536 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
16540 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16541 LDKOpenChannel this_ptr_conv;
16542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16543 this_ptr_conv.is_owned = false;
16544 LDKPublicKey val_ref;
16545 CHECK(*((uint32_t*)val) == 33);
16546 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16547 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16550 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
16551 LDKOpenChannel this_ptr_conv;
16552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16553 this_ptr_conv.is_owned = false;
16554 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16555 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16559 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16560 LDKOpenChannel this_ptr_conv;
16561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16562 this_ptr_conv.is_owned = false;
16563 LDKPublicKey val_ref;
16564 CHECK(*((uint32_t*)val) == 33);
16565 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16566 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16569 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
16570 LDKOpenChannel this_ptr_conv;
16571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16572 this_ptr_conv.is_owned = false;
16573 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16574 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16578 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16579 LDKOpenChannel this_ptr_conv;
16580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16581 this_ptr_conv.is_owned = false;
16582 LDKPublicKey val_ref;
16583 CHECK(*((uint32_t*)val) == 33);
16584 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16585 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16588 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
16589 LDKOpenChannel this_ptr_conv;
16590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16591 this_ptr_conv.is_owned = false;
16592 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16593 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16597 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16598 LDKOpenChannel this_ptr_conv;
16599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16600 this_ptr_conv.is_owned = false;
16601 LDKPublicKey val_ref;
16602 CHECK(*((uint32_t*)val) == 33);
16603 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16604 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16607 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
16608 LDKOpenChannel this_ptr_conv;
16609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16610 this_ptr_conv.is_owned = false;
16611 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16615 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
16616 LDKOpenChannel this_ptr_conv;
16617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16618 this_ptr_conv.is_owned = false;
16619 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16622 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
16623 LDKOpenChannel orig_conv;
16624 orig_conv.inner = (void*)(orig & (~1));
16625 orig_conv.is_owned = false;
16626 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16629 uint64_t ret_ref = (uint64_t)ret_var.inner;
16630 if (ret_var.is_owned) {
16636 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
16637 LDKAcceptChannel this_obj_conv;
16638 this_obj_conv.inner = (void*)(this_obj & (~1));
16639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16640 AcceptChannel_free(this_obj_conv);
16643 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
16644 LDKAcceptChannel this_ptr_conv;
16645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16646 this_ptr_conv.is_owned = false;
16647 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16648 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16652 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16653 LDKAcceptChannel this_ptr_conv;
16654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16655 this_ptr_conv.is_owned = false;
16656 LDKThirtyTwoBytes val_ref;
16657 CHECK(*((uint32_t*)val) == 32);
16658 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16659 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16662 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16663 LDKAcceptChannel this_ptr_conv;
16664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16665 this_ptr_conv.is_owned = false;
16666 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16670 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16671 LDKAcceptChannel this_ptr_conv;
16672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16673 this_ptr_conv.is_owned = false;
16674 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16677 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16678 LDKAcceptChannel this_ptr_conv;
16679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16680 this_ptr_conv.is_owned = false;
16681 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16685 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16686 LDKAcceptChannel this_ptr_conv;
16687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16688 this_ptr_conv.is_owned = false;
16689 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16692 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16693 LDKAcceptChannel this_ptr_conv;
16694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16695 this_ptr_conv.is_owned = false;
16696 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16700 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16701 LDKAcceptChannel this_ptr_conv;
16702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16703 this_ptr_conv.is_owned = false;
16704 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16707 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16708 LDKAcceptChannel this_ptr_conv;
16709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16710 this_ptr_conv.is_owned = false;
16711 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16715 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16716 LDKAcceptChannel this_ptr_conv;
16717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16718 this_ptr_conv.is_owned = false;
16719 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16722 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
16723 LDKAcceptChannel this_ptr_conv;
16724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16725 this_ptr_conv.is_owned = false;
16726 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16730 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
16731 LDKAcceptChannel this_ptr_conv;
16732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16733 this_ptr_conv.is_owned = false;
16734 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16737 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
16738 LDKAcceptChannel this_ptr_conv;
16739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16740 this_ptr_conv.is_owned = false;
16741 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16745 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16746 LDKAcceptChannel this_ptr_conv;
16747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16748 this_ptr_conv.is_owned = false;
16749 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16752 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16753 LDKAcceptChannel this_ptr_conv;
16754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16755 this_ptr_conv.is_owned = false;
16756 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16760 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16761 LDKAcceptChannel this_ptr_conv;
16762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16763 this_ptr_conv.is_owned = false;
16764 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16767 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
16768 LDKAcceptChannel this_ptr_conv;
16769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16770 this_ptr_conv.is_owned = false;
16771 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16772 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16776 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16777 LDKAcceptChannel this_ptr_conv;
16778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16779 this_ptr_conv.is_owned = false;
16780 LDKPublicKey val_ref;
16781 CHECK(*((uint32_t*)val) == 33);
16782 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16783 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16786 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
16787 LDKAcceptChannel this_ptr_conv;
16788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16789 this_ptr_conv.is_owned = false;
16790 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16791 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16795 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16796 LDKAcceptChannel this_ptr_conv;
16797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16798 this_ptr_conv.is_owned = false;
16799 LDKPublicKey val_ref;
16800 CHECK(*((uint32_t*)val) == 33);
16801 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16802 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16805 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
16806 LDKAcceptChannel this_ptr_conv;
16807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16808 this_ptr_conv.is_owned = false;
16809 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16810 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
16814 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16815 LDKAcceptChannel this_ptr_conv;
16816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16817 this_ptr_conv.is_owned = false;
16818 LDKPublicKey val_ref;
16819 CHECK(*((uint32_t*)val) == 33);
16820 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16821 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16824 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
16825 LDKAcceptChannel this_ptr_conv;
16826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16827 this_ptr_conv.is_owned = false;
16828 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16829 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16833 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16834 LDKAcceptChannel this_ptr_conv;
16835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16836 this_ptr_conv.is_owned = false;
16837 LDKPublicKey val_ref;
16838 CHECK(*((uint32_t*)val) == 33);
16839 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16840 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16843 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
16844 LDKAcceptChannel this_ptr_conv;
16845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16846 this_ptr_conv.is_owned = false;
16847 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16848 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16852 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16853 LDKAcceptChannel this_ptr_conv;
16854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16855 this_ptr_conv.is_owned = false;
16856 LDKPublicKey val_ref;
16857 CHECK(*((uint32_t*)val) == 33);
16858 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16859 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16862 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
16863 LDKAcceptChannel this_ptr_conv;
16864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16865 this_ptr_conv.is_owned = false;
16866 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16867 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16871 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16872 LDKAcceptChannel this_ptr_conv;
16873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16874 this_ptr_conv.is_owned = false;
16875 LDKPublicKey val_ref;
16876 CHECK(*((uint32_t*)val) == 33);
16877 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16878 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16881 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
16882 LDKAcceptChannel orig_conv;
16883 orig_conv.inner = (void*)(orig & (~1));
16884 orig_conv.is_owned = false;
16885 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16888 uint64_t ret_ref = (uint64_t)ret_var.inner;
16889 if (ret_var.is_owned) {
16895 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
16896 LDKFundingCreated this_obj_conv;
16897 this_obj_conv.inner = (void*)(this_obj & (~1));
16898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16899 FundingCreated_free(this_obj_conv);
16902 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
16903 LDKFundingCreated this_ptr_conv;
16904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16905 this_ptr_conv.is_owned = false;
16906 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16907 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
16911 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16912 LDKFundingCreated this_ptr_conv;
16913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16914 this_ptr_conv.is_owned = false;
16915 LDKThirtyTwoBytes val_ref;
16916 CHECK(*((uint32_t*)val) == 32);
16917 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16918 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
16921 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
16922 LDKFundingCreated this_ptr_conv;
16923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16924 this_ptr_conv.is_owned = false;
16925 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16926 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
16930 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
16931 LDKFundingCreated this_ptr_conv;
16932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16933 this_ptr_conv.is_owned = false;
16934 LDKThirtyTwoBytes val_ref;
16935 CHECK(*((uint32_t*)val) == 32);
16936 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16937 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
16940 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
16941 LDKFundingCreated this_ptr_conv;
16942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16943 this_ptr_conv.is_owned = false;
16944 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
16948 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
16949 LDKFundingCreated this_ptr_conv;
16950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16951 this_ptr_conv.is_owned = false;
16952 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
16955 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
16956 LDKFundingCreated this_ptr_conv;
16957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16958 this_ptr_conv.is_owned = false;
16959 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16960 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
16964 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
16965 LDKFundingCreated this_ptr_conv;
16966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16967 this_ptr_conv.is_owned = false;
16968 LDKSignature val_ref;
16969 CHECK(*((uint32_t*)val) == 64);
16970 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16971 FundingCreated_set_signature(&this_ptr_conv, val_ref);
16974 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) {
16975 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
16976 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
16977 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
16978 LDKThirtyTwoBytes funding_txid_arg_ref;
16979 CHECK(*((uint32_t*)funding_txid_arg) == 32);
16980 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
16981 LDKSignature signature_arg_ref;
16982 CHECK(*((uint32_t*)signature_arg) == 64);
16983 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16984 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
16985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16987 uint64_t ret_ref = (uint64_t)ret_var.inner;
16988 if (ret_var.is_owned) {
16994 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
16995 LDKFundingCreated orig_conv;
16996 orig_conv.inner = (void*)(orig & (~1));
16997 orig_conv.is_owned = false;
16998 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
16999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17001 uint64_t ret_ref = (uint64_t)ret_var.inner;
17002 if (ret_var.is_owned) {
17008 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
17009 LDKFundingSigned this_obj_conv;
17010 this_obj_conv.inner = (void*)(this_obj & (~1));
17011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17012 FundingSigned_free(this_obj_conv);
17015 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
17016 LDKFundingSigned this_ptr_conv;
17017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17018 this_ptr_conv.is_owned = false;
17019 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17020 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
17024 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17025 LDKFundingSigned this_ptr_conv;
17026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17027 this_ptr_conv.is_owned = false;
17028 LDKThirtyTwoBytes val_ref;
17029 CHECK(*((uint32_t*)val) == 32);
17030 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17031 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17034 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
17035 LDKFundingSigned this_ptr_conv;
17036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17037 this_ptr_conv.is_owned = false;
17038 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17039 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17043 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17044 LDKFundingSigned this_ptr_conv;
17045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17046 this_ptr_conv.is_owned = false;
17047 LDKSignature val_ref;
17048 CHECK(*((uint32_t*)val) == 64);
17049 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17050 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17053 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
17054 LDKThirtyTwoBytes channel_id_arg_ref;
17055 CHECK(*((uint32_t*)channel_id_arg) == 32);
17056 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17057 LDKSignature signature_arg_ref;
17058 CHECK(*((uint32_t*)signature_arg) == 64);
17059 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17060 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17063 uint64_t ret_ref = (uint64_t)ret_var.inner;
17064 if (ret_var.is_owned) {
17070 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
17071 LDKFundingSigned orig_conv;
17072 orig_conv.inner = (void*)(orig & (~1));
17073 orig_conv.is_owned = false;
17074 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17077 uint64_t ret_ref = (uint64_t)ret_var.inner;
17078 if (ret_var.is_owned) {
17084 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
17085 LDKFundingLocked this_obj_conv;
17086 this_obj_conv.inner = (void*)(this_obj & (~1));
17087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17088 FundingLocked_free(this_obj_conv);
17091 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
17092 LDKFundingLocked this_ptr_conv;
17093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17094 this_ptr_conv.is_owned = false;
17095 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17096 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
17100 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17101 LDKFundingLocked this_ptr_conv;
17102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17103 this_ptr_conv.is_owned = false;
17104 LDKThirtyTwoBytes val_ref;
17105 CHECK(*((uint32_t*)val) == 32);
17106 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17107 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17110 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
17111 LDKFundingLocked 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), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17119 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17120 LDKFundingLocked 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 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17129 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
17130 LDKThirtyTwoBytes channel_id_arg_ref;
17131 CHECK(*((uint32_t*)channel_id_arg) == 32);
17132 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17133 LDKPublicKey next_per_commitment_point_arg_ref;
17134 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17135 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17136 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17139 uint64_t ret_ref = (uint64_t)ret_var.inner;
17140 if (ret_var.is_owned) {
17146 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
17147 LDKFundingLocked orig_conv;
17148 orig_conv.inner = (void*)(orig & (~1));
17149 orig_conv.is_owned = false;
17150 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17153 uint64_t ret_ref = (uint64_t)ret_var.inner;
17154 if (ret_var.is_owned) {
17160 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
17161 LDKShutdown this_obj_conv;
17162 this_obj_conv.inner = (void*)(this_obj & (~1));
17163 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17164 Shutdown_free(this_obj_conv);
17167 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
17168 LDKShutdown 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17172 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
17176 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17177 LDKShutdown this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 LDKThirtyTwoBytes val_ref;
17181 CHECK(*((uint32_t*)val) == 32);
17182 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17183 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17186 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
17187 LDKShutdown this_ptr_conv;
17188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17189 this_ptr_conv.is_owned = false;
17190 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17191 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17192 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17196 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
17197 LDKShutdown this_ptr_conv;
17198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17199 this_ptr_conv.is_owned = false;
17200 LDKCVec_u8Z val_ref;
17201 val_ref.datalen = *((uint32_t*)val);
17202 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17203 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17204 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17207 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17208 LDKThirtyTwoBytes channel_id_arg_ref;
17209 CHECK(*((uint32_t*)channel_id_arg) == 32);
17210 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17211 LDKCVec_u8Z scriptpubkey_arg_ref;
17212 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
17213 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17214 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
17215 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17218 uint64_t ret_ref = (uint64_t)ret_var.inner;
17219 if (ret_var.is_owned) {
17225 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
17226 LDKShutdown orig_conv;
17227 orig_conv.inner = (void*)(orig & (~1));
17228 orig_conv.is_owned = false;
17229 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17232 uint64_t ret_ref = (uint64_t)ret_var.inner;
17233 if (ret_var.is_owned) {
17239 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
17240 LDKClosingSignedFeeRange this_obj_conv;
17241 this_obj_conv.inner = (void*)(this_obj & (~1));
17242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17243 ClosingSignedFeeRange_free(this_obj_conv);
17246 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
17247 LDKClosingSignedFeeRange this_ptr_conv;
17248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17249 this_ptr_conv.is_owned = false;
17250 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
17254 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
17255 LDKClosingSignedFeeRange this_ptr_conv;
17256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17257 this_ptr_conv.is_owned = false;
17258 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
17261 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
17262 LDKClosingSignedFeeRange this_ptr_conv;
17263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17264 this_ptr_conv.is_owned = false;
17265 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
17269 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17270 LDKClosingSignedFeeRange this_ptr_conv;
17271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17272 this_ptr_conv.is_owned = false;
17273 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
17276 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
17277 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
17278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17280 uint64_t ret_ref = (uint64_t)ret_var.inner;
17281 if (ret_var.is_owned) {
17287 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
17288 LDKClosingSignedFeeRange orig_conv;
17289 orig_conv.inner = (void*)(orig & (~1));
17290 orig_conv.is_owned = false;
17291 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
17292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17294 uint64_t ret_ref = (uint64_t)ret_var.inner;
17295 if (ret_var.is_owned) {
17301 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
17302 LDKClosingSigned this_obj_conv;
17303 this_obj_conv.inner = (void*)(this_obj & (~1));
17304 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17305 ClosingSigned_free(this_obj_conv);
17308 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
17309 LDKClosingSigned this_ptr_conv;
17310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17311 this_ptr_conv.is_owned = false;
17312 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17313 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
17317 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17318 LDKClosingSigned this_ptr_conv;
17319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17320 this_ptr_conv.is_owned = false;
17321 LDKThirtyTwoBytes val_ref;
17322 CHECK(*((uint32_t*)val) == 32);
17323 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17324 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17327 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
17328 LDKClosingSigned this_ptr_conv;
17329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17330 this_ptr_conv.is_owned = false;
17331 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17335 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
17336 LDKClosingSigned this_ptr_conv;
17337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17338 this_ptr_conv.is_owned = false;
17339 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17342 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
17343 LDKClosingSigned this_ptr_conv;
17344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17345 this_ptr_conv.is_owned = false;
17346 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17347 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17351 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17352 LDKClosingSigned this_ptr_conv;
17353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17354 this_ptr_conv.is_owned = false;
17355 LDKSignature val_ref;
17356 CHECK(*((uint32_t*)val) == 64);
17357 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17358 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17361 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
17362 LDKClosingSigned this_ptr_conv;
17363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17364 this_ptr_conv.is_owned = false;
17365 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
17366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17368 uint64_t ret_ref = (uint64_t)ret_var.inner;
17369 if (ret_var.is_owned) {
17375 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
17376 LDKClosingSigned this_ptr_conv;
17377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17378 this_ptr_conv.is_owned = false;
17379 LDKClosingSignedFeeRange val_conv;
17380 val_conv.inner = (void*)(val & (~1));
17381 val_conv.is_owned = (val & 1) || (val == 0);
17382 val_conv = ClosingSignedFeeRange_clone(&val_conv);
17383 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
17386 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
17387 LDKThirtyTwoBytes channel_id_arg_ref;
17388 CHECK(*((uint32_t*)channel_id_arg) == 32);
17389 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17390 LDKSignature signature_arg_ref;
17391 CHECK(*((uint32_t*)signature_arg) == 64);
17392 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17393 LDKClosingSignedFeeRange fee_range_arg_conv;
17394 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
17395 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
17396 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
17397 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
17398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17400 uint64_t ret_ref = (uint64_t)ret_var.inner;
17401 if (ret_var.is_owned) {
17407 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
17408 LDKClosingSigned orig_conv;
17409 orig_conv.inner = (void*)(orig & (~1));
17410 orig_conv.is_owned = false;
17411 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17414 uint64_t ret_ref = (uint64_t)ret_var.inner;
17415 if (ret_var.is_owned) {
17421 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
17422 LDKUpdateAddHTLC this_obj_conv;
17423 this_obj_conv.inner = (void*)(this_obj & (~1));
17424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17425 UpdateAddHTLC_free(this_obj_conv);
17428 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
17429 LDKUpdateAddHTLC this_ptr_conv;
17430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17431 this_ptr_conv.is_owned = false;
17432 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17433 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
17437 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17438 LDKUpdateAddHTLC this_ptr_conv;
17439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17440 this_ptr_conv.is_owned = false;
17441 LDKThirtyTwoBytes val_ref;
17442 CHECK(*((uint32_t*)val) == 32);
17443 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17444 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17447 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
17448 LDKUpdateAddHTLC this_ptr_conv;
17449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17450 this_ptr_conv.is_owned = false;
17451 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17455 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17456 LDKUpdateAddHTLC this_ptr_conv;
17457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17458 this_ptr_conv.is_owned = false;
17459 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17462 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
17463 LDKUpdateAddHTLC this_ptr_conv;
17464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17465 this_ptr_conv.is_owned = false;
17466 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17470 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
17471 LDKUpdateAddHTLC this_ptr_conv;
17472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17473 this_ptr_conv.is_owned = false;
17474 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17477 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
17478 LDKUpdateAddHTLC this_ptr_conv;
17479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17480 this_ptr_conv.is_owned = false;
17481 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17482 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
17486 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
17487 LDKUpdateAddHTLC this_ptr_conv;
17488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17489 this_ptr_conv.is_owned = false;
17490 LDKThirtyTwoBytes val_ref;
17491 CHECK(*((uint32_t*)val) == 32);
17492 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17493 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17496 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
17497 LDKUpdateAddHTLC this_ptr_conv;
17498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17499 this_ptr_conv.is_owned = false;
17500 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17504 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
17505 LDKUpdateAddHTLC this_ptr_conv;
17506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17507 this_ptr_conv.is_owned = false;
17508 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17511 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
17512 LDKUpdateAddHTLC orig_conv;
17513 orig_conv.inner = (void*)(orig & (~1));
17514 orig_conv.is_owned = false;
17515 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17518 uint64_t ret_ref = (uint64_t)ret_var.inner;
17519 if (ret_var.is_owned) {
17525 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
17526 LDKUpdateFulfillHTLC this_obj_conv;
17527 this_obj_conv.inner = (void*)(this_obj & (~1));
17528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17529 UpdateFulfillHTLC_free(this_obj_conv);
17532 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
17533 LDKUpdateFulfillHTLC this_ptr_conv;
17534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17535 this_ptr_conv.is_owned = false;
17536 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17537 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
17541 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17542 LDKUpdateFulfillHTLC this_ptr_conv;
17543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17544 this_ptr_conv.is_owned = false;
17545 LDKThirtyTwoBytes val_ref;
17546 CHECK(*((uint32_t*)val) == 32);
17547 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17548 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17551 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
17552 LDKUpdateFulfillHTLC this_ptr_conv;
17553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17554 this_ptr_conv.is_owned = false;
17555 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17559 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17560 LDKUpdateFulfillHTLC this_ptr_conv;
17561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17562 this_ptr_conv.is_owned = false;
17563 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17566 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
17567 LDKUpdateFulfillHTLC this_ptr_conv;
17568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17569 this_ptr_conv.is_owned = false;
17570 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17571 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
17575 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
17576 LDKUpdateFulfillHTLC this_ptr_conv;
17577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17578 this_ptr_conv.is_owned = false;
17579 LDKThirtyTwoBytes val_ref;
17580 CHECK(*((uint32_t*)val) == 32);
17581 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17582 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17585 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
17586 LDKThirtyTwoBytes channel_id_arg_ref;
17587 CHECK(*((uint32_t*)channel_id_arg) == 32);
17588 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17589 LDKThirtyTwoBytes payment_preimage_arg_ref;
17590 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
17591 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
17592 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17595 uint64_t ret_ref = (uint64_t)ret_var.inner;
17596 if (ret_var.is_owned) {
17602 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
17603 LDKUpdateFulfillHTLC orig_conv;
17604 orig_conv.inner = (void*)(orig & (~1));
17605 orig_conv.is_owned = false;
17606 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17609 uint64_t ret_ref = (uint64_t)ret_var.inner;
17610 if (ret_var.is_owned) {
17616 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
17617 LDKUpdateFailHTLC this_obj_conv;
17618 this_obj_conv.inner = (void*)(this_obj & (~1));
17619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17620 UpdateFailHTLC_free(this_obj_conv);
17623 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
17624 LDKUpdateFailHTLC this_ptr_conv;
17625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17626 this_ptr_conv.is_owned = false;
17627 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17628 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
17632 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17633 LDKUpdateFailHTLC this_ptr_conv;
17634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17635 this_ptr_conv.is_owned = false;
17636 LDKThirtyTwoBytes val_ref;
17637 CHECK(*((uint32_t*)val) == 32);
17638 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17639 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17642 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
17643 LDKUpdateFailHTLC this_ptr_conv;
17644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17645 this_ptr_conv.is_owned = false;
17646 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17650 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17651 LDKUpdateFailHTLC this_ptr_conv;
17652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17653 this_ptr_conv.is_owned = false;
17654 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17657 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
17658 LDKUpdateFailHTLC orig_conv;
17659 orig_conv.inner = (void*)(orig & (~1));
17660 orig_conv.is_owned = false;
17661 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17664 uint64_t ret_ref = (uint64_t)ret_var.inner;
17665 if (ret_var.is_owned) {
17671 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
17672 LDKUpdateFailMalformedHTLC this_obj_conv;
17673 this_obj_conv.inner = (void*)(this_obj & (~1));
17674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17675 UpdateFailMalformedHTLC_free(this_obj_conv);
17678 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
17679 LDKUpdateFailMalformedHTLC this_ptr_conv;
17680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17681 this_ptr_conv.is_owned = false;
17682 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17683 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
17687 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17688 LDKUpdateFailMalformedHTLC this_ptr_conv;
17689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17690 this_ptr_conv.is_owned = false;
17691 LDKThirtyTwoBytes val_ref;
17692 CHECK(*((uint32_t*)val) == 32);
17693 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17694 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17697 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
17698 LDKUpdateFailMalformedHTLC this_ptr_conv;
17699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17700 this_ptr_conv.is_owned = false;
17701 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17705 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17706 LDKUpdateFailMalformedHTLC this_ptr_conv;
17707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17708 this_ptr_conv.is_owned = false;
17709 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17712 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
17713 LDKUpdateFailMalformedHTLC this_ptr_conv;
17714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17715 this_ptr_conv.is_owned = false;
17716 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17720 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
17721 LDKUpdateFailMalformedHTLC this_ptr_conv;
17722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17723 this_ptr_conv.is_owned = false;
17724 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17727 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
17728 LDKUpdateFailMalformedHTLC orig_conv;
17729 orig_conv.inner = (void*)(orig & (~1));
17730 orig_conv.is_owned = false;
17731 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17734 uint64_t ret_ref = (uint64_t)ret_var.inner;
17735 if (ret_var.is_owned) {
17741 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
17742 LDKCommitmentSigned this_obj_conv;
17743 this_obj_conv.inner = (void*)(this_obj & (~1));
17744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17745 CommitmentSigned_free(this_obj_conv);
17748 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
17749 LDKCommitmentSigned this_ptr_conv;
17750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17751 this_ptr_conv.is_owned = false;
17752 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17753 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
17757 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17758 LDKCommitmentSigned this_ptr_conv;
17759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17760 this_ptr_conv.is_owned = false;
17761 LDKThirtyTwoBytes val_ref;
17762 CHECK(*((uint32_t*)val) == 32);
17763 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17764 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17767 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
17768 LDKCommitmentSigned this_ptr_conv;
17769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17770 this_ptr_conv.is_owned = false;
17771 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17772 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
17776 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17777 LDKCommitmentSigned this_ptr_conv;
17778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17779 this_ptr_conv.is_owned = false;
17780 LDKSignature val_ref;
17781 CHECK(*((uint32_t*)val) == 64);
17782 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17783 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17786 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
17787 LDKCommitmentSigned this_ptr_conv;
17788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17789 this_ptr_conv.is_owned = false;
17790 LDKCVec_SignatureZ val_constr;
17791 val_constr.datalen = *((uint32_t*)val);
17792 if (val_constr.datalen > 0)
17793 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17795 val_constr.data = NULL;
17796 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17797 for (size_t m = 0; m < val_constr.datalen; m++) {
17798 int8_tArray val_conv_12 = val_vals[m];
17799 LDKSignature val_conv_12_ref;
17800 CHECK(*((uint32_t*)val_conv_12) == 64);
17801 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17802 val_constr.data[m] = val_conv_12_ref;
17804 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17807 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
17808 LDKThirtyTwoBytes channel_id_arg_ref;
17809 CHECK(*((uint32_t*)channel_id_arg) == 32);
17810 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17811 LDKSignature signature_arg_ref;
17812 CHECK(*((uint32_t*)signature_arg) == 64);
17813 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17814 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17815 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
17816 if (htlc_signatures_arg_constr.datalen > 0)
17817 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17819 htlc_signatures_arg_constr.data = NULL;
17820 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
17821 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
17822 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
17823 LDKSignature htlc_signatures_arg_conv_12_ref;
17824 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
17825 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
17826 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
17828 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17831 uint64_t ret_ref = (uint64_t)ret_var.inner;
17832 if (ret_var.is_owned) {
17838 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
17839 LDKCommitmentSigned orig_conv;
17840 orig_conv.inner = (void*)(orig & (~1));
17841 orig_conv.is_owned = false;
17842 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17845 uint64_t ret_ref = (uint64_t)ret_var.inner;
17846 if (ret_var.is_owned) {
17852 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
17853 LDKRevokeAndACK this_obj_conv;
17854 this_obj_conv.inner = (void*)(this_obj & (~1));
17855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17856 RevokeAndACK_free(this_obj_conv);
17859 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
17860 LDKRevokeAndACK this_ptr_conv;
17861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17862 this_ptr_conv.is_owned = false;
17863 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17864 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
17868 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17869 LDKRevokeAndACK this_ptr_conv;
17870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17871 this_ptr_conv.is_owned = false;
17872 LDKThirtyTwoBytes val_ref;
17873 CHECK(*((uint32_t*)val) == 32);
17874 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17875 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17878 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
17879 LDKRevokeAndACK this_ptr_conv;
17880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17881 this_ptr_conv.is_owned = false;
17882 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17883 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
17887 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
17888 LDKRevokeAndACK this_ptr_conv;
17889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17890 this_ptr_conv.is_owned = false;
17891 LDKThirtyTwoBytes val_ref;
17892 CHECK(*((uint32_t*)val) == 32);
17893 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17894 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17897 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
17898 LDKRevokeAndACK this_ptr_conv;
17899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17900 this_ptr_conv.is_owned = false;
17901 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17902 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17906 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17907 LDKRevokeAndACK this_ptr_conv;
17908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17909 this_ptr_conv.is_owned = false;
17910 LDKPublicKey val_ref;
17911 CHECK(*((uint32_t*)val) == 33);
17912 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17913 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17916 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) {
17917 LDKThirtyTwoBytes channel_id_arg_ref;
17918 CHECK(*((uint32_t*)channel_id_arg) == 32);
17919 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17920 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17921 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
17922 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
17923 LDKPublicKey next_per_commitment_point_arg_ref;
17924 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17925 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17926 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17929 uint64_t ret_ref = (uint64_t)ret_var.inner;
17930 if (ret_var.is_owned) {
17936 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
17937 LDKRevokeAndACK orig_conv;
17938 orig_conv.inner = (void*)(orig & (~1));
17939 orig_conv.is_owned = false;
17940 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17943 uint64_t ret_ref = (uint64_t)ret_var.inner;
17944 if (ret_var.is_owned) {
17950 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
17951 LDKUpdateFee this_obj_conv;
17952 this_obj_conv.inner = (void*)(this_obj & (~1));
17953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17954 UpdateFee_free(this_obj_conv);
17957 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
17958 LDKUpdateFee this_ptr_conv;
17959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17960 this_ptr_conv.is_owned = false;
17961 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17962 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
17966 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17967 LDKUpdateFee this_ptr_conv;
17968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17969 this_ptr_conv.is_owned = false;
17970 LDKThirtyTwoBytes val_ref;
17971 CHECK(*((uint32_t*)val) == 32);
17972 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17973 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17976 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
17977 LDKUpdateFee this_ptr_conv;
17978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17979 this_ptr_conv.is_owned = false;
17980 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
17984 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
17985 LDKUpdateFee this_ptr_conv;
17986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17987 this_ptr_conv.is_owned = false;
17988 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
17991 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
17992 LDKThirtyTwoBytes channel_id_arg_ref;
17993 CHECK(*((uint32_t*)channel_id_arg) == 32);
17994 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17995 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
17996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17998 uint64_t ret_ref = (uint64_t)ret_var.inner;
17999 if (ret_var.is_owned) {
18005 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
18006 LDKUpdateFee orig_conv;
18007 orig_conv.inner = (void*)(orig & (~1));
18008 orig_conv.is_owned = false;
18009 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18012 uint64_t ret_ref = (uint64_t)ret_var.inner;
18013 if (ret_var.is_owned) {
18019 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
18020 LDKDataLossProtect this_obj_conv;
18021 this_obj_conv.inner = (void*)(this_obj & (~1));
18022 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18023 DataLossProtect_free(this_obj_conv);
18026 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
18027 LDKDataLossProtect this_ptr_conv;
18028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18029 this_ptr_conv.is_owned = false;
18030 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18031 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
18035 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18036 LDKDataLossProtect this_ptr_conv;
18037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18038 this_ptr_conv.is_owned = false;
18039 LDKThirtyTwoBytes val_ref;
18040 CHECK(*((uint32_t*)val) == 32);
18041 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18042 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18045 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
18046 LDKDataLossProtect this_ptr_conv;
18047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18048 this_ptr_conv.is_owned = false;
18049 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18050 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18054 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18055 LDKDataLossProtect this_ptr_conv;
18056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18057 this_ptr_conv.is_owned = false;
18058 LDKPublicKey val_ref;
18059 CHECK(*((uint32_t*)val) == 33);
18060 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18061 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18064 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
18065 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18066 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
18067 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
18068 LDKPublicKey my_current_per_commitment_point_arg_ref;
18069 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
18070 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
18071 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18074 uint64_t ret_ref = (uint64_t)ret_var.inner;
18075 if (ret_var.is_owned) {
18081 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
18082 LDKDataLossProtect orig_conv;
18083 orig_conv.inner = (void*)(orig & (~1));
18084 orig_conv.is_owned = false;
18085 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18088 uint64_t ret_ref = (uint64_t)ret_var.inner;
18089 if (ret_var.is_owned) {
18095 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
18096 LDKChannelReestablish this_obj_conv;
18097 this_obj_conv.inner = (void*)(this_obj & (~1));
18098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18099 ChannelReestablish_free(this_obj_conv);
18102 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
18103 LDKChannelReestablish this_ptr_conv;
18104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18105 this_ptr_conv.is_owned = false;
18106 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18107 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
18111 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18112 LDKChannelReestablish this_ptr_conv;
18113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18114 this_ptr_conv.is_owned = false;
18115 LDKThirtyTwoBytes val_ref;
18116 CHECK(*((uint32_t*)val) == 32);
18117 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18118 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18121 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
18122 LDKChannelReestablish this_ptr_conv;
18123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18124 this_ptr_conv.is_owned = false;
18125 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18129 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
18130 LDKChannelReestablish this_ptr_conv;
18131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18132 this_ptr_conv.is_owned = false;
18133 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18136 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
18137 LDKChannelReestablish this_ptr_conv;
18138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18139 this_ptr_conv.is_owned = false;
18140 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18144 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
18145 LDKChannelReestablish this_ptr_conv;
18146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18147 this_ptr_conv.is_owned = false;
18148 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18151 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
18152 LDKChannelReestablish orig_conv;
18153 orig_conv.inner = (void*)(orig & (~1));
18154 orig_conv.is_owned = false;
18155 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18158 uint64_t ret_ref = (uint64_t)ret_var.inner;
18159 if (ret_var.is_owned) {
18165 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
18166 LDKAnnouncementSignatures this_obj_conv;
18167 this_obj_conv.inner = (void*)(this_obj & (~1));
18168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18169 AnnouncementSignatures_free(this_obj_conv);
18172 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
18173 LDKAnnouncementSignatures this_ptr_conv;
18174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18175 this_ptr_conv.is_owned = false;
18176 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18177 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
18181 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18182 LDKAnnouncementSignatures this_ptr_conv;
18183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18184 this_ptr_conv.is_owned = false;
18185 LDKThirtyTwoBytes val_ref;
18186 CHECK(*((uint32_t*)val) == 32);
18187 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18188 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18191 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
18192 LDKAnnouncementSignatures this_ptr_conv;
18193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18194 this_ptr_conv.is_owned = false;
18195 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18199 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18200 LDKAnnouncementSignatures this_ptr_conv;
18201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18202 this_ptr_conv.is_owned = false;
18203 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18206 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
18207 LDKAnnouncementSignatures this_ptr_conv;
18208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18209 this_ptr_conv.is_owned = false;
18210 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18211 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
18215 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
18216 LDKAnnouncementSignatures this_ptr_conv;
18217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18218 this_ptr_conv.is_owned = false;
18219 LDKSignature val_ref;
18220 CHECK(*((uint32_t*)val) == 64);
18221 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18222 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18225 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
18226 LDKAnnouncementSignatures this_ptr_conv;
18227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18228 this_ptr_conv.is_owned = false;
18229 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18230 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
18234 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
18235 LDKAnnouncementSignatures this_ptr_conv;
18236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18237 this_ptr_conv.is_owned = false;
18238 LDKSignature val_ref;
18239 CHECK(*((uint32_t*)val) == 64);
18240 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18241 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18244 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) {
18245 LDKThirtyTwoBytes channel_id_arg_ref;
18246 CHECK(*((uint32_t*)channel_id_arg) == 32);
18247 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18248 LDKSignature node_signature_arg_ref;
18249 CHECK(*((uint32_t*)node_signature_arg) == 64);
18250 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
18251 LDKSignature bitcoin_signature_arg_ref;
18252 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
18253 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
18254 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18257 uint64_t ret_ref = (uint64_t)ret_var.inner;
18258 if (ret_var.is_owned) {
18264 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
18265 LDKAnnouncementSignatures orig_conv;
18266 orig_conv.inner = (void*)(orig & (~1));
18267 orig_conv.is_owned = false;
18268 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18271 uint64_t ret_ref = (uint64_t)ret_var.inner;
18272 if (ret_var.is_owned) {
18278 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
18279 if ((this_ptr & 1) != 0) return;
18280 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18281 FREE((void*)this_ptr);
18282 NetAddress_free(this_ptr_conv);
18285 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
18286 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18287 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18288 *ret_copy = NetAddress_clone(orig_conv);
18289 uint64_t ret_ref = (uint64_t)ret_copy;
18293 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
18294 LDKFourBytes addr_ref;
18295 CHECK(*((uint32_t*)addr) == 4);
18296 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
18297 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18298 *ret_copy = NetAddress_ipv4(addr_ref, port);
18299 uint64_t ret_ref = (uint64_t)ret_copy;
18303 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
18304 LDKSixteenBytes addr_ref;
18305 CHECK(*((uint32_t*)addr) == 16);
18306 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
18307 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18308 *ret_copy = NetAddress_ipv6(addr_ref, port);
18309 uint64_t ret_ref = (uint64_t)ret_copy;
18313 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
18314 LDKTenBytes addr_ref;
18315 CHECK(*((uint32_t*)addr) == 10);
18316 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
18317 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18318 *ret_copy = NetAddress_onion_v2(addr_ref, port);
18319 uint64_t ret_ref = (uint64_t)ret_copy;
18323 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
18324 LDKThirtyTwoBytes ed25519_pubkey_ref;
18325 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
18326 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
18327 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18328 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
18329 uint64_t ret_ref = (uint64_t)ret_copy;
18333 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
18334 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18335 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18336 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18337 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18338 CVec_u8Z_free(ret_var);
18342 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
18343 LDKu8slice ser_ref;
18344 ser_ref.datalen = *((uint32_t*)ser);
18345 ser_ref.data = (int8_t*)(ser + 4);
18346 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18347 *ret_conv = Result_read(ser_ref);
18348 return (uint64_t)ret_conv;
18351 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
18352 LDKu8slice ser_ref;
18353 ser_ref.datalen = *((uint32_t*)ser);
18354 ser_ref.data = (int8_t*)(ser + 4);
18355 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18356 *ret_conv = NetAddress_read(ser_ref);
18357 return (uint64_t)ret_conv;
18360 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
18361 LDKUnsignedNodeAnnouncement this_obj_conv;
18362 this_obj_conv.inner = (void*)(this_obj & (~1));
18363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18364 UnsignedNodeAnnouncement_free(this_obj_conv);
18367 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
18368 LDKUnsignedNodeAnnouncement this_ptr_conv;
18369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18370 this_ptr_conv.is_owned = false;
18371 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18374 uint64_t ret_ref = (uint64_t)ret_var.inner;
18375 if (ret_var.is_owned) {
18381 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18382 LDKUnsignedNodeAnnouncement this_ptr_conv;
18383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18384 this_ptr_conv.is_owned = false;
18385 LDKNodeFeatures val_conv;
18386 val_conv.inner = (void*)(val & (~1));
18387 val_conv.is_owned = (val & 1) || (val == 0);
18388 val_conv = NodeFeatures_clone(&val_conv);
18389 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18392 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
18393 LDKUnsignedNodeAnnouncement this_ptr_conv;
18394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18395 this_ptr_conv.is_owned = false;
18396 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18400 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
18401 LDKUnsignedNodeAnnouncement this_ptr_conv;
18402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18403 this_ptr_conv.is_owned = false;
18404 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18407 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
18408 LDKUnsignedNodeAnnouncement this_ptr_conv;
18409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18410 this_ptr_conv.is_owned = false;
18411 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18412 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
18416 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
18417 LDKUnsignedNodeAnnouncement this_ptr_conv;
18418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18419 this_ptr_conv.is_owned = false;
18420 LDKPublicKey val_ref;
18421 CHECK(*((uint32_t*)val) == 33);
18422 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18423 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18426 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
18427 LDKUnsignedNodeAnnouncement this_ptr_conv;
18428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18429 this_ptr_conv.is_owned = false;
18430 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18431 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
18435 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
18436 LDKUnsignedNodeAnnouncement this_ptr_conv;
18437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18438 this_ptr_conv.is_owned = false;
18439 LDKThreeBytes val_ref;
18440 CHECK(*((uint32_t*)val) == 3);
18441 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18442 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18445 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
18446 LDKUnsignedNodeAnnouncement this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18450 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
18454 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
18455 LDKUnsignedNodeAnnouncement this_ptr_conv;
18456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18457 this_ptr_conv.is_owned = false;
18458 LDKThirtyTwoBytes val_ref;
18459 CHECK(*((uint32_t*)val) == 32);
18460 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18461 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18464 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18465 LDKUnsignedNodeAnnouncement this_ptr_conv;
18466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18467 this_ptr_conv.is_owned = false;
18468 LDKCVec_NetAddressZ val_constr;
18469 val_constr.datalen = *((uint32_t*)val);
18470 if (val_constr.datalen > 0)
18471 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18473 val_constr.data = NULL;
18474 uint32_t* val_vals = (uint32_t*)(val + 4);
18475 for (size_t m = 0; m < val_constr.datalen; m++) {
18476 uint32_t val_conv_12 = val_vals[m];
18477 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18478 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18479 val_constr.data[m] = val_conv_12_conv;
18481 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18484 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
18485 LDKUnsignedNodeAnnouncement orig_conv;
18486 orig_conv.inner = (void*)(orig & (~1));
18487 orig_conv.is_owned = false;
18488 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18491 uint64_t ret_ref = (uint64_t)ret_var.inner;
18492 if (ret_var.is_owned) {
18498 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
18499 LDKNodeAnnouncement this_obj_conv;
18500 this_obj_conv.inner = (void*)(this_obj & (~1));
18501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18502 NodeAnnouncement_free(this_obj_conv);
18505 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
18506 LDKNodeAnnouncement this_ptr_conv;
18507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18508 this_ptr_conv.is_owned = false;
18509 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18510 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
18514 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
18515 LDKNodeAnnouncement this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 LDKSignature val_ref;
18519 CHECK(*((uint32_t*)val) == 64);
18520 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18521 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18524 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
18525 LDKNodeAnnouncement this_ptr_conv;
18526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18527 this_ptr_conv.is_owned = false;
18528 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18531 uint64_t ret_ref = (uint64_t)ret_var.inner;
18532 if (ret_var.is_owned) {
18538 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
18539 LDKNodeAnnouncement this_ptr_conv;
18540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18541 this_ptr_conv.is_owned = false;
18542 LDKUnsignedNodeAnnouncement val_conv;
18543 val_conv.inner = (void*)(val & (~1));
18544 val_conv.is_owned = (val & 1) || (val == 0);
18545 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18546 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18549 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
18550 LDKSignature signature_arg_ref;
18551 CHECK(*((uint32_t*)signature_arg) == 64);
18552 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18553 LDKUnsignedNodeAnnouncement contents_arg_conv;
18554 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18555 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18556 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18557 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18560 uint64_t ret_ref = (uint64_t)ret_var.inner;
18561 if (ret_var.is_owned) {
18567 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
18568 LDKNodeAnnouncement orig_conv;
18569 orig_conv.inner = (void*)(orig & (~1));
18570 orig_conv.is_owned = false;
18571 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18574 uint64_t ret_ref = (uint64_t)ret_var.inner;
18575 if (ret_var.is_owned) {
18581 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
18582 LDKUnsignedChannelAnnouncement this_obj_conv;
18583 this_obj_conv.inner = (void*)(this_obj & (~1));
18584 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18585 UnsignedChannelAnnouncement_free(this_obj_conv);
18588 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
18589 LDKUnsignedChannelAnnouncement this_ptr_conv;
18590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18591 this_ptr_conv.is_owned = false;
18592 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18595 uint64_t ret_ref = (uint64_t)ret_var.inner;
18596 if (ret_var.is_owned) {
18602 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18603 LDKUnsignedChannelAnnouncement this_ptr_conv;
18604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18605 this_ptr_conv.is_owned = false;
18606 LDKChannelFeatures val_conv;
18607 val_conv.inner = (void*)(val & (~1));
18608 val_conv.is_owned = (val & 1) || (val == 0);
18609 val_conv = ChannelFeatures_clone(&val_conv);
18610 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18613 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
18614 LDKUnsignedChannelAnnouncement this_ptr_conv;
18615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18616 this_ptr_conv.is_owned = false;
18617 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18618 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
18622 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18623 LDKUnsignedChannelAnnouncement this_ptr_conv;
18624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18625 this_ptr_conv.is_owned = false;
18626 LDKThirtyTwoBytes val_ref;
18627 CHECK(*((uint32_t*)val) == 32);
18628 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18629 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18632 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
18633 LDKUnsignedChannelAnnouncement this_ptr_conv;
18634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18635 this_ptr_conv.is_owned = false;
18636 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18640 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18641 LDKUnsignedChannelAnnouncement this_ptr_conv;
18642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18643 this_ptr_conv.is_owned = false;
18644 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18647 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
18648 LDKUnsignedChannelAnnouncement this_ptr_conv;
18649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18650 this_ptr_conv.is_owned = false;
18651 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18652 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
18656 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
18657 LDKUnsignedChannelAnnouncement this_ptr_conv;
18658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18659 this_ptr_conv.is_owned = false;
18660 LDKPublicKey val_ref;
18661 CHECK(*((uint32_t*)val) == 33);
18662 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18663 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18666 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
18667 LDKUnsignedChannelAnnouncement this_ptr_conv;
18668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18669 this_ptr_conv.is_owned = false;
18670 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18671 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
18675 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
18676 LDKUnsignedChannelAnnouncement this_ptr_conv;
18677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18678 this_ptr_conv.is_owned = false;
18679 LDKPublicKey val_ref;
18680 CHECK(*((uint32_t*)val) == 33);
18681 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18682 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18685 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
18686 LDKUnsignedChannelAnnouncement this_ptr_conv;
18687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18688 this_ptr_conv.is_owned = false;
18689 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18690 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
18694 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
18695 LDKUnsignedChannelAnnouncement this_ptr_conv;
18696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18697 this_ptr_conv.is_owned = false;
18698 LDKPublicKey val_ref;
18699 CHECK(*((uint32_t*)val) == 33);
18700 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18701 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18704 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
18705 LDKUnsignedChannelAnnouncement this_ptr_conv;
18706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18707 this_ptr_conv.is_owned = false;
18708 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18709 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
18713 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
18714 LDKUnsignedChannelAnnouncement this_ptr_conv;
18715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18716 this_ptr_conv.is_owned = false;
18717 LDKPublicKey val_ref;
18718 CHECK(*((uint32_t*)val) == 33);
18719 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18720 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18723 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
18724 LDKUnsignedChannelAnnouncement orig_conv;
18725 orig_conv.inner = (void*)(orig & (~1));
18726 orig_conv.is_owned = false;
18727 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18730 uint64_t ret_ref = (uint64_t)ret_var.inner;
18731 if (ret_var.is_owned) {
18737 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
18738 LDKChannelAnnouncement this_obj_conv;
18739 this_obj_conv.inner = (void*)(this_obj & (~1));
18740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18741 ChannelAnnouncement_free(this_obj_conv);
18744 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
18745 LDKChannelAnnouncement this_ptr_conv;
18746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18747 this_ptr_conv.is_owned = false;
18748 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18749 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
18753 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
18754 LDKChannelAnnouncement this_ptr_conv;
18755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18756 this_ptr_conv.is_owned = false;
18757 LDKSignature val_ref;
18758 CHECK(*((uint32_t*)val) == 64);
18759 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18760 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18763 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
18764 LDKChannelAnnouncement this_ptr_conv;
18765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18766 this_ptr_conv.is_owned = false;
18767 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18768 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
18772 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
18773 LDKChannelAnnouncement this_ptr_conv;
18774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18775 this_ptr_conv.is_owned = false;
18776 LDKSignature val_ref;
18777 CHECK(*((uint32_t*)val) == 64);
18778 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18779 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18782 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
18783 LDKChannelAnnouncement this_ptr_conv;
18784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18785 this_ptr_conv.is_owned = false;
18786 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18787 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
18791 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
18792 LDKChannelAnnouncement this_ptr_conv;
18793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18794 this_ptr_conv.is_owned = false;
18795 LDKSignature val_ref;
18796 CHECK(*((uint32_t*)val) == 64);
18797 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18798 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18801 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
18802 LDKChannelAnnouncement this_ptr_conv;
18803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18804 this_ptr_conv.is_owned = false;
18805 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18806 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
18810 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
18811 LDKChannelAnnouncement this_ptr_conv;
18812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18813 this_ptr_conv.is_owned = false;
18814 LDKSignature val_ref;
18815 CHECK(*((uint32_t*)val) == 64);
18816 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18817 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18820 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
18821 LDKChannelAnnouncement this_ptr_conv;
18822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18823 this_ptr_conv.is_owned = false;
18824 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18827 uint64_t ret_ref = (uint64_t)ret_var.inner;
18828 if (ret_var.is_owned) {
18834 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
18835 LDKChannelAnnouncement this_ptr_conv;
18836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18837 this_ptr_conv.is_owned = false;
18838 LDKUnsignedChannelAnnouncement val_conv;
18839 val_conv.inner = (void*)(val & (~1));
18840 val_conv.is_owned = (val & 1) || (val == 0);
18841 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18842 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18845 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) {
18846 LDKSignature node_signature_1_arg_ref;
18847 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
18848 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
18849 LDKSignature node_signature_2_arg_ref;
18850 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
18851 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
18852 LDKSignature bitcoin_signature_1_arg_ref;
18853 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
18854 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
18855 LDKSignature bitcoin_signature_2_arg_ref;
18856 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
18857 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
18858 LDKUnsignedChannelAnnouncement contents_arg_conv;
18859 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18860 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18861 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18862 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);
18863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18865 uint64_t ret_ref = (uint64_t)ret_var.inner;
18866 if (ret_var.is_owned) {
18872 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
18873 LDKChannelAnnouncement orig_conv;
18874 orig_conv.inner = (void*)(orig & (~1));
18875 orig_conv.is_owned = false;
18876 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18879 uint64_t ret_ref = (uint64_t)ret_var.inner;
18880 if (ret_var.is_owned) {
18886 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
18887 LDKUnsignedChannelUpdate this_obj_conv;
18888 this_obj_conv.inner = (void*)(this_obj & (~1));
18889 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18890 UnsignedChannelUpdate_free(this_obj_conv);
18893 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
18894 LDKUnsignedChannelUpdate this_ptr_conv;
18895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18896 this_ptr_conv.is_owned = false;
18897 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18898 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
18902 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18903 LDKUnsignedChannelUpdate this_ptr_conv;
18904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18905 this_ptr_conv.is_owned = false;
18906 LDKThirtyTwoBytes val_ref;
18907 CHECK(*((uint32_t*)val) == 32);
18908 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18909 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18912 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
18913 LDKUnsignedChannelUpdate this_ptr_conv;
18914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18915 this_ptr_conv.is_owned = false;
18916 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18920 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18921 LDKUnsignedChannelUpdate this_ptr_conv;
18922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18923 this_ptr_conv.is_owned = false;
18924 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18927 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
18928 LDKUnsignedChannelUpdate this_ptr_conv;
18929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18930 this_ptr_conv.is_owned = false;
18931 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18935 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
18936 LDKUnsignedChannelUpdate this_ptr_conv;
18937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18938 this_ptr_conv.is_owned = false;
18939 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18942 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
18943 LDKUnsignedChannelUpdate this_ptr_conv;
18944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18945 this_ptr_conv.is_owned = false;
18946 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18950 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
18951 LDKUnsignedChannelUpdate this_ptr_conv;
18952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18953 this_ptr_conv.is_owned = false;
18954 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18957 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
18958 LDKUnsignedChannelUpdate this_ptr_conv;
18959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18960 this_ptr_conv.is_owned = false;
18961 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18965 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18966 LDKUnsignedChannelUpdate this_ptr_conv;
18967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18968 this_ptr_conv.is_owned = false;
18969 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18972 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
18973 LDKUnsignedChannelUpdate this_ptr_conv;
18974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18975 this_ptr_conv.is_owned = false;
18976 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18980 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18981 LDKUnsignedChannelUpdate this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18987 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
18988 LDKUnsignedChannelUpdate this_ptr_conv;
18989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18990 this_ptr_conv.is_owned = false;
18991 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18995 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
18996 LDKUnsignedChannelUpdate this_ptr_conv;
18997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18998 this_ptr_conv.is_owned = false;
18999 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19002 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
19003 LDKUnsignedChannelUpdate this_ptr_conv;
19004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19005 this_ptr_conv.is_owned = false;
19006 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19010 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
19011 LDKUnsignedChannelUpdate this_ptr_conv;
19012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19013 this_ptr_conv.is_owned = false;
19014 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19017 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
19018 LDKUnsignedChannelUpdate orig_conv;
19019 orig_conv.inner = (void*)(orig & (~1));
19020 orig_conv.is_owned = false;
19021 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19024 uint64_t ret_ref = (uint64_t)ret_var.inner;
19025 if (ret_var.is_owned) {
19031 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
19032 LDKChannelUpdate this_obj_conv;
19033 this_obj_conv.inner = (void*)(this_obj & (~1));
19034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19035 ChannelUpdate_free(this_obj_conv);
19038 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
19039 LDKChannelUpdate this_ptr_conv;
19040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19041 this_ptr_conv.is_owned = false;
19042 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19043 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
19047 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
19048 LDKChannelUpdate this_ptr_conv;
19049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19050 this_ptr_conv.is_owned = false;
19051 LDKSignature val_ref;
19052 CHECK(*((uint32_t*)val) == 64);
19053 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19054 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19057 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
19058 LDKChannelUpdate this_ptr_conv;
19059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19060 this_ptr_conv.is_owned = false;
19061 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19064 uint64_t ret_ref = (uint64_t)ret_var.inner;
19065 if (ret_var.is_owned) {
19071 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
19072 LDKChannelUpdate this_ptr_conv;
19073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19074 this_ptr_conv.is_owned = false;
19075 LDKUnsignedChannelUpdate val_conv;
19076 val_conv.inner = (void*)(val & (~1));
19077 val_conv.is_owned = (val & 1) || (val == 0);
19078 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19079 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19082 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
19083 LDKSignature signature_arg_ref;
19084 CHECK(*((uint32_t*)signature_arg) == 64);
19085 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19086 LDKUnsignedChannelUpdate contents_arg_conv;
19087 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19088 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19089 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19090 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19093 uint64_t ret_ref = (uint64_t)ret_var.inner;
19094 if (ret_var.is_owned) {
19100 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
19101 LDKChannelUpdate orig_conv;
19102 orig_conv.inner = (void*)(orig & (~1));
19103 orig_conv.is_owned = false;
19104 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19107 uint64_t ret_ref = (uint64_t)ret_var.inner;
19108 if (ret_var.is_owned) {
19114 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
19115 LDKQueryChannelRange this_obj_conv;
19116 this_obj_conv.inner = (void*)(this_obj & (~1));
19117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19118 QueryChannelRange_free(this_obj_conv);
19121 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
19122 LDKQueryChannelRange this_ptr_conv;
19123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19124 this_ptr_conv.is_owned = false;
19125 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19126 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
19130 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19131 LDKQueryChannelRange this_ptr_conv;
19132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19133 this_ptr_conv.is_owned = false;
19134 LDKThirtyTwoBytes val_ref;
19135 CHECK(*((uint32_t*)val) == 32);
19136 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19137 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19140 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
19141 LDKQueryChannelRange this_ptr_conv;
19142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19143 this_ptr_conv.is_owned = false;
19144 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19148 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19149 LDKQueryChannelRange this_ptr_conv;
19150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19151 this_ptr_conv.is_owned = false;
19152 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19155 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19156 LDKQueryChannelRange this_ptr_conv;
19157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19158 this_ptr_conv.is_owned = false;
19159 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19163 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19164 LDKQueryChannelRange this_ptr_conv;
19165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19166 this_ptr_conv.is_owned = false;
19167 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19170 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
19171 LDKThirtyTwoBytes chain_hash_arg_ref;
19172 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19173 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19174 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19177 uint64_t ret_ref = (uint64_t)ret_var.inner;
19178 if (ret_var.is_owned) {
19184 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
19185 LDKQueryChannelRange orig_conv;
19186 orig_conv.inner = (void*)(orig & (~1));
19187 orig_conv.is_owned = false;
19188 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19191 uint64_t ret_ref = (uint64_t)ret_var.inner;
19192 if (ret_var.is_owned) {
19198 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
19199 LDKReplyChannelRange this_obj_conv;
19200 this_obj_conv.inner = (void*)(this_obj & (~1));
19201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19202 ReplyChannelRange_free(this_obj_conv);
19205 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
19206 LDKReplyChannelRange this_ptr_conv;
19207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19208 this_ptr_conv.is_owned = false;
19209 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19210 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
19214 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19215 LDKReplyChannelRange this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 LDKThirtyTwoBytes val_ref;
19219 CHECK(*((uint32_t*)val) == 32);
19220 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19221 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19224 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
19225 LDKReplyChannelRange this_ptr_conv;
19226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19227 this_ptr_conv.is_owned = false;
19228 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19232 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19233 LDKReplyChannelRange this_ptr_conv;
19234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19235 this_ptr_conv.is_owned = false;
19236 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19239 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19240 LDKReplyChannelRange this_ptr_conv;
19241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19242 this_ptr_conv.is_owned = false;
19243 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19247 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19248 LDKReplyChannelRange this_ptr_conv;
19249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19250 this_ptr_conv.is_owned = false;
19251 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19254 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
19255 LDKReplyChannelRange this_ptr_conv;
19256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19257 this_ptr_conv.is_owned = false;
19258 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19262 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
19263 LDKReplyChannelRange this_ptr_conv;
19264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19265 this_ptr_conv.is_owned = false;
19266 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19269 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19270 LDKReplyChannelRange this_ptr_conv;
19271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19272 this_ptr_conv.is_owned = false;
19273 LDKCVec_u64Z val_constr;
19274 val_constr.datalen = *((uint32_t*)val);
19275 if (val_constr.datalen > 0)
19276 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19278 val_constr.data = NULL;
19279 int64_t* val_vals = (int64_t*)(val + 4);
19280 for (size_t i = 0; i < val_constr.datalen; i++) {
19281 int64_t val_conv_8 = val_vals[i];
19282 val_constr.data[i] = val_conv_8;
19284 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19287 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) {
19288 LDKThirtyTwoBytes chain_hash_arg_ref;
19289 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19290 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19291 LDKCVec_u64Z short_channel_ids_arg_constr;
19292 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19293 if (short_channel_ids_arg_constr.datalen > 0)
19294 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19296 short_channel_ids_arg_constr.data = NULL;
19297 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19298 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19299 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19300 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19302 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19305 uint64_t ret_ref = (uint64_t)ret_var.inner;
19306 if (ret_var.is_owned) {
19312 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
19313 LDKReplyChannelRange orig_conv;
19314 orig_conv.inner = (void*)(orig & (~1));
19315 orig_conv.is_owned = false;
19316 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19319 uint64_t ret_ref = (uint64_t)ret_var.inner;
19320 if (ret_var.is_owned) {
19326 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
19327 LDKQueryShortChannelIds this_obj_conv;
19328 this_obj_conv.inner = (void*)(this_obj & (~1));
19329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19330 QueryShortChannelIds_free(this_obj_conv);
19333 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
19334 LDKQueryShortChannelIds this_ptr_conv;
19335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19336 this_ptr_conv.is_owned = false;
19337 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19338 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
19342 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19343 LDKQueryShortChannelIds this_ptr_conv;
19344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19345 this_ptr_conv.is_owned = false;
19346 LDKThirtyTwoBytes val_ref;
19347 CHECK(*((uint32_t*)val) == 32);
19348 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19349 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19352 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19353 LDKQueryShortChannelIds this_ptr_conv;
19354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19355 this_ptr_conv.is_owned = false;
19356 LDKCVec_u64Z val_constr;
19357 val_constr.datalen = *((uint32_t*)val);
19358 if (val_constr.datalen > 0)
19359 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19361 val_constr.data = NULL;
19362 int64_t* val_vals = (int64_t*)(val + 4);
19363 for (size_t i = 0; i < val_constr.datalen; i++) {
19364 int64_t val_conv_8 = val_vals[i];
19365 val_constr.data[i] = val_conv_8;
19367 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19370 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
19371 LDKThirtyTwoBytes chain_hash_arg_ref;
19372 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19373 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19374 LDKCVec_u64Z short_channel_ids_arg_constr;
19375 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19376 if (short_channel_ids_arg_constr.datalen > 0)
19377 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19379 short_channel_ids_arg_constr.data = NULL;
19380 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19381 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19382 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19383 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19385 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19388 uint64_t ret_ref = (uint64_t)ret_var.inner;
19389 if (ret_var.is_owned) {
19395 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
19396 LDKQueryShortChannelIds orig_conv;
19397 orig_conv.inner = (void*)(orig & (~1));
19398 orig_conv.is_owned = false;
19399 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19400 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19401 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19402 uint64_t ret_ref = (uint64_t)ret_var.inner;
19403 if (ret_var.is_owned) {
19409 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
19410 LDKReplyShortChannelIdsEnd this_obj_conv;
19411 this_obj_conv.inner = (void*)(this_obj & (~1));
19412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19413 ReplyShortChannelIdsEnd_free(this_obj_conv);
19416 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
19417 LDKReplyShortChannelIdsEnd this_ptr_conv;
19418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19419 this_ptr_conv.is_owned = false;
19420 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19421 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
19425 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19426 LDKReplyShortChannelIdsEnd this_ptr_conv;
19427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19428 this_ptr_conv.is_owned = false;
19429 LDKThirtyTwoBytes val_ref;
19430 CHECK(*((uint32_t*)val) == 32);
19431 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19432 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19435 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
19436 LDKReplyShortChannelIdsEnd this_ptr_conv;
19437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19438 this_ptr_conv.is_owned = false;
19439 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19443 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
19444 LDKReplyShortChannelIdsEnd this_ptr_conv;
19445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19446 this_ptr_conv.is_owned = false;
19447 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19450 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
19451 LDKThirtyTwoBytes chain_hash_arg_ref;
19452 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19453 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19454 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19457 uint64_t ret_ref = (uint64_t)ret_var.inner;
19458 if (ret_var.is_owned) {
19464 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
19465 LDKReplyShortChannelIdsEnd orig_conv;
19466 orig_conv.inner = (void*)(orig & (~1));
19467 orig_conv.is_owned = false;
19468 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19471 uint64_t ret_ref = (uint64_t)ret_var.inner;
19472 if (ret_var.is_owned) {
19478 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
19479 LDKGossipTimestampFilter this_obj_conv;
19480 this_obj_conv.inner = (void*)(this_obj & (~1));
19481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19482 GossipTimestampFilter_free(this_obj_conv);
19485 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
19486 LDKGossipTimestampFilter 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19490 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
19494 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19495 LDKGossipTimestampFilter this_ptr_conv;
19496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19497 this_ptr_conv.is_owned = false;
19498 LDKThirtyTwoBytes val_ref;
19499 CHECK(*((uint32_t*)val) == 32);
19500 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19501 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19504 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
19505 LDKGossipTimestampFilter this_ptr_conv;
19506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19507 this_ptr_conv.is_owned = false;
19508 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19512 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
19513 LDKGossipTimestampFilter this_ptr_conv;
19514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19515 this_ptr_conv.is_owned = false;
19516 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19519 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
19520 LDKGossipTimestampFilter this_ptr_conv;
19521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19522 this_ptr_conv.is_owned = false;
19523 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19527 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
19528 LDKGossipTimestampFilter this_ptr_conv;
19529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19530 this_ptr_conv.is_owned = false;
19531 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19534 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
19535 LDKThirtyTwoBytes chain_hash_arg_ref;
19536 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19537 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19538 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19541 uint64_t ret_ref = (uint64_t)ret_var.inner;
19542 if (ret_var.is_owned) {
19548 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
19549 LDKGossipTimestampFilter orig_conv;
19550 orig_conv.inner = (void*)(orig & (~1));
19551 orig_conv.is_owned = false;
19552 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19555 uint64_t ret_ref = (uint64_t)ret_var.inner;
19556 if (ret_var.is_owned) {
19562 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
19563 if ((this_ptr & 1) != 0) return;
19564 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19565 FREE((void*)this_ptr);
19566 ErrorAction_free(this_ptr_conv);
19569 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
19570 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19571 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19572 *ret_copy = ErrorAction_clone(orig_conv);
19573 uint64_t ret_ref = (uint64_t)ret_copy;
19577 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
19578 LDKErrorMessage msg_conv;
19579 msg_conv.inner = (void*)(msg & (~1));
19580 msg_conv.is_owned = (msg & 1) || (msg == 0);
19581 msg_conv = ErrorMessage_clone(&msg_conv);
19582 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19583 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
19584 uint64_t ret_ref = (uint64_t)ret_copy;
19588 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
19589 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19590 *ret_copy = ErrorAction_ignore_error();
19591 uint64_t ret_ref = (uint64_t)ret_copy;
19595 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
19596 LDKLevel a_conv = LDKLevel_from_js(a);
19597 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19598 *ret_copy = ErrorAction_ignore_and_log(a_conv);
19599 uint64_t ret_ref = (uint64_t)ret_copy;
19603 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
19604 LDKErrorMessage msg_conv;
19605 msg_conv.inner = (void*)(msg & (~1));
19606 msg_conv.is_owned = (msg & 1) || (msg == 0);
19607 msg_conv = ErrorMessage_clone(&msg_conv);
19608 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19609 *ret_copy = ErrorAction_send_error_message(msg_conv);
19610 uint64_t ret_ref = (uint64_t)ret_copy;
19614 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
19615 LDKLightningError this_obj_conv;
19616 this_obj_conv.inner = (void*)(this_obj & (~1));
19617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19618 LightningError_free(this_obj_conv);
19621 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
19622 LDKLightningError this_ptr_conv;
19623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19624 this_ptr_conv.is_owned = false;
19625 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19626 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
19631 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
19632 LDKLightningError this_ptr_conv;
19633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19634 this_ptr_conv.is_owned = false;
19635 LDKStr val_conv = str_ref_to_owned_c(val);
19636 LightningError_set_err(&this_ptr_conv, val_conv);
19639 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
19640 LDKLightningError this_ptr_conv;
19641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19642 this_ptr_conv.is_owned = false;
19643 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19644 *ret_copy = LightningError_get_action(&this_ptr_conv);
19645 uint64_t ret_ref = (uint64_t)ret_copy;
19649 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
19650 LDKLightningError this_ptr_conv;
19651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19652 this_ptr_conv.is_owned = false;
19653 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19654 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
19655 LightningError_set_action(&this_ptr_conv, val_conv);
19658 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
19659 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
19660 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19661 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
19662 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19665 uint64_t ret_ref = (uint64_t)ret_var.inner;
19666 if (ret_var.is_owned) {
19672 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
19673 LDKLightningError orig_conv;
19674 orig_conv.inner = (void*)(orig & (~1));
19675 orig_conv.is_owned = false;
19676 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19679 uint64_t ret_ref = (uint64_t)ret_var.inner;
19680 if (ret_var.is_owned) {
19686 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
19687 LDKCommitmentUpdate this_obj_conv;
19688 this_obj_conv.inner = (void*)(this_obj & (~1));
19689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19690 CommitmentUpdate_free(this_obj_conv);
19693 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
19694 LDKCommitmentUpdate this_ptr_conv;
19695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19696 this_ptr_conv.is_owned = false;
19697 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
19698 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19699 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19700 for (size_t p = 0; p < ret_var.datalen; p++) {
19701 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
19702 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19703 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19704 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
19705 if (ret_conv_15_var.is_owned) {
19706 ret_conv_15_ref |= 1;
19708 ret_arr_ptr[p] = ret_conv_15_ref;
19710 FREE(ret_var.data);
19714 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
19715 LDKCommitmentUpdate this_ptr_conv;
19716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19717 this_ptr_conv.is_owned = false;
19718 LDKCVec_UpdateAddHTLCZ val_constr;
19719 val_constr.datalen = *((uint32_t*)val);
19720 if (val_constr.datalen > 0)
19721 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19723 val_constr.data = NULL;
19724 uint32_t* val_vals = (uint32_t*)(val + 4);
19725 for (size_t p = 0; p < val_constr.datalen; p++) {
19726 uint32_t val_conv_15 = val_vals[p];
19727 LDKUpdateAddHTLC val_conv_15_conv;
19728 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19729 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19730 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19731 val_constr.data[p] = val_conv_15_conv;
19733 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19736 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
19737 LDKCommitmentUpdate this_ptr_conv;
19738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19739 this_ptr_conv.is_owned = false;
19740 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
19741 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19742 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19743 for (size_t t = 0; t < ret_var.datalen; t++) {
19744 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
19745 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19746 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19747 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
19748 if (ret_conv_19_var.is_owned) {
19749 ret_conv_19_ref |= 1;
19751 ret_arr_ptr[t] = ret_conv_19_ref;
19753 FREE(ret_var.data);
19757 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
19758 LDKCommitmentUpdate this_ptr_conv;
19759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19760 this_ptr_conv.is_owned = false;
19761 LDKCVec_UpdateFulfillHTLCZ val_constr;
19762 val_constr.datalen = *((uint32_t*)val);
19763 if (val_constr.datalen > 0)
19764 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19766 val_constr.data = NULL;
19767 uint32_t* val_vals = (uint32_t*)(val + 4);
19768 for (size_t t = 0; t < val_constr.datalen; t++) {
19769 uint32_t val_conv_19 = val_vals[t];
19770 LDKUpdateFulfillHTLC val_conv_19_conv;
19771 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19772 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19773 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19774 val_constr.data[t] = val_conv_19_conv;
19776 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19779 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
19780 LDKCommitmentUpdate this_ptr_conv;
19781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19782 this_ptr_conv.is_owned = false;
19783 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
19784 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19785 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19786 for (size_t q = 0; q < ret_var.datalen; q++) {
19787 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
19788 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19789 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19790 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
19791 if (ret_conv_16_var.is_owned) {
19792 ret_conv_16_ref |= 1;
19794 ret_arr_ptr[q] = ret_conv_16_ref;
19796 FREE(ret_var.data);
19800 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
19801 LDKCommitmentUpdate this_ptr_conv;
19802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19803 this_ptr_conv.is_owned = false;
19804 LDKCVec_UpdateFailHTLCZ val_constr;
19805 val_constr.datalen = *((uint32_t*)val);
19806 if (val_constr.datalen > 0)
19807 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19809 val_constr.data = NULL;
19810 uint32_t* val_vals = (uint32_t*)(val + 4);
19811 for (size_t q = 0; q < val_constr.datalen; q++) {
19812 uint32_t val_conv_16 = val_vals[q];
19813 LDKUpdateFailHTLC val_conv_16_conv;
19814 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19815 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19816 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19817 val_constr.data[q] = val_conv_16_conv;
19819 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19822 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
19823 LDKCommitmentUpdate this_ptr_conv;
19824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19825 this_ptr_conv.is_owned = false;
19826 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
19827 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19828 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19829 for (size_t z = 0; z < ret_var.datalen; z++) {
19830 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
19831 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19832 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19833 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
19834 if (ret_conv_25_var.is_owned) {
19835 ret_conv_25_ref |= 1;
19837 ret_arr_ptr[z] = ret_conv_25_ref;
19839 FREE(ret_var.data);
19843 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
19844 LDKCommitmentUpdate this_ptr_conv;
19845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19846 this_ptr_conv.is_owned = false;
19847 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19848 val_constr.datalen = *((uint32_t*)val);
19849 if (val_constr.datalen > 0)
19850 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19852 val_constr.data = NULL;
19853 uint32_t* val_vals = (uint32_t*)(val + 4);
19854 for (size_t z = 0; z < val_constr.datalen; z++) {
19855 uint32_t val_conv_25 = val_vals[z];
19856 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19857 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19858 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19859 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19860 val_constr.data[z] = val_conv_25_conv;
19862 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19865 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
19866 LDKCommitmentUpdate this_ptr_conv;
19867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19868 this_ptr_conv.is_owned = false;
19869 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
19870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19872 uint64_t ret_ref = (uint64_t)ret_var.inner;
19873 if (ret_var.is_owned) {
19879 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
19880 LDKCommitmentUpdate this_ptr_conv;
19881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19882 this_ptr_conv.is_owned = false;
19883 LDKUpdateFee val_conv;
19884 val_conv.inner = (void*)(val & (~1));
19885 val_conv.is_owned = (val & 1) || (val == 0);
19886 val_conv = UpdateFee_clone(&val_conv);
19887 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19890 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
19891 LDKCommitmentUpdate this_ptr_conv;
19892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19893 this_ptr_conv.is_owned = false;
19894 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19897 uint64_t ret_ref = (uint64_t)ret_var.inner;
19898 if (ret_var.is_owned) {
19904 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
19905 LDKCommitmentUpdate this_ptr_conv;
19906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19907 this_ptr_conv.is_owned = false;
19908 LDKCommitmentSigned val_conv;
19909 val_conv.inner = (void*)(val & (~1));
19910 val_conv.is_owned = (val & 1) || (val == 0);
19911 val_conv = CommitmentSigned_clone(&val_conv);
19912 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19915 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) {
19916 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19917 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
19918 if (update_add_htlcs_arg_constr.datalen > 0)
19919 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19921 update_add_htlcs_arg_constr.data = NULL;
19922 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
19923 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19924 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19925 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19926 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19927 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19928 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19929 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19931 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19932 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
19933 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19934 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19936 update_fulfill_htlcs_arg_constr.data = NULL;
19937 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
19938 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19939 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19940 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19941 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19942 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19943 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19944 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19946 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19947 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
19948 if (update_fail_htlcs_arg_constr.datalen > 0)
19949 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19951 update_fail_htlcs_arg_constr.data = NULL;
19952 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
19953 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19954 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19955 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19956 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19957 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19958 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19959 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19961 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19962 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
19963 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19964 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19966 update_fail_malformed_htlcs_arg_constr.data = NULL;
19967 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
19968 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19969 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19970 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19971 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19972 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);
19973 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19974 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19976 LDKUpdateFee update_fee_arg_conv;
19977 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19978 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19979 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19980 LDKCommitmentSigned commitment_signed_arg_conv;
19981 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19982 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19983 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19984 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);
19985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19987 uint64_t ret_ref = (uint64_t)ret_var.inner;
19988 if (ret_var.is_owned) {
19994 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
19995 LDKCommitmentUpdate orig_conv;
19996 orig_conv.inner = (void*)(orig & (~1));
19997 orig_conv.is_owned = false;
19998 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20001 uint64_t ret_ref = (uint64_t)ret_var.inner;
20002 if (ret_var.is_owned) {
20008 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
20009 if ((this_ptr & 1) != 0) return;
20010 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20011 FREE((void*)this_ptr);
20012 ChannelMessageHandler_free(this_ptr_conv);
20015 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
20016 if ((this_ptr & 1) != 0) return;
20017 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20018 FREE((void*)this_ptr);
20019 RoutingMessageHandler_free(this_ptr_conv);
20022 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
20023 LDKAcceptChannel obj_conv;
20024 obj_conv.inner = (void*)(obj & (~1));
20025 obj_conv.is_owned = false;
20026 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20027 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20028 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20029 CVec_u8Z_free(ret_var);
20033 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
20034 LDKu8slice ser_ref;
20035 ser_ref.datalen = *((uint32_t*)ser);
20036 ser_ref.data = (int8_t*)(ser + 4);
20037 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20038 *ret_conv = AcceptChannel_read(ser_ref);
20039 return (uint64_t)ret_conv;
20042 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
20043 LDKAnnouncementSignatures obj_conv;
20044 obj_conv.inner = (void*)(obj & (~1));
20045 obj_conv.is_owned = false;
20046 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20047 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20048 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20049 CVec_u8Z_free(ret_var);
20053 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
20054 LDKu8slice ser_ref;
20055 ser_ref.datalen = *((uint32_t*)ser);
20056 ser_ref.data = (int8_t*)(ser + 4);
20057 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20058 *ret_conv = AnnouncementSignatures_read(ser_ref);
20059 return (uint64_t)ret_conv;
20062 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
20063 LDKChannelReestablish obj_conv;
20064 obj_conv.inner = (void*)(obj & (~1));
20065 obj_conv.is_owned = false;
20066 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20067 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20068 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20069 CVec_u8Z_free(ret_var);
20073 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
20074 LDKu8slice ser_ref;
20075 ser_ref.datalen = *((uint32_t*)ser);
20076 ser_ref.data = (int8_t*)(ser + 4);
20077 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20078 *ret_conv = ChannelReestablish_read(ser_ref);
20079 return (uint64_t)ret_conv;
20082 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
20083 LDKClosingSigned obj_conv;
20084 obj_conv.inner = (void*)(obj & (~1));
20085 obj_conv.is_owned = false;
20086 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20087 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20088 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20089 CVec_u8Z_free(ret_var);
20093 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
20094 LDKu8slice ser_ref;
20095 ser_ref.datalen = *((uint32_t*)ser);
20096 ser_ref.data = (int8_t*)(ser + 4);
20097 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20098 *ret_conv = ClosingSigned_read(ser_ref);
20099 return (uint64_t)ret_conv;
20102 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
20103 LDKClosingSignedFeeRange obj_conv;
20104 obj_conv.inner = (void*)(obj & (~1));
20105 obj_conv.is_owned = false;
20106 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
20107 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20108 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20109 CVec_u8Z_free(ret_var);
20113 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
20114 LDKu8slice ser_ref;
20115 ser_ref.datalen = *((uint32_t*)ser);
20116 ser_ref.data = (int8_t*)(ser + 4);
20117 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20118 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
20119 return (uint64_t)ret_conv;
20122 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
20123 LDKCommitmentSigned obj_conv;
20124 obj_conv.inner = (void*)(obj & (~1));
20125 obj_conv.is_owned = false;
20126 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20127 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20128 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20129 CVec_u8Z_free(ret_var);
20133 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
20134 LDKu8slice ser_ref;
20135 ser_ref.datalen = *((uint32_t*)ser);
20136 ser_ref.data = (int8_t*)(ser + 4);
20137 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20138 *ret_conv = CommitmentSigned_read(ser_ref);
20139 return (uint64_t)ret_conv;
20142 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
20143 LDKFundingCreated obj_conv;
20144 obj_conv.inner = (void*)(obj & (~1));
20145 obj_conv.is_owned = false;
20146 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20147 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20148 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20149 CVec_u8Z_free(ret_var);
20153 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
20154 LDKu8slice ser_ref;
20155 ser_ref.datalen = *((uint32_t*)ser);
20156 ser_ref.data = (int8_t*)(ser + 4);
20157 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20158 *ret_conv = FundingCreated_read(ser_ref);
20159 return (uint64_t)ret_conv;
20162 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
20163 LDKFundingSigned obj_conv;
20164 obj_conv.inner = (void*)(obj & (~1));
20165 obj_conv.is_owned = false;
20166 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20167 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20168 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20169 CVec_u8Z_free(ret_var);
20173 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
20174 LDKu8slice ser_ref;
20175 ser_ref.datalen = *((uint32_t*)ser);
20176 ser_ref.data = (int8_t*)(ser + 4);
20177 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20178 *ret_conv = FundingSigned_read(ser_ref);
20179 return (uint64_t)ret_conv;
20182 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
20183 LDKFundingLocked obj_conv;
20184 obj_conv.inner = (void*)(obj & (~1));
20185 obj_conv.is_owned = false;
20186 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20187 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20188 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20189 CVec_u8Z_free(ret_var);
20193 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
20194 LDKu8slice ser_ref;
20195 ser_ref.datalen = *((uint32_t*)ser);
20196 ser_ref.data = (int8_t*)(ser + 4);
20197 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20198 *ret_conv = FundingLocked_read(ser_ref);
20199 return (uint64_t)ret_conv;
20202 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
20204 obj_conv.inner = (void*)(obj & (~1));
20205 obj_conv.is_owned = false;
20206 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20207 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20208 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20209 CVec_u8Z_free(ret_var);
20213 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
20214 LDKu8slice ser_ref;
20215 ser_ref.datalen = *((uint32_t*)ser);
20216 ser_ref.data = (int8_t*)(ser + 4);
20217 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20218 *ret_conv = Init_read(ser_ref);
20219 return (uint64_t)ret_conv;
20222 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
20223 LDKOpenChannel obj_conv;
20224 obj_conv.inner = (void*)(obj & (~1));
20225 obj_conv.is_owned = false;
20226 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20227 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20228 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20229 CVec_u8Z_free(ret_var);
20233 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
20234 LDKu8slice ser_ref;
20235 ser_ref.datalen = *((uint32_t*)ser);
20236 ser_ref.data = (int8_t*)(ser + 4);
20237 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20238 *ret_conv = OpenChannel_read(ser_ref);
20239 return (uint64_t)ret_conv;
20242 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
20243 LDKRevokeAndACK obj_conv;
20244 obj_conv.inner = (void*)(obj & (~1));
20245 obj_conv.is_owned = false;
20246 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20247 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20248 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20249 CVec_u8Z_free(ret_var);
20253 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
20254 LDKu8slice ser_ref;
20255 ser_ref.datalen = *((uint32_t*)ser);
20256 ser_ref.data = (int8_t*)(ser + 4);
20257 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20258 *ret_conv = RevokeAndACK_read(ser_ref);
20259 return (uint64_t)ret_conv;
20262 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
20263 LDKShutdown obj_conv;
20264 obj_conv.inner = (void*)(obj & (~1));
20265 obj_conv.is_owned = false;
20266 LDKCVec_u8Z ret_var = Shutdown_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_Shutdown_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_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20278 *ret_conv = Shutdown_read(ser_ref);
20279 return (uint64_t)ret_conv;
20282 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
20283 LDKUpdateFailHTLC obj_conv;
20284 obj_conv.inner = (void*)(obj & (~1));
20285 obj_conv.is_owned = false;
20286 LDKCVec_u8Z ret_var = UpdateFailHTLC_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_UpdateFailHTLC_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_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20298 *ret_conv = UpdateFailHTLC_read(ser_ref);
20299 return (uint64_t)ret_conv;
20302 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
20303 LDKUpdateFailMalformedHTLC obj_conv;
20304 obj_conv.inner = (void*)(obj & (~1));
20305 obj_conv.is_owned = false;
20306 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20307 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20308 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20309 CVec_u8Z_free(ret_var);
20313 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
20314 LDKu8slice ser_ref;
20315 ser_ref.datalen = *((uint32_t*)ser);
20316 ser_ref.data = (int8_t*)(ser + 4);
20317 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20318 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20319 return (uint64_t)ret_conv;
20322 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
20323 LDKUpdateFee obj_conv;
20324 obj_conv.inner = (void*)(obj & (~1));
20325 obj_conv.is_owned = false;
20326 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20327 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20328 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20329 CVec_u8Z_free(ret_var);
20333 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
20334 LDKu8slice ser_ref;
20335 ser_ref.datalen = *((uint32_t*)ser);
20336 ser_ref.data = (int8_t*)(ser + 4);
20337 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20338 *ret_conv = UpdateFee_read(ser_ref);
20339 return (uint64_t)ret_conv;
20342 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
20343 LDKUpdateFulfillHTLC obj_conv;
20344 obj_conv.inner = (void*)(obj & (~1));
20345 obj_conv.is_owned = false;
20346 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20347 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20348 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20349 CVec_u8Z_free(ret_var);
20353 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
20354 LDKu8slice ser_ref;
20355 ser_ref.datalen = *((uint32_t*)ser);
20356 ser_ref.data = (int8_t*)(ser + 4);
20357 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20358 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20359 return (uint64_t)ret_conv;
20362 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
20363 LDKUpdateAddHTLC obj_conv;
20364 obj_conv.inner = (void*)(obj & (~1));
20365 obj_conv.is_owned = false;
20366 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20367 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20368 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20369 CVec_u8Z_free(ret_var);
20373 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
20374 LDKu8slice ser_ref;
20375 ser_ref.datalen = *((uint32_t*)ser);
20376 ser_ref.data = (int8_t*)(ser + 4);
20377 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20378 *ret_conv = UpdateAddHTLC_read(ser_ref);
20379 return (uint64_t)ret_conv;
20382 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
20384 obj_conv.inner = (void*)(obj & (~1));
20385 obj_conv.is_owned = false;
20386 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20387 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20388 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20389 CVec_u8Z_free(ret_var);
20393 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
20394 LDKu8slice ser_ref;
20395 ser_ref.datalen = *((uint32_t*)ser);
20396 ser_ref.data = (int8_t*)(ser + 4);
20397 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20398 *ret_conv = Ping_read(ser_ref);
20399 return (uint64_t)ret_conv;
20402 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
20404 obj_conv.inner = (void*)(obj & (~1));
20405 obj_conv.is_owned = false;
20406 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20407 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20408 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20409 CVec_u8Z_free(ret_var);
20413 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
20414 LDKu8slice ser_ref;
20415 ser_ref.datalen = *((uint32_t*)ser);
20416 ser_ref.data = (int8_t*)(ser + 4);
20417 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20418 *ret_conv = Pong_read(ser_ref);
20419 return (uint64_t)ret_conv;
20422 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
20423 LDKUnsignedChannelAnnouncement obj_conv;
20424 obj_conv.inner = (void*)(obj & (~1));
20425 obj_conv.is_owned = false;
20426 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20427 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20428 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20429 CVec_u8Z_free(ret_var);
20433 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
20434 LDKu8slice ser_ref;
20435 ser_ref.datalen = *((uint32_t*)ser);
20436 ser_ref.data = (int8_t*)(ser + 4);
20437 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20438 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20439 return (uint64_t)ret_conv;
20442 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
20443 LDKChannelAnnouncement obj_conv;
20444 obj_conv.inner = (void*)(obj & (~1));
20445 obj_conv.is_owned = false;
20446 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20447 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20448 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20449 CVec_u8Z_free(ret_var);
20453 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
20454 LDKu8slice ser_ref;
20455 ser_ref.datalen = *((uint32_t*)ser);
20456 ser_ref.data = (int8_t*)(ser + 4);
20457 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20458 *ret_conv = ChannelAnnouncement_read(ser_ref);
20459 return (uint64_t)ret_conv;
20462 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
20463 LDKUnsignedChannelUpdate obj_conv;
20464 obj_conv.inner = (void*)(obj & (~1));
20465 obj_conv.is_owned = false;
20466 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20467 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20468 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20469 CVec_u8Z_free(ret_var);
20473 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
20474 LDKu8slice ser_ref;
20475 ser_ref.datalen = *((uint32_t*)ser);
20476 ser_ref.data = (int8_t*)(ser + 4);
20477 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20478 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20479 return (uint64_t)ret_conv;
20482 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
20483 LDKChannelUpdate obj_conv;
20484 obj_conv.inner = (void*)(obj & (~1));
20485 obj_conv.is_owned = false;
20486 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20487 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20488 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20489 CVec_u8Z_free(ret_var);
20493 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
20494 LDKu8slice ser_ref;
20495 ser_ref.datalen = *((uint32_t*)ser);
20496 ser_ref.data = (int8_t*)(ser + 4);
20497 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20498 *ret_conv = ChannelUpdate_read(ser_ref);
20499 return (uint64_t)ret_conv;
20502 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
20503 LDKErrorMessage obj_conv;
20504 obj_conv.inner = (void*)(obj & (~1));
20505 obj_conv.is_owned = false;
20506 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20507 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20508 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20509 CVec_u8Z_free(ret_var);
20513 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
20514 LDKu8slice ser_ref;
20515 ser_ref.datalen = *((uint32_t*)ser);
20516 ser_ref.data = (int8_t*)(ser + 4);
20517 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20518 *ret_conv = ErrorMessage_read(ser_ref);
20519 return (uint64_t)ret_conv;
20522 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
20523 LDKUnsignedNodeAnnouncement obj_conv;
20524 obj_conv.inner = (void*)(obj & (~1));
20525 obj_conv.is_owned = false;
20526 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20527 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20528 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20529 CVec_u8Z_free(ret_var);
20533 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
20534 LDKu8slice ser_ref;
20535 ser_ref.datalen = *((uint32_t*)ser);
20536 ser_ref.data = (int8_t*)(ser + 4);
20537 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20538 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20539 return (uint64_t)ret_conv;
20542 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
20543 LDKNodeAnnouncement obj_conv;
20544 obj_conv.inner = (void*)(obj & (~1));
20545 obj_conv.is_owned = false;
20546 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20547 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20548 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20549 CVec_u8Z_free(ret_var);
20553 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
20554 LDKu8slice ser_ref;
20555 ser_ref.datalen = *((uint32_t*)ser);
20556 ser_ref.data = (int8_t*)(ser + 4);
20557 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20558 *ret_conv = NodeAnnouncement_read(ser_ref);
20559 return (uint64_t)ret_conv;
20562 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
20563 LDKu8slice ser_ref;
20564 ser_ref.datalen = *((uint32_t*)ser);
20565 ser_ref.data = (int8_t*)(ser + 4);
20566 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20567 *ret_conv = QueryShortChannelIds_read(ser_ref);
20568 return (uint64_t)ret_conv;
20571 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
20572 LDKQueryShortChannelIds obj_conv;
20573 obj_conv.inner = (void*)(obj & (~1));
20574 obj_conv.is_owned = false;
20575 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20576 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20577 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20578 CVec_u8Z_free(ret_var);
20582 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
20583 LDKReplyShortChannelIdsEnd obj_conv;
20584 obj_conv.inner = (void*)(obj & (~1));
20585 obj_conv.is_owned = false;
20586 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20587 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20588 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20589 CVec_u8Z_free(ret_var);
20593 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
20594 LDKu8slice ser_ref;
20595 ser_ref.datalen = *((uint32_t*)ser);
20596 ser_ref.data = (int8_t*)(ser + 4);
20597 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20598 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20599 return (uint64_t)ret_conv;
20602 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
20603 LDKQueryChannelRange this_arg_conv;
20604 this_arg_conv.inner = (void*)(this_arg & (~1));
20605 this_arg_conv.is_owned = false;
20606 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20610 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
20611 LDKQueryChannelRange obj_conv;
20612 obj_conv.inner = (void*)(obj & (~1));
20613 obj_conv.is_owned = false;
20614 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20615 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20616 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20617 CVec_u8Z_free(ret_var);
20621 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
20622 LDKu8slice ser_ref;
20623 ser_ref.datalen = *((uint32_t*)ser);
20624 ser_ref.data = (int8_t*)(ser + 4);
20625 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20626 *ret_conv = QueryChannelRange_read(ser_ref);
20627 return (uint64_t)ret_conv;
20630 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
20631 LDKu8slice ser_ref;
20632 ser_ref.datalen = *((uint32_t*)ser);
20633 ser_ref.data = (int8_t*)(ser + 4);
20634 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20635 *ret_conv = ReplyChannelRange_read(ser_ref);
20636 return (uint64_t)ret_conv;
20639 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
20640 LDKReplyChannelRange obj_conv;
20641 obj_conv.inner = (void*)(obj & (~1));
20642 obj_conv.is_owned = false;
20643 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20644 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20645 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20646 CVec_u8Z_free(ret_var);
20650 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
20651 LDKGossipTimestampFilter obj_conv;
20652 obj_conv.inner = (void*)(obj & (~1));
20653 obj_conv.is_owned = false;
20654 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20655 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20656 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20657 CVec_u8Z_free(ret_var);
20661 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
20662 LDKu8slice ser_ref;
20663 ser_ref.datalen = *((uint32_t*)ser);
20664 ser_ref.data = (int8_t*)(ser + 4);
20665 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20666 *ret_conv = GossipTimestampFilter_read(ser_ref);
20667 return (uint64_t)ret_conv;
20670 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
20671 if ((this_ptr & 1) != 0) return;
20672 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
20673 FREE((void*)this_ptr);
20674 CustomMessageHandler_free(this_ptr_conv);
20677 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
20678 LDKIgnoringMessageHandler this_obj_conv;
20679 this_obj_conv.inner = (void*)(this_obj & (~1));
20680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20681 IgnoringMessageHandler_free(this_obj_conv);
20684 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
20685 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20688 uint64_t ret_ref = (uint64_t)ret_var.inner;
20689 if (ret_var.is_owned) {
20695 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20696 LDKIgnoringMessageHandler this_arg_conv;
20697 this_arg_conv.inner = (void*)(this_arg & (~1));
20698 this_arg_conv.is_owned = false;
20699 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20700 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20701 return (uint64_t)ret_ret;
20704 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
20705 LDKIgnoringMessageHandler this_arg_conv;
20706 this_arg_conv.inner = (void*)(this_arg & (~1));
20707 this_arg_conv.is_owned = false;
20708 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20709 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20710 return (uint64_t)ret_ret;
20713 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
20714 LDKIgnoringMessageHandler this_arg_conv;
20715 this_arg_conv.inner = (void*)(this_arg & (~1));
20716 this_arg_conv.is_owned = false;
20717 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
20718 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
20719 return (uint64_t)ret_ret;
20722 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
20723 LDKIgnoringMessageHandler this_arg_conv;
20724 this_arg_conv.inner = (void*)(this_arg & (~1));
20725 this_arg_conv.is_owned = false;
20726 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
20727 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
20728 return (uint64_t)ret_ret;
20731 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
20732 LDKErroringMessageHandler this_obj_conv;
20733 this_obj_conv.inner = (void*)(this_obj & (~1));
20734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20735 ErroringMessageHandler_free(this_obj_conv);
20738 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
20739 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20742 uint64_t ret_ref = (uint64_t)ret_var.inner;
20743 if (ret_var.is_owned) {
20749 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20750 LDKErroringMessageHandler this_arg_conv;
20751 this_arg_conv.inner = (void*)(this_arg & (~1));
20752 this_arg_conv.is_owned = false;
20753 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20754 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20755 return (uint64_t)ret_ret;
20758 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
20759 LDKErroringMessageHandler this_arg_conv;
20760 this_arg_conv.inner = (void*)(this_arg & (~1));
20761 this_arg_conv.is_owned = false;
20762 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20763 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20764 return (uint64_t)ret_ret;
20767 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
20768 LDKMessageHandler this_obj_conv;
20769 this_obj_conv.inner = (void*)(this_obj & (~1));
20770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20771 MessageHandler_free(this_obj_conv);
20774 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
20775 LDKMessageHandler this_ptr_conv;
20776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20777 this_ptr_conv.is_owned = false;
20778 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20782 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
20783 LDKMessageHandler this_ptr_conv;
20784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20785 this_ptr_conv.is_owned = false;
20786 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20787 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20790 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
20791 LDKMessageHandler this_ptr_conv;
20792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20793 this_ptr_conv.is_owned = false;
20794 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20798 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
20799 LDKMessageHandler this_ptr_conv;
20800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20801 this_ptr_conv.is_owned = false;
20802 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20803 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20806 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
20807 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20808 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20809 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20812 uint64_t ret_ref = (uint64_t)ret_var.inner;
20813 if (ret_var.is_owned) {
20819 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
20820 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20821 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20822 *ret_ret = SocketDescriptor_clone(orig_conv);
20823 return (uint64_t)ret_ret;
20826 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
20827 if ((this_ptr & 1) != 0) return;
20828 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20829 FREE((void*)this_ptr);
20830 SocketDescriptor_free(this_ptr_conv);
20833 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
20834 LDKPeerHandleError this_obj_conv;
20835 this_obj_conv.inner = (void*)(this_obj & (~1));
20836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20837 PeerHandleError_free(this_obj_conv);
20840 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
20841 LDKPeerHandleError this_ptr_conv;
20842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20843 this_ptr_conv.is_owned = false;
20844 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20848 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
20849 LDKPeerHandleError this_ptr_conv;
20850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20851 this_ptr_conv.is_owned = false;
20852 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20855 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
20856 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20859 uint64_t ret_ref = (uint64_t)ret_var.inner;
20860 if (ret_var.is_owned) {
20866 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
20867 LDKPeerHandleError orig_conv;
20868 orig_conv.inner = (void*)(orig & (~1));
20869 orig_conv.is_owned = false;
20870 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
20871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20873 uint64_t ret_ref = (uint64_t)ret_var.inner;
20874 if (ret_var.is_owned) {
20880 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
20881 LDKPeerManager this_obj_conv;
20882 this_obj_conv.inner = (void*)(this_obj & (~1));
20883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20884 PeerManager_free(this_obj_conv);
20887 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
20888 LDKMessageHandler message_handler_conv;
20889 message_handler_conv.inner = (void*)(message_handler & (~1));
20890 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20891 // Warning: we need a move here but no clone is available for LDKMessageHandler
20892 LDKSecretKey our_node_secret_ref;
20893 CHECK(*((uint32_t*)our_node_secret) == 32);
20894 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
20895 unsigned char ephemeral_random_data_arr[32];
20896 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
20897 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
20898 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20899 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20900 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
20901 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
20902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20904 uint64_t ret_ref = (uint64_t)ret_var.inner;
20905 if (ret_var.is_owned) {
20911 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
20912 LDKPeerManager this_arg_conv;
20913 this_arg_conv.inner = (void*)(this_arg & (~1));
20914 this_arg_conv.is_owned = false;
20915 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20916 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
20917 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
20918 for (size_t m = 0; m < ret_var.datalen; m++) {
20919 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20920 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
20921 ret_arr_ptr[m] = ret_conv_12_arr;
20923 FREE(ret_var.data);
20927 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
20928 LDKPeerManager this_arg_conv;
20929 this_arg_conv.inner = (void*)(this_arg & (~1));
20930 this_arg_conv.is_owned = false;
20931 LDKPublicKey their_node_id_ref;
20932 CHECK(*((uint32_t*)their_node_id) == 33);
20933 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
20934 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20935 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20936 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20937 return (uint64_t)ret_conv;
20940 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
20941 LDKPeerManager this_arg_conv;
20942 this_arg_conv.inner = (void*)(this_arg & (~1));
20943 this_arg_conv.is_owned = false;
20944 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20945 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20946 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20947 return (uint64_t)ret_conv;
20950 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
20951 LDKPeerManager this_arg_conv;
20952 this_arg_conv.inner = (void*)(this_arg & (~1));
20953 this_arg_conv.is_owned = false;
20954 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20955 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20956 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20957 return (uint64_t)ret_conv;
20960 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
20961 LDKPeerManager this_arg_conv;
20962 this_arg_conv.inner = (void*)(this_arg & (~1));
20963 this_arg_conv.is_owned = false;
20964 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20965 LDKu8slice data_ref;
20966 data_ref.datalen = *((uint32_t*)data);
20967 data_ref.data = (int8_t*)(data + 4);
20968 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20969 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20970 return (uint64_t)ret_conv;
20973 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
20974 LDKPeerManager this_arg_conv;
20975 this_arg_conv.inner = (void*)(this_arg & (~1));
20976 this_arg_conv.is_owned = false;
20977 PeerManager_process_events(&this_arg_conv);
20980 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
20981 LDKPeerManager this_arg_conv;
20982 this_arg_conv.inner = (void*)(this_arg & (~1));
20983 this_arg_conv.is_owned = false;
20984 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20985 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20988 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
20989 LDKPeerManager this_arg_conv;
20990 this_arg_conv.inner = (void*)(this_arg & (~1));
20991 this_arg_conv.is_owned = false;
20992 LDKPublicKey node_id_ref;
20993 CHECK(*((uint32_t*)node_id) == 33);
20994 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
20995 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20998 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
20999 LDKPeerManager this_arg_conv;
21000 this_arg_conv.inner = (void*)(this_arg & (~1));
21001 this_arg_conv.is_owned = false;
21002 PeerManager_timer_tick_occurred(&this_arg_conv);
21005 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
21006 unsigned char commitment_seed_arr[32];
21007 CHECK(*((uint32_t*)commitment_seed) == 32);
21008 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
21009 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21010 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21011 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
21015 int8_tArray __attribute__((visibility("default"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
21016 LDKCVec_u8Z to_holder_script_ref;
21017 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
21018 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
21019 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
21020 LDKCVec_u8Z to_counterparty_script_ref;
21021 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
21022 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
21023 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
21024 LDKOutPoint funding_outpoint_conv;
21025 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
21026 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
21027 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
21028 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
21029 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21030 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21031 Transaction_free(ret_var);
21035 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
21036 LDKPublicKey per_commitment_point_ref;
21037 CHECK(*((uint32_t*)per_commitment_point) == 33);
21038 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21039 unsigned char base_secret_arr[32];
21040 CHECK(*((uint32_t*)base_secret) == 32);
21041 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
21042 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21043 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21044 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21045 return (uint64_t)ret_conv;
21048 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
21049 LDKPublicKey per_commitment_point_ref;
21050 CHECK(*((uint32_t*)per_commitment_point) == 33);
21051 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21052 LDKPublicKey base_point_ref;
21053 CHECK(*((uint32_t*)base_point) == 33);
21054 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
21055 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21056 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21057 return (uint64_t)ret_conv;
21060 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
21061 unsigned char per_commitment_secret_arr[32];
21062 CHECK(*((uint32_t*)per_commitment_secret) == 32);
21063 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
21064 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21065 unsigned char countersignatory_revocation_base_secret_arr[32];
21066 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
21067 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
21068 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21069 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21070 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21071 return (uint64_t)ret_conv;
21074 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
21075 LDKPublicKey per_commitment_point_ref;
21076 CHECK(*((uint32_t*)per_commitment_point) == 33);
21077 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21078 LDKPublicKey countersignatory_revocation_base_point_ref;
21079 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
21080 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
21081 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21082 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21083 return (uint64_t)ret_conv;
21086 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
21087 LDKTxCreationKeys this_obj_conv;
21088 this_obj_conv.inner = (void*)(this_obj & (~1));
21089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21090 TxCreationKeys_free(this_obj_conv);
21093 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
21094 LDKTxCreationKeys this_ptr_conv;
21095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21096 this_ptr_conv.is_owned = false;
21097 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21098 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
21102 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
21103 LDKTxCreationKeys this_ptr_conv;
21104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21105 this_ptr_conv.is_owned = false;
21106 LDKPublicKey val_ref;
21107 CHECK(*((uint32_t*)val) == 33);
21108 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21109 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21112 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
21113 LDKTxCreationKeys this_ptr_conv;
21114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21115 this_ptr_conv.is_owned = false;
21116 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21117 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
21121 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
21122 LDKTxCreationKeys this_ptr_conv;
21123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21124 this_ptr_conv.is_owned = false;
21125 LDKPublicKey val_ref;
21126 CHECK(*((uint32_t*)val) == 33);
21127 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21128 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21131 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
21132 LDKTxCreationKeys this_ptr_conv;
21133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21134 this_ptr_conv.is_owned = false;
21135 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21136 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
21140 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
21141 LDKTxCreationKeys this_ptr_conv;
21142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21143 this_ptr_conv.is_owned = false;
21144 LDKPublicKey val_ref;
21145 CHECK(*((uint32_t*)val) == 33);
21146 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21147 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21150 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
21151 LDKTxCreationKeys this_ptr_conv;
21152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21153 this_ptr_conv.is_owned = false;
21154 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21155 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
21159 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
21160 LDKTxCreationKeys this_ptr_conv;
21161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21162 this_ptr_conv.is_owned = false;
21163 LDKPublicKey val_ref;
21164 CHECK(*((uint32_t*)val) == 33);
21165 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21166 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21169 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
21170 LDKTxCreationKeys this_ptr_conv;
21171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21172 this_ptr_conv.is_owned = false;
21173 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21174 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
21178 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
21179 LDKTxCreationKeys this_ptr_conv;
21180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21181 this_ptr_conv.is_owned = false;
21182 LDKPublicKey val_ref;
21183 CHECK(*((uint32_t*)val) == 33);
21184 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21185 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21188 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) {
21189 LDKPublicKey per_commitment_point_arg_ref;
21190 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
21191 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
21192 LDKPublicKey revocation_key_arg_ref;
21193 CHECK(*((uint32_t*)revocation_key_arg) == 33);
21194 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
21195 LDKPublicKey broadcaster_htlc_key_arg_ref;
21196 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
21197 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
21198 LDKPublicKey countersignatory_htlc_key_arg_ref;
21199 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
21200 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
21201 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21202 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
21203 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
21204 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);
21205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21207 uint64_t ret_ref = (uint64_t)ret_var.inner;
21208 if (ret_var.is_owned) {
21214 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
21215 LDKTxCreationKeys orig_conv;
21216 orig_conv.inner = (void*)(orig & (~1));
21217 orig_conv.is_owned = false;
21218 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21221 uint64_t ret_ref = (uint64_t)ret_var.inner;
21222 if (ret_var.is_owned) {
21228 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
21229 LDKTxCreationKeys obj_conv;
21230 obj_conv.inner = (void*)(obj & (~1));
21231 obj_conv.is_owned = false;
21232 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21233 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21234 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21235 CVec_u8Z_free(ret_var);
21239 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
21240 LDKu8slice ser_ref;
21241 ser_ref.datalen = *((uint32_t*)ser);
21242 ser_ref.data = (int8_t*)(ser + 4);
21243 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21244 *ret_conv = TxCreationKeys_read(ser_ref);
21245 return (uint64_t)ret_conv;
21248 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
21249 LDKChannelPublicKeys this_obj_conv;
21250 this_obj_conv.inner = (void*)(this_obj & (~1));
21251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21252 ChannelPublicKeys_free(this_obj_conv);
21255 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
21256 LDKChannelPublicKeys this_ptr_conv;
21257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21258 this_ptr_conv.is_owned = false;
21259 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21260 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
21264 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
21265 LDKChannelPublicKeys this_ptr_conv;
21266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21267 this_ptr_conv.is_owned = false;
21268 LDKPublicKey val_ref;
21269 CHECK(*((uint32_t*)val) == 33);
21270 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21271 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21274 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
21275 LDKChannelPublicKeys this_ptr_conv;
21276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21277 this_ptr_conv.is_owned = false;
21278 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21279 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
21283 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
21284 LDKChannelPublicKeys this_ptr_conv;
21285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21286 this_ptr_conv.is_owned = false;
21287 LDKPublicKey val_ref;
21288 CHECK(*((uint32_t*)val) == 33);
21289 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21290 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21293 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
21294 LDKChannelPublicKeys this_ptr_conv;
21295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21296 this_ptr_conv.is_owned = false;
21297 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21298 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
21302 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
21303 LDKChannelPublicKeys this_ptr_conv;
21304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21305 this_ptr_conv.is_owned = false;
21306 LDKPublicKey val_ref;
21307 CHECK(*((uint32_t*)val) == 33);
21308 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21309 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21312 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
21313 LDKChannelPublicKeys this_ptr_conv;
21314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21315 this_ptr_conv.is_owned = false;
21316 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21317 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
21321 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
21322 LDKChannelPublicKeys this_ptr_conv;
21323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21324 this_ptr_conv.is_owned = false;
21325 LDKPublicKey val_ref;
21326 CHECK(*((uint32_t*)val) == 33);
21327 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21328 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21331 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
21332 LDKChannelPublicKeys this_ptr_conv;
21333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21334 this_ptr_conv.is_owned = false;
21335 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21336 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
21340 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
21341 LDKChannelPublicKeys this_ptr_conv;
21342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21343 this_ptr_conv.is_owned = false;
21344 LDKPublicKey val_ref;
21345 CHECK(*((uint32_t*)val) == 33);
21346 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21347 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21350 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) {
21351 LDKPublicKey funding_pubkey_arg_ref;
21352 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
21353 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
21354 LDKPublicKey revocation_basepoint_arg_ref;
21355 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
21356 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
21357 LDKPublicKey payment_point_arg_ref;
21358 CHECK(*((uint32_t*)payment_point_arg) == 33);
21359 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
21360 LDKPublicKey delayed_payment_basepoint_arg_ref;
21361 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
21362 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
21363 LDKPublicKey htlc_basepoint_arg_ref;
21364 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
21365 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
21366 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);
21367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21369 uint64_t ret_ref = (uint64_t)ret_var.inner;
21370 if (ret_var.is_owned) {
21376 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
21377 LDKChannelPublicKeys orig_conv;
21378 orig_conv.inner = (void*)(orig & (~1));
21379 orig_conv.is_owned = false;
21380 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21383 uint64_t ret_ref = (uint64_t)ret_var.inner;
21384 if (ret_var.is_owned) {
21390 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
21391 LDKChannelPublicKeys obj_conv;
21392 obj_conv.inner = (void*)(obj & (~1));
21393 obj_conv.is_owned = false;
21394 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21395 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21396 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21397 CVec_u8Z_free(ret_var);
21401 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
21402 LDKu8slice ser_ref;
21403 ser_ref.datalen = *((uint32_t*)ser);
21404 ser_ref.data = (int8_t*)(ser + 4);
21405 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21406 *ret_conv = ChannelPublicKeys_read(ser_ref);
21407 return (uint64_t)ret_conv;
21410 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) {
21411 LDKPublicKey per_commitment_point_ref;
21412 CHECK(*((uint32_t*)per_commitment_point) == 33);
21413 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21414 LDKPublicKey broadcaster_delayed_payment_base_ref;
21415 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
21416 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
21417 LDKPublicKey broadcaster_htlc_base_ref;
21418 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
21419 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
21420 LDKPublicKey countersignatory_revocation_base_ref;
21421 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
21422 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
21423 LDKPublicKey countersignatory_htlc_base_ref;
21424 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
21425 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
21426 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21427 *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);
21428 return (uint64_t)ret_conv;
21431 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
21432 LDKPublicKey per_commitment_point_ref;
21433 CHECK(*((uint32_t*)per_commitment_point) == 33);
21434 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21435 LDKChannelPublicKeys broadcaster_keys_conv;
21436 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21437 broadcaster_keys_conv.is_owned = false;
21438 LDKChannelPublicKeys countersignatory_keys_conv;
21439 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21440 countersignatory_keys_conv.is_owned = false;
21441 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21442 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21443 return (uint64_t)ret_conv;
21446 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
21447 LDKPublicKey revocation_key_ref;
21448 CHECK(*((uint32_t*)revocation_key) == 33);
21449 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21450 LDKPublicKey broadcaster_delayed_payment_key_ref;
21451 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21452 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21453 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21454 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21455 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21456 CVec_u8Z_free(ret_var);
21460 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
21461 LDKHTLCOutputInCommitment this_obj_conv;
21462 this_obj_conv.inner = (void*)(this_obj & (~1));
21463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21464 HTLCOutputInCommitment_free(this_obj_conv);
21467 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
21468 LDKHTLCOutputInCommitment this_ptr_conv;
21469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21470 this_ptr_conv.is_owned = false;
21471 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21475 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
21476 LDKHTLCOutputInCommitment this_ptr_conv;
21477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21478 this_ptr_conv.is_owned = false;
21479 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21482 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
21483 LDKHTLCOutputInCommitment this_ptr_conv;
21484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21485 this_ptr_conv.is_owned = false;
21486 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21490 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
21491 LDKHTLCOutputInCommitment this_ptr_conv;
21492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21493 this_ptr_conv.is_owned = false;
21494 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21497 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
21498 LDKHTLCOutputInCommitment this_ptr_conv;
21499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21500 this_ptr_conv.is_owned = false;
21501 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21505 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
21506 LDKHTLCOutputInCommitment this_ptr_conv;
21507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21508 this_ptr_conv.is_owned = false;
21509 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21512 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
21513 LDKHTLCOutputInCommitment this_ptr_conv;
21514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21515 this_ptr_conv.is_owned = false;
21516 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21517 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
21521 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
21522 LDKHTLCOutputInCommitment this_ptr_conv;
21523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21524 this_ptr_conv.is_owned = false;
21525 LDKThirtyTwoBytes val_ref;
21526 CHECK(*((uint32_t*)val) == 32);
21527 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21528 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21531 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
21532 LDKHTLCOutputInCommitment this_ptr_conv;
21533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21534 this_ptr_conv.is_owned = false;
21535 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21536 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21537 uint64_t ret_ref = (uint64_t)ret_copy;
21541 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
21542 LDKHTLCOutputInCommitment this_ptr_conv;
21543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21544 this_ptr_conv.is_owned = false;
21545 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21546 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21547 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21550 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) {
21551 LDKThirtyTwoBytes payment_hash_arg_ref;
21552 CHECK(*((uint32_t*)payment_hash_arg) == 32);
21553 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
21554 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21555 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
21556 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21559 uint64_t ret_ref = (uint64_t)ret_var.inner;
21560 if (ret_var.is_owned) {
21566 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
21567 LDKHTLCOutputInCommitment orig_conv;
21568 orig_conv.inner = (void*)(orig & (~1));
21569 orig_conv.is_owned = false;
21570 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21573 uint64_t ret_ref = (uint64_t)ret_var.inner;
21574 if (ret_var.is_owned) {
21580 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
21581 LDKHTLCOutputInCommitment obj_conv;
21582 obj_conv.inner = (void*)(obj & (~1));
21583 obj_conv.is_owned = false;
21584 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21585 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21586 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21587 CVec_u8Z_free(ret_var);
21591 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
21592 LDKu8slice ser_ref;
21593 ser_ref.datalen = *((uint32_t*)ser);
21594 ser_ref.data = (int8_t*)(ser + 4);
21595 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21596 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21597 return (uint64_t)ret_conv;
21600 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
21601 LDKHTLCOutputInCommitment htlc_conv;
21602 htlc_conv.inner = (void*)(htlc & (~1));
21603 htlc_conv.is_owned = false;
21604 LDKTxCreationKeys keys_conv;
21605 keys_conv.inner = (void*)(keys & (~1));
21606 keys_conv.is_owned = false;
21607 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21608 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21609 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21610 CVec_u8Z_free(ret_var);
21614 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
21615 LDKPublicKey broadcaster_ref;
21616 CHECK(*((uint32_t*)broadcaster) == 33);
21617 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
21618 LDKPublicKey countersignatory_ref;
21619 CHECK(*((uint32_t*)countersignatory) == 33);
21620 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
21621 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21622 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21623 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21624 CVec_u8Z_free(ret_var);
21628 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) {
21629 unsigned char commitment_txid_arr[32];
21630 CHECK(*((uint32_t*)commitment_txid) == 32);
21631 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
21632 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21633 LDKHTLCOutputInCommitment htlc_conv;
21634 htlc_conv.inner = (void*)(htlc & (~1));
21635 htlc_conv.is_owned = false;
21636 LDKPublicKey broadcaster_delayed_payment_key_ref;
21637 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21638 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21639 LDKPublicKey revocation_key_ref;
21640 CHECK(*((uint32_t*)revocation_key) == 33);
21641 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21642 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21645 Transaction_free(ret_var);
21649 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
21650 LDKChannelTransactionParameters this_obj_conv;
21651 this_obj_conv.inner = (void*)(this_obj & (~1));
21652 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21653 ChannelTransactionParameters_free(this_obj_conv);
21656 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
21657 LDKChannelTransactionParameters this_ptr_conv;
21658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21659 this_ptr_conv.is_owned = false;
21660 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21663 uint64_t ret_ref = (uint64_t)ret_var.inner;
21664 if (ret_var.is_owned) {
21670 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
21671 LDKChannelTransactionParameters this_ptr_conv;
21672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21673 this_ptr_conv.is_owned = false;
21674 LDKChannelPublicKeys val_conv;
21675 val_conv.inner = (void*)(val & (~1));
21676 val_conv.is_owned = (val & 1) || (val == 0);
21677 val_conv = ChannelPublicKeys_clone(&val_conv);
21678 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21681 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
21682 LDKChannelTransactionParameters this_ptr_conv;
21683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21684 this_ptr_conv.is_owned = false;
21685 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21689 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
21690 LDKChannelTransactionParameters this_ptr_conv;
21691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21692 this_ptr_conv.is_owned = false;
21693 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21696 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
21697 LDKChannelTransactionParameters this_ptr_conv;
21698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21699 this_ptr_conv.is_owned = false;
21700 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21704 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
21705 LDKChannelTransactionParameters this_ptr_conv;
21706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21707 this_ptr_conv.is_owned = false;
21708 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21711 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
21712 LDKChannelTransactionParameters this_ptr_conv;
21713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21714 this_ptr_conv.is_owned = false;
21715 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21718 uint64_t ret_ref = (uint64_t)ret_var.inner;
21719 if (ret_var.is_owned) {
21725 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
21726 LDKChannelTransactionParameters this_ptr_conv;
21727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21728 this_ptr_conv.is_owned = false;
21729 LDKCounterpartyChannelTransactionParameters val_conv;
21730 val_conv.inner = (void*)(val & (~1));
21731 val_conv.is_owned = (val & 1) || (val == 0);
21732 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21733 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21736 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
21737 LDKChannelTransactionParameters this_ptr_conv;
21738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21739 this_ptr_conv.is_owned = false;
21740 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21743 uint64_t ret_ref = (uint64_t)ret_var.inner;
21744 if (ret_var.is_owned) {
21750 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
21751 LDKChannelTransactionParameters this_ptr_conv;
21752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21753 this_ptr_conv.is_owned = false;
21754 LDKOutPoint val_conv;
21755 val_conv.inner = (void*)(val & (~1));
21756 val_conv.is_owned = (val & 1) || (val == 0);
21757 val_conv = OutPoint_clone(&val_conv);
21758 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21761 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) {
21762 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21763 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21764 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21765 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21766 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21767 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21768 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21769 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21770 LDKOutPoint funding_outpoint_arg_conv;
21771 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21772 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21773 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21774 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);
21775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21777 uint64_t ret_ref = (uint64_t)ret_var.inner;
21778 if (ret_var.is_owned) {
21784 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
21785 LDKChannelTransactionParameters orig_conv;
21786 orig_conv.inner = (void*)(orig & (~1));
21787 orig_conv.is_owned = false;
21788 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21791 uint64_t ret_ref = (uint64_t)ret_var.inner;
21792 if (ret_var.is_owned) {
21798 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
21799 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21800 this_obj_conv.inner = (void*)(this_obj & (~1));
21801 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21802 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21805 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
21806 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21808 this_ptr_conv.is_owned = false;
21809 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21812 uint64_t ret_ref = (uint64_t)ret_var.inner;
21813 if (ret_var.is_owned) {
21819 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
21820 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21822 this_ptr_conv.is_owned = false;
21823 LDKChannelPublicKeys val_conv;
21824 val_conv.inner = (void*)(val & (~1));
21825 val_conv.is_owned = (val & 1) || (val == 0);
21826 val_conv = ChannelPublicKeys_clone(&val_conv);
21827 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21830 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
21831 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21833 this_ptr_conv.is_owned = false;
21834 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21838 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
21839 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21841 this_ptr_conv.is_owned = false;
21842 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21845 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
21846 LDKChannelPublicKeys pubkeys_arg_conv;
21847 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21848 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21849 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21850 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21853 uint64_t ret_ref = (uint64_t)ret_var.inner;
21854 if (ret_var.is_owned) {
21860 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
21861 LDKCounterpartyChannelTransactionParameters orig_conv;
21862 orig_conv.inner = (void*)(orig & (~1));
21863 orig_conv.is_owned = false;
21864 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21867 uint64_t ret_ref = (uint64_t)ret_var.inner;
21868 if (ret_var.is_owned) {
21874 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
21875 LDKChannelTransactionParameters this_arg_conv;
21876 this_arg_conv.inner = (void*)(this_arg & (~1));
21877 this_arg_conv.is_owned = false;
21878 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21882 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
21883 LDKChannelTransactionParameters this_arg_conv;
21884 this_arg_conv.inner = (void*)(this_arg & (~1));
21885 this_arg_conv.is_owned = false;
21886 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21889 uint64_t ret_ref = (uint64_t)ret_var.inner;
21890 if (ret_var.is_owned) {
21896 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
21897 LDKChannelTransactionParameters this_arg_conv;
21898 this_arg_conv.inner = (void*)(this_arg & (~1));
21899 this_arg_conv.is_owned = false;
21900 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21903 uint64_t ret_ref = (uint64_t)ret_var.inner;
21904 if (ret_var.is_owned) {
21910 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
21911 LDKCounterpartyChannelTransactionParameters obj_conv;
21912 obj_conv.inner = (void*)(obj & (~1));
21913 obj_conv.is_owned = false;
21914 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21915 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21916 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21917 CVec_u8Z_free(ret_var);
21921 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
21922 LDKu8slice ser_ref;
21923 ser_ref.datalen = *((uint32_t*)ser);
21924 ser_ref.data = (int8_t*)(ser + 4);
21925 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21926 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21927 return (uint64_t)ret_conv;
21930 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
21931 LDKChannelTransactionParameters obj_conv;
21932 obj_conv.inner = (void*)(obj & (~1));
21933 obj_conv.is_owned = false;
21934 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21935 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21936 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21937 CVec_u8Z_free(ret_var);
21941 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
21942 LDKu8slice ser_ref;
21943 ser_ref.datalen = *((uint32_t*)ser);
21944 ser_ref.data = (int8_t*)(ser + 4);
21945 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21946 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21947 return (uint64_t)ret_conv;
21950 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
21951 LDKDirectedChannelTransactionParameters this_obj_conv;
21952 this_obj_conv.inner = (void*)(this_obj & (~1));
21953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21954 DirectedChannelTransactionParameters_free(this_obj_conv);
21957 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
21958 LDKDirectedChannelTransactionParameters this_arg_conv;
21959 this_arg_conv.inner = (void*)(this_arg & (~1));
21960 this_arg_conv.is_owned = false;
21961 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21964 uint64_t ret_ref = (uint64_t)ret_var.inner;
21965 if (ret_var.is_owned) {
21971 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
21972 LDKDirectedChannelTransactionParameters this_arg_conv;
21973 this_arg_conv.inner = (void*)(this_arg & (~1));
21974 this_arg_conv.is_owned = false;
21975 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21978 uint64_t ret_ref = (uint64_t)ret_var.inner;
21979 if (ret_var.is_owned) {
21985 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
21986 LDKDirectedChannelTransactionParameters this_arg_conv;
21987 this_arg_conv.inner = (void*)(this_arg & (~1));
21988 this_arg_conv.is_owned = false;
21989 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21993 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
21994 LDKDirectedChannelTransactionParameters this_arg_conv;
21995 this_arg_conv.inner = (void*)(this_arg & (~1));
21996 this_arg_conv.is_owned = false;
21997 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22001 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
22002 LDKDirectedChannelTransactionParameters this_arg_conv;
22003 this_arg_conv.inner = (void*)(this_arg & (~1));
22004 this_arg_conv.is_owned = false;
22005 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22006 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22007 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22008 uint64_t ret_ref = (uint64_t)ret_var.inner;
22009 if (ret_var.is_owned) {
22015 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
22016 LDKHolderCommitmentTransaction this_obj_conv;
22017 this_obj_conv.inner = (void*)(this_obj & (~1));
22018 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22019 HolderCommitmentTransaction_free(this_obj_conv);
22022 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
22023 LDKHolderCommitmentTransaction this_ptr_conv;
22024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22025 this_ptr_conv.is_owned = false;
22026 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22027 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
22031 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
22032 LDKHolderCommitmentTransaction this_ptr_conv;
22033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22034 this_ptr_conv.is_owned = false;
22035 LDKSignature val_ref;
22036 CHECK(*((uint32_t*)val) == 64);
22037 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
22038 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22041 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
22042 LDKHolderCommitmentTransaction this_ptr_conv;
22043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22044 this_ptr_conv.is_owned = false;
22045 LDKCVec_SignatureZ val_constr;
22046 val_constr.datalen = *((uint32_t*)val);
22047 if (val_constr.datalen > 0)
22048 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22050 val_constr.data = NULL;
22051 int8_tArray* val_vals = (int8_tArray*)(val + 4);
22052 for (size_t m = 0; m < val_constr.datalen; m++) {
22053 int8_tArray val_conv_12 = val_vals[m];
22054 LDKSignature val_conv_12_ref;
22055 CHECK(*((uint32_t*)val_conv_12) == 64);
22056 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
22057 val_constr.data[m] = val_conv_12_ref;
22059 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22062 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
22063 LDKHolderCommitmentTransaction orig_conv;
22064 orig_conv.inner = (void*)(orig & (~1));
22065 orig_conv.is_owned = false;
22066 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22069 uint64_t ret_ref = (uint64_t)ret_var.inner;
22070 if (ret_var.is_owned) {
22076 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
22077 LDKHolderCommitmentTransaction obj_conv;
22078 obj_conv.inner = (void*)(obj & (~1));
22079 obj_conv.is_owned = false;
22080 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22081 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22082 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22083 CVec_u8Z_free(ret_var);
22087 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
22088 LDKu8slice ser_ref;
22089 ser_ref.datalen = *((uint32_t*)ser);
22090 ser_ref.data = (int8_t*)(ser + 4);
22091 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22092 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22093 return (uint64_t)ret_conv;
22096 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) {
22097 LDKCommitmentTransaction commitment_tx_conv;
22098 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22099 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22100 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22101 LDKSignature counterparty_sig_ref;
22102 CHECK(*((uint32_t*)counterparty_sig) == 64);
22103 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
22104 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22105 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
22106 if (counterparty_htlc_sigs_constr.datalen > 0)
22107 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22109 counterparty_htlc_sigs_constr.data = NULL;
22110 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
22111 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
22112 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
22113 LDKSignature counterparty_htlc_sigs_conv_12_ref;
22114 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
22115 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
22116 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
22118 LDKPublicKey holder_funding_key_ref;
22119 CHECK(*((uint32_t*)holder_funding_key) == 33);
22120 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
22121 LDKPublicKey counterparty_funding_key_ref;
22122 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
22123 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
22124 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22127 uint64_t ret_ref = (uint64_t)ret_var.inner;
22128 if (ret_var.is_owned) {
22134 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
22135 LDKBuiltCommitmentTransaction this_obj_conv;
22136 this_obj_conv.inner = (void*)(this_obj & (~1));
22137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22138 BuiltCommitmentTransaction_free(this_obj_conv);
22141 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
22142 LDKBuiltCommitmentTransaction this_ptr_conv;
22143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22144 this_ptr_conv.is_owned = false;
22145 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22146 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22147 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22148 Transaction_free(ret_var);
22152 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
22153 LDKBuiltCommitmentTransaction this_ptr_conv;
22154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22155 this_ptr_conv.is_owned = false;
22156 LDKTransaction val_ref;
22157 val_ref.datalen = *((uint32_t*)val);
22158 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22159 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22160 val_ref.data_is_owned = true;
22161 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22164 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
22165 LDKBuiltCommitmentTransaction this_ptr_conv;
22166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22167 this_ptr_conv.is_owned = false;
22168 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22169 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
22173 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
22174 LDKBuiltCommitmentTransaction this_ptr_conv;
22175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22176 this_ptr_conv.is_owned = false;
22177 LDKThirtyTwoBytes val_ref;
22178 CHECK(*((uint32_t*)val) == 32);
22179 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22180 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22183 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
22184 LDKTransaction transaction_arg_ref;
22185 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
22186 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22187 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
22188 transaction_arg_ref.data_is_owned = true;
22189 LDKThirtyTwoBytes txid_arg_ref;
22190 CHECK(*((uint32_t*)txid_arg) == 32);
22191 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
22192 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22195 uint64_t ret_ref = (uint64_t)ret_var.inner;
22196 if (ret_var.is_owned) {
22202 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
22203 LDKBuiltCommitmentTransaction orig_conv;
22204 orig_conv.inner = (void*)(orig & (~1));
22205 orig_conv.is_owned = false;
22206 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22209 uint64_t ret_ref = (uint64_t)ret_var.inner;
22210 if (ret_var.is_owned) {
22216 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
22217 LDKBuiltCommitmentTransaction obj_conv;
22218 obj_conv.inner = (void*)(obj & (~1));
22219 obj_conv.is_owned = false;
22220 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22221 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22222 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22223 CVec_u8Z_free(ret_var);
22227 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
22228 LDKu8slice ser_ref;
22229 ser_ref.datalen = *((uint32_t*)ser);
22230 ser_ref.data = (int8_t*)(ser + 4);
22231 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22232 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22233 return (uint64_t)ret_conv;
22236 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22237 LDKBuiltCommitmentTransaction this_arg_conv;
22238 this_arg_conv.inner = (void*)(this_arg & (~1));
22239 this_arg_conv.is_owned = false;
22240 LDKu8slice funding_redeemscript_ref;
22241 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22242 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22243 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22244 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22248 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) {
22249 LDKBuiltCommitmentTransaction this_arg_conv;
22250 this_arg_conv.inner = (void*)(this_arg & (~1));
22251 this_arg_conv.is_owned = false;
22252 unsigned char funding_key_arr[32];
22253 CHECK(*((uint32_t*)funding_key) == 32);
22254 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22255 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22256 LDKu8slice funding_redeemscript_ref;
22257 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22258 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22259 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22260 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22264 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
22265 LDKClosingTransaction this_obj_conv;
22266 this_obj_conv.inner = (void*)(this_obj & (~1));
22267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22268 ClosingTransaction_free(this_obj_conv);
22271 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
22272 LDKCVec_u8Z to_holder_script_ref;
22273 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
22274 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
22275 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
22276 LDKCVec_u8Z to_counterparty_script_ref;
22277 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
22278 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
22279 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
22280 LDKOutPoint funding_outpoint_conv;
22281 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22282 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22283 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22284 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
22285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22287 uint64_t ret_ref = (uint64_t)ret_var.inner;
22288 if (ret_var.is_owned) {
22294 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
22295 LDKClosingTransaction this_arg_conv;
22296 this_arg_conv.inner = (void*)(this_arg & (~1));
22297 this_arg_conv.is_owned = false;
22298 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
22299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22301 uint64_t ret_ref = (uint64_t)ret_var.inner;
22302 if (ret_var.is_owned) {
22308 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
22309 LDKClosingTransaction this_arg_conv;
22310 this_arg_conv.inner = (void*)(this_arg & (~1));
22311 this_arg_conv.is_owned = false;
22312 LDKOutPoint funding_outpoint_conv;
22313 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22314 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22315 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22316 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
22317 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
22318 return (uint64_t)ret_conv;
22321 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
22322 LDKClosingTransaction this_arg_conv;
22323 this_arg_conv.inner = (void*)(this_arg & (~1));
22324 this_arg_conv.is_owned = false;
22325 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
22329 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
22330 LDKClosingTransaction this_arg_conv;
22331 this_arg_conv.inner = (void*)(this_arg & (~1));
22332 this_arg_conv.is_owned = false;
22333 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
22337 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
22338 LDKClosingTransaction this_arg_conv;
22339 this_arg_conv.inner = (void*)(this_arg & (~1));
22340 this_arg_conv.is_owned = false;
22341 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
22342 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22343 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22347 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
22348 LDKClosingTransaction this_arg_conv;
22349 this_arg_conv.inner = (void*)(this_arg & (~1));
22350 this_arg_conv.is_owned = false;
22351 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
22352 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22353 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22357 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
22358 LDKTrustedClosingTransaction this_obj_conv;
22359 this_obj_conv.inner = (void*)(this_obj & (~1));
22360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22361 TrustedClosingTransaction_free(this_obj_conv);
22364 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
22365 LDKTrustedClosingTransaction this_arg_conv;
22366 this_arg_conv.inner = (void*)(this_arg & (~1));
22367 this_arg_conv.is_owned = false;
22368 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
22369 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22370 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22371 Transaction_free(ret_var);
22375 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22376 LDKTrustedClosingTransaction this_arg_conv;
22377 this_arg_conv.inner = (void*)(this_arg & (~1));
22378 this_arg_conv.is_owned = false;
22379 LDKu8slice funding_redeemscript_ref;
22380 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22381 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22382 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22383 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22387 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22388 LDKTrustedClosingTransaction this_arg_conv;
22389 this_arg_conv.inner = (void*)(this_arg & (~1));
22390 this_arg_conv.is_owned = false;
22391 unsigned char funding_key_arr[32];
22392 CHECK(*((uint32_t*)funding_key) == 32);
22393 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22394 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22395 LDKu8slice funding_redeemscript_ref;
22396 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22397 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22398 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22399 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22403 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
22404 LDKCommitmentTransaction this_obj_conv;
22405 this_obj_conv.inner = (void*)(this_obj & (~1));
22406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22407 CommitmentTransaction_free(this_obj_conv);
22410 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
22411 LDKCommitmentTransaction orig_conv;
22412 orig_conv.inner = (void*)(orig & (~1));
22413 orig_conv.is_owned = false;
22414 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22417 uint64_t ret_ref = (uint64_t)ret_var.inner;
22418 if (ret_var.is_owned) {
22424 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
22425 LDKCommitmentTransaction obj_conv;
22426 obj_conv.inner = (void*)(obj & (~1));
22427 obj_conv.is_owned = false;
22428 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22429 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22430 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22431 CVec_u8Z_free(ret_var);
22435 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
22436 LDKu8slice ser_ref;
22437 ser_ref.datalen = *((uint32_t*)ser);
22438 ser_ref.data = (int8_t*)(ser + 4);
22439 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22440 *ret_conv = CommitmentTransaction_read(ser_ref);
22441 return (uint64_t)ret_conv;
22444 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
22445 LDKCommitmentTransaction this_arg_conv;
22446 this_arg_conv.inner = (void*)(this_arg & (~1));
22447 this_arg_conv.is_owned = false;
22448 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22452 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
22453 LDKCommitmentTransaction this_arg_conv;
22454 this_arg_conv.inner = (void*)(this_arg & (~1));
22455 this_arg_conv.is_owned = false;
22456 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22460 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
22461 LDKCommitmentTransaction this_arg_conv;
22462 this_arg_conv.inner = (void*)(this_arg & (~1));
22463 this_arg_conv.is_owned = false;
22464 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22468 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
22469 LDKCommitmentTransaction this_arg_conv;
22470 this_arg_conv.inner = (void*)(this_arg & (~1));
22471 this_arg_conv.is_owned = false;
22472 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22476 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
22477 LDKCommitmentTransaction this_arg_conv;
22478 this_arg_conv.inner = (void*)(this_arg & (~1));
22479 this_arg_conv.is_owned = false;
22480 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22483 uint64_t ret_ref = (uint64_t)ret_var.inner;
22484 if (ret_var.is_owned) {
22490 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22491 LDKCommitmentTransaction this_arg_conv;
22492 this_arg_conv.inner = (void*)(this_arg & (~1));
22493 this_arg_conv.is_owned = false;
22494 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22495 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22496 channel_parameters_conv.is_owned = false;
22497 LDKChannelPublicKeys broadcaster_keys_conv;
22498 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22499 broadcaster_keys_conv.is_owned = false;
22500 LDKChannelPublicKeys countersignatory_keys_conv;
22501 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22502 countersignatory_keys_conv.is_owned = false;
22503 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22504 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22505 return (uint64_t)ret_conv;
22508 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
22509 LDKTrustedCommitmentTransaction this_obj_conv;
22510 this_obj_conv.inner = (void*)(this_obj & (~1));
22511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22512 TrustedCommitmentTransaction_free(this_obj_conv);
22515 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
22516 LDKTrustedCommitmentTransaction this_arg_conv;
22517 this_arg_conv.inner = (void*)(this_arg & (~1));
22518 this_arg_conv.is_owned = false;
22519 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22520 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
22524 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
22525 LDKTrustedCommitmentTransaction this_arg_conv;
22526 this_arg_conv.inner = (void*)(this_arg & (~1));
22527 this_arg_conv.is_owned = false;
22528 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22531 uint64_t ret_ref = (uint64_t)ret_var.inner;
22532 if (ret_var.is_owned) {
22538 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
22539 LDKTrustedCommitmentTransaction this_arg_conv;
22540 this_arg_conv.inner = (void*)(this_arg & (~1));
22541 this_arg_conv.is_owned = false;
22542 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22545 uint64_t ret_ref = (uint64_t)ret_var.inner;
22546 if (ret_var.is_owned) {
22552 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
22553 LDKTrustedCommitmentTransaction this_arg_conv;
22554 this_arg_conv.inner = (void*)(this_arg & (~1));
22555 this_arg_conv.is_owned = false;
22556 unsigned char htlc_base_key_arr[32];
22557 CHECK(*((uint32_t*)htlc_base_key) == 32);
22558 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
22559 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22560 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22561 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22562 channel_parameters_conv.is_owned = false;
22563 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22564 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22565 return (uint64_t)ret_conv;
22568 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) {
22569 LDKPublicKey broadcaster_payment_basepoint_ref;
22570 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
22571 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
22572 LDKPublicKey countersignatory_payment_basepoint_ref;
22573 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
22574 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
22575 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22579 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
22580 LDKInitFeatures a_conv;
22581 a_conv.inner = (void*)(a & (~1));
22582 a_conv.is_owned = false;
22583 LDKInitFeatures b_conv;
22584 b_conv.inner = (void*)(b & (~1));
22585 b_conv.is_owned = false;
22586 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22590 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
22591 LDKNodeFeatures a_conv;
22592 a_conv.inner = (void*)(a & (~1));
22593 a_conv.is_owned = false;
22594 LDKNodeFeatures b_conv;
22595 b_conv.inner = (void*)(b & (~1));
22596 b_conv.is_owned = false;
22597 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22601 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
22602 LDKChannelFeatures a_conv;
22603 a_conv.inner = (void*)(a & (~1));
22604 a_conv.is_owned = false;
22605 LDKChannelFeatures b_conv;
22606 b_conv.inner = (void*)(b & (~1));
22607 b_conv.is_owned = false;
22608 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22612 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
22613 LDKInvoiceFeatures a_conv;
22614 a_conv.inner = (void*)(a & (~1));
22615 a_conv.is_owned = false;
22616 LDKInvoiceFeatures b_conv;
22617 b_conv.inner = (void*)(b & (~1));
22618 b_conv.is_owned = false;
22619 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22623 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
22624 LDKInitFeatures orig_conv;
22625 orig_conv.inner = (void*)(orig & (~1));
22626 orig_conv.is_owned = false;
22627 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22630 uint64_t ret_ref = (uint64_t)ret_var.inner;
22631 if (ret_var.is_owned) {
22637 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
22638 LDKNodeFeatures orig_conv;
22639 orig_conv.inner = (void*)(orig & (~1));
22640 orig_conv.is_owned = false;
22641 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22644 uint64_t ret_ref = (uint64_t)ret_var.inner;
22645 if (ret_var.is_owned) {
22651 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
22652 LDKChannelFeatures orig_conv;
22653 orig_conv.inner = (void*)(orig & (~1));
22654 orig_conv.is_owned = false;
22655 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22658 uint64_t ret_ref = (uint64_t)ret_var.inner;
22659 if (ret_var.is_owned) {
22665 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
22666 LDKInvoiceFeatures orig_conv;
22667 orig_conv.inner = (void*)(orig & (~1));
22668 orig_conv.is_owned = false;
22669 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22672 uint64_t ret_ref = (uint64_t)ret_var.inner;
22673 if (ret_var.is_owned) {
22679 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
22680 LDKInitFeatures this_obj_conv;
22681 this_obj_conv.inner = (void*)(this_obj & (~1));
22682 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22683 InitFeatures_free(this_obj_conv);
22686 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
22687 LDKNodeFeatures this_obj_conv;
22688 this_obj_conv.inner = (void*)(this_obj & (~1));
22689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22690 NodeFeatures_free(this_obj_conv);
22693 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
22694 LDKChannelFeatures this_obj_conv;
22695 this_obj_conv.inner = (void*)(this_obj & (~1));
22696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22697 ChannelFeatures_free(this_obj_conv);
22700 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
22701 LDKInvoiceFeatures this_obj_conv;
22702 this_obj_conv.inner = (void*)(this_obj & (~1));
22703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22704 InvoiceFeatures_free(this_obj_conv);
22707 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
22708 LDKInitFeatures ret_var = InitFeatures_empty();
22709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22711 uint64_t ret_ref = (uint64_t)ret_var.inner;
22712 if (ret_var.is_owned) {
22718 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
22719 LDKInitFeatures ret_var = InitFeatures_known();
22720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22722 uint64_t ret_ref = (uint64_t)ret_var.inner;
22723 if (ret_var.is_owned) {
22729 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
22730 LDKInitFeatures this_arg_conv;
22731 this_arg_conv.inner = (void*)(this_arg & (~1));
22732 this_arg_conv.is_owned = false;
22733 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
22737 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
22738 LDKNodeFeatures ret_var = NodeFeatures_empty();
22739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22741 uint64_t ret_ref = (uint64_t)ret_var.inner;
22742 if (ret_var.is_owned) {
22748 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
22749 LDKNodeFeatures ret_var = NodeFeatures_known();
22750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22752 uint64_t ret_ref = (uint64_t)ret_var.inner;
22753 if (ret_var.is_owned) {
22759 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
22760 LDKNodeFeatures this_arg_conv;
22761 this_arg_conv.inner = (void*)(this_arg & (~1));
22762 this_arg_conv.is_owned = false;
22763 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
22767 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
22768 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22771 uint64_t ret_ref = (uint64_t)ret_var.inner;
22772 if (ret_var.is_owned) {
22778 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
22779 LDKChannelFeatures ret_var = ChannelFeatures_known();
22780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22782 uint64_t ret_ref = (uint64_t)ret_var.inner;
22783 if (ret_var.is_owned) {
22789 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
22790 LDKChannelFeatures this_arg_conv;
22791 this_arg_conv.inner = (void*)(this_arg & (~1));
22792 this_arg_conv.is_owned = false;
22793 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
22797 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
22798 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22801 uint64_t ret_ref = (uint64_t)ret_var.inner;
22802 if (ret_var.is_owned) {
22808 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
22809 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22812 uint64_t ret_ref = (uint64_t)ret_var.inner;
22813 if (ret_var.is_owned) {
22819 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
22820 LDKInvoiceFeatures this_arg_conv;
22821 this_arg_conv.inner = (void*)(this_arg & (~1));
22822 this_arg_conv.is_owned = false;
22823 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
22827 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
22828 LDKInitFeatures this_arg_conv;
22829 this_arg_conv.inner = (void*)(this_arg & (~1));
22830 this_arg_conv.is_owned = false;
22831 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22835 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
22836 LDKNodeFeatures this_arg_conv;
22837 this_arg_conv.inner = (void*)(this_arg & (~1));
22838 this_arg_conv.is_owned = false;
22839 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22843 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
22844 LDKInvoiceFeatures this_arg_conv;
22845 this_arg_conv.inner = (void*)(this_arg & (~1));
22846 this_arg_conv.is_owned = false;
22847 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22851 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
22852 LDKInitFeatures obj_conv;
22853 obj_conv.inner = (void*)(obj & (~1));
22854 obj_conv.is_owned = false;
22855 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22856 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22857 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22858 CVec_u8Z_free(ret_var);
22862 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
22863 LDKNodeFeatures obj_conv;
22864 obj_conv.inner = (void*)(obj & (~1));
22865 obj_conv.is_owned = false;
22866 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22867 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22868 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22869 CVec_u8Z_free(ret_var);
22873 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
22874 LDKChannelFeatures obj_conv;
22875 obj_conv.inner = (void*)(obj & (~1));
22876 obj_conv.is_owned = false;
22877 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22878 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22879 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22880 CVec_u8Z_free(ret_var);
22884 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
22885 LDKInvoiceFeatures obj_conv;
22886 obj_conv.inner = (void*)(obj & (~1));
22887 obj_conv.is_owned = false;
22888 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22889 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22890 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22891 CVec_u8Z_free(ret_var);
22895 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
22896 LDKu8slice ser_ref;
22897 ser_ref.datalen = *((uint32_t*)ser);
22898 ser_ref.data = (int8_t*)(ser + 4);
22899 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22900 *ret_conv = InitFeatures_read(ser_ref);
22901 return (uint64_t)ret_conv;
22904 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
22905 LDKu8slice ser_ref;
22906 ser_ref.datalen = *((uint32_t*)ser);
22907 ser_ref.data = (int8_t*)(ser + 4);
22908 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22909 *ret_conv = NodeFeatures_read(ser_ref);
22910 return (uint64_t)ret_conv;
22913 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
22914 LDKu8slice ser_ref;
22915 ser_ref.datalen = *((uint32_t*)ser);
22916 ser_ref.data = (int8_t*)(ser + 4);
22917 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22918 *ret_conv = ChannelFeatures_read(ser_ref);
22919 return (uint64_t)ret_conv;
22922 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
22923 LDKu8slice ser_ref;
22924 ser_ref.datalen = *((uint32_t*)ser);
22925 ser_ref.data = (int8_t*)(ser + 4);
22926 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22927 *ret_conv = InvoiceFeatures_read(ser_ref);
22928 return (uint64_t)ret_conv;
22931 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
22932 LDKShutdownScript this_obj_conv;
22933 this_obj_conv.inner = (void*)(this_obj & (~1));
22934 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22935 ShutdownScript_free(this_obj_conv);
22938 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
22939 LDKShutdownScript orig_conv;
22940 orig_conv.inner = (void*)(orig & (~1));
22941 orig_conv.is_owned = false;
22942 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
22943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22945 uint64_t ret_ref = (uint64_t)ret_var.inner;
22946 if (ret_var.is_owned) {
22952 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
22953 LDKInvalidShutdownScript this_obj_conv;
22954 this_obj_conv.inner = (void*)(this_obj & (~1));
22955 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22956 InvalidShutdownScript_free(this_obj_conv);
22959 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
22960 LDKInvalidShutdownScript this_ptr_conv;
22961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22962 this_ptr_conv.is_owned = false;
22963 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
22964 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22965 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22969 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
22970 LDKInvalidShutdownScript this_ptr_conv;
22971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22972 this_ptr_conv.is_owned = false;
22973 LDKCVec_u8Z val_ref;
22974 val_ref.datalen = *((uint32_t*)val);
22975 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22976 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22977 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
22980 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
22981 LDKCVec_u8Z script_arg_ref;
22982 script_arg_ref.datalen = *((uint32_t*)script_arg);
22983 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22984 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
22985 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
22986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22988 uint64_t ret_ref = (uint64_t)ret_var.inner;
22989 if (ret_var.is_owned) {
22995 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
22996 LDKShutdownScript obj_conv;
22997 obj_conv.inner = (void*)(obj & (~1));
22998 obj_conv.is_owned = false;
22999 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
23000 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23001 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23002 CVec_u8Z_free(ret_var);
23006 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
23007 LDKu8slice ser_ref;
23008 ser_ref.datalen = *((uint32_t*)ser);
23009 ser_ref.data = (int8_t*)(ser + 4);
23010 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
23011 *ret_conv = ShutdownScript_read(ser_ref);
23012 return (uint64_t)ret_conv;
23015 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
23016 unsigned char pubkey_hash_arr[20];
23017 CHECK(*((uint32_t*)pubkey_hash) == 20);
23018 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23019 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23020 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
23021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23023 uint64_t ret_ref = (uint64_t)ret_var.inner;
23024 if (ret_var.is_owned) {
23030 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
23031 unsigned char script_hash_arr[20];
23032 CHECK(*((uint32_t*)script_hash) == 20);
23033 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
23034 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
23035 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
23036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23038 uint64_t ret_ref = (uint64_t)ret_var.inner;
23039 if (ret_var.is_owned) {
23045 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
23046 unsigned char pubkey_hash_arr[20];
23047 CHECK(*((uint32_t*)pubkey_hash) == 20);
23048 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23049 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23050 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
23051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23053 uint64_t ret_ref = (uint64_t)ret_var.inner;
23054 if (ret_var.is_owned) {
23060 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
23061 unsigned char script_hash_arr[32];
23062 CHECK(*((uint32_t*)script_hash) == 32);
23063 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
23064 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
23065 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
23066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23068 uint64_t ret_ref = (uint64_t)ret_var.inner;
23069 if (ret_var.is_owned) {
23075 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
23076 LDKu8slice program_ref;
23077 program_ref.datalen = *((uint32_t*)program);
23078 program_ref.data = (int8_t*)(program + 4);
23079 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
23080 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
23081 return (uint64_t)ret_conv;
23084 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
23085 LDKShutdownScript this_arg_conv;
23086 this_arg_conv.inner = (void*)(this_arg & (~1));
23087 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23088 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
23089 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
23090 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23091 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23092 CVec_u8Z_free(ret_var);
23096 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
23097 LDKShutdownScript this_arg_conv;
23098 this_arg_conv.inner = (void*)(this_arg & (~1));
23099 this_arg_conv.is_owned = false;
23100 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23101 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
23105 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
23106 LDKShutdownScript this_arg_conv;
23107 this_arg_conv.inner = (void*)(this_arg & (~1));
23108 this_arg_conv.is_owned = false;
23109 LDKInitFeatures features_conv;
23110 features_conv.inner = (void*)(features & (~1));
23111 features_conv.is_owned = false;
23112 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
23116 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
23117 if ((this_ptr & 1) != 0) return;
23118 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
23119 FREE((void*)this_ptr);
23120 CustomMessageReader_free(this_ptr_conv);
23123 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
23124 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
23125 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
23126 *ret_ret = Type_clone(orig_conv);
23127 return (uint64_t)ret_ret;
23130 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
23131 if ((this_ptr & 1) != 0) return;
23132 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
23133 FREE((void*)this_ptr);
23134 Type_free(this_ptr_conv);
23137 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
23138 LDKRouteHop this_obj_conv;
23139 this_obj_conv.inner = (void*)(this_obj & (~1));
23140 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23141 RouteHop_free(this_obj_conv);
23144 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
23145 LDKRouteHop this_ptr_conv;
23146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23147 this_ptr_conv.is_owned = false;
23148 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23149 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
23153 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
23154 LDKRouteHop this_ptr_conv;
23155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23156 this_ptr_conv.is_owned = false;
23157 LDKPublicKey val_ref;
23158 CHECK(*((uint32_t*)val) == 33);
23159 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23160 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
23163 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
23164 LDKRouteHop this_ptr_conv;
23165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23166 this_ptr_conv.is_owned = false;
23167 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
23168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23170 uint64_t ret_ref = (uint64_t)ret_var.inner;
23171 if (ret_var.is_owned) {
23177 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
23178 LDKRouteHop this_ptr_conv;
23179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23180 this_ptr_conv.is_owned = false;
23181 LDKNodeFeatures val_conv;
23182 val_conv.inner = (void*)(val & (~1));
23183 val_conv.is_owned = (val & 1) || (val == 0);
23184 val_conv = NodeFeatures_clone(&val_conv);
23185 RouteHop_set_node_features(&this_ptr_conv, val_conv);
23188 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
23189 LDKRouteHop this_ptr_conv;
23190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23191 this_ptr_conv.is_owned = false;
23192 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23196 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23197 LDKRouteHop this_ptr_conv;
23198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23199 this_ptr_conv.is_owned = false;
23200 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23203 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
23204 LDKRouteHop this_ptr_conv;
23205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23206 this_ptr_conv.is_owned = false;
23207 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23210 uint64_t ret_ref = (uint64_t)ret_var.inner;
23211 if (ret_var.is_owned) {
23217 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
23218 LDKRouteHop this_ptr_conv;
23219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23220 this_ptr_conv.is_owned = false;
23221 LDKChannelFeatures val_conv;
23222 val_conv.inner = (void*)(val & (~1));
23223 val_conv.is_owned = (val & 1) || (val == 0);
23224 val_conv = ChannelFeatures_clone(&val_conv);
23225 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23228 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
23229 LDKRouteHop this_ptr_conv;
23230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23231 this_ptr_conv.is_owned = false;
23232 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23236 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
23237 LDKRouteHop this_ptr_conv;
23238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23239 this_ptr_conv.is_owned = false;
23240 RouteHop_set_fee_msat(&this_ptr_conv, val);
23243 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23244 LDKRouteHop this_ptr_conv;
23245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23246 this_ptr_conv.is_owned = false;
23247 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23251 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
23252 LDKRouteHop this_ptr_conv;
23253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23254 this_ptr_conv.is_owned = false;
23255 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23258 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) {
23259 LDKPublicKey pubkey_arg_ref;
23260 CHECK(*((uint32_t*)pubkey_arg) == 33);
23261 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
23262 LDKNodeFeatures node_features_arg_conv;
23263 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23264 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23265 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23266 LDKChannelFeatures channel_features_arg_conv;
23267 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23268 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23269 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23270 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);
23271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23273 uint64_t ret_ref = (uint64_t)ret_var.inner;
23274 if (ret_var.is_owned) {
23280 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
23281 LDKRouteHop orig_conv;
23282 orig_conv.inner = (void*)(orig & (~1));
23283 orig_conv.is_owned = false;
23284 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23287 uint64_t ret_ref = (uint64_t)ret_var.inner;
23288 if (ret_var.is_owned) {
23294 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
23295 LDKRouteHop o_conv;
23296 o_conv.inner = (void*)(o & (~1));
23297 o_conv.is_owned = false;
23298 int64_t ret_val = RouteHop_hash(&o_conv);
23302 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
23303 LDKRouteHop a_conv;
23304 a_conv.inner = (void*)(a & (~1));
23305 a_conv.is_owned = false;
23306 LDKRouteHop b_conv;
23307 b_conv.inner = (void*)(b & (~1));
23308 b_conv.is_owned = false;
23309 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
23313 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
23314 LDKRouteHop obj_conv;
23315 obj_conv.inner = (void*)(obj & (~1));
23316 obj_conv.is_owned = false;
23317 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23318 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23319 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23320 CVec_u8Z_free(ret_var);
23324 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
23325 LDKu8slice ser_ref;
23326 ser_ref.datalen = *((uint32_t*)ser);
23327 ser_ref.data = (int8_t*)(ser + 4);
23328 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23329 *ret_conv = RouteHop_read(ser_ref);
23330 return (uint64_t)ret_conv;
23333 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
23334 LDKRoute this_obj_conv;
23335 this_obj_conv.inner = (void*)(this_obj & (~1));
23336 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23337 Route_free(this_obj_conv);
23340 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
23341 LDKRoute this_ptr_conv;
23342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23343 this_ptr_conv.is_owned = false;
23344 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
23345 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
23346 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
23347 for (size_t m = 0; m < ret_var.datalen; m++) {
23348 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
23349 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23350 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
23351 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
23352 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
23353 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23354 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23355 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
23356 if (ret_conv_12_conv_10_var.is_owned) {
23357 ret_conv_12_conv_10_ref |= 1;
23359 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
23361 FREE(ret_conv_12_var.data);
23362 ret_arr_ptr[m] = ret_conv_12_arr;
23364 FREE(ret_var.data);
23368 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
23369 LDKRoute this_ptr_conv;
23370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23371 this_ptr_conv.is_owned = false;
23372 LDKCVec_CVec_RouteHopZZ val_constr;
23373 val_constr.datalen = *((uint32_t*)val);
23374 if (val_constr.datalen > 0)
23375 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23377 val_constr.data = NULL;
23378 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
23379 for (size_t m = 0; m < val_constr.datalen; m++) {
23380 uint32_tArray val_conv_12 = val_vals[m];
23381 LDKCVec_RouteHopZ val_conv_12_constr;
23382 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
23383 if (val_conv_12_constr.datalen > 0)
23384 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23386 val_conv_12_constr.data = NULL;
23387 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
23388 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23389 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
23390 LDKRouteHop val_conv_12_conv_10_conv;
23391 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23392 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23393 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23394 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23396 val_constr.data[m] = val_conv_12_constr;
23398 Route_set_paths(&this_ptr_conv, val_constr);
23401 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
23402 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23403 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
23404 if (paths_arg_constr.datalen > 0)
23405 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23407 paths_arg_constr.data = NULL;
23408 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
23409 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23410 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
23411 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23412 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
23413 if (paths_arg_conv_12_constr.datalen > 0)
23414 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23416 paths_arg_conv_12_constr.data = NULL;
23417 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
23418 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23419 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23420 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23421 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23422 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23423 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23424 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23426 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23428 LDKRoute ret_var = Route_new(paths_arg_constr);
23429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23431 uint64_t ret_ref = (uint64_t)ret_var.inner;
23432 if (ret_var.is_owned) {
23438 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
23439 LDKRoute orig_conv;
23440 orig_conv.inner = (void*)(orig & (~1));
23441 orig_conv.is_owned = false;
23442 LDKRoute ret_var = Route_clone(&orig_conv);
23443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23445 uint64_t ret_ref = (uint64_t)ret_var.inner;
23446 if (ret_var.is_owned) {
23452 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
23454 o_conv.inner = (void*)(o & (~1));
23455 o_conv.is_owned = false;
23456 int64_t ret_val = Route_hash(&o_conv);
23460 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
23462 a_conv.inner = (void*)(a & (~1));
23463 a_conv.is_owned = false;
23465 b_conv.inner = (void*)(b & (~1));
23466 b_conv.is_owned = false;
23467 jboolean ret_val = Route_eq(&a_conv, &b_conv);
23471 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
23472 LDKRoute this_arg_conv;
23473 this_arg_conv.inner = (void*)(this_arg & (~1));
23474 this_arg_conv.is_owned = false;
23475 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
23479 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
23480 LDKRoute this_arg_conv;
23481 this_arg_conv.inner = (void*)(this_arg & (~1));
23482 this_arg_conv.is_owned = false;
23483 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
23487 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
23489 obj_conv.inner = (void*)(obj & (~1));
23490 obj_conv.is_owned = false;
23491 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23492 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23493 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23494 CVec_u8Z_free(ret_var);
23498 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
23499 LDKu8slice ser_ref;
23500 ser_ref.datalen = *((uint32_t*)ser);
23501 ser_ref.data = (int8_t*)(ser + 4);
23502 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23503 *ret_conv = Route_read(ser_ref);
23504 return (uint64_t)ret_conv;
23507 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
23508 LDKRouteHint this_obj_conv;
23509 this_obj_conv.inner = (void*)(this_obj & (~1));
23510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23511 RouteHint_free(this_obj_conv);
23514 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
23515 LDKRouteHint orig_conv;
23516 orig_conv.inner = (void*)(orig & (~1));
23517 orig_conv.is_owned = false;
23518 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23521 uint64_t ret_ref = (uint64_t)ret_var.inner;
23522 if (ret_var.is_owned) {
23528 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
23529 LDKRouteHint o_conv;
23530 o_conv.inner = (void*)(o & (~1));
23531 o_conv.is_owned = false;
23532 int64_t ret_val = RouteHint_hash(&o_conv);
23536 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
23537 LDKRouteHint a_conv;
23538 a_conv.inner = (void*)(a & (~1));
23539 a_conv.is_owned = false;
23540 LDKRouteHint b_conv;
23541 b_conv.inner = (void*)(b & (~1));
23542 b_conv.is_owned = false;
23543 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23547 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
23548 LDKRouteHintHop this_obj_conv;
23549 this_obj_conv.inner = (void*)(this_obj & (~1));
23550 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23551 RouteHintHop_free(this_obj_conv);
23554 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
23555 LDKRouteHintHop this_ptr_conv;
23556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23557 this_ptr_conv.is_owned = false;
23558 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23559 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
23563 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
23564 LDKRouteHintHop this_ptr_conv;
23565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23566 this_ptr_conv.is_owned = false;
23567 LDKPublicKey val_ref;
23568 CHECK(*((uint32_t*)val) == 33);
23569 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23570 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23573 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
23574 LDKRouteHintHop this_ptr_conv;
23575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23576 this_ptr_conv.is_owned = false;
23577 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23581 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23582 LDKRouteHintHop this_ptr_conv;
23583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23584 this_ptr_conv.is_owned = false;
23585 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23588 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
23589 LDKRouteHintHop this_ptr_conv;
23590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23591 this_ptr_conv.is_owned = false;
23592 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23595 uint64_t ret_ref = (uint64_t)ret_var.inner;
23596 if (ret_var.is_owned) {
23602 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
23603 LDKRouteHintHop this_ptr_conv;
23604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23605 this_ptr_conv.is_owned = false;
23606 LDKRoutingFees val_conv;
23607 val_conv.inner = (void*)(val & (~1));
23608 val_conv.is_owned = (val & 1) || (val == 0);
23609 val_conv = RoutingFees_clone(&val_conv);
23610 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23613 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23614 LDKRouteHintHop this_ptr_conv;
23615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23616 this_ptr_conv.is_owned = false;
23617 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23621 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
23622 LDKRouteHintHop this_ptr_conv;
23623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23624 this_ptr_conv.is_owned = false;
23625 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23628 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
23629 LDKRouteHintHop this_ptr_conv;
23630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23631 this_ptr_conv.is_owned = false;
23632 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23633 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23634 uint64_t ret_ref = (uint64_t)ret_copy;
23638 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
23639 LDKRouteHintHop this_ptr_conv;
23640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23641 this_ptr_conv.is_owned = false;
23642 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23643 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23644 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23647 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
23648 LDKRouteHintHop this_ptr_conv;
23649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23650 this_ptr_conv.is_owned = false;
23651 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23652 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23653 uint64_t ret_ref = (uint64_t)ret_copy;
23657 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
23658 LDKRouteHintHop this_ptr_conv;
23659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23660 this_ptr_conv.is_owned = false;
23661 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23662 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23663 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23666 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) {
23667 LDKPublicKey src_node_id_arg_ref;
23668 CHECK(*((uint32_t*)src_node_id_arg) == 33);
23669 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
23670 LDKRoutingFees fees_arg_conv;
23671 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23672 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23673 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23674 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23675 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
23676 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23677 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
23678 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);
23679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23681 uint64_t ret_ref = (uint64_t)ret_var.inner;
23682 if (ret_var.is_owned) {
23688 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
23689 LDKRouteHintHop orig_conv;
23690 orig_conv.inner = (void*)(orig & (~1));
23691 orig_conv.is_owned = false;
23692 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23695 uint64_t ret_ref = (uint64_t)ret_var.inner;
23696 if (ret_var.is_owned) {
23702 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
23703 LDKRouteHintHop o_conv;
23704 o_conv.inner = (void*)(o & (~1));
23705 o_conv.is_owned = false;
23706 int64_t ret_val = RouteHintHop_hash(&o_conv);
23710 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
23711 LDKRouteHintHop a_conv;
23712 a_conv.inner = (void*)(a & (~1));
23713 a_conv.is_owned = false;
23714 LDKRouteHintHop b_conv;
23715 b_conv.inner = (void*)(b & (~1));
23716 b_conv.is_owned = false;
23717 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23721 uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
23722 LDKPublicKey our_node_id_ref;
23723 CHECK(*((uint32_t*)our_node_id) == 33);
23724 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23725 LDKNetworkGraph network_conv;
23726 network_conv.inner = (void*)(network & (~1));
23727 network_conv.is_owned = false;
23728 LDKPublicKey payee_ref;
23729 CHECK(*((uint32_t*)payee) == 33);
23730 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23731 LDKCVec_ChannelDetailsZ first_hops_constr;
23732 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23733 if (first_hops != 0) {
23734 first_hops_constr.datalen = *((uint32_t*)first_hops);
23735 if (first_hops_constr.datalen > 0)
23736 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23738 first_hops_constr.data = NULL;
23739 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23740 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23741 uint32_t first_hops_conv_16 = first_hops_vals[q];
23742 LDKChannelDetails first_hops_conv_16_conv;
23743 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23744 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23745 first_hops_constr.data[q] = first_hops_conv_16_conv;
23747 first_hops_ptr = &first_hops_constr;
23749 LDKCVec_RouteHintZ last_hops_constr;
23750 last_hops_constr.datalen = *((uint32_t*)last_hops);
23751 if (last_hops_constr.datalen > 0)
23752 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23754 last_hops_constr.data = NULL;
23755 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23756 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23757 uint32_t last_hops_conv_11 = last_hops_vals[l];
23758 LDKRouteHint last_hops_conv_11_conv;
23759 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23760 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23761 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23762 last_hops_constr.data[l] = last_hops_conv_11_conv;
23764 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23765 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23766 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23767 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
23768 return (uint64_t)ret_conv;
23771 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) {
23772 LDKPublicKey our_node_id_ref;
23773 CHECK(*((uint32_t*)our_node_id) == 33);
23774 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23775 LDKNetworkGraph network_conv;
23776 network_conv.inner = (void*)(network & (~1));
23777 network_conv.is_owned = false;
23778 LDKPublicKey payee_ref;
23779 CHECK(*((uint32_t*)payee) == 33);
23780 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23781 LDKInvoiceFeatures payee_features_conv;
23782 payee_features_conv.inner = (void*)(payee_features & (~1));
23783 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23784 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23785 LDKCVec_ChannelDetailsZ first_hops_constr;
23786 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23787 if (first_hops != 0) {
23788 first_hops_constr.datalen = *((uint32_t*)first_hops);
23789 if (first_hops_constr.datalen > 0)
23790 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23792 first_hops_constr.data = NULL;
23793 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23794 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23795 uint32_t first_hops_conv_16 = first_hops_vals[q];
23796 LDKChannelDetails first_hops_conv_16_conv;
23797 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23798 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23799 first_hops_constr.data[q] = first_hops_conv_16_conv;
23801 first_hops_ptr = &first_hops_constr;
23803 LDKCVec_RouteHintZ last_hops_constr;
23804 last_hops_constr.datalen = *((uint32_t*)last_hops);
23805 if (last_hops_constr.datalen > 0)
23806 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23808 last_hops_constr.data = NULL;
23809 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23810 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23811 uint32_t last_hops_conv_11 = last_hops_vals[l];
23812 LDKRouteHint last_hops_conv_11_conv;
23813 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23814 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23815 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23816 last_hops_constr.data[l] = last_hops_conv_11_conv;
23818 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23819 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23820 *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);
23821 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
23822 return (uint64_t)ret_conv;
23825 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
23826 LDKNetworkGraph this_obj_conv;
23827 this_obj_conv.inner = (void*)(this_obj & (~1));
23828 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23829 NetworkGraph_free(this_obj_conv);
23832 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
23833 LDKReadOnlyNetworkGraph this_obj_conv;
23834 this_obj_conv.inner = (void*)(this_obj & (~1));
23835 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23836 ReadOnlyNetworkGraph_free(this_obj_conv);
23839 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
23840 if ((this_ptr & 1) != 0) return;
23841 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
23842 FREE((void*)this_ptr);
23843 NetworkUpdate_free(this_ptr_conv);
23846 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
23847 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
23848 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23849 *ret_copy = NetworkUpdate_clone(orig_conv);
23850 uint64_t ret_ref = (uint64_t)ret_copy;
23854 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
23855 LDKChannelUpdate msg_conv;
23856 msg_conv.inner = (void*)(msg & (~1));
23857 msg_conv.is_owned = (msg & 1) || (msg == 0);
23858 msg_conv = ChannelUpdate_clone(&msg_conv);
23859 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23860 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
23861 uint64_t ret_ref = (uint64_t)ret_copy;
23865 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
23866 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23867 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
23868 uint64_t ret_ref = (uint64_t)ret_copy;
23872 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
23873 LDKPublicKey node_id_ref;
23874 CHECK(*((uint32_t*)node_id) == 33);
23875 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
23876 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23877 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
23878 uint64_t ret_ref = (uint64_t)ret_copy;
23882 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
23883 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
23884 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
23885 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23886 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23887 CVec_u8Z_free(ret_var);
23891 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
23892 LDKNetGraphMsgHandler this_arg_conv;
23893 this_arg_conv.inner = (void*)(this_arg & (~1));
23894 this_arg_conv.is_owned = false;
23895 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
23896 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
23897 return (uint64_t)ret_ret;
23900 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
23901 LDKNetGraphMsgHandler this_obj_conv;
23902 this_obj_conv.inner = (void*)(this_obj & (~1));
23903 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23904 NetGraphMsgHandler_free(this_obj_conv);
23907 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
23908 LDKNetGraphMsgHandler this_ptr_conv;
23909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23910 this_ptr_conv.is_owned = false;
23911 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
23912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23914 uint64_t ret_ref = (uint64_t)ret_var.inner;
23915 if (ret_var.is_owned) {
23921 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
23922 LDKNetGraphMsgHandler this_ptr_conv;
23923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23924 this_ptr_conv.is_owned = false;
23925 LDKNetworkGraph val_conv;
23926 val_conv.inner = (void*)(val & (~1));
23927 val_conv.is_owned = (val & 1) || (val == 0);
23928 // Warning: we need a move here but no clone is available for LDKNetworkGraph
23929 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
23932 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
23933 LDKNetworkGraph network_graph_conv;
23934 network_graph_conv.inner = (void*)(network_graph & (~1));
23935 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23936 // Warning: we need a move here but no clone is available for LDKNetworkGraph
23937 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
23938 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
23939 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
23940 // Manually implement clone for Java trait instances
23942 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23943 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
23944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23946 uint64_t ret_ref = (uint64_t)ret_var.inner;
23947 if (ret_var.is_owned) {
23953 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
23954 LDKNetGraphMsgHandler this_arg_conv;
23955 this_arg_conv.inner = (void*)(this_arg & (~1));
23956 this_arg_conv.is_owned = false;
23957 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
23958 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
23959 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
23960 // Manually implement clone for Java trait instances
23962 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
23965 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
23966 LDKNetGraphMsgHandler this_arg_conv;
23967 this_arg_conv.inner = (void*)(this_arg & (~1));
23968 this_arg_conv.is_owned = false;
23969 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23970 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23971 return (uint64_t)ret_ret;
23974 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
23975 LDKNetGraphMsgHandler this_arg_conv;
23976 this_arg_conv.inner = (void*)(this_arg & (~1));
23977 this_arg_conv.is_owned = false;
23978 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23979 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23980 return (uint64_t)ret_ret;
23983 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
23984 LDKDirectionalChannelInfo this_obj_conv;
23985 this_obj_conv.inner = (void*)(this_obj & (~1));
23986 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23987 DirectionalChannelInfo_free(this_obj_conv);
23990 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
23991 LDKDirectionalChannelInfo this_ptr_conv;
23992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23993 this_ptr_conv.is_owned = false;
23994 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23998 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
23999 LDKDirectionalChannelInfo this_ptr_conv;
24000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24001 this_ptr_conv.is_owned = false;
24002 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24005 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24006 LDKDirectionalChannelInfo this_ptr_conv;
24007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24008 this_ptr_conv.is_owned = false;
24009 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24013 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24014 LDKDirectionalChannelInfo this_ptr_conv;
24015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24016 this_ptr_conv.is_owned = false;
24017 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24020 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24021 LDKDirectionalChannelInfo this_ptr_conv;
24022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24023 this_ptr_conv.is_owned = false;
24024 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24028 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24029 LDKDirectionalChannelInfo this_ptr_conv;
24030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24031 this_ptr_conv.is_owned = false;
24032 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24035 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24036 LDKDirectionalChannelInfo this_ptr_conv;
24037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24038 this_ptr_conv.is_owned = false;
24039 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24043 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24044 LDKDirectionalChannelInfo this_ptr_conv;
24045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24046 this_ptr_conv.is_owned = false;
24047 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24050 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24051 LDKDirectionalChannelInfo this_ptr_conv;
24052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24053 this_ptr_conv.is_owned = false;
24054 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24055 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24056 uint64_t ret_ref = (uint64_t)ret_copy;
24060 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24061 LDKDirectionalChannelInfo this_ptr_conv;
24062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24063 this_ptr_conv.is_owned = false;
24064 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24065 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24066 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24069 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24070 LDKDirectionalChannelInfo this_ptr_conv;
24071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24072 this_ptr_conv.is_owned = false;
24073 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24076 uint64_t ret_ref = (uint64_t)ret_var.inner;
24077 if (ret_var.is_owned) {
24083 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24084 LDKDirectionalChannelInfo this_ptr_conv;
24085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24086 this_ptr_conv.is_owned = false;
24087 LDKRoutingFees val_conv;
24088 val_conv.inner = (void*)(val & (~1));
24089 val_conv.is_owned = (val & 1) || (val == 0);
24090 val_conv = RoutingFees_clone(&val_conv);
24091 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24094 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24095 LDKDirectionalChannelInfo this_ptr_conv;
24096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24097 this_ptr_conv.is_owned = false;
24098 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24101 uint64_t ret_ref = (uint64_t)ret_var.inner;
24102 if (ret_var.is_owned) {
24108 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
24109 LDKDirectionalChannelInfo this_ptr_conv;
24110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24111 this_ptr_conv.is_owned = false;
24112 LDKChannelUpdate val_conv;
24113 val_conv.inner = (void*)(val & (~1));
24114 val_conv.is_owned = (val & 1) || (val == 0);
24115 val_conv = ChannelUpdate_clone(&val_conv);
24116 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
24119 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) {
24120 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
24121 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
24122 LDKRoutingFees fees_arg_conv;
24123 fees_arg_conv.inner = (void*)(fees_arg & (~1));
24124 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
24125 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
24126 LDKChannelUpdate last_update_message_arg_conv;
24127 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
24128 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
24129 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
24130 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);
24131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24133 uint64_t ret_ref = (uint64_t)ret_var.inner;
24134 if (ret_var.is_owned) {
24140 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
24141 LDKDirectionalChannelInfo orig_conv;
24142 orig_conv.inner = (void*)(orig & (~1));
24143 orig_conv.is_owned = false;
24144 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
24145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24147 uint64_t ret_ref = (uint64_t)ret_var.inner;
24148 if (ret_var.is_owned) {
24154 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
24155 LDKDirectionalChannelInfo obj_conv;
24156 obj_conv.inner = (void*)(obj & (~1));
24157 obj_conv.is_owned = false;
24158 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
24159 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24160 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24161 CVec_u8Z_free(ret_var);
24165 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
24166 LDKu8slice ser_ref;
24167 ser_ref.datalen = *((uint32_t*)ser);
24168 ser_ref.data = (int8_t*)(ser + 4);
24169 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
24170 *ret_conv = DirectionalChannelInfo_read(ser_ref);
24171 return (uint64_t)ret_conv;
24174 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
24175 LDKChannelInfo this_obj_conv;
24176 this_obj_conv.inner = (void*)(this_obj & (~1));
24177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24178 ChannelInfo_free(this_obj_conv);
24181 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
24182 LDKChannelInfo this_ptr_conv;
24183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24184 this_ptr_conv.is_owned = false;
24185 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
24186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24188 uint64_t ret_ref = (uint64_t)ret_var.inner;
24189 if (ret_var.is_owned) {
24195 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
24196 LDKChannelInfo this_ptr_conv;
24197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24198 this_ptr_conv.is_owned = false;
24199 LDKChannelFeatures val_conv;
24200 val_conv.inner = (void*)(val & (~1));
24201 val_conv.is_owned = (val & 1) || (val == 0);
24202 val_conv = ChannelFeatures_clone(&val_conv);
24203 ChannelInfo_set_features(&this_ptr_conv, val_conv);
24206 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
24207 LDKChannelInfo this_ptr_conv;
24208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24209 this_ptr_conv.is_owned = false;
24210 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24211 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
24215 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
24216 LDKChannelInfo this_ptr_conv;
24217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24218 this_ptr_conv.is_owned = false;
24219 LDKPublicKey val_ref;
24220 CHECK(*((uint32_t*)val) == 33);
24221 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24222 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
24225 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
24226 LDKChannelInfo this_ptr_conv;
24227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24228 this_ptr_conv.is_owned = false;
24229 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
24230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24232 uint64_t ret_ref = (uint64_t)ret_var.inner;
24233 if (ret_var.is_owned) {
24239 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
24240 LDKChannelInfo this_ptr_conv;
24241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24242 this_ptr_conv.is_owned = false;
24243 LDKDirectionalChannelInfo val_conv;
24244 val_conv.inner = (void*)(val & (~1));
24245 val_conv.is_owned = (val & 1) || (val == 0);
24246 val_conv = DirectionalChannelInfo_clone(&val_conv);
24247 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
24250 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
24251 LDKChannelInfo this_ptr_conv;
24252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24253 this_ptr_conv.is_owned = false;
24254 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24255 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
24259 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
24260 LDKChannelInfo this_ptr_conv;
24261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24262 this_ptr_conv.is_owned = false;
24263 LDKPublicKey val_ref;
24264 CHECK(*((uint32_t*)val) == 33);
24265 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24266 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
24269 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
24270 LDKChannelInfo this_ptr_conv;
24271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24272 this_ptr_conv.is_owned = false;
24273 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
24274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24276 uint64_t ret_ref = (uint64_t)ret_var.inner;
24277 if (ret_var.is_owned) {
24283 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
24284 LDKChannelInfo this_ptr_conv;
24285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24286 this_ptr_conv.is_owned = false;
24287 LDKDirectionalChannelInfo val_conv;
24288 val_conv.inner = (void*)(val & (~1));
24289 val_conv.is_owned = (val & 1) || (val == 0);
24290 val_conv = DirectionalChannelInfo_clone(&val_conv);
24291 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
24294 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
24295 LDKChannelInfo this_ptr_conv;
24296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24297 this_ptr_conv.is_owned = false;
24298 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24299 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
24300 uint64_t ret_ref = (uint64_t)ret_copy;
24304 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
24305 LDKChannelInfo this_ptr_conv;
24306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24307 this_ptr_conv.is_owned = false;
24308 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24309 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24310 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
24313 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
24314 LDKChannelInfo this_ptr_conv;
24315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24316 this_ptr_conv.is_owned = false;
24317 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
24318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24320 uint64_t ret_ref = (uint64_t)ret_var.inner;
24321 if (ret_var.is_owned) {
24327 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24328 LDKChannelInfo this_ptr_conv;
24329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24330 this_ptr_conv.is_owned = false;
24331 LDKChannelAnnouncement val_conv;
24332 val_conv.inner = (void*)(val & (~1));
24333 val_conv.is_owned = (val & 1) || (val == 0);
24334 val_conv = ChannelAnnouncement_clone(&val_conv);
24335 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24338 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) {
24339 LDKChannelFeatures features_arg_conv;
24340 features_arg_conv.inner = (void*)(features_arg & (~1));
24341 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24342 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24343 LDKPublicKey node_one_arg_ref;
24344 CHECK(*((uint32_t*)node_one_arg) == 33);
24345 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
24346 LDKDirectionalChannelInfo one_to_two_arg_conv;
24347 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24348 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24349 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24350 LDKPublicKey node_two_arg_ref;
24351 CHECK(*((uint32_t*)node_two_arg) == 33);
24352 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
24353 LDKDirectionalChannelInfo two_to_one_arg_conv;
24354 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24355 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24356 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24357 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24358 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
24359 LDKChannelAnnouncement announcement_message_arg_conv;
24360 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24361 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24362 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24363 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);
24364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24366 uint64_t ret_ref = (uint64_t)ret_var.inner;
24367 if (ret_var.is_owned) {
24373 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
24374 LDKChannelInfo orig_conv;
24375 orig_conv.inner = (void*)(orig & (~1));
24376 orig_conv.is_owned = false;
24377 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24380 uint64_t ret_ref = (uint64_t)ret_var.inner;
24381 if (ret_var.is_owned) {
24387 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
24388 LDKChannelInfo obj_conv;
24389 obj_conv.inner = (void*)(obj & (~1));
24390 obj_conv.is_owned = false;
24391 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24392 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24393 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24394 CVec_u8Z_free(ret_var);
24398 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
24399 LDKu8slice ser_ref;
24400 ser_ref.datalen = *((uint32_t*)ser);
24401 ser_ref.data = (int8_t*)(ser + 4);
24402 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24403 *ret_conv = ChannelInfo_read(ser_ref);
24404 return (uint64_t)ret_conv;
24407 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
24408 LDKRoutingFees this_obj_conv;
24409 this_obj_conv.inner = (void*)(this_obj & (~1));
24410 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24411 RoutingFees_free(this_obj_conv);
24414 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
24415 LDKRoutingFees this_ptr_conv;
24416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24417 this_ptr_conv.is_owned = false;
24418 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24422 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
24423 LDKRoutingFees this_ptr_conv;
24424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24425 this_ptr_conv.is_owned = false;
24426 RoutingFees_set_base_msat(&this_ptr_conv, val);
24429 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
24430 LDKRoutingFees this_ptr_conv;
24431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24432 this_ptr_conv.is_owned = false;
24433 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24437 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
24438 LDKRoutingFees this_ptr_conv;
24439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24440 this_ptr_conv.is_owned = false;
24441 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24444 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
24445 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24448 uint64_t ret_ref = (uint64_t)ret_var.inner;
24449 if (ret_var.is_owned) {
24455 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
24456 LDKRoutingFees a_conv;
24457 a_conv.inner = (void*)(a & (~1));
24458 a_conv.is_owned = false;
24459 LDKRoutingFees b_conv;
24460 b_conv.inner = (void*)(b & (~1));
24461 b_conv.is_owned = false;
24462 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24466 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
24467 LDKRoutingFees orig_conv;
24468 orig_conv.inner = (void*)(orig & (~1));
24469 orig_conv.is_owned = false;
24470 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24473 uint64_t ret_ref = (uint64_t)ret_var.inner;
24474 if (ret_var.is_owned) {
24480 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
24481 LDKRoutingFees o_conv;
24482 o_conv.inner = (void*)(o & (~1));
24483 o_conv.is_owned = false;
24484 int64_t ret_val = RoutingFees_hash(&o_conv);
24488 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
24489 LDKRoutingFees obj_conv;
24490 obj_conv.inner = (void*)(obj & (~1));
24491 obj_conv.is_owned = false;
24492 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24493 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24494 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24495 CVec_u8Z_free(ret_var);
24499 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
24500 LDKu8slice ser_ref;
24501 ser_ref.datalen = *((uint32_t*)ser);
24502 ser_ref.data = (int8_t*)(ser + 4);
24503 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24504 *ret_conv = RoutingFees_read(ser_ref);
24505 return (uint64_t)ret_conv;
24508 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
24509 LDKNodeAnnouncementInfo this_obj_conv;
24510 this_obj_conv.inner = (void*)(this_obj & (~1));
24511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24512 NodeAnnouncementInfo_free(this_obj_conv);
24515 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
24516 LDKNodeAnnouncementInfo this_ptr_conv;
24517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24518 this_ptr_conv.is_owned = false;
24519 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24522 uint64_t ret_ref = (uint64_t)ret_var.inner;
24523 if (ret_var.is_owned) {
24529 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
24530 LDKNodeAnnouncementInfo this_ptr_conv;
24531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24532 this_ptr_conv.is_owned = false;
24533 LDKNodeFeatures val_conv;
24534 val_conv.inner = (void*)(val & (~1));
24535 val_conv.is_owned = (val & 1) || (val == 0);
24536 val_conv = NodeFeatures_clone(&val_conv);
24537 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24540 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
24541 LDKNodeAnnouncementInfo this_ptr_conv;
24542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24543 this_ptr_conv.is_owned = false;
24544 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24548 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24549 LDKNodeAnnouncementInfo this_ptr_conv;
24550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24551 this_ptr_conv.is_owned = false;
24552 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24555 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
24556 LDKNodeAnnouncementInfo this_ptr_conv;
24557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24558 this_ptr_conv.is_owned = false;
24559 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
24560 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
24564 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
24565 LDKNodeAnnouncementInfo this_ptr_conv;
24566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24567 this_ptr_conv.is_owned = false;
24568 LDKThreeBytes val_ref;
24569 CHECK(*((uint32_t*)val) == 3);
24570 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
24571 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24574 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
24575 LDKNodeAnnouncementInfo this_ptr_conv;
24576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24577 this_ptr_conv.is_owned = false;
24578 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24579 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
24583 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
24584 LDKNodeAnnouncementInfo this_ptr_conv;
24585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24586 this_ptr_conv.is_owned = false;
24587 LDKThirtyTwoBytes val_ref;
24588 CHECK(*((uint32_t*)val) == 32);
24589 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24590 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24593 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
24594 LDKNodeAnnouncementInfo this_ptr_conv;
24595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24596 this_ptr_conv.is_owned = false;
24597 LDKCVec_NetAddressZ val_constr;
24598 val_constr.datalen = *((uint32_t*)val);
24599 if (val_constr.datalen > 0)
24600 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24602 val_constr.data = NULL;
24603 uint32_t* val_vals = (uint32_t*)(val + 4);
24604 for (size_t m = 0; m < val_constr.datalen; m++) {
24605 uint32_t val_conv_12 = val_vals[m];
24606 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24607 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24608 val_constr.data[m] = val_conv_12_conv;
24610 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24613 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
24614 LDKNodeAnnouncementInfo this_ptr_conv;
24615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24616 this_ptr_conv.is_owned = false;
24617 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24620 uint64_t ret_ref = (uint64_t)ret_var.inner;
24621 if (ret_var.is_owned) {
24627 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24628 LDKNodeAnnouncementInfo this_ptr_conv;
24629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24630 this_ptr_conv.is_owned = false;
24631 LDKNodeAnnouncement val_conv;
24632 val_conv.inner = (void*)(val & (~1));
24633 val_conv.is_owned = (val & 1) || (val == 0);
24634 val_conv = NodeAnnouncement_clone(&val_conv);
24635 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24638 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) {
24639 LDKNodeFeatures features_arg_conv;
24640 features_arg_conv.inner = (void*)(features_arg & (~1));
24641 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24642 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24643 LDKThreeBytes rgb_arg_ref;
24644 CHECK(*((uint32_t*)rgb_arg) == 3);
24645 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
24646 LDKThirtyTwoBytes alias_arg_ref;
24647 CHECK(*((uint32_t*)alias_arg) == 32);
24648 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
24649 LDKCVec_NetAddressZ addresses_arg_constr;
24650 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
24651 if (addresses_arg_constr.datalen > 0)
24652 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24654 addresses_arg_constr.data = NULL;
24655 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
24656 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24657 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
24658 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24659 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24661 LDKNodeAnnouncement announcement_message_arg_conv;
24662 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24663 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24664 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24665 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24668 uint64_t ret_ref = (uint64_t)ret_var.inner;
24669 if (ret_var.is_owned) {
24675 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
24676 LDKNodeAnnouncementInfo orig_conv;
24677 orig_conv.inner = (void*)(orig & (~1));
24678 orig_conv.is_owned = false;
24679 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24682 uint64_t ret_ref = (uint64_t)ret_var.inner;
24683 if (ret_var.is_owned) {
24689 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
24690 LDKNodeAnnouncementInfo obj_conv;
24691 obj_conv.inner = (void*)(obj & (~1));
24692 obj_conv.is_owned = false;
24693 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24694 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24695 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24696 CVec_u8Z_free(ret_var);
24700 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
24701 LDKu8slice ser_ref;
24702 ser_ref.datalen = *((uint32_t*)ser);
24703 ser_ref.data = (int8_t*)(ser + 4);
24704 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24705 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24706 return (uint64_t)ret_conv;
24709 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
24710 LDKNodeInfo this_obj_conv;
24711 this_obj_conv.inner = (void*)(this_obj & (~1));
24712 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24713 NodeInfo_free(this_obj_conv);
24716 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
24717 LDKNodeInfo this_ptr_conv;
24718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24719 this_ptr_conv.is_owned = false;
24720 LDKCVec_u64Z val_constr;
24721 val_constr.datalen = *((uint32_t*)val);
24722 if (val_constr.datalen > 0)
24723 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24725 val_constr.data = NULL;
24726 int64_t* val_vals = (int64_t*)(val + 4);
24727 for (size_t i = 0; i < val_constr.datalen; i++) {
24728 int64_t val_conv_8 = val_vals[i];
24729 val_constr.data[i] = val_conv_8;
24731 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24734 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
24735 LDKNodeInfo this_ptr_conv;
24736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24737 this_ptr_conv.is_owned = false;
24738 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24741 uint64_t ret_ref = (uint64_t)ret_var.inner;
24742 if (ret_var.is_owned) {
24748 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
24749 LDKNodeInfo this_ptr_conv;
24750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24751 this_ptr_conv.is_owned = false;
24752 LDKRoutingFees val_conv;
24753 val_conv.inner = (void*)(val & (~1));
24754 val_conv.is_owned = (val & 1) || (val == 0);
24755 val_conv = RoutingFees_clone(&val_conv);
24756 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24759 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
24760 LDKNodeInfo this_ptr_conv;
24761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24762 this_ptr_conv.is_owned = false;
24763 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24766 uint64_t ret_ref = (uint64_t)ret_var.inner;
24767 if (ret_var.is_owned) {
24773 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
24774 LDKNodeInfo this_ptr_conv;
24775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24776 this_ptr_conv.is_owned = false;
24777 LDKNodeAnnouncementInfo val_conv;
24778 val_conv.inner = (void*)(val & (~1));
24779 val_conv.is_owned = (val & 1) || (val == 0);
24780 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24781 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24784 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
24785 LDKCVec_u64Z channels_arg_constr;
24786 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
24787 if (channels_arg_constr.datalen > 0)
24788 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24790 channels_arg_constr.data = NULL;
24791 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
24792 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
24793 int64_t channels_arg_conv_8 = channels_arg_vals[i];
24794 channels_arg_constr.data[i] = channels_arg_conv_8;
24796 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24797 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24798 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24799 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24800 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24801 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24802 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24803 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24804 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24807 uint64_t ret_ref = (uint64_t)ret_var.inner;
24808 if (ret_var.is_owned) {
24814 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
24815 LDKNodeInfo orig_conv;
24816 orig_conv.inner = (void*)(orig & (~1));
24817 orig_conv.is_owned = false;
24818 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24821 uint64_t ret_ref = (uint64_t)ret_var.inner;
24822 if (ret_var.is_owned) {
24828 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
24829 LDKNodeInfo obj_conv;
24830 obj_conv.inner = (void*)(obj & (~1));
24831 obj_conv.is_owned = false;
24832 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24833 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24834 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24835 CVec_u8Z_free(ret_var);
24839 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
24840 LDKu8slice ser_ref;
24841 ser_ref.datalen = *((uint32_t*)ser);
24842 ser_ref.data = (int8_t*)(ser + 4);
24843 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24844 *ret_conv = NodeInfo_read(ser_ref);
24845 return (uint64_t)ret_conv;
24848 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
24849 LDKNetworkGraph obj_conv;
24850 obj_conv.inner = (void*)(obj & (~1));
24851 obj_conv.is_owned = false;
24852 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24853 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24854 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24855 CVec_u8Z_free(ret_var);
24859 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
24860 LDKu8slice ser_ref;
24861 ser_ref.datalen = *((uint32_t*)ser);
24862 ser_ref.data = (int8_t*)(ser + 4);
24863 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24864 *ret_conv = NetworkGraph_read(ser_ref);
24865 return (uint64_t)ret_conv;
24868 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
24869 LDKThirtyTwoBytes genesis_hash_ref;
24870 CHECK(*((uint32_t*)genesis_hash) == 32);
24871 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
24872 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24875 uint64_t ret_ref = (uint64_t)ret_var.inner;
24876 if (ret_var.is_owned) {
24882 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
24883 LDKNetworkGraph this_arg_conv;
24884 this_arg_conv.inner = (void*)(this_arg & (~1));
24885 this_arg_conv.is_owned = false;
24886 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
24887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24889 uint64_t ret_ref = (uint64_t)ret_var.inner;
24890 if (ret_var.is_owned) {
24896 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
24897 LDKNetworkGraph this_arg_conv;
24898 this_arg_conv.inner = (void*)(this_arg & (~1));
24899 this_arg_conv.is_owned = false;
24900 LDKNodeAnnouncement msg_conv;
24901 msg_conv.inner = (void*)(msg & (~1));
24902 msg_conv.is_owned = false;
24903 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24904 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24905 return (uint64_t)ret_conv;
24908 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
24909 LDKNetworkGraph this_arg_conv;
24910 this_arg_conv.inner = (void*)(this_arg & (~1));
24911 this_arg_conv.is_owned = false;
24912 LDKUnsignedNodeAnnouncement msg_conv;
24913 msg_conv.inner = (void*)(msg & (~1));
24914 msg_conv.is_owned = false;
24915 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24916 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24917 return (uint64_t)ret_conv;
24920 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
24921 LDKNetworkGraph this_arg_conv;
24922 this_arg_conv.inner = (void*)(this_arg & (~1));
24923 this_arg_conv.is_owned = false;
24924 LDKChannelAnnouncement msg_conv;
24925 msg_conv.inner = (void*)(msg & (~1));
24926 msg_conv.is_owned = false;
24927 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24928 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24929 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24930 // Manually implement clone for Java trait instances
24932 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24933 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
24934 return (uint64_t)ret_conv;
24937 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
24938 LDKNetworkGraph this_arg_conv;
24939 this_arg_conv.inner = (void*)(this_arg & (~1));
24940 this_arg_conv.is_owned = false;
24941 LDKUnsignedChannelAnnouncement msg_conv;
24942 msg_conv.inner = (void*)(msg & (~1));
24943 msg_conv.is_owned = false;
24944 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24945 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24946 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24947 // Manually implement clone for Java trait instances
24949 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24950 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
24951 return (uint64_t)ret_conv;
24954 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
24955 LDKNetworkGraph this_arg_conv;
24956 this_arg_conv.inner = (void*)(this_arg & (~1));
24957 this_arg_conv.is_owned = false;
24958 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24961 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
24962 LDKNetworkGraph this_arg_conv;
24963 this_arg_conv.inner = (void*)(this_arg & (~1));
24964 this_arg_conv.is_owned = false;
24965 LDKPublicKey _node_id_ref;
24966 CHECK(*((uint32_t*)_node_id) == 33);
24967 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
24968 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
24971 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
24972 LDKNetworkGraph this_arg_conv;
24973 this_arg_conv.inner = (void*)(this_arg & (~1));
24974 this_arg_conv.is_owned = false;
24975 LDKChannelUpdate msg_conv;
24976 msg_conv.inner = (void*)(msg & (~1));
24977 msg_conv.is_owned = false;
24978 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24979 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24980 return (uint64_t)ret_conv;
24983 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
24984 LDKNetworkGraph this_arg_conv;
24985 this_arg_conv.inner = (void*)(this_arg & (~1));
24986 this_arg_conv.is_owned = false;
24987 LDKUnsignedChannelUpdate msg_conv;
24988 msg_conv.inner = (void*)(msg & (~1));
24989 msg_conv.is_owned = false;
24990 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24991 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24992 return (uint64_t)ret_conv;
24995 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
24996 LDKFilesystemPersister this_obj_conv;
24997 this_obj_conv.inner = (void*)(this_obj & (~1));
24998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24999 FilesystemPersister_free(this_obj_conv);
25002 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
25003 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
25004 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
25005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25007 uint64_t ret_ref = (uint64_t)ret_var.inner;
25008 if (ret_var.is_owned) {
25014 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
25015 LDKFilesystemPersister this_arg_conv;
25016 this_arg_conv.inner = (void*)(this_arg & (~1));
25017 this_arg_conv.is_owned = false;
25018 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
25019 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25024 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
25025 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
25026 LDKChannelManager manager_conv;
25027 manager_conv.inner = (void*)(manager & (~1));
25028 manager_conv.is_owned = false;
25029 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25030 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
25031 return (uint64_t)ret_conv;
25034 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
25035 LDKFilesystemPersister this_arg_conv;
25036 this_arg_conv.inner = (void*)(this_arg & (~1));
25037 this_arg_conv.is_owned = false;
25038 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25039 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
25040 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
25041 return (uint64_t)ret_conv;
25044 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
25045 LDKFilesystemPersister this_arg_conv;
25046 this_arg_conv.inner = (void*)(this_arg & (~1));
25047 this_arg_conv.is_owned = false;
25048 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
25049 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
25050 return (uint64_t)ret_ret;
25053 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
25054 LDKBackgroundProcessor this_obj_conv;
25055 this_obj_conv.inner = (void*)(this_obj & (~1));
25056 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25057 BackgroundProcessor_free(this_obj_conv);
25060 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
25061 if ((this_ptr & 1) != 0) return;
25062 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
25063 FREE((void*)this_ptr);
25064 ChannelManagerPersister_free(this_ptr_conv);
25067 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t net_graph_msg_handler, uint32_t peer_manager, uint32_t logger) {
25068 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
25069 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
25070 LDKChainMonitor chain_monitor_conv;
25071 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
25072 chain_monitor_conv.is_owned = false;
25073 LDKChannelManager channel_manager_conv;
25074 channel_manager_conv.inner = (void*)(channel_manager & (~1));
25075 channel_manager_conv.is_owned = false;
25076 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
25077 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
25078 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
25079 LDKPeerManager peer_manager_conv;
25080 peer_manager_conv.inner = (void*)(peer_manager & (~1));
25081 peer_manager_conv.is_owned = false;
25082 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25083 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
25084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25086 uint64_t ret_ref = (uint64_t)ret_var.inner;
25087 if (ret_var.is_owned) {
25093 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
25094 LDKBackgroundProcessor this_arg_conv;
25095 this_arg_conv.inner = (void*)(this_arg & (~1));
25096 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25097 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25098 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25099 *ret_conv = BackgroundProcessor_join(this_arg_conv);
25100 return (uint64_t)ret_conv;
25103 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
25104 LDKBackgroundProcessor this_arg_conv;
25105 this_arg_conv.inner = (void*)(this_arg & (~1));
25106 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25107 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25108 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25109 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
25110 return (uint64_t)ret_conv;
25113 void __attribute__((visibility("default"))) TS_check_platform() {
25117 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
25118 LDKInvoice this_obj_conv;
25119 this_obj_conv.inner = (void*)(this_obj & (~1));
25120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25121 Invoice_free(this_obj_conv);
25124 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
25126 a_conv.inner = (void*)(a & (~1));
25127 a_conv.is_owned = false;
25129 b_conv.inner = (void*)(b & (~1));
25130 b_conv.is_owned = false;
25131 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
25135 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
25136 LDKInvoice orig_conv;
25137 orig_conv.inner = (void*)(orig & (~1));
25138 orig_conv.is_owned = false;
25139 LDKInvoice ret_var = Invoice_clone(&orig_conv);
25140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25142 uint64_t ret_ref = (uint64_t)ret_var.inner;
25143 if (ret_var.is_owned) {
25149 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
25150 LDKSignedRawInvoice this_obj_conv;
25151 this_obj_conv.inner = (void*)(this_obj & (~1));
25152 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25153 SignedRawInvoice_free(this_obj_conv);
25156 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
25157 LDKSignedRawInvoice a_conv;
25158 a_conv.inner = (void*)(a & (~1));
25159 a_conv.is_owned = false;
25160 LDKSignedRawInvoice b_conv;
25161 b_conv.inner = (void*)(b & (~1));
25162 b_conv.is_owned = false;
25163 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
25167 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
25168 LDKSignedRawInvoice orig_conv;
25169 orig_conv.inner = (void*)(orig & (~1));
25170 orig_conv.is_owned = false;
25171 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
25172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25174 uint64_t ret_ref = (uint64_t)ret_var.inner;
25175 if (ret_var.is_owned) {
25181 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
25182 LDKRawInvoice this_obj_conv;
25183 this_obj_conv.inner = (void*)(this_obj & (~1));
25184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25185 RawInvoice_free(this_obj_conv);
25188 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
25189 LDKRawInvoice this_ptr_conv;
25190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25191 this_ptr_conv.is_owned = false;
25192 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
25193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25195 uint64_t ret_ref = (uint64_t)ret_var.inner;
25196 if (ret_var.is_owned) {
25202 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
25203 LDKRawInvoice this_ptr_conv;
25204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25205 this_ptr_conv.is_owned = false;
25206 LDKRawDataPart val_conv;
25207 val_conv.inner = (void*)(val & (~1));
25208 val_conv.is_owned = (val & 1) || (val == 0);
25209 val_conv = RawDataPart_clone(&val_conv);
25210 RawInvoice_set_data(&this_ptr_conv, val_conv);
25213 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
25214 LDKRawInvoice a_conv;
25215 a_conv.inner = (void*)(a & (~1));
25216 a_conv.is_owned = false;
25217 LDKRawInvoice b_conv;
25218 b_conv.inner = (void*)(b & (~1));
25219 b_conv.is_owned = false;
25220 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
25224 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
25225 LDKRawInvoice orig_conv;
25226 orig_conv.inner = (void*)(orig & (~1));
25227 orig_conv.is_owned = false;
25228 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
25229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25231 uint64_t ret_ref = (uint64_t)ret_var.inner;
25232 if (ret_var.is_owned) {
25238 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
25239 LDKRawDataPart this_obj_conv;
25240 this_obj_conv.inner = (void*)(this_obj & (~1));
25241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25242 RawDataPart_free(this_obj_conv);
25245 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
25246 LDKRawDataPart this_ptr_conv;
25247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25248 this_ptr_conv.is_owned = false;
25249 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
25250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25252 uint64_t ret_ref = (uint64_t)ret_var.inner;
25253 if (ret_var.is_owned) {
25259 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
25260 LDKRawDataPart this_ptr_conv;
25261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25262 this_ptr_conv.is_owned = false;
25263 LDKPositiveTimestamp val_conv;
25264 val_conv.inner = (void*)(val & (~1));
25265 val_conv.is_owned = (val & 1) || (val == 0);
25266 val_conv = PositiveTimestamp_clone(&val_conv);
25267 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
25270 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
25271 LDKRawDataPart a_conv;
25272 a_conv.inner = (void*)(a & (~1));
25273 a_conv.is_owned = false;
25274 LDKRawDataPart b_conv;
25275 b_conv.inner = (void*)(b & (~1));
25276 b_conv.is_owned = false;
25277 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
25281 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
25282 LDKRawDataPart orig_conv;
25283 orig_conv.inner = (void*)(orig & (~1));
25284 orig_conv.is_owned = false;
25285 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
25286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25288 uint64_t ret_ref = (uint64_t)ret_var.inner;
25289 if (ret_var.is_owned) {
25295 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
25296 LDKPositiveTimestamp this_obj_conv;
25297 this_obj_conv.inner = (void*)(this_obj & (~1));
25298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25299 PositiveTimestamp_free(this_obj_conv);
25302 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
25303 LDKPositiveTimestamp a_conv;
25304 a_conv.inner = (void*)(a & (~1));
25305 a_conv.is_owned = false;
25306 LDKPositiveTimestamp b_conv;
25307 b_conv.inner = (void*)(b & (~1));
25308 b_conv.is_owned = false;
25309 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
25313 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
25314 LDKPositiveTimestamp orig_conv;
25315 orig_conv.inner = (void*)(orig & (~1));
25316 orig_conv.is_owned = false;
25317 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
25318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25320 uint64_t ret_ref = (uint64_t)ret_var.inner;
25321 if (ret_var.is_owned) {
25327 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
25328 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
25329 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
25333 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
25334 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
25338 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
25339 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
25343 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
25344 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
25348 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
25349 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
25353 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
25354 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
25355 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
25356 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
25360 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
25361 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
25362 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
25366 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
25367 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
25368 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
25372 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
25373 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
25377 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
25378 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
25382 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
25383 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
25387 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
25388 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
25392 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
25393 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
25397 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
25398 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25399 int64_t ret_val = Currency_hash(o_conv);
25403 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
25404 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25405 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25406 jboolean ret_val = Currency_eq(a_conv, b_conv);
25410 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
25411 LDKSha256 this_obj_conv;
25412 this_obj_conv.inner = (void*)(this_obj & (~1));
25413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25414 Sha256_free(this_obj_conv);
25417 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
25418 LDKSha256 orig_conv;
25419 orig_conv.inner = (void*)(orig & (~1));
25420 orig_conv.is_owned = false;
25421 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25424 uint64_t ret_ref = (uint64_t)ret_var.inner;
25425 if (ret_var.is_owned) {
25431 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
25433 o_conv.inner = (void*)(o & (~1));
25434 o_conv.is_owned = false;
25435 int64_t ret_val = Sha256_hash(&o_conv);
25439 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
25441 a_conv.inner = (void*)(a & (~1));
25442 a_conv.is_owned = false;
25444 b_conv.inner = (void*)(b & (~1));
25445 b_conv.is_owned = false;
25446 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25450 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
25451 LDKDescription this_obj_conv;
25452 this_obj_conv.inner = (void*)(this_obj & (~1));
25453 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25454 Description_free(this_obj_conv);
25457 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
25458 LDKDescription orig_conv;
25459 orig_conv.inner = (void*)(orig & (~1));
25460 orig_conv.is_owned = false;
25461 LDKDescription ret_var = Description_clone(&orig_conv);
25462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25464 uint64_t ret_ref = (uint64_t)ret_var.inner;
25465 if (ret_var.is_owned) {
25471 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
25472 LDKDescription o_conv;
25473 o_conv.inner = (void*)(o & (~1));
25474 o_conv.is_owned = false;
25475 int64_t ret_val = Description_hash(&o_conv);
25479 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
25480 LDKDescription a_conv;
25481 a_conv.inner = (void*)(a & (~1));
25482 a_conv.is_owned = false;
25483 LDKDescription b_conv;
25484 b_conv.inner = (void*)(b & (~1));
25485 b_conv.is_owned = false;
25486 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25490 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
25491 LDKPayeePubKey this_obj_conv;
25492 this_obj_conv.inner = (void*)(this_obj & (~1));
25493 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25494 PayeePubKey_free(this_obj_conv);
25497 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
25498 LDKPayeePubKey orig_conv;
25499 orig_conv.inner = (void*)(orig & (~1));
25500 orig_conv.is_owned = false;
25501 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25502 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25503 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25504 uint64_t ret_ref = (uint64_t)ret_var.inner;
25505 if (ret_var.is_owned) {
25511 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
25512 LDKPayeePubKey o_conv;
25513 o_conv.inner = (void*)(o & (~1));
25514 o_conv.is_owned = false;
25515 int64_t ret_val = PayeePubKey_hash(&o_conv);
25519 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
25520 LDKPayeePubKey a_conv;
25521 a_conv.inner = (void*)(a & (~1));
25522 a_conv.is_owned = false;
25523 LDKPayeePubKey b_conv;
25524 b_conv.inner = (void*)(b & (~1));
25525 b_conv.is_owned = false;
25526 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25530 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
25531 LDKExpiryTime this_obj_conv;
25532 this_obj_conv.inner = (void*)(this_obj & (~1));
25533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25534 ExpiryTime_free(this_obj_conv);
25537 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
25538 LDKExpiryTime orig_conv;
25539 orig_conv.inner = (void*)(orig & (~1));
25540 orig_conv.is_owned = false;
25541 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25544 uint64_t ret_ref = (uint64_t)ret_var.inner;
25545 if (ret_var.is_owned) {
25551 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
25552 LDKExpiryTime o_conv;
25553 o_conv.inner = (void*)(o & (~1));
25554 o_conv.is_owned = false;
25555 int64_t ret_val = ExpiryTime_hash(&o_conv);
25559 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
25560 LDKExpiryTime a_conv;
25561 a_conv.inner = (void*)(a & (~1));
25562 a_conv.is_owned = false;
25563 LDKExpiryTime b_conv;
25564 b_conv.inner = (void*)(b & (~1));
25565 b_conv.is_owned = false;
25566 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25570 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
25571 LDKMinFinalCltvExpiry this_obj_conv;
25572 this_obj_conv.inner = (void*)(this_obj & (~1));
25573 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25574 MinFinalCltvExpiry_free(this_obj_conv);
25577 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
25578 LDKMinFinalCltvExpiry orig_conv;
25579 orig_conv.inner = (void*)(orig & (~1));
25580 orig_conv.is_owned = false;
25581 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25584 uint64_t ret_ref = (uint64_t)ret_var.inner;
25585 if (ret_var.is_owned) {
25591 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
25592 LDKMinFinalCltvExpiry o_conv;
25593 o_conv.inner = (void*)(o & (~1));
25594 o_conv.is_owned = false;
25595 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
25599 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
25600 LDKMinFinalCltvExpiry a_conv;
25601 a_conv.inner = (void*)(a & (~1));
25602 a_conv.is_owned = false;
25603 LDKMinFinalCltvExpiry b_conv;
25604 b_conv.inner = (void*)(b & (~1));
25605 b_conv.is_owned = false;
25606 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25610 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
25611 if ((this_ptr & 1) != 0) return;
25612 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25613 FREE((void*)this_ptr);
25614 Fallback_free(this_ptr_conv);
25617 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
25618 LDKFallback* orig_conv = (LDKFallback*)orig;
25619 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25620 *ret_copy = Fallback_clone(orig_conv);
25621 uint64_t ret_ref = (uint64_t)ret_copy;
25625 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
25627 LDKCVec_u8Z program_ref;
25628 program_ref.datalen = *((uint32_t*)program);
25629 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
25630 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
25631 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25632 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
25633 uint64_t ret_ref = (uint64_t)ret_copy;
25637 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
25638 LDKTwentyBytes a_ref;
25639 CHECK(*((uint32_t*)a) == 20);
25640 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25641 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25642 *ret_copy = Fallback_pub_key_hash(a_ref);
25643 uint64_t ret_ref = (uint64_t)ret_copy;
25647 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
25648 LDKTwentyBytes a_ref;
25649 CHECK(*((uint32_t*)a) == 20);
25650 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25651 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25652 *ret_copy = Fallback_script_hash(a_ref);
25653 uint64_t ret_ref = (uint64_t)ret_copy;
25657 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
25658 LDKFallback* o_conv = (LDKFallback*)o;
25659 int64_t ret_val = Fallback_hash(o_conv);
25663 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
25664 LDKFallback* a_conv = (LDKFallback*)a;
25665 LDKFallback* b_conv = (LDKFallback*)b;
25666 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25670 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
25671 LDKInvoiceSignature this_obj_conv;
25672 this_obj_conv.inner = (void*)(this_obj & (~1));
25673 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25674 InvoiceSignature_free(this_obj_conv);
25677 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
25678 LDKInvoiceSignature orig_conv;
25679 orig_conv.inner = (void*)(orig & (~1));
25680 orig_conv.is_owned = false;
25681 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25684 uint64_t ret_ref = (uint64_t)ret_var.inner;
25685 if (ret_var.is_owned) {
25691 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
25692 LDKInvoiceSignature a_conv;
25693 a_conv.inner = (void*)(a & (~1));
25694 a_conv.is_owned = false;
25695 LDKInvoiceSignature b_conv;
25696 b_conv.inner = (void*)(b & (~1));
25697 b_conv.is_owned = false;
25698 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25702 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
25703 LDKPrivateRoute this_obj_conv;
25704 this_obj_conv.inner = (void*)(this_obj & (~1));
25705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25706 PrivateRoute_free(this_obj_conv);
25709 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
25710 LDKPrivateRoute orig_conv;
25711 orig_conv.inner = (void*)(orig & (~1));
25712 orig_conv.is_owned = false;
25713 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25716 uint64_t ret_ref = (uint64_t)ret_var.inner;
25717 if (ret_var.is_owned) {
25723 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
25724 LDKPrivateRoute o_conv;
25725 o_conv.inner = (void*)(o & (~1));
25726 o_conv.is_owned = false;
25727 int64_t ret_val = PrivateRoute_hash(&o_conv);
25731 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
25732 LDKPrivateRoute a_conv;
25733 a_conv.inner = (void*)(a & (~1));
25734 a_conv.is_owned = false;
25735 LDKPrivateRoute b_conv;
25736 b_conv.inner = (void*)(b & (~1));
25737 b_conv.is_owned = false;
25738 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25742 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
25743 LDKSignedRawInvoice this_arg_conv;
25744 this_arg_conv.inner = (void*)(this_arg & (~1));
25745 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25746 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25747 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25748 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
25749 return (uint64_t)ret_ref;
25752 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
25753 LDKSignedRawInvoice this_arg_conv;
25754 this_arg_conv.inner = (void*)(this_arg & (~1));
25755 this_arg_conv.is_owned = false;
25756 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25759 uint64_t ret_ref = (uint64_t)ret_var.inner;
25760 if (ret_var.is_owned) {
25766 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
25767 LDKSignedRawInvoice this_arg_conv;
25768 this_arg_conv.inner = (void*)(this_arg & (~1));
25769 this_arg_conv.is_owned = false;
25770 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25771 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
25775 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
25776 LDKSignedRawInvoice this_arg_conv;
25777 this_arg_conv.inner = (void*)(this_arg & (~1));
25778 this_arg_conv.is_owned = false;
25779 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25782 uint64_t ret_ref = (uint64_t)ret_var.inner;
25783 if (ret_var.is_owned) {
25789 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
25790 LDKSignedRawInvoice this_arg_conv;
25791 this_arg_conv.inner = (void*)(this_arg & (~1));
25792 this_arg_conv.is_owned = false;
25793 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25794 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25795 return (uint64_t)ret_conv;
25798 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
25799 LDKSignedRawInvoice this_arg_conv;
25800 this_arg_conv.inner = (void*)(this_arg & (~1));
25801 this_arg_conv.is_owned = false;
25802 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25806 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
25807 LDKRawInvoice this_arg_conv;
25808 this_arg_conv.inner = (void*)(this_arg & (~1));
25809 this_arg_conv.is_owned = false;
25810 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25811 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
25815 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
25816 LDKRawInvoice this_arg_conv;
25817 this_arg_conv.inner = (void*)(this_arg & (~1));
25818 this_arg_conv.is_owned = false;
25819 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25822 uint64_t ret_ref = (uint64_t)ret_var.inner;
25823 if (ret_var.is_owned) {
25829 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
25830 LDKRawInvoice this_arg_conv;
25831 this_arg_conv.inner = (void*)(this_arg & (~1));
25832 this_arg_conv.is_owned = false;
25833 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25836 uint64_t ret_ref = (uint64_t)ret_var.inner;
25837 if (ret_var.is_owned) {
25843 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
25844 LDKRawInvoice this_arg_conv;
25845 this_arg_conv.inner = (void*)(this_arg & (~1));
25846 this_arg_conv.is_owned = false;
25847 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25850 uint64_t ret_ref = (uint64_t)ret_var.inner;
25851 if (ret_var.is_owned) {
25857 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
25858 LDKRawInvoice this_arg_conv;
25859 this_arg_conv.inner = (void*)(this_arg & (~1));
25860 this_arg_conv.is_owned = false;
25861 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25864 uint64_t ret_ref = (uint64_t)ret_var.inner;
25865 if (ret_var.is_owned) {
25871 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
25872 LDKRawInvoice this_arg_conv;
25873 this_arg_conv.inner = (void*)(this_arg & (~1));
25874 this_arg_conv.is_owned = false;
25875 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25878 uint64_t ret_ref = (uint64_t)ret_var.inner;
25879 if (ret_var.is_owned) {
25885 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
25886 LDKRawInvoice this_arg_conv;
25887 this_arg_conv.inner = (void*)(this_arg & (~1));
25888 this_arg_conv.is_owned = false;
25889 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25892 uint64_t ret_ref = (uint64_t)ret_var.inner;
25893 if (ret_var.is_owned) {
25899 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
25900 LDKRawInvoice this_arg_conv;
25901 this_arg_conv.inner = (void*)(this_arg & (~1));
25902 this_arg_conv.is_owned = false;
25903 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25904 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
25908 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
25909 LDKRawInvoice this_arg_conv;
25910 this_arg_conv.inner = (void*)(this_arg & (~1));
25911 this_arg_conv.is_owned = false;
25912 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25915 uint64_t ret_ref = (uint64_t)ret_var.inner;
25916 if (ret_var.is_owned) {
25922 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
25923 LDKRawInvoice this_arg_conv;
25924 this_arg_conv.inner = (void*)(this_arg & (~1));
25925 this_arg_conv.is_owned = false;
25926 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25927 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
25928 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
25929 for (size_t o = 0; o < ret_var.datalen; o++) {
25930 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25931 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25932 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25933 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25934 if (ret_conv_14_var.is_owned) {
25935 ret_conv_14_ref |= 1;
25937 ret_arr_ptr[o] = ret_conv_14_ref;
25939 FREE(ret_var.data);
25943 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
25944 LDKRawInvoice this_arg_conv;
25945 this_arg_conv.inner = (void*)(this_arg & (~1));
25946 this_arg_conv.is_owned = false;
25947 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25948 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25949 uint64_t ret_ref = (uint64_t)ret_copy;
25953 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
25954 LDKRawInvoice this_arg_conv;
25955 this_arg_conv.inner = (void*)(this_arg & (~1));
25956 this_arg_conv.is_owned = false;
25957 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
25961 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
25962 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25963 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25964 return (uint64_t)ret_conv;
25967 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
25968 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25969 *ret_conv = PositiveTimestamp_from_system_time(time);
25970 return (uint64_t)ret_conv;
25973 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
25974 LDKPositiveTimestamp this_arg_conv;
25975 this_arg_conv.inner = (void*)(this_arg & (~1));
25976 this_arg_conv.is_owned = false;
25977 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25981 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
25982 LDKPositiveTimestamp this_arg_conv;
25983 this_arg_conv.inner = (void*)(this_arg & (~1));
25984 this_arg_conv.is_owned = false;
25985 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25989 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
25990 LDKInvoice this_arg_conv;
25991 this_arg_conv.inner = (void*)(this_arg & (~1));
25992 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25993 this_arg_conv = Invoice_clone(&this_arg_conv);
25994 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25997 uint64_t ret_ref = (uint64_t)ret_var.inner;
25998 if (ret_var.is_owned) {
26004 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
26005 LDKInvoice this_arg_conv;
26006 this_arg_conv.inner = (void*)(this_arg & (~1));
26007 this_arg_conv.is_owned = false;
26008 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
26009 *ret_conv = Invoice_check_signature(&this_arg_conv);
26010 return (uint64_t)ret_conv;
26013 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
26014 LDKSignedRawInvoice signed_invoice_conv;
26015 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
26016 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
26017 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
26018 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
26019 *ret_conv = Invoice_from_signed(signed_invoice_conv);
26020 return (uint64_t)ret_conv;
26023 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
26024 LDKInvoice this_arg_conv;
26025 this_arg_conv.inner = (void*)(this_arg & (~1));
26026 this_arg_conv.is_owned = false;
26027 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
26031 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
26032 LDKInvoice this_arg_conv;
26033 this_arg_conv.inner = (void*)(this_arg & (~1));
26034 this_arg_conv.is_owned = false;
26035 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26036 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
26040 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
26041 LDKInvoice this_arg_conv;
26042 this_arg_conv.inner = (void*)(this_arg & (~1));
26043 this_arg_conv.is_owned = false;
26044 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26045 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
26049 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
26050 LDKInvoice this_arg_conv;
26051 this_arg_conv.inner = (void*)(this_arg & (~1));
26052 this_arg_conv.is_owned = false;
26053 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26054 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
26058 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
26059 LDKInvoice this_arg_conv;
26060 this_arg_conv.inner = (void*)(this_arg & (~1));
26061 this_arg_conv.is_owned = false;
26062 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
26063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26065 uint64_t ret_ref = (uint64_t)ret_var.inner;
26066 if (ret_var.is_owned) {
26072 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
26073 LDKInvoice this_arg_conv;
26074 this_arg_conv.inner = (void*)(this_arg & (~1));
26075 this_arg_conv.is_owned = false;
26076 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26077 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
26081 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
26082 LDKInvoice this_arg_conv;
26083 this_arg_conv.inner = (void*)(this_arg & (~1));
26084 this_arg_conv.is_owned = false;
26085 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
26089 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
26090 LDKInvoice this_arg_conv;
26091 this_arg_conv.inner = (void*)(this_arg & (~1));
26092 this_arg_conv.is_owned = false;
26093 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
26097 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
26098 LDKInvoice this_arg_conv;
26099 this_arg_conv.inner = (void*)(this_arg & (~1));
26100 this_arg_conv.is_owned = false;
26101 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
26102 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26103 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26104 for (size_t o = 0; o < ret_var.datalen; o++) {
26105 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26106 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26107 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26108 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26109 if (ret_conv_14_var.is_owned) {
26110 ret_conv_14_ref |= 1;
26112 ret_arr_ptr[o] = ret_conv_14_ref;
26114 FREE(ret_var.data);
26118 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
26119 LDKInvoice this_arg_conv;
26120 this_arg_conv.inner = (void*)(this_arg & (~1));
26121 this_arg_conv.is_owned = false;
26122 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
26123 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26124 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26125 for (size_t l = 0; l < ret_var.datalen; l++) {
26126 LDKRouteHint ret_conv_11_var = ret_var.data[l];
26127 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26128 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26129 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
26130 if (ret_conv_11_var.is_owned) {
26131 ret_conv_11_ref |= 1;
26133 ret_arr_ptr[l] = ret_conv_11_ref;
26135 FREE(ret_var.data);
26139 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
26140 LDKInvoice this_arg_conv;
26141 this_arg_conv.inner = (void*)(this_arg & (~1));
26142 this_arg_conv.is_owned = false;
26143 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
26147 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
26148 LDKInvoice this_arg_conv;
26149 this_arg_conv.inner = (void*)(this_arg & (~1));
26150 this_arg_conv.is_owned = false;
26151 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26152 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
26153 uint64_t ret_ref = (uint64_t)ret_copy;
26157 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
26158 LDKStr description_conv = str_ref_to_owned_c(description);
26159 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
26160 *ret_conv = Description_new(description_conv);
26161 return (uint64_t)ret_conv;
26164 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
26165 LDKDescription this_arg_conv;
26166 this_arg_conv.inner = (void*)(this_arg & (~1));
26167 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26168 this_arg_conv = Description_clone(&this_arg_conv);
26169 LDKStr ret_str = Description_into_inner(this_arg_conv);
26170 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26175 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
26176 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26177 *ret_conv = ExpiryTime_from_seconds(seconds);
26178 return (uint64_t)ret_conv;
26181 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
26182 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26183 *ret_conv = ExpiryTime_from_duration(duration);
26184 return (uint64_t)ret_conv;
26187 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
26188 LDKExpiryTime this_arg_conv;
26189 this_arg_conv.inner = (void*)(this_arg & (~1));
26190 this_arg_conv.is_owned = false;
26191 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
26195 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
26196 LDKExpiryTime this_arg_conv;
26197 this_arg_conv.inner = (void*)(this_arg & (~1));
26198 this_arg_conv.is_owned = false;
26199 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
26203 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
26204 LDKRouteHint hops_conv;
26205 hops_conv.inner = (void*)(hops & (~1));
26206 hops_conv.is_owned = (hops & 1) || (hops == 0);
26207 hops_conv = RouteHint_clone(&hops_conv);
26208 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
26209 *ret_conv = PrivateRoute_new(hops_conv);
26210 return (uint64_t)ret_conv;
26213 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
26214 LDKPrivateRoute this_arg_conv;
26215 this_arg_conv.inner = (void*)(this_arg & (~1));
26216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26217 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
26218 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
26219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26221 uint64_t ret_ref = (uint64_t)ret_var.inner;
26222 if (ret_var.is_owned) {
26228 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
26229 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
26230 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
26234 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
26235 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
26239 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
26240 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
26244 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
26245 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
26249 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
26250 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
26254 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
26255 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
26256 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
26257 jboolean ret_val = CreationError_eq(a_conv, b_conv);
26261 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
26262 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
26263 LDKStr ret_str = CreationError_to_str(o_conv);
26264 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26269 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
26270 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
26271 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
26275 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
26276 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
26280 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
26281 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
26285 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
26286 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
26290 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
26291 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
26295 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
26296 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
26300 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
26301 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
26305 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
26306 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
26310 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
26311 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
26315 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
26316 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
26320 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
26321 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
26325 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
26326 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
26327 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
26328 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
26332 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
26333 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
26334 LDKStr ret_str = SemanticError_to_str(o_conv);
26335 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26340 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
26341 if ((this_ptr & 1) != 0) return;
26342 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
26343 FREE((void*)this_ptr);
26344 SignOrCreationError_free(this_ptr_conv);
26347 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
26348 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
26349 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26350 *ret_copy = SignOrCreationError_clone(orig_conv);
26351 uint64_t ret_ref = (uint64_t)ret_copy;
26355 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
26356 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26357 *ret_copy = SignOrCreationError_sign_error();
26358 uint64_t ret_ref = (uint64_t)ret_copy;
26362 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
26363 LDKCreationError a_conv = LDKCreationError_from_js(a);
26364 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26365 *ret_copy = SignOrCreationError_creation_error(a_conv);
26366 uint64_t ret_ref = (uint64_t)ret_copy;
26370 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
26371 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
26372 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
26373 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
26377 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
26378 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
26379 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
26380 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26385 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) {
26386 LDKChannelManager channelmanager_conv;
26387 channelmanager_conv.inner = (void*)(channelmanager & (~1));
26388 channelmanager_conv.is_owned = false;
26389 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26390 LDKCurrency network_conv = LDKCurrency_from_js(network);
26391 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
26392 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
26393 LDKStr description_conv = str_ref_to_owned_c(description);
26394 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26395 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
26396 return (uint64_t)ret_conv;
26399 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
26400 LDKStr s_conv = str_ref_to_owned_c(s);
26401 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
26402 *ret_conv = SiPrefix_from_str(s_conv);
26403 return (uint64_t)ret_conv;
26406 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
26407 LDKStr s_conv = str_ref_to_owned_c(s);
26408 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
26409 *ret_conv = Invoice_from_str(s_conv);
26410 return (uint64_t)ret_conv;
26413 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
26414 LDKStr s_conv = str_ref_to_owned_c(s);
26415 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
26416 *ret_conv = SignedRawInvoice_from_str(s_conv);
26417 return (uint64_t)ret_conv;
26420 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
26422 o_conv.inner = (void*)(o & (~1));
26423 o_conv.is_owned = false;
26424 LDKStr ret_str = Invoice_to_str(&o_conv);
26425 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26430 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
26431 LDKSignedRawInvoice o_conv;
26432 o_conv.inner = (void*)(o & (~1));
26433 o_conv.is_owned = false;
26434 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
26435 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26440 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
26441 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
26442 LDKStr ret_str = Currency_to_str(o_conv);
26443 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26448 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
26449 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
26450 LDKStr ret_str = SiPrefix_to_str(o_conv);
26451 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);