5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
22 #define CHECK_ACCESS(p)
24 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
25 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
31 typedef uint32_t int64_tArray;
32 typedef uint32_t int8_tArray;
33 typedef uint32_t uint32_tArray;
34 typedef uint32_t ptrArray;
35 typedef uint32_t jstring;
37 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
38 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
40 return (uint32_t)elems;
43 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
44 char* err_buf = MALLOC(len + 4, "str conv buf");
45 *((uint32_t*)err_buf) = len;
46 memcpy(err_buf + 4, chars, len);
47 return (uint32_t) err_buf;
49 static inline LDKStr str_ref_to_owned_c(jstring str) {
50 uint32_t *str_len = (uint32_t*)str;
51 char* newchars = MALLOC(*str_len + 1, "String chars");
52 memcpy(newchars, (const char*)(str + 4), *str_len);
53 newchars[*str_len] = 0;
57 .chars_is_owned = true
62 typedef bool jboolean;
64 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
65 return (uint32_t)MALLOC(size, "JS-Called malloc");
67 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
70 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
71 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
73 case 0: return LDKAccessError_UnknownChain;
74 case 1: return LDKAccessError_UnknownTx;
78 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
80 case LDKAccessError_UnknownChain: return 0;
81 case LDKAccessError_UnknownTx: return 1;
85 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
87 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
88 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
92 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
94 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
95 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
99 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
101 case 0: return LDKConfirmationTarget_Background;
102 case 1: return LDKConfirmationTarget_Normal;
103 case 2: return LDKConfirmationTarget_HighPriority;
107 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
109 case LDKConfirmationTarget_Background: return 0;
110 case LDKConfirmationTarget_Normal: return 1;
111 case LDKConfirmationTarget_HighPriority: return 2;
115 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
117 case 0: return LDKCreationError_DescriptionTooLong;
118 case 1: return LDKCreationError_RouteTooLong;
119 case 2: return LDKCreationError_TimestampOutOfBounds;
120 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
124 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
126 case LDKCreationError_DescriptionTooLong: return 0;
127 case LDKCreationError_RouteTooLong: return 1;
128 case LDKCreationError_TimestampOutOfBounds: return 2;
129 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
133 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
135 case 0: return LDKCurrency_Bitcoin;
136 case 1: return LDKCurrency_BitcoinTestnet;
137 case 2: return LDKCurrency_Regtest;
138 case 3: return LDKCurrency_Simnet;
139 case 4: return LDKCurrency_Signet;
143 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
145 case LDKCurrency_Bitcoin: return 0;
146 case LDKCurrency_BitcoinTestnet: return 1;
147 case LDKCurrency_Regtest: return 2;
148 case LDKCurrency_Simnet: return 3;
149 case LDKCurrency_Signet: return 4;
153 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
155 case 0: return LDKIOError_NotFound;
156 case 1: return LDKIOError_PermissionDenied;
157 case 2: return LDKIOError_ConnectionRefused;
158 case 3: return LDKIOError_ConnectionReset;
159 case 4: return LDKIOError_ConnectionAborted;
160 case 5: return LDKIOError_NotConnected;
161 case 6: return LDKIOError_AddrInUse;
162 case 7: return LDKIOError_AddrNotAvailable;
163 case 8: return LDKIOError_BrokenPipe;
164 case 9: return LDKIOError_AlreadyExists;
165 case 10: return LDKIOError_WouldBlock;
166 case 11: return LDKIOError_InvalidInput;
167 case 12: return LDKIOError_InvalidData;
168 case 13: return LDKIOError_TimedOut;
169 case 14: return LDKIOError_WriteZero;
170 case 15: return LDKIOError_Interrupted;
171 case 16: return LDKIOError_Other;
172 case 17: return LDKIOError_UnexpectedEof;
176 static inline int32_t LDKIOError_to_js(LDKIOError val) {
178 case LDKIOError_NotFound: return 0;
179 case LDKIOError_PermissionDenied: return 1;
180 case LDKIOError_ConnectionRefused: return 2;
181 case LDKIOError_ConnectionReset: return 3;
182 case LDKIOError_ConnectionAborted: return 4;
183 case LDKIOError_NotConnected: return 5;
184 case LDKIOError_AddrInUse: return 6;
185 case LDKIOError_AddrNotAvailable: return 7;
186 case LDKIOError_BrokenPipe: return 8;
187 case LDKIOError_AlreadyExists: return 9;
188 case LDKIOError_WouldBlock: return 10;
189 case LDKIOError_InvalidInput: return 11;
190 case LDKIOError_InvalidData: return 12;
191 case LDKIOError_TimedOut: return 13;
192 case LDKIOError_WriteZero: return 14;
193 case LDKIOError_Interrupted: return 15;
194 case LDKIOError_Other: return 16;
195 case LDKIOError_UnexpectedEof: return 17;
199 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
201 case 0: return LDKLevel_Trace;
202 case 1: return LDKLevel_Debug;
203 case 2: return LDKLevel_Info;
204 case 3: return LDKLevel_Warn;
205 case 4: return LDKLevel_Error;
209 static inline int32_t LDKLevel_to_js(LDKLevel val) {
211 case LDKLevel_Trace: return 0;
212 case LDKLevel_Debug: return 1;
213 case LDKLevel_Info: return 2;
214 case LDKLevel_Warn: return 3;
215 case LDKLevel_Error: return 4;
219 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
221 case 0: return LDKNetwork_Bitcoin;
222 case 1: return LDKNetwork_Testnet;
223 case 2: return LDKNetwork_Regtest;
224 case 3: return LDKNetwork_Signet;
228 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
230 case LDKNetwork_Bitcoin: return 0;
231 case LDKNetwork_Testnet: return 1;
232 case LDKNetwork_Regtest: return 2;
233 case LDKNetwork_Signet: return 3;
237 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
239 case 0: return LDKSecp256k1Error_IncorrectSignature;
240 case 1: return LDKSecp256k1Error_InvalidMessage;
241 case 2: return LDKSecp256k1Error_InvalidPublicKey;
242 case 3: return LDKSecp256k1Error_InvalidSignature;
243 case 4: return LDKSecp256k1Error_InvalidSecretKey;
244 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
245 case 6: return LDKSecp256k1Error_InvalidTweak;
246 case 7: return LDKSecp256k1Error_TweakCheckFailed;
247 case 8: return LDKSecp256k1Error_NotEnoughMemory;
251 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
253 case LDKSecp256k1Error_IncorrectSignature: return 0;
254 case LDKSecp256k1Error_InvalidMessage: return 1;
255 case LDKSecp256k1Error_InvalidPublicKey: return 2;
256 case LDKSecp256k1Error_InvalidSignature: return 3;
257 case LDKSecp256k1Error_InvalidSecretKey: return 4;
258 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
259 case LDKSecp256k1Error_InvalidTweak: return 6;
260 case LDKSecp256k1Error_TweakCheckFailed: return 7;
261 case LDKSecp256k1Error_NotEnoughMemory: return 8;
265 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
267 case 0: return LDKSemanticError_NoPaymentHash;
268 case 1: return LDKSemanticError_MultiplePaymentHashes;
269 case 2: return LDKSemanticError_NoDescription;
270 case 3: return LDKSemanticError_MultipleDescriptions;
271 case 4: return LDKSemanticError_NoPaymentSecret;
272 case 5: return LDKSemanticError_MultiplePaymentSecrets;
273 case 6: return LDKSemanticError_InvalidFeatures;
274 case 7: return LDKSemanticError_InvalidRecoveryId;
275 case 8: return LDKSemanticError_InvalidSignature;
276 case 9: return LDKSemanticError_ImpreciseAmount;
280 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
282 case LDKSemanticError_NoPaymentHash: return 0;
283 case LDKSemanticError_MultiplePaymentHashes: return 1;
284 case LDKSemanticError_NoDescription: return 2;
285 case LDKSemanticError_MultipleDescriptions: return 3;
286 case LDKSemanticError_NoPaymentSecret: return 4;
287 case LDKSemanticError_MultiplePaymentSecrets: return 5;
288 case LDKSemanticError_InvalidFeatures: return 6;
289 case LDKSemanticError_InvalidRecoveryId: return 7;
290 case LDKSemanticError_InvalidSignature: return 8;
291 case LDKSemanticError_ImpreciseAmount: return 9;
295 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
297 case 0: return LDKSiPrefix_Milli;
298 case 1: return LDKSiPrefix_Micro;
299 case 2: return LDKSiPrefix_Nano;
300 case 3: return LDKSiPrefix_Pico;
304 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
306 case LDKSiPrefix_Milli: return 0;
307 case LDKSiPrefix_Micro: return 1;
308 case LDKSiPrefix_Nano: return 2;
309 case LDKSiPrefix_Pico: return 3;
313 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
314 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
315 ret->datalen = *((uint32_t*)elems);
316 if (ret->datalen == 0) {
319 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
320 int8_t *java_elems = (int8_t*)(elems + 4);
321 for (size_t i = 0; i < ret->datalen; i++) {
322 ret->data[i] = java_elems[i];
325 return (uint64_t)ret;
327 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
328 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
329 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
332 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) {
333 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
334 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
335 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
336 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
337 CVec_u8Z_free(ret_var);
341 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
342 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
343 int64_t ret_val = TxOut_get_value(thing_conv);
347 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
348 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
350 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
351 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
352 CHECK(val->result_ok);
353 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
354 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
358 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
359 CHECK(!val->result_ok);
360 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
363 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
364 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
366 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
367 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
368 CHECK(val->result_ok);
369 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
370 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
374 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
375 CHECK(!val->result_ok);
376 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
379 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
380 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
383 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
384 CHECK(val->result_ok);
385 LDKTxCreationKeys res_var = (*val->contents.result);
386 uint64_t res_ref = 0;
387 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
388 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
389 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 uint64_t err_ref = 0;
397 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
398 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
399 err_ref = (uint64_t)err_var.inner & ~1;
402 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
403 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
405 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
406 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
407 CHECK(val->result_ok);
408 LDKChannelPublicKeys res_var = (*val->contents.result);
409 uint64_t res_ref = 0;
410 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
411 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
412 res_ref = (uint64_t)res_var.inner & ~1;
415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
416 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
417 CHECK(!val->result_ok);
418 LDKDecodeError err_var = (*val->contents.err);
419 uint64_t err_ref = 0;
420 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
421 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
422 err_ref = (uint64_t)err_var.inner & ~1;
425 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
426 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
428 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
429 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
430 CHECK(val->result_ok);
431 LDKTxCreationKeys res_var = (*val->contents.result);
432 uint64_t res_ref = 0;
433 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
434 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
435 res_ref = (uint64_t)res_var.inner & ~1;
438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
439 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
440 CHECK(!val->result_ok);
441 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
444 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
445 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
447 case LDKCOption_u32Z_Some: {
448 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
450 case LDKCOption_u32Z_None: {
451 return 0 /* LDKCOption_u32Z - None */;
456 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
457 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
460 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
461 CHECK(val->result_ok);
462 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
463 uint64_t res_ref = 0;
464 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
465 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
466 res_ref = (uint64_t)res_var.inner & ~1;
469 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
470 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
471 CHECK(!val->result_ok);
472 LDKDecodeError err_var = (*val->contents.err);
473 uint64_t err_ref = 0;
474 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
475 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
476 err_ref = (uint64_t)err_var.inner & ~1;
479 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
480 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
482 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
483 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
484 CHECK(val->result_ok);
485 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
486 uint64_t res_ref = 0;
487 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
488 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
489 res_ref = (uint64_t)res_var.inner & ~1;
492 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
493 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
494 CHECK(!val->result_ok);
495 LDKDecodeError err_var = (*val->contents.err);
496 uint64_t err_ref = 0;
497 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
498 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
499 err_ref = (uint64_t)err_var.inner & ~1;
502 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
503 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
505 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
506 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
507 CHECK(val->result_ok);
508 LDKChannelTransactionParameters res_var = (*val->contents.result);
509 uint64_t res_ref = 0;
510 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
511 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
512 res_ref = (uint64_t)res_var.inner & ~1;
515 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
516 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
517 CHECK(!val->result_ok);
518 LDKDecodeError err_var = (*val->contents.err);
519 uint64_t err_ref = 0;
520 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
521 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
522 err_ref = (uint64_t)err_var.inner & ~1;
525 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
526 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
529 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
530 CHECK(val->result_ok);
531 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
532 uint64_t res_ref = 0;
533 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
534 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
535 res_ref = (uint64_t)res_var.inner & ~1;
538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
539 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
540 CHECK(!val->result_ok);
541 LDKDecodeError err_var = (*val->contents.err);
542 uint64_t err_ref = 0;
543 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
544 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
545 err_ref = (uint64_t)err_var.inner & ~1;
548 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
549 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
551 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
552 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
553 CHECK(val->result_ok);
554 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
555 uint64_t res_ref = 0;
556 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
557 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
558 res_ref = (uint64_t)res_var.inner & ~1;
561 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
562 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
563 CHECK(!val->result_ok);
564 LDKDecodeError err_var = (*val->contents.err);
565 uint64_t err_ref = 0;
566 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
567 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
568 err_ref = (uint64_t)err_var.inner & ~1;
571 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
572 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
574 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
575 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
576 CHECK(val->result_ok);
577 LDKTrustedClosingTransaction res_var = (*val->contents.result);
578 uint64_t res_ref = 0;
579 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
580 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
581 res_ref = (uint64_t)res_var.inner & ~1;
584 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
585 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
586 CHECK(!val->result_ok);
587 return *val->contents.err;
589 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
590 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
592 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
593 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
594 CHECK(val->result_ok);
595 LDKCommitmentTransaction res_var = (*val->contents.result);
596 uint64_t res_ref = 0;
597 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
598 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
599 res_ref = (uint64_t)res_var.inner & ~1;
602 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
603 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
604 CHECK(!val->result_ok);
605 LDKDecodeError err_var = (*val->contents.err);
606 uint64_t err_ref = 0;
607 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
608 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
609 err_ref = (uint64_t)err_var.inner & ~1;
612 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
613 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
615 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
616 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
617 CHECK(val->result_ok);
618 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
619 uint64_t res_ref = 0;
620 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
621 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
622 res_ref = (uint64_t)res_var.inner & ~1;
625 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
626 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
627 CHECK(!val->result_ok);
628 return *val->contents.err;
630 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
631 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
633 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
634 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
635 CHECK(val->result_ok);
636 LDKCVec_SignatureZ res_var = (*val->contents.result);
637 ptrArray res_arr = NULL;
638 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
639 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
640 for (size_t m = 0; m < res_var.datalen; m++) {
641 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
642 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
643 res_arr_ptr[m] = res_conv_12_arr;
648 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
649 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
650 CHECK(!val->result_ok);
651 return *val->contents.err;
653 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
654 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
656 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
657 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
658 CHECK(val->result_ok);
659 LDKShutdownScript res_var = (*val->contents.result);
660 uint64_t res_ref = 0;
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 res_ref = (uint64_t)res_var.inner & ~1;
666 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
667 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
668 CHECK(!val->result_ok);
669 LDKDecodeError err_var = (*val->contents.err);
670 uint64_t err_ref = 0;
671 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
672 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
673 err_ref = (uint64_t)err_var.inner & ~1;
676 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
677 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
679 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
680 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
681 CHECK(val->result_ok);
682 LDKShutdownScript res_var = (*val->contents.result);
683 uint64_t res_ref = 0;
684 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
685 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
686 res_ref = (uint64_t)res_var.inner & ~1;
689 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
690 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
691 CHECK(!val->result_ok);
692 LDKInvalidShutdownScript err_var = (*val->contents.err);
693 uint64_t err_ref = 0;
694 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
695 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
696 err_ref = (uint64_t)err_var.inner & ~1;
699 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
700 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
702 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
703 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
704 CHECK(val->result_ok);
705 return *val->contents.result;
707 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
708 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
709 CHECK(!val->result_ok);
710 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
713 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
714 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
716 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
717 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
718 CHECK(val->result_ok);
719 LDKRouteHop res_var = (*val->contents.result);
720 uint64_t res_ref = 0;
721 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
722 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
723 res_ref = (uint64_t)res_var.inner & ~1;
726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
727 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
728 CHECK(!val->result_ok);
729 LDKDecodeError err_var = (*val->contents.err);
730 uint64_t err_ref = 0;
731 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
732 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
733 err_ref = (uint64_t)err_var.inner & ~1;
736 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
737 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
738 ret->datalen = *((uint32_t*)elems);
739 if (ret->datalen == 0) {
742 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
743 uint32_t *java_elems = (uint32_t*)(elems + 4);
744 for (size_t i = 0; i < ret->datalen; i++) {
745 uint32_t arr_elem = java_elems[i];
746 LDKRouteHop arr_elem_conv;
747 arr_elem_conv.inner = (void*)(arr_elem & (~1));
748 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
749 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
750 ret->data[i] = arr_elem_conv;
753 return (uint64_t)ret;
755 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
756 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
757 for (size_t i = 0; i < ret.datalen; i++) {
758 ret.data[i] = RouteHop_clone(&orig->data[i]);
762 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
763 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
764 for (size_t i = 0; i < ret.datalen; i++) {
765 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
769 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
770 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
772 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
773 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
774 CHECK(val->result_ok);
775 LDKRoute res_var = (*val->contents.result);
776 uint64_t res_ref = 0;
777 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
778 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
779 res_ref = (uint64_t)res_var.inner & ~1;
782 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
783 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
784 CHECK(!val->result_ok);
785 LDKDecodeError err_var = (*val->contents.err);
786 uint64_t err_ref = 0;
787 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 err_ref = (uint64_t)err_var.inner & ~1;
792 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_result_ok(uint32_t arg) {
793 return ((LDKCResult_RouteParametersDecodeErrorZ*)arg)->result_ok;
795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_ok(uint32_t arg) {
796 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
797 CHECK(val->result_ok);
798 LDKRouteParameters res_var = (*val->contents.result);
799 uint64_t res_ref = 0;
800 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
801 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
802 res_ref = (uint64_t)res_var.inner & ~1;
805 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteParametersDecodeErrorZ_get_err(uint32_t arg) {
806 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
807 CHECK(!val->result_ok);
808 LDKDecodeError err_var = (*val->contents.err);
809 uint64_t err_ref = 0;
810 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
811 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
812 err_ref = (uint64_t)err_var.inner & ~1;
815 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
816 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
817 ret->datalen = *((uint32_t*)elems);
818 if (ret->datalen == 0) {
821 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
822 uint32_t *java_elems = (uint32_t*)(elems + 4);
823 for (size_t i = 0; i < ret->datalen; i++) {
824 uint32_t arr_elem = java_elems[i];
825 LDKRouteHint arr_elem_conv;
826 arr_elem_conv.inner = (void*)(arr_elem & (~1));
827 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
828 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
829 ret->data[i] = arr_elem_conv;
832 return (uint64_t)ret;
834 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
835 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
836 for (size_t i = 0; i < ret.datalen; i++) {
837 ret.data[i] = RouteHint_clone(&orig->data[i]);
841 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
842 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
844 case LDKCOption_u64Z_Some: {
845 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
847 case LDKCOption_u64Z_None: {
848 return 0 /* LDKCOption_u64Z - None */;
853 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_result_ok(uint32_t arg) {
854 return ((LDKCResult_PayeeDecodeErrorZ*)arg)->result_ok;
856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_ok(uint32_t arg) {
857 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
858 CHECK(val->result_ok);
859 LDKPayee res_var = (*val->contents.result);
860 uint64_t res_ref = 0;
861 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
862 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
863 res_ref = (uint64_t)res_var.inner & ~1;
866 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeeDecodeErrorZ_get_err(uint32_t arg) {
867 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
868 CHECK(!val->result_ok);
869 LDKDecodeError err_var = (*val->contents.err);
870 uint64_t err_ref = 0;
871 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
872 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
873 err_ref = (uint64_t)err_var.inner & ~1;
876 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintHopZ_new(uint32_tArray elems) {
877 LDKCVec_RouteHintHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHintHopZ), "LDKCVec_RouteHintHopZ");
878 ret->datalen = *((uint32_t*)elems);
879 if (ret->datalen == 0) {
882 ret->data = MALLOC(sizeof(LDKRouteHintHop) * ret->datalen, "LDKCVec_RouteHintHopZ Data");
883 uint32_t *java_elems = (uint32_t*)(elems + 4);
884 for (size_t i = 0; i < ret->datalen; i++) {
885 uint32_t arr_elem = java_elems[i];
886 LDKRouteHintHop arr_elem_conv;
887 arr_elem_conv.inner = (void*)(arr_elem & (~1));
888 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
889 arr_elem_conv = RouteHintHop_clone(&arr_elem_conv);
890 ret->data[i] = arr_elem_conv;
893 return (uint64_t)ret;
895 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
896 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
897 for (size_t i = 0; i < ret.datalen; i++) {
898 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
902 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_result_ok(uint32_t arg) {
903 return ((LDKCResult_RouteHintDecodeErrorZ*)arg)->result_ok;
905 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_ok(uint32_t arg) {
906 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
907 CHECK(val->result_ok);
908 LDKRouteHint res_var = (*val->contents.result);
909 uint64_t res_ref = 0;
910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 res_ref = (uint64_t)res_var.inner & ~1;
915 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintDecodeErrorZ_get_err(uint32_t arg) {
916 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
917 CHECK(!val->result_ok);
918 LDKDecodeError err_var = (*val->contents.err);
919 uint64_t err_ref = 0;
920 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
921 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
922 err_ref = (uint64_t)err_var.inner & ~1;
925 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_result_ok(uint32_t arg) {
926 return ((LDKCResult_RouteHintHopDecodeErrorZ*)arg)->result_ok;
928 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t arg) {
929 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
930 CHECK(val->result_ok);
931 LDKRouteHintHop res_var = (*val->contents.result);
932 uint64_t res_ref = 0;
933 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
934 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
935 res_ref = (uint64_t)res_var.inner & ~1;
938 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHintHopDecodeErrorZ_get_err(uint32_t arg) {
939 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
940 CHECK(!val->result_ok);
941 LDKDecodeError err_var = (*val->contents.err);
942 uint64_t err_ref = 0;
943 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 err_ref = (uint64_t)err_var.inner & ~1;
948 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
949 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
950 ret->datalen = *((uint32_t*)elems);
951 if (ret->datalen == 0) {
954 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
955 uint32_t *java_elems = (uint32_t*)(elems + 4);
956 for (size_t i = 0; i < ret->datalen; i++) {
957 uint32_t arr_elem = java_elems[i];
958 LDKChannelDetails arr_elem_conv;
959 arr_elem_conv.inner = (void*)(arr_elem & (~1));
960 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
961 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
962 ret->data[i] = arr_elem_conv;
965 return (uint64_t)ret;
967 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
968 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
969 for (size_t i = 0; i < ret.datalen; i++) {
970 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
974 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
975 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
977 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
978 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
979 CHECK(val->result_ok);
980 LDKRoute res_var = (*val->contents.result);
981 uint64_t res_ref = 0;
982 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 res_ref = (uint64_t)res_var.inner & ~1;
987 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
988 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
989 CHECK(!val->result_ok);
990 LDKLightningError err_var = (*val->contents.err);
991 uint64_t err_ref = 0;
992 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
993 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
994 err_ref = (uint64_t)err_var.inner & ~1;
997 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
998 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1000 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
1001 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1002 CHECK(val->result_ok);
1003 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1004 return (uint64_t)res_ref;
1006 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
1007 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1008 CHECK(!val->result_ok);
1009 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
1012 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1015 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
1016 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1017 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1021 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1024 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
1025 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1026 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1027 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1028 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1029 Transaction_free(ret_var);
1033 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1034 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1035 ret->datalen = *((uint32_t*)elems);
1036 if (ret->datalen == 0) {
1039 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1040 uint32_t *java_elems = (uint32_t*)(elems + 4);
1041 for (size_t i = 0; i < ret->datalen; i++) {
1042 uint32_t arr_elem = java_elems[i];
1043 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1044 CHECK_ACCESS(arr_elem_ptr);
1045 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(arr_elem_ptr);
1046 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1047 ret->data[i] = arr_elem_conv;
1050 return (uint64_t)ret;
1052 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1053 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1054 for (size_t i = 0; i < ret.datalen; i++) {
1055 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1059 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1060 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1061 for (size_t i = 0; i < ret.datalen; i++) {
1062 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1066 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1067 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1069 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1070 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1071 CHECK(val->result_ok);
1072 return *val->contents.result;
1074 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1075 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1076 CHECK(!val->result_ok);
1077 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1080 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1081 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1083 case LDKMonitorEvent_HTLCEvent: {
1084 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1085 uint64_t htlc_event_ref = 0;
1086 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1087 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1088 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1089 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
1091 case LDKMonitorEvent_CommitmentTxConfirmed: {
1092 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1093 uint64_t commitment_tx_confirmed_ref = 0;
1094 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1095 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1096 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1097 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
1099 case LDKMonitorEvent_UpdateCompleted: {
1100 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1101 uint64_t funding_txo_ref = 0;
1102 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1103 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1104 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1105 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
1107 case LDKMonitorEvent_UpdateFailed: {
1108 LDKOutPoint update_failed_var = obj->update_failed;
1109 uint64_t update_failed_ref = 0;
1110 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1113 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
1118 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1119 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1120 ret->datalen = *((uint32_t*)elems);
1121 if (ret->datalen == 0) {
1124 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1125 uint32_t *java_elems = (uint32_t*)(elems + 4);
1126 for (size_t i = 0; i < ret->datalen; i++) {
1127 uint32_t arr_elem = java_elems[i];
1128 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1129 CHECK_ACCESS(arr_elem_ptr);
1130 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(arr_elem_ptr);
1131 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1132 ret->data[i] = arr_elem_conv;
1135 return (uint64_t)ret;
1137 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1138 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1139 for (size_t i = 0; i < ret.datalen; i++) {
1140 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1144 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
1145 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1147 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1148 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1149 *some_conv = obj->some;
1150 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1151 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
1153 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1154 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
1159 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1160 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1162 case LDKNetworkUpdate_ChannelUpdateMessage: {
1163 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1164 uint64_t msg_ref = 0;
1165 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1166 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1167 msg_ref = (uint64_t)msg_var.inner & ~1;
1168 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1170 case LDKNetworkUpdate_ChannelClosed: {
1171 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1173 case LDKNetworkUpdate_NodeFailure: {
1174 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1175 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1176 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1181 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1182 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1184 case LDKCOption_NetworkUpdateZ_Some: {
1185 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1186 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1188 case LDKCOption_NetworkUpdateZ_None: {
1189 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1194 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1195 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1197 case LDKSpendableOutputDescriptor_StaticOutput: {
1198 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1199 uint64_t outpoint_ref = 0;
1200 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1201 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1202 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1203 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1204 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1206 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1207 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1208 uint64_t delayed_payment_output_ref = 0;
1209 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1210 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1211 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1212 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1214 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1215 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1216 uint64_t static_payment_output_ref = 0;
1217 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1218 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1219 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1220 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1225 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1226 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1227 ret->datalen = *((uint32_t*)elems);
1228 if (ret->datalen == 0) {
1231 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1232 uint32_t *java_elems = (uint32_t*)(elems + 4);
1233 for (size_t i = 0; i < ret->datalen; i++) {
1234 uint32_t arr_elem = java_elems[i];
1235 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1236 CHECK_ACCESS(arr_elem_ptr);
1237 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(arr_elem_ptr);
1238 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1239 ret->data[i] = arr_elem_conv;
1242 return (uint64_t)ret;
1244 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1245 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1246 for (size_t i = 0; i < ret.datalen; i++) {
1247 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1251 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1252 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1254 case LDKErrorAction_DisconnectPeer: {
1255 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1256 uint64_t msg_ref = 0;
1257 if ((uint64_t)msg_var.inner > 4096) {
1258 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1259 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1260 msg_ref = (uint64_t)msg_var.inner & ~1;
1262 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1264 case LDKErrorAction_IgnoreError: {
1265 return 0 /* LDKErrorAction - IgnoreError */;
1267 case LDKErrorAction_IgnoreAndLog: {
1268 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1269 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1271 case LDKErrorAction_SendErrorMessage: {
1272 LDKErrorMessage msg_var = obj->send_error_message.msg;
1273 uint64_t msg_ref = 0;
1274 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1275 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1276 msg_ref = (uint64_t)msg_var.inner & ~1;
1277 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1282 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1283 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1285 case LDKMessageSendEvent_SendAcceptChannel: {
1286 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1287 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1288 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1289 uint64_t msg_ref = 0;
1290 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1291 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1292 msg_ref = (uint64_t)msg_var.inner & ~1;
1293 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1295 case LDKMessageSendEvent_SendOpenChannel: {
1296 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1297 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1298 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1299 uint64_t msg_ref = 0;
1300 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1301 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1302 msg_ref = (uint64_t)msg_var.inner & ~1;
1303 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1305 case LDKMessageSendEvent_SendFundingCreated: {
1306 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1307 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1308 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1309 uint64_t msg_ref = 0;
1310 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1311 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1312 msg_ref = (uint64_t)msg_var.inner & ~1;
1313 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1315 case LDKMessageSendEvent_SendFundingSigned: {
1316 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1317 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1318 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1319 uint64_t msg_ref = 0;
1320 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1321 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1322 msg_ref = (uint64_t)msg_var.inner & ~1;
1323 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1325 case LDKMessageSendEvent_SendFundingLocked: {
1326 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1327 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1328 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1329 uint64_t msg_ref = 0;
1330 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1331 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1332 msg_ref = (uint64_t)msg_var.inner & ~1;
1333 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1335 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1336 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1337 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1338 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1339 uint64_t msg_ref = 0;
1340 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1341 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1342 msg_ref = (uint64_t)msg_var.inner & ~1;
1343 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1345 case LDKMessageSendEvent_UpdateHTLCs: {
1346 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1347 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1348 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1349 uint64_t updates_ref = 0;
1350 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1352 updates_ref = (uint64_t)updates_var.inner & ~1;
1353 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1355 case LDKMessageSendEvent_SendRevokeAndACK: {
1356 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1357 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1358 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1359 uint64_t msg_ref = 0;
1360 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1361 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1362 msg_ref = (uint64_t)msg_var.inner & ~1;
1363 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1365 case LDKMessageSendEvent_SendClosingSigned: {
1366 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1367 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1368 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1369 uint64_t msg_ref = 0;
1370 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1371 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1372 msg_ref = (uint64_t)msg_var.inner & ~1;
1373 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1375 case LDKMessageSendEvent_SendShutdown: {
1376 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1377 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1378 LDKShutdown msg_var = obj->send_shutdown.msg;
1379 uint64_t msg_ref = 0;
1380 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1381 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1382 msg_ref = (uint64_t)msg_var.inner & ~1;
1383 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1385 case LDKMessageSendEvent_SendChannelReestablish: {
1386 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1387 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1388 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1389 uint64_t msg_ref = 0;
1390 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1391 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1392 msg_ref = (uint64_t)msg_var.inner & ~1;
1393 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1395 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1396 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1397 uint64_t msg_ref = 0;
1398 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1399 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 msg_ref = (uint64_t)msg_var.inner & ~1;
1401 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1402 uint64_t update_msg_ref = 0;
1403 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1404 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1405 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1406 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1408 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1409 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1410 uint64_t msg_ref = 0;
1411 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1412 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1413 msg_ref = (uint64_t)msg_var.inner & ~1;
1414 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1416 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1417 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1418 uint64_t msg_ref = 0;
1419 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 msg_ref = (uint64_t)msg_var.inner & ~1;
1422 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1424 case LDKMessageSendEvent_SendChannelUpdate: {
1425 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1426 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1427 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1428 uint64_t msg_ref = 0;
1429 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1430 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1431 msg_ref = (uint64_t)msg_var.inner & ~1;
1432 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1434 case LDKMessageSendEvent_HandleError: {
1435 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1436 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1437 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1438 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1440 case LDKMessageSendEvent_SendChannelRangeQuery: {
1441 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1442 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1443 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1444 uint64_t msg_ref = 0;
1445 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1446 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1447 msg_ref = (uint64_t)msg_var.inner & ~1;
1448 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1450 case LDKMessageSendEvent_SendShortIdsQuery: {
1451 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1452 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1453 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1454 uint64_t msg_ref = 0;
1455 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1456 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1457 msg_ref = (uint64_t)msg_var.inner & ~1;
1458 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1460 case LDKMessageSendEvent_SendReplyChannelRange: {
1461 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1462 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1463 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1464 uint64_t msg_ref = 0;
1465 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1466 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1467 msg_ref = (uint64_t)msg_var.inner & ~1;
1468 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1473 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1474 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1475 ret->datalen = *((uint32_t*)elems);
1476 if (ret->datalen == 0) {
1479 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1480 uint32_t *java_elems = (uint32_t*)(elems + 4);
1481 for (size_t i = 0; i < ret->datalen; i++) {
1482 uint32_t arr_elem = java_elems[i];
1483 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1484 CHECK_ACCESS(arr_elem_ptr);
1485 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(arr_elem_ptr);
1486 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1487 ret->data[i] = arr_elem_conv;
1490 return (uint64_t)ret;
1492 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1493 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1494 for (size_t i = 0; i < ret.datalen; i++) {
1495 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1499 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1500 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1502 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1503 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1504 CHECK(val->result_ok);
1505 LDKInitFeatures res_var = (*val->contents.result);
1506 uint64_t res_ref = 0;
1507 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1508 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1509 res_ref = (uint64_t)res_var.inner & ~1;
1512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1513 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1514 CHECK(!val->result_ok);
1515 LDKDecodeError err_var = (*val->contents.err);
1516 uint64_t err_ref = 0;
1517 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1518 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1519 err_ref = (uint64_t)err_var.inner & ~1;
1522 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1523 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1526 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1527 CHECK(val->result_ok);
1528 LDKNodeFeatures res_var = (*val->contents.result);
1529 uint64_t res_ref = 0;
1530 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1531 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1532 res_ref = (uint64_t)res_var.inner & ~1;
1535 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1536 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1537 CHECK(!val->result_ok);
1538 LDKDecodeError err_var = (*val->contents.err);
1539 uint64_t err_ref = 0;
1540 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1541 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1542 err_ref = (uint64_t)err_var.inner & ~1;
1545 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1546 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1548 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1549 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1550 CHECK(val->result_ok);
1551 LDKChannelFeatures res_var = (*val->contents.result);
1552 uint64_t res_ref = 0;
1553 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1554 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1555 res_ref = (uint64_t)res_var.inner & ~1;
1558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1559 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1560 CHECK(!val->result_ok);
1561 LDKDecodeError err_var = (*val->contents.err);
1562 uint64_t err_ref = 0;
1563 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1564 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1565 err_ref = (uint64_t)err_var.inner & ~1;
1568 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1569 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1571 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1572 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1573 CHECK(val->result_ok);
1574 LDKInvoiceFeatures res_var = (*val->contents.result);
1575 uint64_t res_ref = 0;
1576 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1577 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1578 res_ref = (uint64_t)res_var.inner & ~1;
1581 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1582 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1583 CHECK(!val->result_ok);
1584 LDKDecodeError err_var = (*val->contents.err);
1585 uint64_t err_ref = 0;
1586 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1587 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1588 err_ref = (uint64_t)err_var.inner & ~1;
1591 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_result_ok(uint32_t arg) {
1592 return ((LDKCResult_ScoringParametersDecodeErrorZ*)arg)->result_ok;
1594 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) {
1595 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1596 CHECK(val->result_ok);
1597 LDKScoringParameters res_var = (*val->contents.result);
1598 uint64_t res_ref = 0;
1599 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1600 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1601 res_ref = (uint64_t)res_var.inner & ~1;
1604 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) {
1605 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
1606 CHECK(!val->result_ok);
1607 LDKDecodeError err_var = (*val->contents.err);
1608 uint64_t err_ref = 0;
1609 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1610 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1611 err_ref = (uint64_t)err_var.inner & ~1;
1614 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_result_ok(uint32_t arg) {
1615 return ((LDKCResult_ScorerDecodeErrorZ*)arg)->result_ok;
1617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) {
1618 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1619 CHECK(val->result_ok);
1620 LDKScorer res_var = (*val->contents.result);
1621 uint64_t res_ref = 0;
1622 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1623 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1624 res_ref = (uint64_t)res_var.inner & ~1;
1627 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) {
1628 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
1629 CHECK(!val->result_ok);
1630 LDKDecodeError err_var = (*val->contents.err);
1631 uint64_t err_ref = 0;
1632 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1633 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1634 err_ref = (uint64_t)err_var.inner & ~1;
1637 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1638 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1640 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1641 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1642 CHECK(val->result_ok);
1643 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1644 uint64_t res_ref = 0;
1645 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1646 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1647 res_ref = (uint64_t)res_var.inner & ~1;
1650 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1651 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1652 CHECK(!val->result_ok);
1653 LDKDecodeError err_var = (*val->contents.err);
1654 uint64_t err_ref = 0;
1655 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1656 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1657 err_ref = (uint64_t)err_var.inner & ~1;
1660 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1661 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1663 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1664 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1665 CHECK(val->result_ok);
1666 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1667 uint64_t res_ref = 0;
1668 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1669 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1670 res_ref = (uint64_t)res_var.inner & ~1;
1673 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1674 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1675 CHECK(!val->result_ok);
1676 LDKDecodeError err_var = (*val->contents.err);
1677 uint64_t err_ref = 0;
1678 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1679 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1680 err_ref = (uint64_t)err_var.inner & ~1;
1683 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1684 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1686 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1687 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1688 CHECK(val->result_ok);
1689 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1692 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1693 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1694 CHECK(!val->result_ok);
1695 LDKDecodeError err_var = (*val->contents.err);
1696 uint64_t err_ref = 0;
1697 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1698 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1699 err_ref = (uint64_t)err_var.inner & ~1;
1702 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1703 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1705 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1706 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1707 CHECK(val->result_ok);
1708 return *val->contents.result;
1710 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1711 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1712 CHECK(!val->result_ok);
1713 return *val->contents.err;
1715 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1718 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1719 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1720 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1721 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1725 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1728 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1729 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1730 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1731 ptrArray ret_arr = NULL;
1732 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1733 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1734 for (size_t m = 0; m < ret_var.datalen; m++) {
1735 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1736 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1737 ret_arr_ptr[m] = ret_conv_12_arr;
1744 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1745 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1748 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1749 CHECK(val->result_ok);
1750 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1751 *res_conv = (*val->contents.result);
1752 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1753 return ((uint64_t)res_conv);
1755 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1756 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1757 CHECK(!val->result_ok);
1758 return *val->contents.err;
1760 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1761 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1763 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1764 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1765 CHECK(val->result_ok);
1766 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1767 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1770 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1771 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1772 CHECK(!val->result_ok);
1773 return *val->contents.err;
1775 typedef struct LDKBaseSign_JCalls {
1776 atomic_size_t refcnt;
1777 uint32_t get_per_commitment_point_meth;
1778 uint32_t release_commitment_secret_meth;
1779 uint32_t validate_holder_commitment_meth;
1780 uint32_t channel_keys_id_meth;
1781 uint32_t sign_counterparty_commitment_meth;
1782 uint32_t validate_counterparty_revocation_meth;
1783 uint32_t sign_holder_commitment_and_htlcs_meth;
1784 uint32_t sign_justice_revoked_output_meth;
1785 uint32_t sign_justice_revoked_htlc_meth;
1786 uint32_t sign_counterparty_htlc_transaction_meth;
1787 uint32_t sign_closing_transaction_meth;
1788 uint32_t sign_channel_announcement_meth;
1789 uint32_t ready_channel_meth;
1790 } LDKBaseSign_JCalls;
1791 static void LDKBaseSign_JCalls_free(void* this_arg) {
1792 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1793 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1794 js_free(j_calls->get_per_commitment_point_meth);
1795 js_free(j_calls->release_commitment_secret_meth);
1796 js_free(j_calls->validate_holder_commitment_meth);
1797 js_free(j_calls->channel_keys_id_meth);
1798 js_free(j_calls->sign_counterparty_commitment_meth);
1799 js_free(j_calls->validate_counterparty_revocation_meth);
1800 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1801 js_free(j_calls->sign_justice_revoked_output_meth);
1802 js_free(j_calls->sign_justice_revoked_htlc_meth);
1803 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1804 js_free(j_calls->sign_closing_transaction_meth);
1805 js_free(j_calls->sign_channel_announcement_meth);
1806 js_free(j_calls->ready_channel_meth);
1810 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1811 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1812 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1813 LDKPublicKey ret_ref;
1814 CHECK(*((uint32_t*)ret) == 33);
1815 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1818 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1819 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1820 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1821 LDKThirtyTwoBytes ret_ref;
1822 CHECK(*((uint32_t*)ret) == 32);
1823 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1826 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1827 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1828 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1829 uint64_t holder_tx_ref = 0;
1830 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1831 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1832 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1833 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1834 if (holder_tx_var.is_owned) {
1837 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1838 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1839 CHECK_ACCESS(ret_ptr);
1840 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1841 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1844 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1845 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1846 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1847 LDKThirtyTwoBytes ret_ref;
1848 CHECK(*((uint32_t*)ret) == 32);
1849 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1852 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1853 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1854 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1855 uint64_t commitment_tx_ref = 0;
1856 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1857 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1858 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1859 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1860 if (commitment_tx_var.is_owned) {
1861 commitment_tx_ref |= 1;
1863 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1864 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1865 CHECK_ACCESS(ret_ptr);
1866 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1867 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1870 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1871 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1872 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1873 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1874 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1875 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1876 CHECK_ACCESS(ret_ptr);
1877 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1878 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1881 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1882 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1883 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1884 uint64_t commitment_tx_ref = 0;
1885 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1886 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1889 if (commitment_tx_var.is_owned) {
1890 commitment_tx_ref |= 1;
1892 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1893 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1894 CHECK_ACCESS(ret_ptr);
1895 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1896 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1899 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]) {
1900 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1901 LDKTransaction justice_tx_var = justice_tx;
1902 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1903 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1904 Transaction_free(justice_tx_var);
1905 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1906 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1907 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1908 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1909 CHECK_ACCESS(ret_ptr);
1910 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1911 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1914 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) {
1915 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1916 LDKTransaction justice_tx_var = justice_tx;
1917 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1918 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1919 Transaction_free(justice_tx_var);
1920 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1921 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1922 LDKHTLCOutputInCommitment htlc_var = *htlc;
1923 uint64_t htlc_ref = 0;
1924 htlc_var = HTLCOutputInCommitment_clone(htlc);
1925 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1926 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1927 htlc_ref = (uint64_t)htlc_var.inner;
1928 if (htlc_var.is_owned) {
1931 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);
1932 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1933 CHECK_ACCESS(ret_ptr);
1934 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1935 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1938 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) {
1939 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1940 LDKTransaction htlc_tx_var = htlc_tx;
1941 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1942 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1943 Transaction_free(htlc_tx_var);
1944 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1945 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1946 LDKHTLCOutputInCommitment htlc_var = *htlc;
1947 uint64_t htlc_ref = 0;
1948 htlc_var = HTLCOutputInCommitment_clone(htlc);
1949 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1950 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1951 htlc_ref = (uint64_t)htlc_var.inner;
1952 if (htlc_var.is_owned) {
1955 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);
1956 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1957 CHECK_ACCESS(ret_ptr);
1958 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1959 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1962 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1963 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1964 LDKClosingTransaction closing_tx_var = *closing_tx;
1965 uint64_t closing_tx_ref = 0;
1966 closing_tx_var = ClosingTransaction_clone(closing_tx);
1967 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 closing_tx_ref = (uint64_t)closing_tx_var.inner;
1970 if (closing_tx_var.is_owned) {
1971 closing_tx_ref |= 1;
1973 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1974 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1975 CHECK_ACCESS(ret_ptr);
1976 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1977 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1980 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1981 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1982 LDKUnsignedChannelAnnouncement msg_var = *msg;
1983 uint64_t msg_ref = 0;
1984 msg_var = UnsignedChannelAnnouncement_clone(msg);
1985 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1986 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1987 msg_ref = (uint64_t)msg_var.inner;
1988 if (msg_var.is_owned) {
1991 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1992 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1993 CHECK_ACCESS(ret_ptr);
1994 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1995 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1998 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1999 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2000 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2001 uint64_t channel_parameters_ref = 0;
2002 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2003 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2004 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2005 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2006 if (channel_parameters_var.is_owned) {
2007 channel_parameters_ref |= 1;
2009 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
2011 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2012 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2013 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2015 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2016 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2017 atomic_init(&calls->refcnt, 1);
2018 //TODO: Assign calls->o from o
2020 LDKChannelPublicKeys pubkeys_conv;
2021 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2022 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2023 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2026 .this_arg = (void*) calls,
2027 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2028 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2029 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2030 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2031 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2032 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2033 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2034 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2035 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2036 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2037 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2038 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2039 .ready_channel = ready_channel_LDKBaseSign_jcall,
2040 .free = LDKBaseSign_JCalls_free,
2041 .pubkeys = pubkeys_conv,
2042 .set_pubkeys = NULL,
2046 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
2047 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2048 *res_ptr = LDKBaseSign_init(o, pubkeys);
2049 return (long)res_ptr;
2051 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2052 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2053 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2054 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2055 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2056 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2060 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2061 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2062 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2063 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2064 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2065 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2069 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2070 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2071 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2072 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2073 LDKHolderCommitmentTransaction holder_tx_conv;
2074 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2075 holder_tx_conv.is_owned = false;
2076 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2077 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2078 return (uint64_t)ret_conv;
2081 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2082 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2083 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2084 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2085 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2086 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2090 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2091 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2092 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2093 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2094 LDKCommitmentTransaction commitment_tx_conv;
2095 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2096 commitment_tx_conv.is_owned = false;
2097 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2098 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2099 return (uint64_t)ret_conv;
2102 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2103 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2104 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2105 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2106 unsigned char secret_arr[32];
2107 CHECK(*((uint32_t*)secret) == 32);
2108 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
2109 unsigned char (*secret_ref)[32] = &secret_arr;
2110 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2111 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2112 return (uint64_t)ret_conv;
2115 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2116 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2117 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2118 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2119 LDKHolderCommitmentTransaction commitment_tx_conv;
2120 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2121 commitment_tx_conv.is_owned = false;
2122 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2123 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2124 return (uint64_t)ret_conv;
2127 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) {
2128 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2129 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2130 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2131 LDKTransaction justice_tx_ref;
2132 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2133 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2134 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2135 justice_tx_ref.data_is_owned = true;
2136 unsigned char per_commitment_key_arr[32];
2137 CHECK(*((uint32_t*)per_commitment_key) == 32);
2138 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2139 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2140 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2141 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2142 return (uint64_t)ret_conv;
2145 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) {
2146 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2147 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2148 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2149 LDKTransaction justice_tx_ref;
2150 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2151 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2152 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2153 justice_tx_ref.data_is_owned = true;
2154 unsigned char per_commitment_key_arr[32];
2155 CHECK(*((uint32_t*)per_commitment_key) == 32);
2156 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2157 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2158 LDKHTLCOutputInCommitment htlc_conv;
2159 htlc_conv.inner = (void*)(htlc & (~1));
2160 htlc_conv.is_owned = false;
2161 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2162 *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);
2163 return (uint64_t)ret_conv;
2166 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) {
2167 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2168 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2169 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2170 LDKTransaction htlc_tx_ref;
2171 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2172 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2173 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2174 htlc_tx_ref.data_is_owned = true;
2175 LDKPublicKey per_commitment_point_ref;
2176 CHECK(*((uint32_t*)per_commitment_point) == 33);
2177 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2178 LDKHTLCOutputInCommitment htlc_conv;
2179 htlc_conv.inner = (void*)(htlc & (~1));
2180 htlc_conv.is_owned = false;
2181 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2182 *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);
2183 return (uint64_t)ret_conv;
2186 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2187 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2188 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2189 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2190 LDKClosingTransaction closing_tx_conv;
2191 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2192 closing_tx_conv.is_owned = false;
2193 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2194 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2195 return (uint64_t)ret_conv;
2198 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2199 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2200 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2201 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2202 LDKUnsignedChannelAnnouncement msg_conv;
2203 msg_conv.inner = (void*)(msg & (~1));
2204 msg_conv.is_owned = false;
2205 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2206 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2207 return (uint64_t)ret_conv;
2210 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2211 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2212 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2213 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2214 LDKChannelTransactionParameters channel_parameters_conv;
2215 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2216 channel_parameters_conv.is_owned = false;
2217 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2220 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2221 if (this_arg->set_pubkeys != NULL)
2222 this_arg->set_pubkeys(this_arg);
2223 return this_arg->pubkeys;
2225 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2226 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2227 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2228 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2229 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2230 uint64_t ret_ref = 0;
2231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2233 ret_ref = (uint64_t)ret_var.inner;
2234 if (ret_var.is_owned) {
2240 typedef struct LDKSign_JCalls {
2241 atomic_size_t refcnt;
2242 LDKBaseSign_JCalls* BaseSign;
2243 uint32_t write_meth;
2245 static void LDKSign_JCalls_free(void* this_arg) {
2246 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2247 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2248 js_free(j_calls->write_meth);
2252 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2253 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2254 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
2255 LDKCVec_u8Z ret_ref;
2256 ret_ref.datalen = *((uint32_t*)ret);
2257 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2258 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2261 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2262 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2263 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2264 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2266 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2267 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2268 atomic_init(&calls->refcnt, 1);
2269 //TODO: Assign calls->o from o
2271 LDKChannelPublicKeys pubkeys_conv;
2272 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2273 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2274 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2277 .this_arg = (void*) calls,
2278 .write = write_LDKSign_jcall,
2279 .cloned = LDKSign_JCalls_cloned,
2280 .free = LDKSign_JCalls_free,
2281 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2283 calls->BaseSign = ret.BaseSign.this_arg;
2286 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2287 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2288 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2289 return (long)res_ptr;
2291 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2292 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2294 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2295 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2296 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2297 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2298 CVec_u8Z_free(ret_var);
2302 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2303 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2305 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2306 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2307 CHECK(val->result_ok);
2308 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
2309 *res_ret = Sign_clone(&(*val->contents.result));
2310 return (uint64_t)res_ret;
2312 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2313 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2314 CHECK(!val->result_ok);
2315 LDKDecodeError err_var = (*val->contents.err);
2316 uint64_t err_ref = 0;
2317 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2318 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2319 err_ref = (uint64_t)err_var.inner & ~1;
2322 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2323 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2325 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2326 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2327 CHECK(val->result_ok);
2328 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2329 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2332 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2333 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2334 CHECK(!val->result_ok);
2335 return *val->contents.err;
2337 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2338 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2339 for (size_t i = 0; i < ret.datalen; i++) {
2340 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2344 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2345 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2347 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2348 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2349 CHECK(val->result_ok);
2350 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2351 ptrArray res_arr = NULL;
2352 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2353 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2354 for (size_t m = 0; m < res_var.datalen; m++) {
2355 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2356 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2357 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2358 res_arr_ptr[m] = res_conv_12_arr;
2363 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2364 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2365 CHECK(!val->result_ok);
2366 return *val->contents.err;
2368 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2369 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2371 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2372 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2373 CHECK(val->result_ok);
2374 LDKInMemorySigner res_var = (*val->contents.result);
2375 uint64_t res_ref = 0;
2376 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2377 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2378 res_ref = (uint64_t)res_var.inner & ~1;
2381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2382 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2383 CHECK(!val->result_ok);
2384 LDKDecodeError err_var = (*val->contents.err);
2385 uint64_t err_ref = 0;
2386 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2387 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2388 err_ref = (uint64_t)err_var.inner & ~1;
2391 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2392 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2393 ret->datalen = *((uint32_t*)elems);
2394 if (ret->datalen == 0) {
2397 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2398 uint32_t *java_elems = (uint32_t*)(elems + 4);
2399 for (size_t i = 0; i < ret->datalen; i++) {
2400 uint32_t arr_elem = java_elems[i];
2401 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2402 CHECK_ACCESS(arr_elem_ptr);
2403 LDKTxOut arr_elem_conv = *(LDKTxOut*)(arr_elem_ptr);
2404 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2405 ret->data[i] = arr_elem_conv;
2408 return (uint64_t)ret;
2410 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2411 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2412 for (size_t i = 0; i < ret.datalen; i++) {
2413 ret.data[i] = TxOut_clone(&orig->data[i]);
2417 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2418 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2420 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2421 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2422 CHECK(val->result_ok);
2423 LDKTransaction res_var = (*val->contents.result);
2424 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2425 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2428 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2429 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2430 CHECK(!val->result_ok);
2431 return *val->contents.err;
2433 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2434 return ThirtyTwoBytes_clone(&tuple->a);
2436 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2437 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2438 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2439 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2443 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2444 return ChannelMonitor_clone(&tuple->b);
2446 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2447 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2448 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2449 uint64_t ret_ref = 0;
2450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2452 ret_ref = (uint64_t)ret_var.inner;
2453 if (ret_var.is_owned) {
2459 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2460 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2461 ret->datalen = *((uint32_t*)elems);
2462 if (ret->datalen == 0) {
2465 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2466 uint32_t *java_elems = (uint32_t*)(elems + 4);
2467 for (size_t i = 0; i < ret->datalen; i++) {
2468 uint32_t arr_elem = java_elems[i];
2469 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2470 CHECK_ACCESS(arr_elem_ptr);
2471 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(arr_elem_ptr);
2472 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
2473 ret->data[i] = arr_elem_conv;
2476 return (uint64_t)ret;
2478 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2479 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2480 for (size_t i = 0; i < ret.datalen; i++) {
2481 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2485 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2486 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2488 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2489 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2490 CHECK(val->result_ok);
2491 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2492 uint32_tArray res_arr = NULL;
2493 res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2494 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2495 for (size_t j = 0; j < res_var.datalen; j++) {
2496 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2497 *res_conv_35_conv = res_var.data[j];
2498 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2499 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2504 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2505 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2506 CHECK(!val->result_ok);
2507 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2510 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2511 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2513 case LDKCOption_u16Z_Some: {
2514 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2516 case LDKCOption_u16Z_None: {
2517 return 0 /* LDKCOption_u16Z - None */;
2522 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2523 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2525 case LDKAPIError_APIMisuseError: {
2526 LDKStr err_str = obj->api_misuse_error.err;
2527 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2528 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2530 case LDKAPIError_FeeRateTooHigh: {
2531 LDKStr err_str = obj->fee_rate_too_high.err;
2532 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2533 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2535 case LDKAPIError_RouteError: {
2536 LDKStr err_str = obj->route_error.err;
2537 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2538 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2540 case LDKAPIError_ChannelUnavailable: {
2541 LDKStr err_str = obj->channel_unavailable.err;
2542 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2543 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2545 case LDKAPIError_MonitorUpdateFailed: {
2546 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2548 case LDKAPIError_IncompatibleShutdownScript: {
2549 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2550 uint64_t script_ref = 0;
2551 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2552 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2553 script_ref = (uint64_t)script_var.inner & ~1;
2554 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2559 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2560 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2562 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2563 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2564 CHECK(val->result_ok);
2565 return *val->contents.result;
2567 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2568 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2569 CHECK(!val->result_ok);
2570 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2573 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2574 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2575 ret->datalen = *((uint32_t*)elems);
2576 if (ret->datalen == 0) {
2579 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2580 uint32_t *java_elems = (uint32_t*)(elems + 4);
2581 for (size_t i = 0; i < ret->datalen; i++) {
2582 uint32_t arr_elem = java_elems[i];
2583 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2584 CHECK_ACCESS(arr_elem_ptr);
2585 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(arr_elem_ptr);
2586 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2587 ret->data[i] = arr_elem_conv;
2590 return (uint64_t)ret;
2592 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2593 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2594 for (size_t i = 0; i < ret.datalen; i++) {
2595 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2599 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2600 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2601 ret->datalen = *((uint32_t*)elems);
2602 if (ret->datalen == 0) {
2605 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2606 uint32_t *java_elems = (uint32_t*)(elems + 4);
2607 for (size_t i = 0; i < ret->datalen; i++) {
2608 uint32_t arr_elem = java_elems[i];
2609 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2610 CHECK_ACCESS(arr_elem_ptr);
2611 LDKAPIError arr_elem_conv = *(LDKAPIError*)(arr_elem_ptr);
2612 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2613 ret->data[i] = arr_elem_conv;
2616 return (uint64_t)ret;
2618 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2619 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2620 for (size_t i = 0; i < ret.datalen; i++) {
2621 ret.data[i] = APIError_clone(&orig->data[i]);
2625 jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) {
2626 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
2628 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2629 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2630 CHECK(val->result_ok);
2631 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2632 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2636 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2637 CHECK(!val->result_ok);
2638 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2641 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2642 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2644 case LDKPaymentSendFailure_ParameterError: {
2645 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2646 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2648 case LDKPaymentSendFailure_PathParameterError: {
2649 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2650 uint32_tArray path_parameter_error_arr = NULL;
2651 path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2652 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2653 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2654 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2655 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2656 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2657 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2660 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2662 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2663 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2664 uint32_tArray all_failed_retry_safe_arr = NULL;
2665 all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2666 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2667 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2668 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2669 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2672 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2674 case LDKPaymentSendFailure_PartialFailure: {
2675 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
2676 uint32_tArray results_arr = NULL;
2677 results_arr = init_arr(results_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2678 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
2679 for (size_t w = 0; w < results_var.datalen; w++) {
2680 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2681 *results_conv_22_conv = results_var.data[w];
2682 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
2683 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
2686 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
2687 uint64_t failed_paths_retry_ref = 0;
2688 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
2689 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2690 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2691 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
2693 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2694 memcpy((uint8_t*)(payment_id_arr + 4), obj->partial_failure.payment_id.data, 32);
2695 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
2700 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) {
2701 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
2703 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2704 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2705 CHECK(val->result_ok);
2706 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2707 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2710 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2711 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2712 CHECK(!val->result_ok);
2713 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2716 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2717 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2719 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2720 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2721 CHECK(val->result_ok);
2722 return *val->contents.result;
2724 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2725 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2726 CHECK(!val->result_ok);
2727 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2730 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2731 return ThirtyTwoBytes_clone(&tuple->a);
2733 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2734 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2735 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2736 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2740 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2741 return ThirtyTwoBytes_clone(&tuple->b);
2743 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2744 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2745 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2746 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data, 32);
2750 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) {
2751 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
2753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2754 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2755 CHECK(val->result_ok);
2756 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2757 *res_conv = (*val->contents.result);
2758 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2759 return ((uint64_t)res_conv);
2761 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2762 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2763 CHECK(!val->result_ok);
2764 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2767 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2768 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2770 case LDKNetAddress_IPv4: {
2771 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2772 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2773 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2775 case LDKNetAddress_IPv6: {
2776 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2777 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2778 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2780 case LDKNetAddress_OnionV2: {
2781 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2782 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2783 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2785 case LDKNetAddress_OnionV3: {
2786 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2787 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2788 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2793 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2794 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2795 ret->datalen = *((uint32_t*)elems);
2796 if (ret->datalen == 0) {
2799 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2800 uint32_t *java_elems = (uint32_t*)(elems + 4);
2801 for (size_t i = 0; i < ret->datalen; i++) {
2802 uint32_t arr_elem = java_elems[i];
2803 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2804 CHECK_ACCESS(arr_elem_ptr);
2805 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(arr_elem_ptr);
2806 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2807 ret->data[i] = arr_elem_conv;
2810 return (uint64_t)ret;
2812 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2813 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2814 for (size_t i = 0; i < ret.datalen; i++) {
2815 ret.data[i] = NetAddress_clone(&orig->data[i]);
2819 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2820 return ThirtyTwoBytes_clone(&tuple->a);
2822 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2823 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2824 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2825 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2829 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2830 return ThirtyTwoBytes_clone(&tuple->b);
2832 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2833 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2834 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2835 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2839 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2840 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2842 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2843 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2844 CHECK(val->result_ok);
2845 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2846 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2849 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2850 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2851 CHECK(!val->result_ok);
2852 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2855 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2856 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2857 ret->datalen = *((uint32_t*)elems);
2858 if (ret->datalen == 0) {
2861 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2862 uint32_t *java_elems = (uint32_t*)(elems + 4);
2863 for (size_t i = 0; i < ret->datalen; i++) {
2864 uint32_t arr_elem = java_elems[i];
2865 LDKChannelMonitor arr_elem_conv;
2866 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2867 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2868 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2869 ret->data[i] = arr_elem_conv;
2872 return (uint64_t)ret;
2874 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2875 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2876 for (size_t i = 0; i < ret.datalen; i++) {
2877 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2881 typedef struct LDKWatch_JCalls {
2882 atomic_size_t refcnt;
2883 uint32_t watch_channel_meth;
2884 uint32_t update_channel_meth;
2885 uint32_t release_pending_monitor_events_meth;
2887 static void LDKWatch_JCalls_free(void* this_arg) {
2888 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2889 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2890 js_free(j_calls->watch_channel_meth);
2891 js_free(j_calls->update_channel_meth);
2892 js_free(j_calls->release_pending_monitor_events_meth);
2896 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2897 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2898 LDKOutPoint funding_txo_var = funding_txo;
2899 uint64_t funding_txo_ref = 0;
2900 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2901 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2902 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2903 if (funding_txo_var.is_owned) {
2904 funding_txo_ref |= 1;
2906 LDKChannelMonitor monitor_var = monitor;
2907 uint64_t monitor_ref = 0;
2908 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2909 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2910 monitor_ref = (uint64_t)monitor_var.inner;
2911 if (monitor_var.is_owned) {
2914 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2915 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2916 CHECK_ACCESS(ret_ptr);
2917 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2918 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2921 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2922 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2923 LDKOutPoint funding_txo_var = funding_txo;
2924 uint64_t funding_txo_ref = 0;
2925 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2926 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2927 funding_txo_ref = (uint64_t)funding_txo_var.inner;
2928 if (funding_txo_var.is_owned) {
2929 funding_txo_ref |= 1;
2931 LDKChannelMonitorUpdate update_var = update;
2932 uint64_t update_ref = 0;
2933 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2934 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2935 update_ref = (uint64_t)update_var.inner;
2936 if (update_var.is_owned) {
2939 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2940 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2941 CHECK_ACCESS(ret_ptr);
2942 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
2943 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2946 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2947 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2948 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2949 LDKCVec_MonitorEventZ ret_constr;
2950 ret_constr.datalen = *((uint32_t*)ret);
2951 if (ret_constr.datalen > 0)
2952 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2954 ret_constr.data = NULL;
2955 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2956 for (size_t o = 0; o < ret_constr.datalen; o++) {
2957 uint32_t ret_conv_14 = ret_vals[o];
2958 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
2959 CHECK_ACCESS(ret_conv_14_ptr);
2960 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
2961 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2962 ret_constr.data[o] = ret_conv_14_conv;
2966 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2967 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2968 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2970 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2971 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2972 atomic_init(&calls->refcnt, 1);
2973 //TODO: Assign calls->o from o
2976 .this_arg = (void*) calls,
2977 .watch_channel = watch_channel_LDKWatch_jcall,
2978 .update_channel = update_channel_LDKWatch_jcall,
2979 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2980 .free = LDKWatch_JCalls_free,
2984 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2985 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2986 *res_ptr = LDKWatch_init(o);
2987 return (long)res_ptr;
2989 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2990 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2991 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2992 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
2993 LDKOutPoint funding_txo_conv;
2994 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2995 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2996 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2997 LDKChannelMonitor monitor_conv;
2998 monitor_conv.inner = (void*)(monitor & (~1));
2999 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3000 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3001 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3002 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3003 return (uint64_t)ret_conv;
3006 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
3007 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3008 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3009 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3010 LDKOutPoint funding_txo_conv;
3011 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3012 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3013 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3014 LDKChannelMonitorUpdate update_conv;
3015 update_conv.inner = (void*)(update & (~1));
3016 update_conv.is_owned = (update & 1) || (update == 0);
3017 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3018 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3019 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3020 return (uint64_t)ret_conv;
3023 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
3024 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3025 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3026 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3027 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3028 uint32_tArray ret_arr = NULL;
3029 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3030 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3031 for (size_t o = 0; o < ret_var.datalen; o++) {
3032 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3033 *ret_conv_14_copy = ret_var.data[o];
3034 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3035 ret_arr_ptr[o] = ret_conv_14_ref;
3042 typedef struct LDKBroadcasterInterface_JCalls {
3043 atomic_size_t refcnt;
3044 uint32_t broadcast_transaction_meth;
3045 } LDKBroadcasterInterface_JCalls;
3046 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3047 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3048 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3049 js_free(j_calls->broadcast_transaction_meth);
3053 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3054 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3055 LDKTransaction tx_var = tx;
3056 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3057 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
3058 Transaction_free(tx_var);
3059 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
3061 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3062 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3063 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3065 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
3066 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3067 atomic_init(&calls->refcnt, 1);
3068 //TODO: Assign calls->o from o
3070 LDKBroadcasterInterface ret = {
3071 .this_arg = (void*) calls,
3072 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3073 .free = LDKBroadcasterInterface_JCalls_free,
3077 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
3078 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3079 *res_ptr = LDKBroadcasterInterface_init(o);
3080 return (long)res_ptr;
3082 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
3083 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3084 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3085 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
3086 LDKTransaction tx_ref;
3087 tx_ref.datalen = *((uint32_t*)tx);
3088 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3089 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
3090 tx_ref.data_is_owned = true;
3091 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3094 typedef struct LDKKeysInterface_JCalls {
3095 atomic_size_t refcnt;
3096 uint32_t get_node_secret_meth;
3097 uint32_t get_destination_script_meth;
3098 uint32_t get_shutdown_scriptpubkey_meth;
3099 uint32_t get_channel_signer_meth;
3100 uint32_t get_secure_random_bytes_meth;
3101 uint32_t read_chan_signer_meth;
3102 uint32_t sign_invoice_meth;
3103 } LDKKeysInterface_JCalls;
3104 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3105 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3106 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3107 js_free(j_calls->get_node_secret_meth);
3108 js_free(j_calls->get_destination_script_meth);
3109 js_free(j_calls->get_shutdown_scriptpubkey_meth);
3110 js_free(j_calls->get_channel_signer_meth);
3111 js_free(j_calls->get_secure_random_bytes_meth);
3112 js_free(j_calls->read_chan_signer_meth);
3113 js_free(j_calls->sign_invoice_meth);
3117 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3118 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3119 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
3120 LDKSecretKey ret_ref;
3121 CHECK(*((uint32_t*)ret) == 32);
3122 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
3125 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3126 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3127 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
3128 LDKCVec_u8Z ret_ref;
3129 ret_ref.datalen = *((uint32_t*)ret);
3130 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3131 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3134 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3135 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3136 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
3137 LDKShutdownScript ret_conv;
3138 ret_conv.inner = (void*)(ret & (~1));
3139 ret_conv.is_owned = (ret & 1) || (ret == 0);
3140 ret_conv = ShutdownScript_clone(&ret_conv);
3143 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3144 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3145 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3146 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3147 CHECK_ACCESS(ret_ptr);
3148 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
3149 ret_conv = Sign_clone(&ret_conv);
3152 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3153 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3154 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
3155 LDKThirtyTwoBytes ret_ref;
3156 CHECK(*((uint32_t*)ret) == 32);
3157 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
3160 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3161 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3162 LDKu8slice reader_var = reader;
3163 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3164 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
3165 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
3166 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3167 CHECK_ACCESS(ret_ptr);
3168 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
3169 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3172 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3173 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3174 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3175 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3176 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
3177 CVec_u8Z_free(invoice_preimage_var);
3178 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
3179 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3180 CHECK_ACCESS(ret_ptr);
3181 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
3182 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3185 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3186 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3187 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3189 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
3190 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3191 atomic_init(&calls->refcnt, 1);
3192 //TODO: Assign calls->o from o
3194 LDKKeysInterface ret = {
3195 .this_arg = (void*) calls,
3196 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3197 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3198 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3199 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3200 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3201 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3202 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3203 .free = LDKKeysInterface_JCalls_free,
3207 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
3208 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3209 *res_ptr = LDKKeysInterface_init(o);
3210 return (long)res_ptr;
3212 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
3213 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3214 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3215 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3216 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3217 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
3221 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
3222 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3223 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3224 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3225 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3226 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3227 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3228 CVec_u8Z_free(ret_var);
3232 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
3233 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3234 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3235 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3236 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
3237 uint64_t ret_ref = 0;
3238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3240 ret_ref = (uint64_t)ret_var.inner;
3241 if (ret_var.is_owned) {
3247 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3248 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3249 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3250 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3251 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3252 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3253 return (uint64_t)ret_ret;
3256 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
3257 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3258 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3259 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3260 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3261 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
3265 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
3266 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3267 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3268 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3269 LDKu8slice reader_ref;
3270 reader_ref.datalen = *((uint32_t*)reader);
3271 reader_ref.data = (int8_t*)(reader + 4);
3272 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3273 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3274 return (uint64_t)ret_conv;
3277 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
3278 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3279 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3280 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
3281 LDKCVec_u8Z invoice_preimage_ref;
3282 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
3283 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3284 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
3285 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3286 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3287 return (uint64_t)ret_conv;
3290 typedef struct LDKFeeEstimator_JCalls {
3291 atomic_size_t refcnt;
3292 uint32_t get_est_sat_per_1000_weight_meth;
3293 } LDKFeeEstimator_JCalls;
3294 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3295 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3296 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3297 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3301 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3302 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3303 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3304 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3306 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3307 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3308 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3310 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3311 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3312 atomic_init(&calls->refcnt, 1);
3313 //TODO: Assign calls->o from o
3315 LDKFeeEstimator ret = {
3316 .this_arg = (void*) calls,
3317 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3318 .free = LDKFeeEstimator_JCalls_free,
3322 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3323 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3324 *res_ptr = LDKFeeEstimator_init(o);
3325 return (long)res_ptr;
3327 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3328 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3329 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3330 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
3331 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3332 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3336 typedef struct LDKLogger_JCalls {
3337 atomic_size_t refcnt;
3340 static void LDKLogger_JCalls_free(void* this_arg) {
3341 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3342 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3343 js_free(j_calls->log_meth);
3347 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3348 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3349 const char* record_str = record;
3350 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3351 js_invoke_function_1(j_calls->log_meth, record_conv);
3353 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3354 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3355 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3357 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3358 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3359 atomic_init(&calls->refcnt, 1);
3360 //TODO: Assign calls->o from o
3363 .this_arg = (void*) calls,
3364 .log = log_LDKLogger_jcall,
3365 .free = LDKLogger_JCalls_free,
3369 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3370 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3371 *res_ptr = LDKLogger_init(o);
3372 return (long)res_ptr;
3374 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3375 return ThirtyTwoBytes_clone(&tuple->a);
3377 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3378 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3379 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3380 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3384 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3387 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3388 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3389 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3390 uint64_t ret_ref = 0;
3391 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3392 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3393 ret_ref = (uint64_t)ret_var.inner & ~1;
3397 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
3398 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3401 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3402 CHECK(val->result_ok);
3403 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
3404 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3405 return ((uint64_t)res_conv) | 1;
3407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3408 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3409 CHECK(!val->result_ok);
3410 LDKDecodeError err_var = (*val->contents.err);
3411 uint64_t err_ref = 0;
3412 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3413 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3414 err_ref = (uint64_t)err_var.inner & ~1;
3417 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
3418 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
3420 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3421 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3422 CHECK(val->result_ok);
3423 LDKChannelConfig res_var = (*val->contents.result);
3424 uint64_t res_ref = 0;
3425 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3426 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3427 res_ref = (uint64_t)res_var.inner & ~1;
3430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3431 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3432 CHECK(!val->result_ok);
3433 LDKDecodeError err_var = (*val->contents.err);
3434 uint64_t err_ref = 0;
3435 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3436 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3437 err_ref = (uint64_t)err_var.inner & ~1;
3440 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3441 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3443 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3444 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3445 CHECK(val->result_ok);
3446 LDKOutPoint res_var = (*val->contents.result);
3447 uint64_t res_ref = 0;
3448 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3449 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3450 res_ref = (uint64_t)res_var.inner & ~1;
3453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3454 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3455 CHECK(!val->result_ok);
3456 LDKDecodeError err_var = (*val->contents.err);
3457 uint64_t err_ref = 0;
3458 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3459 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3460 err_ref = (uint64_t)err_var.inner & ~1;
3463 typedef struct LDKType_JCalls {
3464 atomic_size_t refcnt;
3465 uint32_t type_id_meth;
3466 uint32_t debug_str_meth;
3467 uint32_t write_meth;
3469 static void LDKType_JCalls_free(void* this_arg) {
3470 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3471 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3472 js_free(j_calls->type_id_meth);
3473 js_free(j_calls->debug_str_meth);
3474 js_free(j_calls->write_meth);
3478 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3479 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3480 return js_invoke_function_0(j_calls->type_id_meth);
3482 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3483 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3484 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3485 LDKStr ret_conv = str_ref_to_owned_c(ret);
3488 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3489 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3490 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3491 LDKCVec_u8Z ret_ref;
3492 ret_ref.datalen = *((uint32_t*)ret);
3493 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3494 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3497 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3498 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3499 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3501 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3502 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3503 atomic_init(&calls->refcnt, 1);
3504 //TODO: Assign calls->o from o
3507 .this_arg = (void*) calls,
3508 .type_id = type_id_LDKType_jcall,
3509 .debug_str = debug_str_LDKType_jcall,
3510 .write = write_LDKType_jcall,
3511 .cloned = LDKType_JCalls_cloned,
3512 .free = LDKType_JCalls_free,
3516 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3517 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3518 *res_ptr = LDKType_init(o);
3519 return (long)res_ptr;
3521 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3522 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3523 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3524 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3525 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3529 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3530 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3531 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3532 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3533 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3534 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3539 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3540 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3541 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3542 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
3543 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3544 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3545 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3546 CVec_u8Z_free(ret_var);
3550 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3551 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3553 case LDKCOption_TypeZ_Some: {
3554 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
3555 *some_ret = Type_clone(&obj->some);
3556 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3558 case LDKCOption_TypeZ_None: {
3559 return 0 /* LDKCOption_TypeZ - None */;
3564 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3565 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3567 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3568 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3569 CHECK(val->result_ok);
3570 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3574 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3575 CHECK(!val->result_ok);
3576 LDKDecodeError err_var = (*val->contents.err);
3577 uint64_t err_ref = 0;
3578 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3579 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3580 err_ref = (uint64_t)err_var.inner & ~1;
3583 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentError_ref_from_ptr(uint32_t ptr) {
3584 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
3586 case LDKPaymentError_Invoice: {
3587 LDKStr invoice_str = obj->invoice;
3588 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
3589 return 0 /* LDKPaymentError - Invoice */; (void) invoice_conv;
3591 case LDKPaymentError_Routing: {
3592 LDKLightningError routing_var = obj->routing;
3593 uint64_t routing_ref = 0;
3594 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3595 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3596 routing_ref = (uint64_t)routing_var.inner & ~1;
3597 return 0 /* LDKPaymentError - Routing */; (void) routing_ref;
3599 case LDKPaymentError_Sending: {
3600 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
3601 return 0 /* LDKPaymentError - Sending */; (void) sending_ref;
3606 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_result_ok(uint32_t arg) {
3607 return ((LDKCResult_PaymentIdPaymentErrorZ*)arg)->result_ok;
3609 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_ok(uint32_t arg) {
3610 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3611 CHECK(val->result_ok);
3612 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3613 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
3616 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentErrorZ_get_err(uint32_t arg) {
3617 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
3618 CHECK(!val->result_ok);
3619 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3622 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3623 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3625 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3626 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3627 CHECK(val->result_ok);
3628 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3631 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3632 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3633 CHECK(!val->result_ok);
3634 return *val->contents.err;
3636 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3637 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3639 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3640 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3641 CHECK(val->result_ok);
3642 LDKInvoice res_var = (*val->contents.result);
3643 uint64_t res_ref = 0;
3644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3646 res_ref = (uint64_t)res_var.inner & ~1;
3649 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3650 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3651 CHECK(!val->result_ok);
3652 return *val->contents.err;
3654 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3655 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3657 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3658 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3659 CHECK(val->result_ok);
3660 LDKSignedRawInvoice res_var = (*val->contents.result);
3661 uint64_t res_ref = 0;
3662 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3663 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3664 res_ref = (uint64_t)res_var.inner & ~1;
3667 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3668 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3669 CHECK(!val->result_ok);
3670 return *val->contents.err;
3672 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3673 return RawInvoice_clone(&tuple->a);
3675 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3676 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3677 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3678 uint64_t ret_ref = 0;
3679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3681 ret_ref = (uint64_t)ret_var.inner;
3682 if (ret_var.is_owned) {
3688 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3689 return ThirtyTwoBytes_clone(&tuple->b);
3691 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3692 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3693 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3694 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3698 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3699 return InvoiceSignature_clone(&tuple->c);
3701 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3702 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3703 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3704 uint64_t ret_ref = 0;
3705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3707 ret_ref = (uint64_t)ret_var.inner;
3708 if (ret_var.is_owned) {
3714 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3715 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3717 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3718 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3719 CHECK(val->result_ok);
3720 LDKPayeePubKey res_var = (*val->contents.result);
3721 uint64_t res_ref = 0;
3722 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3723 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3724 res_ref = (uint64_t)res_var.inner & ~1;
3727 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3728 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3729 CHECK(!val->result_ok);
3730 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3733 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3734 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3735 ret->datalen = *((uint32_t*)elems);
3736 if (ret->datalen == 0) {
3739 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3740 uint32_t *java_elems = (uint32_t*)(elems + 4);
3741 for (size_t i = 0; i < ret->datalen; i++) {
3742 uint32_t arr_elem = java_elems[i];
3743 LDKPrivateRoute arr_elem_conv;
3744 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3745 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3746 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3747 ret->data[i] = arr_elem_conv;
3750 return (uint64_t)ret;
3752 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3753 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3754 for (size_t i = 0; i < ret.datalen; i++) {
3755 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3759 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3760 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3762 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3763 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3764 CHECK(val->result_ok);
3765 LDKPositiveTimestamp res_var = (*val->contents.result);
3766 uint64_t res_ref = 0;
3767 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3768 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3769 res_ref = (uint64_t)res_var.inner & ~1;
3772 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3773 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3774 CHECK(!val->result_ok);
3775 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3778 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3779 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3781 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3782 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3783 CHECK(val->result_ok);
3784 return *val->contents.result;
3786 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3787 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3788 CHECK(!val->result_ok);
3789 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3792 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3793 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3796 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3797 CHECK(val->result_ok);
3798 LDKInvoice res_var = (*val->contents.result);
3799 uint64_t res_ref = 0;
3800 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3801 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3802 res_ref = (uint64_t)res_var.inner & ~1;
3805 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3806 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3807 CHECK(!val->result_ok);
3808 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3811 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3812 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3814 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3815 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3816 CHECK(val->result_ok);
3817 LDKDescription res_var = (*val->contents.result);
3818 uint64_t res_ref = 0;
3819 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3820 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3821 res_ref = (uint64_t)res_var.inner & ~1;
3824 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3825 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3826 CHECK(!val->result_ok);
3827 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3830 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3831 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3833 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3834 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3835 CHECK(val->result_ok);
3836 LDKExpiryTime res_var = (*val->contents.result);
3837 uint64_t res_ref = 0;
3838 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3839 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3840 res_ref = (uint64_t)res_var.inner & ~1;
3843 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3844 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3845 CHECK(!val->result_ok);
3846 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3849 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3850 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3852 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3853 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3854 CHECK(val->result_ok);
3855 LDKPrivateRoute res_var = (*val->contents.result);
3856 uint64_t res_ref = 0;
3857 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3858 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3859 res_ref = (uint64_t)res_var.inner & ~1;
3862 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3863 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3864 CHECK(!val->result_ok);
3865 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3868 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3869 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3871 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3872 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3873 CHECK(val->result_ok);
3874 LDKStr res_str = (*val->contents.result);
3875 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3878 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3879 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3880 CHECK(!val->result_ok);
3881 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3884 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3885 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3887 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3888 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3889 CHECK(val->result_ok);
3890 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3891 uint64_t res_ref = 0;
3892 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3893 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3894 res_ref = (uint64_t)res_var.inner & ~1;
3897 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3898 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3899 CHECK(!val->result_ok);
3900 LDKDecodeError err_var = (*val->contents.err);
3901 uint64_t err_ref = 0;
3902 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3903 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3904 err_ref = (uint64_t)err_var.inner & ~1;
3907 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3908 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3910 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3911 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3912 CHECK(val->result_ok);
3913 LDKHTLCUpdate res_var = (*val->contents.result);
3914 uint64_t res_ref = 0;
3915 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3916 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3917 res_ref = (uint64_t)res_var.inner & ~1;
3920 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3921 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3922 CHECK(!val->result_ok);
3923 LDKDecodeError err_var = (*val->contents.err);
3924 uint64_t err_ref = 0;
3925 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3926 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3927 err_ref = (uint64_t)err_var.inner & ~1;
3930 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3931 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3933 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3934 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3935 CHECK(val->result_ok);
3936 return *val->contents.result;
3938 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3939 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3940 CHECK(!val->result_ok);
3941 LDKMonitorUpdateError err_var = (*val->contents.err);
3942 uint64_t err_ref = 0;
3943 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3944 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3945 err_ref = (uint64_t)err_var.inner & ~1;
3948 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3949 return OutPoint_clone(&tuple->a);
3951 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3952 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3953 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3954 uint64_t ret_ref = 0;
3955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3957 ret_ref = (uint64_t)ret_var.inner;
3958 if (ret_var.is_owned) {
3964 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3965 return CVec_u8Z_clone(&tuple->b);
3967 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3968 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3969 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3970 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3971 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3972 CVec_u8Z_free(ret_var);
3976 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3979 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3980 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3981 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3985 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3986 return CVec_u8Z_clone(&tuple->b);
3988 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3989 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3990 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3991 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3992 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3993 CVec_u8Z_free(ret_var);
3997 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3998 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3999 ret->datalen = *((uint32_t*)elems);
4000 if (ret->datalen == 0) {
4003 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4004 uint32_t *java_elems = (uint32_t*)(elems + 4);
4005 for (size_t i = 0; i < ret->datalen; i++) {
4006 uint32_t arr_elem = java_elems[i];
4007 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4008 CHECK_ACCESS(arr_elem_ptr);
4009 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(arr_elem_ptr);
4010 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4011 ret->data[i] = arr_elem_conv;
4014 return (uint64_t)ret;
4016 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4017 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4018 for (size_t i = 0; i < ret.datalen; i++) {
4019 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4023 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
4024 return ThirtyTwoBytes_clone(&tuple->a);
4026 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
4027 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
4028 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4029 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
4033 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
4034 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
4036 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
4037 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
4038 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
4039 uint32_tArray ret_arr = NULL;
4040 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4041 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4042 for (size_t v = 0; v < ret_var.datalen; v++) {
4043 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4044 *ret_conv_21_conv = ret_var.data[v];
4045 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
4052 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
4053 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4054 ret->datalen = *((uint32_t*)elems);
4055 if (ret->datalen == 0) {
4058 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4059 uint32_t *java_elems = (uint32_t*)(elems + 4);
4060 for (size_t i = 0; i < ret->datalen; i++) {
4061 uint32_t arr_elem = java_elems[i];
4062 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4063 CHECK_ACCESS(arr_elem_ptr);
4064 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arr_elem_ptr);
4065 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4066 ret->data[i] = arr_elem_conv;
4069 return (uint64_t)ret;
4071 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4072 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 };
4073 for (size_t i = 0; i < ret.datalen; i++) {
4074 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4078 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
4079 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
4081 case LDKPaymentPurpose_InvoicePayment: {
4082 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4083 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
4084 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4085 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
4086 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
4088 case LDKPaymentPurpose_SpontaneousPayment: {
4089 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4090 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
4091 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
4096 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
4097 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
4099 case LDKClosureReason_CounterpartyForceClosed: {
4100 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
4101 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
4102 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
4104 case LDKClosureReason_HolderForceClosed: {
4105 return 0 /* LDKClosureReason - HolderForceClosed */;
4107 case LDKClosureReason_CooperativeClosure: {
4108 return 0 /* LDKClosureReason - CooperativeClosure */;
4110 case LDKClosureReason_CommitmentTxConfirmed: {
4111 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
4113 case LDKClosureReason_ProcessingError: {
4114 LDKStr err_str = obj->processing_error.err;
4115 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4116 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
4118 case LDKClosureReason_DisconnectedPeer: {
4119 return 0 /* LDKClosureReason - DisconnectedPeer */;
4121 case LDKClosureReason_OutdatedChannelManager: {
4122 return 0 /* LDKClosureReason - OutdatedChannelManager */;
4127 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
4128 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4130 case LDKEvent_FundingGenerationReady: {
4131 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4132 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
4133 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4134 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4135 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
4136 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;
4138 case LDKEvent_PaymentReceived: {
4139 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4140 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
4141 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
4142 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
4144 case LDKEvent_PaymentSent: {
4145 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4146 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_sent.payment_id.data, 32);
4147 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4148 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
4149 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4150 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
4151 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
4152 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
4154 case LDKEvent_PaymentPathFailed: {
4155 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4156 memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_failed.payment_id.data, 32);
4157 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4158 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
4159 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
4160 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
4161 uint32_tArray path_arr = NULL;
4162 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4163 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
4164 for (size_t k = 0; k < path_var.datalen; k++) {
4165 LDKRouteHop path_conv_10_var = path_var.data[k];
4166 uint64_t path_conv_10_ref = 0;
4167 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4168 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4169 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
4170 path_arr_ptr[k] = path_conv_10_ref;
4173 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
4174 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
4175 uint64_t retry_ref = 0;
4176 if ((uint64_t)retry_var.inner > 4096) {
4177 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4178 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4179 retry_ref = (uint64_t)retry_var.inner & ~1;
4181 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_id_arr; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; (void) retry_ref;
4183 case LDKEvent_PendingHTLCsForwardable: {
4184 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
4186 case LDKEvent_SpendableOutputs: {
4187 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4188 uint32_tArray outputs_arr = NULL;
4189 outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4190 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
4191 for (size_t b = 0; b < outputs_var.datalen; b++) {
4192 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4193 outputs_arr_ptr[b] = outputs_conv_27_ref;
4196 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
4198 case LDKEvent_PaymentForwarded: {
4199 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
4200 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
4202 case LDKEvent_ChannelClosed: {
4203 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4204 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
4205 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
4206 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
4208 case LDKEvent_DiscardFunding: {
4209 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4210 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
4211 LDKTransaction transaction_var = obj->discard_funding.transaction;
4212 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4213 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
4214 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
4219 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
4220 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4221 ret->datalen = *((uint32_t*)elems);
4222 if (ret->datalen == 0) {
4225 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4226 uint32_t *java_elems = (uint32_t*)(elems + 4);
4227 for (size_t i = 0; i < ret->datalen; i++) {
4228 uint32_t arr_elem = java_elems[i];
4229 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4230 CHECK_ACCESS(arr_elem_ptr);
4231 LDKEvent arr_elem_conv = *(LDKEvent*)(arr_elem_ptr);
4232 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4233 ret->data[i] = arr_elem_conv;
4236 return (uint64_t)ret;
4238 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4239 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4240 for (size_t i = 0; i < ret.datalen; i++) {
4241 ret.data[i] = Event_clone(&orig->data[i]);
4245 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
4248 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
4249 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
4250 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
4254 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
4255 return TxOut_clone(&tuple->b);
4257 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
4258 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
4259 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4260 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
4261 return (uint64_t)ret_ref;
4264 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
4265 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4266 ret->datalen = *((uint32_t*)elems);
4267 if (ret->datalen == 0) {
4270 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4271 uint32_t *java_elems = (uint32_t*)(elems + 4);
4272 for (size_t i = 0; i < ret->datalen; i++) {
4273 uint32_t arr_elem = java_elems[i];
4274 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4275 CHECK_ACCESS(arr_elem_ptr);
4276 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(arr_elem_ptr);
4277 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4278 ret->data[i] = arr_elem_conv;
4281 return (uint64_t)ret;
4283 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4284 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4285 for (size_t i = 0; i < ret.datalen; i++) {
4286 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4290 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4291 return ThirtyTwoBytes_clone(&tuple->a);
4293 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
4294 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4295 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4296 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
4300 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4301 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
4303 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
4304 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4305 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
4306 uint32_tArray ret_arr = NULL;
4307 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4308 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4309 for (size_t u = 0; u < ret_var.datalen; u++) {
4310 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4311 *ret_conv_20_conv = ret_var.data[u];
4312 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
4319 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
4320 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4321 ret->datalen = *((uint32_t*)elems);
4322 if (ret->datalen == 0) {
4325 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4326 uint32_t *java_elems = (uint32_t*)(elems + 4);
4327 for (size_t i = 0; i < ret->datalen; i++) {
4328 uint32_t arr_elem = java_elems[i];
4329 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4330 CHECK_ACCESS(arr_elem_ptr);
4331 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arr_elem_ptr);
4332 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4333 ret->data[i] = arr_elem_conv;
4336 return (uint64_t)ret;
4338 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4339 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 };
4340 for (size_t i = 0; i < ret.datalen; i++) {
4341 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4345 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
4346 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
4348 case LDKBalance_ClaimableOnChannelClose: {
4349 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
4351 case LDKBalance_ClaimableAwaitingConfirmations: {
4352 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
4354 case LDKBalance_ContentiousClaimable: {
4355 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
4357 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
4358 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4363 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
4364 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
4365 ret->datalen = *((uint32_t*)elems);
4366 if (ret->datalen == 0) {
4369 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
4370 uint32_t *java_elems = (uint32_t*)(elems + 4);
4371 for (size_t i = 0; i < ret->datalen; i++) {
4372 uint32_t arr_elem = java_elems[i];
4373 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4374 CHECK_ACCESS(arr_elem_ptr);
4375 LDKBalance arr_elem_conv = *(LDKBalance*)(arr_elem_ptr);
4376 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
4377 ret->data[i] = arr_elem_conv;
4380 return (uint64_t)ret;
4382 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4383 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4384 for (size_t i = 0; i < ret.datalen; i++) {
4385 ret.data[i] = Balance_clone(&orig->data[i]);
4389 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
4390 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4393 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4394 CHECK(val->result_ok);
4395 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4396 *res_conv = (*val->contents.result);
4397 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4398 return ((uint64_t)res_conv);
4400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4401 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4402 CHECK(!val->result_ok);
4403 LDKDecodeError err_var = (*val->contents.err);
4404 uint64_t err_ref = 0;
4405 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4406 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4407 err_ref = (uint64_t)err_var.inner & ~1;
4410 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
4411 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4413 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4414 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4415 CHECK(val->result_ok);
4416 return *val->contents.result;
4418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4419 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4420 CHECK(!val->result_ok);
4421 LDKLightningError err_var = (*val->contents.err);
4422 uint64_t err_ref = 0;
4423 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4424 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4425 err_ref = (uint64_t)err_var.inner & ~1;
4428 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4431 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4432 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4433 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4434 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4438 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4439 return Type_clone(&tuple->b);
4441 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4442 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4443 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
4444 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4445 return (uint64_t)ret_ret;
4448 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
4449 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
4450 ret->datalen = *((uint32_t*)elems);
4451 if (ret->datalen == 0) {
4454 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
4455 uint32_t *java_elems = (uint32_t*)(elems + 4);
4456 for (size_t i = 0; i < ret->datalen; i++) {
4457 uint32_t arr_elem = java_elems[i];
4458 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4459 CHECK_ACCESS(arr_elem_ptr);
4460 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(arr_elem_ptr);
4461 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
4462 ret->data[i] = arr_elem_conv;
4465 return (uint64_t)ret;
4467 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4468 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4469 for (size_t i = 0; i < ret.datalen; i++) {
4470 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4474 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
4475 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4477 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4478 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4479 CHECK(val->result_ok);
4480 return *val->contents.result;
4482 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4483 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4484 CHECK(!val->result_ok);
4485 LDKLightningError err_var = (*val->contents.err);
4486 uint64_t err_ref = 0;
4487 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4488 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4489 err_ref = (uint64_t)err_var.inner & ~1;
4492 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4493 return ChannelAnnouncement_clone(&tuple->a);
4495 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4496 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4497 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4498 uint64_t ret_ref = 0;
4499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 ret_ref = (uint64_t)ret_var.inner;
4502 if (ret_var.is_owned) {
4508 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4509 return ChannelUpdate_clone(&tuple->b);
4511 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4512 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4513 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4514 uint64_t ret_ref = 0;
4515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4517 ret_ref = (uint64_t)ret_var.inner;
4518 if (ret_var.is_owned) {
4524 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4525 return ChannelUpdate_clone(&tuple->c);
4527 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4528 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4529 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4530 uint64_t ret_ref = 0;
4531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4533 ret_ref = (uint64_t)ret_var.inner;
4534 if (ret_var.is_owned) {
4540 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4541 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4542 ret->datalen = *((uint32_t*)elems);
4543 if (ret->datalen == 0) {
4546 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4547 uint32_t *java_elems = (uint32_t*)(elems + 4);
4548 for (size_t i = 0; i < ret->datalen; i++) {
4549 uint32_t arr_elem = java_elems[i];
4550 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
4551 CHECK_ACCESS(arr_elem_ptr);
4552 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arr_elem_ptr);
4553 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4554 ret->data[i] = arr_elem_conv;
4557 return (uint64_t)ret;
4559 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4560 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4561 for (size_t i = 0; i < ret.datalen; i++) {
4562 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4566 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4567 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4568 ret->datalen = *((uint32_t*)elems);
4569 if (ret->datalen == 0) {
4572 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4573 uint32_t *java_elems = (uint32_t*)(elems + 4);
4574 for (size_t i = 0; i < ret->datalen; i++) {
4575 uint32_t arr_elem = java_elems[i];
4576 LDKNodeAnnouncement arr_elem_conv;
4577 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4578 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4579 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4580 ret->data[i] = arr_elem_conv;
4583 return (uint64_t)ret;
4585 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4586 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4587 for (size_t i = 0; i < ret.datalen; i++) {
4588 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4592 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4593 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4595 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4596 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4597 CHECK(val->result_ok);
4598 LDKCVec_u8Z res_var = (*val->contents.result);
4599 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4600 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4603 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4604 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4605 CHECK(!val->result_ok);
4606 LDKPeerHandleError err_var = (*val->contents.err);
4607 uint64_t err_ref = 0;
4608 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4609 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4610 err_ref = (uint64_t)err_var.inner & ~1;
4613 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4614 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4616 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4617 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4618 CHECK(val->result_ok);
4619 return *val->contents.result;
4621 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4622 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4623 CHECK(!val->result_ok);
4624 LDKPeerHandleError err_var = (*val->contents.err);
4625 uint64_t err_ref = 0;
4626 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4627 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4628 err_ref = (uint64_t)err_var.inner & ~1;
4631 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4632 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4634 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4635 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4636 CHECK(val->result_ok);
4637 return *val->contents.result;
4639 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4640 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4641 CHECK(!val->result_ok);
4642 LDKPeerHandleError err_var = (*val->contents.err);
4643 uint64_t err_ref = 0;
4644 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4645 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4646 err_ref = (uint64_t)err_var.inner & ~1;
4649 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) {
4650 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
4652 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4653 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4654 CHECK(val->result_ok);
4655 LDKNodeId res_var = (*val->contents.result);
4656 uint64_t res_ref = 0;
4657 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4658 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4659 res_ref = (uint64_t)res_var.inner & ~1;
4662 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4663 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4664 CHECK(!val->result_ok);
4665 LDKDecodeError err_var = (*val->contents.err);
4666 uint64_t err_ref = 0;
4667 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4668 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4669 err_ref = (uint64_t)err_var.inner & ~1;
4672 typedef struct LDKAccess_JCalls {
4673 atomic_size_t refcnt;
4674 uint32_t get_utxo_meth;
4676 static void LDKAccess_JCalls_free(void* this_arg) {
4677 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4678 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4679 js_free(j_calls->get_utxo_meth);
4683 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4684 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4685 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4686 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4687 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4688 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4689 CHECK_ACCESS(ret_ptr);
4690 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4691 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4694 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4695 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4696 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4698 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4699 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4700 atomic_init(&calls->refcnt, 1);
4701 //TODO: Assign calls->o from o
4704 .this_arg = (void*) calls,
4705 .get_utxo = get_utxo_LDKAccess_jcall,
4706 .free = LDKAccess_JCalls_free,
4710 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4711 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4712 *res_ptr = LDKAccess_init(o);
4713 return (long)res_ptr;
4715 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4716 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4717 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4718 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4719 unsigned char genesis_hash_arr[32];
4720 CHECK(*((uint32_t*)genesis_hash) == 32);
4721 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4722 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4723 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4724 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4725 return (uint64_t)ret_conv;
4728 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4729 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4731 case LDKCOption_AccessZ_Some: {
4732 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4733 *some_ret = obj->some;
4734 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4735 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4737 case LDKCOption_AccessZ_None: {
4738 return 0 /* LDKCOption_AccessZ - None */;
4743 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4744 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4746 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4747 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4748 CHECK(val->result_ok);
4749 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4750 uint64_t res_ref = 0;
4751 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4752 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4753 res_ref = (uint64_t)res_var.inner & ~1;
4756 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4757 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4758 CHECK(!val->result_ok);
4759 LDKDecodeError err_var = (*val->contents.err);
4760 uint64_t err_ref = 0;
4761 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4762 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4763 err_ref = (uint64_t)err_var.inner & ~1;
4766 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4767 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4769 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4770 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4771 CHECK(val->result_ok);
4772 LDKChannelInfo res_var = (*val->contents.result);
4773 uint64_t res_ref = 0;
4774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4776 res_ref = (uint64_t)res_var.inner & ~1;
4779 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4780 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4781 CHECK(!val->result_ok);
4782 LDKDecodeError err_var = (*val->contents.err);
4783 uint64_t err_ref = 0;
4784 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4785 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4786 err_ref = (uint64_t)err_var.inner & ~1;
4789 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4790 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4792 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4793 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4794 CHECK(val->result_ok);
4795 LDKRoutingFees res_var = (*val->contents.result);
4796 uint64_t res_ref = 0;
4797 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4798 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4799 res_ref = (uint64_t)res_var.inner & ~1;
4802 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4803 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4804 CHECK(!val->result_ok);
4805 LDKDecodeError err_var = (*val->contents.err);
4806 uint64_t err_ref = 0;
4807 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4808 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4809 err_ref = (uint64_t)err_var.inner & ~1;
4812 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4813 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4816 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4817 CHECK(val->result_ok);
4818 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4819 uint64_t res_ref = 0;
4820 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4821 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4822 res_ref = (uint64_t)res_var.inner & ~1;
4825 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4826 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4827 CHECK(!val->result_ok);
4828 LDKDecodeError err_var = (*val->contents.err);
4829 uint64_t err_ref = 0;
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 err_ref = (uint64_t)err_var.inner & ~1;
4835 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4836 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4837 ret->datalen = *((uint32_t*)elems);
4838 if (ret->datalen == 0) {
4841 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4842 int64_t *java_elems = (int64_t*)(elems + 4);
4843 for (size_t i = 0; i < ret->datalen; i++) {
4844 ret->data[i] = java_elems[i];
4847 return (uint64_t)ret;
4849 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4850 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4851 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4854 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4855 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4858 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4859 CHECK(val->result_ok);
4860 LDKNodeInfo res_var = (*val->contents.result);
4861 uint64_t res_ref = 0;
4862 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4863 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4864 res_ref = (uint64_t)res_var.inner & ~1;
4867 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4868 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4869 CHECK(!val->result_ok);
4870 LDKDecodeError err_var = (*val->contents.err);
4871 uint64_t err_ref = 0;
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 err_ref = (uint64_t)err_var.inner & ~1;
4877 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4878 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4881 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4882 CHECK(val->result_ok);
4883 LDKNetworkGraph res_var = (*val->contents.result);
4884 uint64_t res_ref = 0;
4885 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4886 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4887 res_ref = (uint64_t)res_var.inner & ~1;
4890 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4891 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4892 CHECK(!val->result_ok);
4893 LDKDecodeError err_var = (*val->contents.err);
4894 uint64_t err_ref = 0;
4895 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 err_ref = (uint64_t)err_var.inner & ~1;
4900 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4901 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4903 case LDKCOption_CVec_NetAddressZZ_Some: {
4904 LDKCVec_NetAddressZ some_var = obj->some;
4905 uint32_tArray some_arr = NULL;
4906 some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4907 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4908 for (size_t m = 0; m < some_var.datalen; m++) {
4909 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4910 some_arr_ptr[m] = some_conv_12_ref;
4913 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4915 case LDKCOption_CVec_NetAddressZZ_None: {
4916 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4921 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4922 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4924 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4925 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4926 CHECK(val->result_ok);
4927 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4930 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4931 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4932 CHECK(!val->result_ok);
4933 LDKDecodeError err_var = (*val->contents.err);
4934 uint64_t err_ref = 0;
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 err_ref = (uint64_t)err_var.inner & ~1;
4940 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4941 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4942 ret->datalen = *((uint32_t*)elems);
4943 if (ret->datalen == 0) {
4946 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4947 uint32_t *java_elems = (uint32_t*)(elems + 4);
4948 for (size_t i = 0; i < ret->datalen; i++) {
4949 uint32_t arr_elem = java_elems[i];
4950 LDKUpdateAddHTLC arr_elem_conv;
4951 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4952 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4953 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4954 ret->data[i] = arr_elem_conv;
4957 return (uint64_t)ret;
4959 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4960 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4961 for (size_t i = 0; i < ret.datalen; i++) {
4962 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4966 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4967 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4968 ret->datalen = *((uint32_t*)elems);
4969 if (ret->datalen == 0) {
4972 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4973 uint32_t *java_elems = (uint32_t*)(elems + 4);
4974 for (size_t i = 0; i < ret->datalen; i++) {
4975 uint32_t arr_elem = java_elems[i];
4976 LDKUpdateFulfillHTLC arr_elem_conv;
4977 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4978 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4979 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4980 ret->data[i] = arr_elem_conv;
4983 return (uint64_t)ret;
4985 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4986 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4987 for (size_t i = 0; i < ret.datalen; i++) {
4988 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4992 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4993 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4994 ret->datalen = *((uint32_t*)elems);
4995 if (ret->datalen == 0) {
4998 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4999 uint32_t *java_elems = (uint32_t*)(elems + 4);
5000 for (size_t i = 0; i < ret->datalen; i++) {
5001 uint32_t arr_elem = java_elems[i];
5002 LDKUpdateFailHTLC arr_elem_conv;
5003 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5004 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5005 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5006 ret->data[i] = arr_elem_conv;
5009 return (uint64_t)ret;
5011 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5012 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5013 for (size_t i = 0; i < ret.datalen; i++) {
5014 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5018 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
5019 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5020 ret->datalen = *((uint32_t*)elems);
5021 if (ret->datalen == 0) {
5024 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5025 uint32_t *java_elems = (uint32_t*)(elems + 4);
5026 for (size_t i = 0; i < ret->datalen; i++) {
5027 uint32_t arr_elem = java_elems[i];
5028 LDKUpdateFailMalformedHTLC arr_elem_conv;
5029 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5030 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5031 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5032 ret->data[i] = arr_elem_conv;
5035 return (uint64_t)ret;
5037 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5038 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5039 for (size_t i = 0; i < ret.datalen; i++) {
5040 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5044 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
5045 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5047 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
5048 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5049 CHECK(val->result_ok);
5050 LDKAcceptChannel res_var = (*val->contents.result);
5051 uint64_t res_ref = 0;
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 res_ref = (uint64_t)res_var.inner & ~1;
5057 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
5058 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5059 CHECK(!val->result_ok);
5060 LDKDecodeError err_var = (*val->contents.err);
5061 uint64_t err_ref = 0;
5062 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5063 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5064 err_ref = (uint64_t)err_var.inner & ~1;
5067 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
5068 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5070 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
5071 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5072 CHECK(val->result_ok);
5073 LDKAnnouncementSignatures res_var = (*val->contents.result);
5074 uint64_t res_ref = 0;
5075 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5076 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5077 res_ref = (uint64_t)res_var.inner & ~1;
5080 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
5081 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5082 CHECK(!val->result_ok);
5083 LDKDecodeError err_var = (*val->contents.err);
5084 uint64_t err_ref = 0;
5085 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5086 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5087 err_ref = (uint64_t)err_var.inner & ~1;
5090 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
5091 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5093 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
5094 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5095 CHECK(val->result_ok);
5096 LDKChannelReestablish res_var = (*val->contents.result);
5097 uint64_t res_ref = 0;
5098 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5099 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5100 res_ref = (uint64_t)res_var.inner & ~1;
5103 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
5104 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5105 CHECK(!val->result_ok);
5106 LDKDecodeError err_var = (*val->contents.err);
5107 uint64_t err_ref = 0;
5108 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5109 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5110 err_ref = (uint64_t)err_var.inner & ~1;
5113 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
5114 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5116 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
5117 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5118 CHECK(val->result_ok);
5119 LDKClosingSigned res_var = (*val->contents.result);
5120 uint64_t res_ref = 0;
5121 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5122 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5123 res_ref = (uint64_t)res_var.inner & ~1;
5126 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
5127 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5128 CHECK(!val->result_ok);
5129 LDKDecodeError err_var = (*val->contents.err);
5130 uint64_t err_ref = 0;
5131 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5132 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5133 err_ref = (uint64_t)err_var.inner & ~1;
5136 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
5137 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
5139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
5140 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5141 CHECK(val->result_ok);
5142 LDKClosingSignedFeeRange res_var = (*val->contents.result);
5143 uint64_t res_ref = 0;
5144 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5145 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5146 res_ref = (uint64_t)res_var.inner & ~1;
5149 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
5150 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5151 CHECK(!val->result_ok);
5152 LDKDecodeError err_var = (*val->contents.err);
5153 uint64_t err_ref = 0;
5154 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5155 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5156 err_ref = (uint64_t)err_var.inner & ~1;
5159 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
5160 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5162 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
5163 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5164 CHECK(val->result_ok);
5165 LDKCommitmentSigned res_var = (*val->contents.result);
5166 uint64_t res_ref = 0;
5167 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5168 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5169 res_ref = (uint64_t)res_var.inner & ~1;
5172 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
5173 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5174 CHECK(!val->result_ok);
5175 LDKDecodeError err_var = (*val->contents.err);
5176 uint64_t err_ref = 0;
5177 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5178 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5179 err_ref = (uint64_t)err_var.inner & ~1;
5182 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
5183 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5185 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
5186 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5187 CHECK(val->result_ok);
5188 LDKFundingCreated res_var = (*val->contents.result);
5189 uint64_t res_ref = 0;
5190 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5191 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5192 res_ref = (uint64_t)res_var.inner & ~1;
5195 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
5196 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5197 CHECK(!val->result_ok);
5198 LDKDecodeError err_var = (*val->contents.err);
5199 uint64_t err_ref = 0;
5200 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5201 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5202 err_ref = (uint64_t)err_var.inner & ~1;
5205 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
5206 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5208 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
5209 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5210 CHECK(val->result_ok);
5211 LDKFundingSigned res_var = (*val->contents.result);
5212 uint64_t res_ref = 0;
5213 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5214 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5215 res_ref = (uint64_t)res_var.inner & ~1;
5218 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
5219 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5220 CHECK(!val->result_ok);
5221 LDKDecodeError err_var = (*val->contents.err);
5222 uint64_t err_ref = 0;
5223 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5224 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5225 err_ref = (uint64_t)err_var.inner & ~1;
5228 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
5229 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5231 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
5232 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5233 CHECK(val->result_ok);
5234 LDKFundingLocked res_var = (*val->contents.result);
5235 uint64_t res_ref = 0;
5236 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5237 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5238 res_ref = (uint64_t)res_var.inner & ~1;
5241 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
5242 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5243 CHECK(!val->result_ok);
5244 LDKDecodeError err_var = (*val->contents.err);
5245 uint64_t err_ref = 0;
5246 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5247 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5248 err_ref = (uint64_t)err_var.inner & ~1;
5251 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
5252 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5254 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
5255 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5256 CHECK(val->result_ok);
5257 LDKInit res_var = (*val->contents.result);
5258 uint64_t res_ref = 0;
5259 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5260 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5261 res_ref = (uint64_t)res_var.inner & ~1;
5264 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
5265 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5266 CHECK(!val->result_ok);
5267 LDKDecodeError err_var = (*val->contents.err);
5268 uint64_t err_ref = 0;
5269 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5270 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5271 err_ref = (uint64_t)err_var.inner & ~1;
5274 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
5275 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5277 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
5278 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5279 CHECK(val->result_ok);
5280 LDKOpenChannel res_var = (*val->contents.result);
5281 uint64_t res_ref = 0;
5282 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5283 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5284 res_ref = (uint64_t)res_var.inner & ~1;
5287 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
5288 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5289 CHECK(!val->result_ok);
5290 LDKDecodeError err_var = (*val->contents.err);
5291 uint64_t err_ref = 0;
5292 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5293 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5294 err_ref = (uint64_t)err_var.inner & ~1;
5297 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
5298 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
5301 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5302 CHECK(val->result_ok);
5303 LDKRevokeAndACK res_var = (*val->contents.result);
5304 uint64_t res_ref = 0;
5305 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5306 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5307 res_ref = (uint64_t)res_var.inner & ~1;
5310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
5311 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5312 CHECK(!val->result_ok);
5313 LDKDecodeError err_var = (*val->contents.err);
5314 uint64_t err_ref = 0;
5315 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5316 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5317 err_ref = (uint64_t)err_var.inner & ~1;
5320 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
5321 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5323 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
5324 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5325 CHECK(val->result_ok);
5326 LDKShutdown res_var = (*val->contents.result);
5327 uint64_t res_ref = 0;
5328 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5329 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5330 res_ref = (uint64_t)res_var.inner & ~1;
5333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
5334 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5335 CHECK(!val->result_ok);
5336 LDKDecodeError err_var = (*val->contents.err);
5337 uint64_t err_ref = 0;
5338 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5339 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5340 err_ref = (uint64_t)err_var.inner & ~1;
5343 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5344 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5346 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5347 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5348 CHECK(val->result_ok);
5349 LDKUpdateFailHTLC res_var = (*val->contents.result);
5350 uint64_t res_ref = 0;
5351 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5352 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5353 res_ref = (uint64_t)res_var.inner & ~1;
5356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
5357 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5358 CHECK(!val->result_ok);
5359 LDKDecodeError err_var = (*val->contents.err);
5360 uint64_t err_ref = 0;
5361 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5362 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5363 err_ref = (uint64_t)err_var.inner & ~1;
5366 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5367 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5369 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5370 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5371 CHECK(val->result_ok);
5372 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5373 uint64_t res_ref = 0;
5374 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5375 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5376 res_ref = (uint64_t)res_var.inner & ~1;
5379 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
5380 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5381 CHECK(!val->result_ok);
5382 LDKDecodeError err_var = (*val->contents.err);
5383 uint64_t err_ref = 0;
5384 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5385 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5386 err_ref = (uint64_t)err_var.inner & ~1;
5389 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
5390 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5392 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
5393 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5394 CHECK(val->result_ok);
5395 LDKUpdateFee res_var = (*val->contents.result);
5396 uint64_t res_ref = 0;
5397 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5398 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5399 res_ref = (uint64_t)res_var.inner & ~1;
5402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
5403 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5404 CHECK(!val->result_ok);
5405 LDKDecodeError err_var = (*val->contents.err);
5406 uint64_t err_ref = 0;
5407 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5408 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5409 err_ref = (uint64_t)err_var.inner & ~1;
5412 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5413 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5416 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5417 CHECK(val->result_ok);
5418 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5419 uint64_t res_ref = 0;
5420 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5421 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5422 res_ref = (uint64_t)res_var.inner & ~1;
5425 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
5426 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5427 CHECK(!val->result_ok);
5428 LDKDecodeError err_var = (*val->contents.err);
5429 uint64_t err_ref = 0;
5430 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5431 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5432 err_ref = (uint64_t)err_var.inner & ~1;
5435 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5436 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5439 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5440 CHECK(val->result_ok);
5441 LDKUpdateAddHTLC res_var = (*val->contents.result);
5442 uint64_t res_ref = 0;
5443 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5444 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5445 res_ref = (uint64_t)res_var.inner & ~1;
5448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5449 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5450 CHECK(!val->result_ok);
5451 LDKDecodeError err_var = (*val->contents.err);
5452 uint64_t err_ref = 0;
5453 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5454 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5455 err_ref = (uint64_t)err_var.inner & ~1;
5458 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
5459 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5461 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5462 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5463 CHECK(val->result_ok);
5464 LDKPing res_var = (*val->contents.result);
5465 uint64_t res_ref = 0;
5466 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5467 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5468 res_ref = (uint64_t)res_var.inner & ~1;
5471 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
5472 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5473 CHECK(!val->result_ok);
5474 LDKDecodeError err_var = (*val->contents.err);
5475 uint64_t err_ref = 0;
5476 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5477 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5478 err_ref = (uint64_t)err_var.inner & ~1;
5481 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
5482 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5484 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5485 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5486 CHECK(val->result_ok);
5487 LDKPong res_var = (*val->contents.result);
5488 uint64_t res_ref = 0;
5489 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5490 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5491 res_ref = (uint64_t)res_var.inner & ~1;
5494 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5495 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5496 CHECK(!val->result_ok);
5497 LDKDecodeError err_var = (*val->contents.err);
5498 uint64_t err_ref = 0;
5499 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5500 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5501 err_ref = (uint64_t)err_var.inner & ~1;
5504 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5505 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5508 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5509 CHECK(val->result_ok);
5510 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5511 uint64_t res_ref = 0;
5512 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5513 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5514 res_ref = (uint64_t)res_var.inner & ~1;
5517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5518 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5519 CHECK(!val->result_ok);
5520 LDKDecodeError err_var = (*val->contents.err);
5521 uint64_t err_ref = 0;
5522 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5523 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5524 err_ref = (uint64_t)err_var.inner & ~1;
5527 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5528 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5530 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5531 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5532 CHECK(val->result_ok);
5533 LDKChannelAnnouncement res_var = (*val->contents.result);
5534 uint64_t res_ref = 0;
5535 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5536 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5537 res_ref = (uint64_t)res_var.inner & ~1;
5540 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5541 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5542 CHECK(!val->result_ok);
5543 LDKDecodeError err_var = (*val->contents.err);
5544 uint64_t err_ref = 0;
5545 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 err_ref = (uint64_t)err_var.inner & ~1;
5550 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5551 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5553 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5554 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5555 CHECK(val->result_ok);
5556 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5557 uint64_t res_ref = 0;
5558 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5559 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5560 res_ref = (uint64_t)res_var.inner & ~1;
5563 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5564 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5565 CHECK(!val->result_ok);
5566 LDKDecodeError err_var = (*val->contents.err);
5567 uint64_t err_ref = 0;
5568 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5569 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5570 err_ref = (uint64_t)err_var.inner & ~1;
5573 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5574 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5576 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5577 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5578 CHECK(val->result_ok);
5579 LDKChannelUpdate res_var = (*val->contents.result);
5580 uint64_t res_ref = 0;
5581 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5582 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5583 res_ref = (uint64_t)res_var.inner & ~1;
5586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5587 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5588 CHECK(!val->result_ok);
5589 LDKDecodeError err_var = (*val->contents.err);
5590 uint64_t err_ref = 0;
5591 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5592 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5593 err_ref = (uint64_t)err_var.inner & ~1;
5596 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
5597 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5600 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5601 CHECK(val->result_ok);
5602 LDKErrorMessage res_var = (*val->contents.result);
5603 uint64_t res_ref = 0;
5604 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5605 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5606 res_ref = (uint64_t)res_var.inner & ~1;
5609 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5610 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5611 CHECK(!val->result_ok);
5612 LDKDecodeError err_var = (*val->contents.err);
5613 uint64_t err_ref = 0;
5614 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5615 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5616 err_ref = (uint64_t)err_var.inner & ~1;
5619 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5620 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5622 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5623 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5624 CHECK(val->result_ok);
5625 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5626 uint64_t res_ref = 0;
5627 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5628 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5629 res_ref = (uint64_t)res_var.inner & ~1;
5632 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5633 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5634 CHECK(!val->result_ok);
5635 LDKDecodeError err_var = (*val->contents.err);
5636 uint64_t err_ref = 0;
5637 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5638 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5639 err_ref = (uint64_t)err_var.inner & ~1;
5642 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5643 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5645 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5646 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5647 CHECK(val->result_ok);
5648 LDKNodeAnnouncement res_var = (*val->contents.result);
5649 uint64_t res_ref = 0;
5650 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5651 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5652 res_ref = (uint64_t)res_var.inner & ~1;
5655 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5656 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5657 CHECK(!val->result_ok);
5658 LDKDecodeError err_var = (*val->contents.err);
5659 uint64_t err_ref = 0;
5660 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5661 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5662 err_ref = (uint64_t)err_var.inner & ~1;
5665 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5666 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5669 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5670 CHECK(val->result_ok);
5671 LDKQueryShortChannelIds res_var = (*val->contents.result);
5672 uint64_t res_ref = 0;
5673 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5674 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5675 res_ref = (uint64_t)res_var.inner & ~1;
5678 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5679 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5680 CHECK(!val->result_ok);
5681 LDKDecodeError err_var = (*val->contents.err);
5682 uint64_t err_ref = 0;
5683 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5684 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5685 err_ref = (uint64_t)err_var.inner & ~1;
5688 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5689 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5691 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5692 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5693 CHECK(val->result_ok);
5694 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5695 uint64_t res_ref = 0;
5696 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5697 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5698 res_ref = (uint64_t)res_var.inner & ~1;
5701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5702 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5703 CHECK(!val->result_ok);
5704 LDKDecodeError err_var = (*val->contents.err);
5705 uint64_t err_ref = 0;
5706 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5707 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5708 err_ref = (uint64_t)err_var.inner & ~1;
5711 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5712 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5714 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5715 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5716 CHECK(val->result_ok);
5717 LDKQueryChannelRange res_var = (*val->contents.result);
5718 uint64_t res_ref = 0;
5719 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5720 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5721 res_ref = (uint64_t)res_var.inner & ~1;
5724 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5725 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5726 CHECK(!val->result_ok);
5727 LDKDecodeError err_var = (*val->contents.err);
5728 uint64_t err_ref = 0;
5729 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5730 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5731 err_ref = (uint64_t)err_var.inner & ~1;
5734 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5735 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5737 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5738 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5739 CHECK(val->result_ok);
5740 LDKReplyChannelRange res_var = (*val->contents.result);
5741 uint64_t res_ref = 0;
5742 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5743 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5744 res_ref = (uint64_t)res_var.inner & ~1;
5747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5748 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5749 CHECK(!val->result_ok);
5750 LDKDecodeError err_var = (*val->contents.err);
5751 uint64_t err_ref = 0;
5752 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5753 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5754 err_ref = (uint64_t)err_var.inner & ~1;
5757 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5758 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5760 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5761 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5762 CHECK(val->result_ok);
5763 LDKGossipTimestampFilter res_var = (*val->contents.result);
5764 uint64_t res_ref = 0;
5765 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5766 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5767 res_ref = (uint64_t)res_var.inner & ~1;
5770 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5771 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5772 CHECK(!val->result_ok);
5773 LDKDecodeError err_var = (*val->contents.err);
5774 uint64_t err_ref = 0;
5775 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5776 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5777 err_ref = (uint64_t)err_var.inner & ~1;
5780 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5781 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5783 case LDKSignOrCreationError_SignError: {
5784 return 0 /* LDKSignOrCreationError - SignError */;
5786 case LDKSignOrCreationError_CreationError: {
5787 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5788 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5793 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5794 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5796 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5797 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5798 CHECK(val->result_ok);
5799 LDKInvoice res_var = (*val->contents.result);
5800 uint64_t res_ref = 0;
5801 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5802 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5803 res_ref = (uint64_t)res_var.inner & ~1;
5806 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5807 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5808 CHECK(!val->result_ok);
5809 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5812 typedef struct LDKFilter_JCalls {
5813 atomic_size_t refcnt;
5814 uint32_t register_tx_meth;
5815 uint32_t register_output_meth;
5817 static void LDKFilter_JCalls_free(void* this_arg) {
5818 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5819 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5820 js_free(j_calls->register_tx_meth);
5821 js_free(j_calls->register_output_meth);
5825 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5826 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5827 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5828 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5829 LDKu8slice script_pubkey_var = script_pubkey;
5830 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5831 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5832 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5834 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5835 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5836 LDKWatchedOutput output_var = output;
5837 uint64_t output_ref = 0;
5838 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5839 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5840 output_ref = (uint64_t)output_var.inner;
5841 if (output_var.is_owned) {
5844 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5845 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5846 CHECK_ACCESS(ret_ptr);
5847 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5848 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5851 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5852 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5853 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5855 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5856 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5857 atomic_init(&calls->refcnt, 1);
5858 //TODO: Assign calls->o from o
5861 .this_arg = (void*) calls,
5862 .register_tx = register_tx_LDKFilter_jcall,
5863 .register_output = register_output_LDKFilter_jcall,
5864 .free = LDKFilter_JCalls_free,
5868 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5869 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5870 *res_ptr = LDKFilter_init(o);
5871 return (long)res_ptr;
5873 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5874 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5875 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5876 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5877 unsigned char txid_arr[32];
5878 CHECK(*((uint32_t*)txid) == 32);
5879 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5880 unsigned char (*txid_ref)[32] = &txid_arr;
5881 LDKu8slice script_pubkey_ref;
5882 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5883 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5884 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5887 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5888 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5889 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5890 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5891 LDKWatchedOutput output_conv;
5892 output_conv.inner = (void*)(output & (~1));
5893 output_conv.is_owned = (output & 1) || (output == 0);
5894 output_conv = WatchedOutput_clone(&output_conv);
5895 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5896 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5897 uint64_t ret_ref = (uint64_t)ret_copy;
5901 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5902 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5904 case LDKCOption_FilterZ_Some: {
5905 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5906 *some_ret = obj->some;
5907 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5908 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5910 case LDKCOption_FilterZ_None: {
5911 return 0 /* LDKCOption_FilterZ - None */;
5916 jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) {
5917 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
5919 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5920 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5921 CHECK(val->result_ok);
5922 LDKLockedChannelMonitor res_var = (*val->contents.result);
5923 uint64_t res_ref = 0;
5924 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5925 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5926 res_ref = (uint64_t)res_var.inner & ~1;
5929 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5930 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5931 CHECK(!val->result_ok);
5932 return *val->contents.err;
5934 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) {
5935 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
5936 ret->datalen = *((uint32_t*)elems);
5937 if (ret->datalen == 0) {
5940 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
5941 uint32_t *java_elems = (uint32_t*)(elems + 4);
5942 for (size_t i = 0; i < ret->datalen; i++) {
5943 uint32_t arr_elem = java_elems[i];
5944 LDKOutPoint arr_elem_conv;
5945 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5946 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5947 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
5948 ret->data[i] = arr_elem_conv;
5951 return (uint64_t)ret;
5953 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5954 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5955 for (size_t i = 0; i < ret.datalen; i++) {
5956 ret.data[i] = OutPoint_clone(&orig->data[i]);
5960 typedef struct LDKMessageSendEventsProvider_JCalls {
5961 atomic_size_t refcnt;
5962 uint32_t get_and_clear_pending_msg_events_meth;
5963 } LDKMessageSendEventsProvider_JCalls;
5964 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5965 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5966 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5967 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5971 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5972 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5973 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5974 LDKCVec_MessageSendEventZ ret_constr;
5975 ret_constr.datalen = *((uint32_t*)ret);
5976 if (ret_constr.datalen > 0)
5977 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5979 ret_constr.data = NULL;
5980 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5981 for (size_t s = 0; s < ret_constr.datalen; s++) {
5982 uint32_t ret_conv_18 = ret_vals[s];
5983 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
5984 CHECK_ACCESS(ret_conv_18_ptr);
5985 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
5986 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5987 ret_constr.data[s] = ret_conv_18_conv;
5991 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5992 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5993 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5995 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5996 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5997 atomic_init(&calls->refcnt, 1);
5998 //TODO: Assign calls->o from o
6000 LDKMessageSendEventsProvider ret = {
6001 .this_arg = (void*) calls,
6002 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6003 .free = LDKMessageSendEventsProvider_JCalls_free,
6007 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6008 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6009 *res_ptr = LDKMessageSendEventsProvider_init(o);
6010 return (long)res_ptr;
6012 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
6013 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6014 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6015 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
6016 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6017 uint32_tArray ret_arr = NULL;
6018 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6019 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6020 for (size_t s = 0; s < ret_var.datalen; s++) {
6021 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6022 *ret_conv_18_copy = ret_var.data[s];
6023 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6024 ret_arr_ptr[s] = ret_conv_18_ref;
6031 typedef struct LDKEventHandler_JCalls {
6032 atomic_size_t refcnt;
6033 uint32_t handle_event_meth;
6034 } LDKEventHandler_JCalls;
6035 static void LDKEventHandler_JCalls_free(void* this_arg) {
6036 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6037 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6038 js_free(j_calls->handle_event_meth);
6042 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
6043 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6044 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
6045 *ret_event = Event_clone(event);
6046 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
6048 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6049 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6050 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6052 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
6053 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6054 atomic_init(&calls->refcnt, 1);
6055 //TODO: Assign calls->o from o
6057 LDKEventHandler ret = {
6058 .this_arg = (void*) calls,
6059 .handle_event = handle_event_LDKEventHandler_jcall,
6060 .free = LDKEventHandler_JCalls_free,
6064 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
6065 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6066 *res_ptr = LDKEventHandler_init(o);
6067 return (long)res_ptr;
6069 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
6070 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6071 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6072 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
6073 LDKEvent* event_conv = (LDKEvent*)event;
6074 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6077 typedef struct LDKEventsProvider_JCalls {
6078 atomic_size_t refcnt;
6079 uint32_t process_pending_events_meth;
6080 } LDKEventsProvider_JCalls;
6081 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6082 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6083 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6084 js_free(j_calls->process_pending_events_meth);
6088 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6089 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6090 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6091 *handler_ret = handler;
6092 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
6094 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6095 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6096 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6098 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
6099 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6100 atomic_init(&calls->refcnt, 1);
6101 //TODO: Assign calls->o from o
6103 LDKEventsProvider ret = {
6104 .this_arg = (void*) calls,
6105 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6106 .free = LDKEventsProvider_JCalls_free,
6110 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6111 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6112 *res_ptr = LDKEventsProvider_init(o);
6113 return (long)res_ptr;
6115 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
6116 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6117 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6118 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
6119 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
6120 CHECK_ACCESS(handler_ptr);
6121 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
6122 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6125 typedef struct LDKListen_JCalls {
6126 atomic_size_t refcnt;
6127 uint32_t block_connected_meth;
6128 uint32_t block_disconnected_meth;
6130 static void LDKListen_JCalls_free(void* this_arg) {
6131 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6132 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6133 js_free(j_calls->block_connected_meth);
6134 js_free(j_calls->block_disconnected_meth);
6138 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6139 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6140 LDKu8slice block_var = block;
6141 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6142 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
6143 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
6145 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6146 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6147 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
6148 memcpy((uint8_t*)(header_arr + 4), *header, 80);
6149 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
6151 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6152 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6153 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6155 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
6156 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6157 atomic_init(&calls->refcnt, 1);
6158 //TODO: Assign calls->o from o
6161 .this_arg = (void*) calls,
6162 .block_connected = block_connected_LDKListen_jcall,
6163 .block_disconnected = block_disconnected_LDKListen_jcall,
6164 .free = LDKListen_JCalls_free,
6168 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
6169 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6170 *res_ptr = LDKListen_init(o);
6171 return (long)res_ptr;
6173 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
6174 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6175 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6176 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6177 LDKu8slice block_ref;
6178 block_ref.datalen = *((uint32_t*)block);
6179 block_ref.data = (int8_t*)(block + 4);
6180 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6183 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
6184 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6185 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6186 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6187 unsigned char header_arr[80];
6188 CHECK(*((uint32_t*)header) == 80);
6189 memcpy(header_arr, (uint8_t*)(header + 4), 80);
6190 unsigned char (*header_ref)[80] = &header_arr;
6191 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6194 typedef struct LDKConfirm_JCalls {
6195 atomic_size_t refcnt;
6196 uint32_t transactions_confirmed_meth;
6197 uint32_t transaction_unconfirmed_meth;
6198 uint32_t best_block_updated_meth;
6199 uint32_t get_relevant_txids_meth;
6200 } LDKConfirm_JCalls;
6201 static void LDKConfirm_JCalls_free(void* this_arg) {
6202 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6203 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6204 js_free(j_calls->transactions_confirmed_meth);
6205 js_free(j_calls->transaction_unconfirmed_meth);
6206 js_free(j_calls->best_block_updated_meth);
6207 js_free(j_calls->get_relevant_txids_meth);
6211 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6212 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6213 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
6214 memcpy((uint8_t*)(header_arr + 4), *header, 80);
6215 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6216 uint32_tArray txdata_arr = NULL;
6217 txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6218 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
6219 for (size_t c = 0; c < txdata_var.datalen; c++) {
6220 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6221 *txdata_conv_28_conv = txdata_var.data[c];
6222 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
6225 FREE(txdata_var.data);
6226 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6228 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6229 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6230 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
6231 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
6232 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
6234 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6235 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6236 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
6237 memcpy((uint8_t*)(header_arr + 4), *header, 80);
6238 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
6240 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6241 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6242 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
6243 LDKCVec_TxidZ ret_constr;
6244 ret_constr.datalen = *((uint32_t*)ret);
6245 if (ret_constr.datalen > 0)
6246 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6248 ret_constr.data = NULL;
6249 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
6250 for (size_t m = 0; m < ret_constr.datalen; m++) {
6251 int8_tArray ret_conv_12 = ret_vals[m];
6252 LDKThirtyTwoBytes ret_conv_12_ref;
6253 CHECK(*((uint32_t*)ret_conv_12) == 32);
6254 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
6255 ret_constr.data[m] = ret_conv_12_ref;
6259 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6260 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6261 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6263 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
6264 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6265 atomic_init(&calls->refcnt, 1);
6266 //TODO: Assign calls->o from o
6269 .this_arg = (void*) calls,
6270 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6271 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6272 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6273 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6274 .free = LDKConfirm_JCalls_free,
6278 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
6279 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6280 *res_ptr = LDKConfirm_init(o);
6281 return (long)res_ptr;
6283 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6284 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6285 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6286 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6287 unsigned char header_arr[80];
6288 CHECK(*((uint32_t*)header) == 80);
6289 memcpy(header_arr, (uint8_t*)(header + 4), 80);
6290 unsigned char (*header_ref)[80] = &header_arr;
6291 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6292 txdata_constr.datalen = *((uint32_t*)txdata);
6293 if (txdata_constr.datalen > 0)
6294 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6296 txdata_constr.data = NULL;
6297 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
6298 for (size_t c = 0; c < txdata_constr.datalen; c++) {
6299 uint32_t txdata_conv_28 = txdata_vals[c];
6300 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
6301 CHECK_ACCESS(txdata_conv_28_ptr);
6302 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
6303 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
6304 txdata_constr.data[c] = txdata_conv_28_conv;
6306 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6309 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
6310 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6312 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6313 unsigned char txid_arr[32];
6314 CHECK(*((uint32_t*)txid) == 32);
6315 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
6316 unsigned char (*txid_ref)[32] = &txid_arr;
6317 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6320 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
6321 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6322 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6323 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6324 unsigned char header_arr[80];
6325 CHECK(*((uint32_t*)header) == 80);
6326 memcpy(header_arr, (uint8_t*)(header + 4), 80);
6327 unsigned char (*header_ref)[80] = &header_arr;
6328 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6331 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
6332 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6333 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6334 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6335 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6336 ptrArray ret_arr = NULL;
6337 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
6338 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
6339 for (size_t m = 0; m < ret_var.datalen; m++) {
6340 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
6341 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
6342 ret_arr_ptr[m] = ret_conv_12_arr;
6349 typedef struct LDKPersist_JCalls {
6350 atomic_size_t refcnt;
6351 uint32_t persist_new_channel_meth;
6352 uint32_t update_persisted_channel_meth;
6353 } LDKPersist_JCalls;
6354 static void LDKPersist_JCalls_free(void* this_arg) {
6355 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6356 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6357 js_free(j_calls->persist_new_channel_meth);
6358 js_free(j_calls->update_persisted_channel_meth);
6362 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6363 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6364 LDKOutPoint channel_id_var = channel_id;
6365 uint64_t channel_id_ref = 0;
6366 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6367 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6368 channel_id_ref = (uint64_t)channel_id_var.inner;
6369 if (channel_id_var.is_owned) {
6370 channel_id_ref |= 1;
6372 LDKChannelMonitor data_var = *data;
6373 uint64_t data_ref = 0;
6374 data_var = ChannelMonitor_clone(data);
6375 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6376 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6377 data_ref = (uint64_t)data_var.inner;
6378 if (data_var.is_owned) {
6381 LDKMonitorUpdateId update_id_var = update_id;
6382 uint64_t update_id_ref = 0;
6383 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6384 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6385 update_id_ref = (uint64_t)update_id_var.inner;
6386 if (update_id_var.is_owned) {
6389 uint32_t ret = js_invoke_function_3(j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
6390 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6391 CHECK_ACCESS(ret_ptr);
6392 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6393 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6396 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6397 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6398 LDKOutPoint channel_id_var = channel_id;
6399 uint64_t channel_id_ref = 0;
6400 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6401 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6402 channel_id_ref = (uint64_t)channel_id_var.inner;
6403 if (channel_id_var.is_owned) {
6404 channel_id_ref |= 1;
6406 LDKChannelMonitorUpdate update_var = *update;
6407 uint64_t update_ref = 0;
6408 if ((uint64_t)update_var.inner > 4096) {
6409 update_var = ChannelMonitorUpdate_clone(update);
6410 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6411 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6412 update_ref = (uint64_t)update_var.inner;
6413 if (update_var.is_owned) {
6417 LDKChannelMonitor data_var = *data;
6418 uint64_t data_ref = 0;
6419 data_var = ChannelMonitor_clone(data);
6420 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6421 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6422 data_ref = (uint64_t)data_var.inner;
6423 if (data_var.is_owned) {
6426 LDKMonitorUpdateId update_id_var = update_id;
6427 uint64_t update_id_ref = 0;
6428 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6429 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6430 update_id_ref = (uint64_t)update_id_var.inner;
6431 if (update_id_var.is_owned) {
6434 uint32_t ret = js_invoke_function_4(j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
6435 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6436 CHECK_ACCESS(ret_ptr);
6437 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6438 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6441 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6442 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6443 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6445 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6446 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6447 atomic_init(&calls->refcnt, 1);
6448 //TODO: Assign calls->o from o
6451 .this_arg = (void*) calls,
6452 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6453 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6454 .free = LDKPersist_JCalls_free,
6458 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6459 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6460 *res_ptr = LDKPersist_init(o);
6461 return (long)res_ptr;
6463 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t channel_id, uint32_t data, uint32_t update_id) {
6464 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6465 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6466 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6467 LDKOutPoint channel_id_conv;
6468 channel_id_conv.inner = (void*)(channel_id & (~1));
6469 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6470 channel_id_conv = OutPoint_clone(&channel_id_conv);
6471 LDKChannelMonitor data_conv;
6472 data_conv.inner = (void*)(data & (~1));
6473 data_conv.is_owned = false;
6474 LDKMonitorUpdateId update_id_conv;
6475 update_id_conv.inner = (void*)(update_id & (~1));
6476 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6477 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6478 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6479 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
6480 return (uint64_t)ret_conv;
6483 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t channel_id, uint32_t update, uint32_t data, uint32_t update_id) {
6484 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6485 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6486 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6487 LDKOutPoint channel_id_conv;
6488 channel_id_conv.inner = (void*)(channel_id & (~1));
6489 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6490 channel_id_conv = OutPoint_clone(&channel_id_conv);
6491 LDKChannelMonitorUpdate update_conv;
6492 update_conv.inner = (void*)(update & (~1));
6493 update_conv.is_owned = false;
6494 LDKChannelMonitor data_conv;
6495 data_conv.inner = (void*)(data & (~1));
6496 data_conv.is_owned = false;
6497 LDKMonitorUpdateId update_id_conv;
6498 update_id_conv.inner = (void*)(update_id & (~1));
6499 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6500 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6501 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6502 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
6503 return (uint64_t)ret_conv;
6506 typedef struct LDKChannelMessageHandler_JCalls {
6507 atomic_size_t refcnt;
6508 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6509 uint32_t handle_open_channel_meth;
6510 uint32_t handle_accept_channel_meth;
6511 uint32_t handle_funding_created_meth;
6512 uint32_t handle_funding_signed_meth;
6513 uint32_t handle_funding_locked_meth;
6514 uint32_t handle_shutdown_meth;
6515 uint32_t handle_closing_signed_meth;
6516 uint32_t handle_update_add_htlc_meth;
6517 uint32_t handle_update_fulfill_htlc_meth;
6518 uint32_t handle_update_fail_htlc_meth;
6519 uint32_t handle_update_fail_malformed_htlc_meth;
6520 uint32_t handle_commitment_signed_meth;
6521 uint32_t handle_revoke_and_ack_meth;
6522 uint32_t handle_update_fee_meth;
6523 uint32_t handle_announcement_signatures_meth;
6524 uint32_t peer_disconnected_meth;
6525 uint32_t peer_connected_meth;
6526 uint32_t handle_channel_reestablish_meth;
6527 uint32_t handle_channel_update_meth;
6528 uint32_t handle_error_meth;
6529 } LDKChannelMessageHandler_JCalls;
6530 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6531 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6532 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6533 js_free(j_calls->handle_open_channel_meth);
6534 js_free(j_calls->handle_accept_channel_meth);
6535 js_free(j_calls->handle_funding_created_meth);
6536 js_free(j_calls->handle_funding_signed_meth);
6537 js_free(j_calls->handle_funding_locked_meth);
6538 js_free(j_calls->handle_shutdown_meth);
6539 js_free(j_calls->handle_closing_signed_meth);
6540 js_free(j_calls->handle_update_add_htlc_meth);
6541 js_free(j_calls->handle_update_fulfill_htlc_meth);
6542 js_free(j_calls->handle_update_fail_htlc_meth);
6543 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
6544 js_free(j_calls->handle_commitment_signed_meth);
6545 js_free(j_calls->handle_revoke_and_ack_meth);
6546 js_free(j_calls->handle_update_fee_meth);
6547 js_free(j_calls->handle_announcement_signatures_meth);
6548 js_free(j_calls->peer_disconnected_meth);
6549 js_free(j_calls->peer_connected_meth);
6550 js_free(j_calls->handle_channel_reestablish_meth);
6551 js_free(j_calls->handle_channel_update_meth);
6552 js_free(j_calls->handle_error_meth);
6556 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6557 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6558 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6559 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6560 LDKInitFeatures their_features_var = their_features;
6561 uint64_t their_features_ref = 0;
6562 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6563 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6564 their_features_ref = (uint64_t)their_features_var.inner;
6565 if (their_features_var.is_owned) {
6566 their_features_ref |= 1;
6568 LDKOpenChannel msg_var = *msg;
6569 uint64_t msg_ref = 0;
6570 msg_var = OpenChannel_clone(msg);
6571 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6572 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6573 msg_ref = (uint64_t)msg_var.inner;
6574 if (msg_var.is_owned) {
6577 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6579 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6580 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6581 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6582 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6583 LDKInitFeatures their_features_var = their_features;
6584 uint64_t their_features_ref = 0;
6585 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6586 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6587 their_features_ref = (uint64_t)their_features_var.inner;
6588 if (their_features_var.is_owned) {
6589 their_features_ref |= 1;
6591 LDKAcceptChannel msg_var = *msg;
6592 uint64_t msg_ref = 0;
6593 msg_var = AcceptChannel_clone(msg);
6594 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6595 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6596 msg_ref = (uint64_t)msg_var.inner;
6597 if (msg_var.is_owned) {
6600 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6602 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6603 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6604 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6605 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6606 LDKFundingCreated msg_var = *msg;
6607 uint64_t msg_ref = 0;
6608 msg_var = FundingCreated_clone(msg);
6609 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6610 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6611 msg_ref = (uint64_t)msg_var.inner;
6612 if (msg_var.is_owned) {
6615 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6617 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6618 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6619 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6620 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6621 LDKFundingSigned msg_var = *msg;
6622 uint64_t msg_ref = 0;
6623 msg_var = FundingSigned_clone(msg);
6624 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6625 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6626 msg_ref = (uint64_t)msg_var.inner;
6627 if (msg_var.is_owned) {
6630 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6632 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6633 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6634 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6635 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6636 LDKFundingLocked msg_var = *msg;
6637 uint64_t msg_ref = 0;
6638 msg_var = FundingLocked_clone(msg);
6639 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6640 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6641 msg_ref = (uint64_t)msg_var.inner;
6642 if (msg_var.is_owned) {
6645 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6647 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6648 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6649 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6650 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6651 LDKInitFeatures their_features_var = *their_features;
6652 uint64_t their_features_ref = 0;
6653 their_features_var = InitFeatures_clone(their_features);
6654 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6655 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6656 their_features_ref = (uint64_t)their_features_var.inner;
6657 if (their_features_var.is_owned) {
6658 their_features_ref |= 1;
6660 LDKShutdown msg_var = *msg;
6661 uint64_t msg_ref = 0;
6662 msg_var = Shutdown_clone(msg);
6663 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6664 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6665 msg_ref = (uint64_t)msg_var.inner;
6666 if (msg_var.is_owned) {
6669 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6671 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6672 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6673 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6674 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6675 LDKClosingSigned msg_var = *msg;
6676 uint64_t msg_ref = 0;
6677 msg_var = ClosingSigned_clone(msg);
6678 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6679 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6680 msg_ref = (uint64_t)msg_var.inner;
6681 if (msg_var.is_owned) {
6684 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6686 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6687 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6688 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6689 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6690 LDKUpdateAddHTLC msg_var = *msg;
6691 uint64_t msg_ref = 0;
6692 msg_var = UpdateAddHTLC_clone(msg);
6693 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6694 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6695 msg_ref = (uint64_t)msg_var.inner;
6696 if (msg_var.is_owned) {
6699 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6701 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6702 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6703 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6704 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6705 LDKUpdateFulfillHTLC msg_var = *msg;
6706 uint64_t msg_ref = 0;
6707 msg_var = UpdateFulfillHTLC_clone(msg);
6708 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6709 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6710 msg_ref = (uint64_t)msg_var.inner;
6711 if (msg_var.is_owned) {
6714 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6716 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6717 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6718 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6719 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6720 LDKUpdateFailHTLC msg_var = *msg;
6721 uint64_t msg_ref = 0;
6722 msg_var = UpdateFailHTLC_clone(msg);
6723 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6724 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6725 msg_ref = (uint64_t)msg_var.inner;
6726 if (msg_var.is_owned) {
6729 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6731 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6732 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6733 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6734 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6735 LDKUpdateFailMalformedHTLC msg_var = *msg;
6736 uint64_t msg_ref = 0;
6737 msg_var = UpdateFailMalformedHTLC_clone(msg);
6738 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6739 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6740 msg_ref = (uint64_t)msg_var.inner;
6741 if (msg_var.is_owned) {
6744 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6746 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6747 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6748 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6749 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6750 LDKCommitmentSigned msg_var = *msg;
6751 uint64_t msg_ref = 0;
6752 msg_var = CommitmentSigned_clone(msg);
6753 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6754 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6755 msg_ref = (uint64_t)msg_var.inner;
6756 if (msg_var.is_owned) {
6759 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6761 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6762 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6763 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6764 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6765 LDKRevokeAndACK msg_var = *msg;
6766 uint64_t msg_ref = 0;
6767 msg_var = RevokeAndACK_clone(msg);
6768 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6769 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6770 msg_ref = (uint64_t)msg_var.inner;
6771 if (msg_var.is_owned) {
6774 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6776 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6777 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6778 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6779 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6780 LDKUpdateFee msg_var = *msg;
6781 uint64_t msg_ref = 0;
6782 msg_var = UpdateFee_clone(msg);
6783 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6784 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6785 msg_ref = (uint64_t)msg_var.inner;
6786 if (msg_var.is_owned) {
6789 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6791 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6792 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6793 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6794 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6795 LDKAnnouncementSignatures msg_var = *msg;
6796 uint64_t msg_ref = 0;
6797 msg_var = AnnouncementSignatures_clone(msg);
6798 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6799 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6800 msg_ref = (uint64_t)msg_var.inner;
6801 if (msg_var.is_owned) {
6804 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6806 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6807 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6808 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6809 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6810 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6812 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6813 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6814 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6815 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6816 LDKInit msg_var = *msg;
6817 uint64_t msg_ref = 0;
6818 msg_var = Init_clone(msg);
6819 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6820 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6821 msg_ref = (uint64_t)msg_var.inner;
6822 if (msg_var.is_owned) {
6825 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6827 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6828 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6829 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6830 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6831 LDKChannelReestablish msg_var = *msg;
6832 uint64_t msg_ref = 0;
6833 msg_var = ChannelReestablish_clone(msg);
6834 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6835 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6836 msg_ref = (uint64_t)msg_var.inner;
6837 if (msg_var.is_owned) {
6840 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6842 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6843 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6844 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6845 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6846 LDKChannelUpdate msg_var = *msg;
6847 uint64_t msg_ref = 0;
6848 msg_var = ChannelUpdate_clone(msg);
6849 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6850 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6851 msg_ref = (uint64_t)msg_var.inner;
6852 if (msg_var.is_owned) {
6855 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6857 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6858 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6859 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6860 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6861 LDKErrorMessage msg_var = *msg;
6862 uint64_t msg_ref = 0;
6863 msg_var = ErrorMessage_clone(msg);
6864 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6865 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6866 msg_ref = (uint64_t)msg_var.inner;
6867 if (msg_var.is_owned) {
6870 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6872 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6873 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6874 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6875 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6877 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6878 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6879 atomic_init(&calls->refcnt, 1);
6880 //TODO: Assign calls->o from o
6882 LDKChannelMessageHandler ret = {
6883 .this_arg = (void*) calls,
6884 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6885 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6886 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6887 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6888 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6889 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6890 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6891 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6892 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6893 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6894 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6895 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6896 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6897 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6898 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6899 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6900 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6901 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6902 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6903 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6904 .free = LDKChannelMessageHandler_JCalls_free,
6905 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6907 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6910 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6911 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6912 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6913 return (long)res_ptr;
6915 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) {
6916 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6917 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6918 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6919 LDKPublicKey their_node_id_ref;
6920 CHECK(*((uint32_t*)their_node_id) == 33);
6921 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6922 LDKInitFeatures their_features_conv;
6923 their_features_conv.inner = (void*)(their_features & (~1));
6924 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6925 their_features_conv = InitFeatures_clone(&their_features_conv);
6926 LDKOpenChannel msg_conv;
6927 msg_conv.inner = (void*)(msg & (~1));
6928 msg_conv.is_owned = false;
6929 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6932 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) {
6933 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6934 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6935 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6936 LDKPublicKey their_node_id_ref;
6937 CHECK(*((uint32_t*)their_node_id) == 33);
6938 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6939 LDKInitFeatures their_features_conv;
6940 their_features_conv.inner = (void*)(their_features & (~1));
6941 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6942 their_features_conv = InitFeatures_clone(&their_features_conv);
6943 LDKAcceptChannel msg_conv;
6944 msg_conv.inner = (void*)(msg & (~1));
6945 msg_conv.is_owned = false;
6946 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6949 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6950 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6951 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6952 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6953 LDKPublicKey their_node_id_ref;
6954 CHECK(*((uint32_t*)their_node_id) == 33);
6955 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6956 LDKFundingCreated msg_conv;
6957 msg_conv.inner = (void*)(msg & (~1));
6958 msg_conv.is_owned = false;
6959 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6962 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6963 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6964 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6965 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6966 LDKPublicKey their_node_id_ref;
6967 CHECK(*((uint32_t*)their_node_id) == 33);
6968 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6969 LDKFundingSigned msg_conv;
6970 msg_conv.inner = (void*)(msg & (~1));
6971 msg_conv.is_owned = false;
6972 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6975 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6976 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6977 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6978 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6979 LDKPublicKey their_node_id_ref;
6980 CHECK(*((uint32_t*)their_node_id) == 33);
6981 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6982 LDKFundingLocked msg_conv;
6983 msg_conv.inner = (void*)(msg & (~1));
6984 msg_conv.is_owned = false;
6985 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6988 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6989 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6991 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
6992 LDKPublicKey their_node_id_ref;
6993 CHECK(*((uint32_t*)their_node_id) == 33);
6994 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6995 LDKInitFeatures their_features_conv;
6996 their_features_conv.inner = (void*)(their_features & (~1));
6997 their_features_conv.is_owned = false;
6998 LDKShutdown msg_conv;
6999 msg_conv.inner = (void*)(msg & (~1));
7000 msg_conv.is_owned = false;
7001 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7004 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7005 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7006 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7007 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7008 LDKPublicKey their_node_id_ref;
7009 CHECK(*((uint32_t*)their_node_id) == 33);
7010 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7011 LDKClosingSigned msg_conv;
7012 msg_conv.inner = (void*)(msg & (~1));
7013 msg_conv.is_owned = false;
7014 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7017 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7018 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7020 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7021 LDKPublicKey their_node_id_ref;
7022 CHECK(*((uint32_t*)their_node_id) == 33);
7023 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7024 LDKUpdateAddHTLC msg_conv;
7025 msg_conv.inner = (void*)(msg & (~1));
7026 msg_conv.is_owned = false;
7027 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7030 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7031 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7032 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7033 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7034 LDKPublicKey their_node_id_ref;
7035 CHECK(*((uint32_t*)their_node_id) == 33);
7036 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7037 LDKUpdateFulfillHTLC msg_conv;
7038 msg_conv.inner = (void*)(msg & (~1));
7039 msg_conv.is_owned = false;
7040 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7043 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7044 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7045 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7046 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7047 LDKPublicKey their_node_id_ref;
7048 CHECK(*((uint32_t*)their_node_id) == 33);
7049 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7050 LDKUpdateFailHTLC msg_conv;
7051 msg_conv.inner = (void*)(msg & (~1));
7052 msg_conv.is_owned = false;
7053 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7056 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7057 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7058 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7059 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7060 LDKPublicKey their_node_id_ref;
7061 CHECK(*((uint32_t*)their_node_id) == 33);
7062 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7063 LDKUpdateFailMalformedHTLC msg_conv;
7064 msg_conv.inner = (void*)(msg & (~1));
7065 msg_conv.is_owned = false;
7066 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7069 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7070 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7071 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7072 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7073 LDKPublicKey their_node_id_ref;
7074 CHECK(*((uint32_t*)their_node_id) == 33);
7075 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7076 LDKCommitmentSigned msg_conv;
7077 msg_conv.inner = (void*)(msg & (~1));
7078 msg_conv.is_owned = false;
7079 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7082 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7083 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7084 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7085 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7086 LDKPublicKey their_node_id_ref;
7087 CHECK(*((uint32_t*)their_node_id) == 33);
7088 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7089 LDKRevokeAndACK msg_conv;
7090 msg_conv.inner = (void*)(msg & (~1));
7091 msg_conv.is_owned = false;
7092 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7095 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7096 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7097 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7098 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7099 LDKPublicKey their_node_id_ref;
7100 CHECK(*((uint32_t*)their_node_id) == 33);
7101 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7102 LDKUpdateFee msg_conv;
7103 msg_conv.inner = (void*)(msg & (~1));
7104 msg_conv.is_owned = false;
7105 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7108 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7109 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7110 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7111 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7112 LDKPublicKey their_node_id_ref;
7113 CHECK(*((uint32_t*)their_node_id) == 33);
7114 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7115 LDKAnnouncementSignatures msg_conv;
7116 msg_conv.inner = (void*)(msg & (~1));
7117 msg_conv.is_owned = false;
7118 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7121 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
7122 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7123 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7124 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7125 LDKPublicKey their_node_id_ref;
7126 CHECK(*((uint32_t*)their_node_id) == 33);
7127 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7128 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7131 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7132 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7133 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7134 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7135 LDKPublicKey their_node_id_ref;
7136 CHECK(*((uint32_t*)their_node_id) == 33);
7137 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7139 msg_conv.inner = (void*)(msg & (~1));
7140 msg_conv.is_owned = false;
7141 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7144 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7145 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7146 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7147 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7148 LDKPublicKey their_node_id_ref;
7149 CHECK(*((uint32_t*)their_node_id) == 33);
7150 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7151 LDKChannelReestablish msg_conv;
7152 msg_conv.inner = (void*)(msg & (~1));
7153 msg_conv.is_owned = false;
7154 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7157 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7158 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7159 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7160 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7161 LDKPublicKey their_node_id_ref;
7162 CHECK(*((uint32_t*)their_node_id) == 33);
7163 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7164 LDKChannelUpdate msg_conv;
7165 msg_conv.inner = (void*)(msg & (~1));
7166 msg_conv.is_owned = false;
7167 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7170 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7171 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7172 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7173 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7174 LDKPublicKey their_node_id_ref;
7175 CHECK(*((uint32_t*)their_node_id) == 33);
7176 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7177 LDKErrorMessage msg_conv;
7178 msg_conv.inner = (void*)(msg & (~1));
7179 msg_conv.is_owned = false;
7180 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7183 typedef struct LDKRoutingMessageHandler_JCalls {
7184 atomic_size_t refcnt;
7185 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7186 uint32_t handle_node_announcement_meth;
7187 uint32_t handle_channel_announcement_meth;
7188 uint32_t handle_channel_update_meth;
7189 uint32_t get_next_channel_announcements_meth;
7190 uint32_t get_next_node_announcements_meth;
7191 uint32_t sync_routing_table_meth;
7192 uint32_t handle_reply_channel_range_meth;
7193 uint32_t handle_reply_short_channel_ids_end_meth;
7194 uint32_t handle_query_channel_range_meth;
7195 uint32_t handle_query_short_channel_ids_meth;
7196 } LDKRoutingMessageHandler_JCalls;
7197 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7198 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7199 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7200 js_free(j_calls->handle_node_announcement_meth);
7201 js_free(j_calls->handle_channel_announcement_meth);
7202 js_free(j_calls->handle_channel_update_meth);
7203 js_free(j_calls->get_next_channel_announcements_meth);
7204 js_free(j_calls->get_next_node_announcements_meth);
7205 js_free(j_calls->sync_routing_table_meth);
7206 js_free(j_calls->handle_reply_channel_range_meth);
7207 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
7208 js_free(j_calls->handle_query_channel_range_meth);
7209 js_free(j_calls->handle_query_short_channel_ids_meth);
7213 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7214 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7215 LDKNodeAnnouncement msg_var = *msg;
7216 uint64_t msg_ref = 0;
7217 msg_var = NodeAnnouncement_clone(msg);
7218 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7219 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7220 msg_ref = (uint64_t)msg_var.inner;
7221 if (msg_var.is_owned) {
7224 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
7225 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7226 CHECK_ACCESS(ret_ptr);
7227 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7228 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7231 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7232 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7233 LDKChannelAnnouncement msg_var = *msg;
7234 uint64_t msg_ref = 0;
7235 msg_var = ChannelAnnouncement_clone(msg);
7236 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7237 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7238 msg_ref = (uint64_t)msg_var.inner;
7239 if (msg_var.is_owned) {
7242 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
7243 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7244 CHECK_ACCESS(ret_ptr);
7245 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7246 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7249 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7250 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7251 LDKChannelUpdate msg_var = *msg;
7252 uint64_t msg_ref = 0;
7253 msg_var = ChannelUpdate_clone(msg);
7254 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7255 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7256 msg_ref = (uint64_t)msg_var.inner;
7257 if (msg_var.is_owned) {
7260 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
7261 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7262 CHECK_ACCESS(ret_ptr);
7263 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7264 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7267 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7268 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7269 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
7270 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7271 ret_constr.datalen = *((uint32_t*)ret);
7272 if (ret_constr.datalen > 0)
7273 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7275 ret_constr.data = NULL;
7276 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7277 for (size_t h = 0; h < ret_constr.datalen; h++) {
7278 uint32_t ret_conv_59 = ret_vals[h];
7279 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
7280 CHECK_ACCESS(ret_conv_59_ptr);
7281 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
7282 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
7283 ret_constr.data[h] = ret_conv_59_conv;
7287 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7288 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7289 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7290 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
7291 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
7292 LDKCVec_NodeAnnouncementZ ret_constr;
7293 ret_constr.datalen = *((uint32_t*)ret);
7294 if (ret_constr.datalen > 0)
7295 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7297 ret_constr.data = NULL;
7298 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7299 for (size_t s = 0; s < ret_constr.datalen; s++) {
7300 uint32_t ret_conv_18 = ret_vals[s];
7301 LDKNodeAnnouncement ret_conv_18_conv;
7302 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7303 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7304 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
7305 ret_constr.data[s] = ret_conv_18_conv;
7309 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7310 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7311 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7312 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
7313 LDKInit init_var = *init;
7314 uint64_t init_ref = 0;
7315 init_var = Init_clone(init);
7316 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7317 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7318 init_ref = (uint64_t)init_var.inner;
7319 if (init_var.is_owned) {
7322 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
7324 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7325 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7326 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7327 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
7328 LDKReplyChannelRange msg_var = msg;
7329 uint64_t msg_ref = 0;
7330 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7331 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7332 msg_ref = (uint64_t)msg_var.inner;
7333 if (msg_var.is_owned) {
7336 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
7337 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7338 CHECK_ACCESS(ret_ptr);
7339 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7340 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7343 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
7344 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7345 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7346 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
7347 LDKReplyShortChannelIdsEnd msg_var = msg;
7348 uint64_t msg_ref = 0;
7349 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7350 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7351 msg_ref = (uint64_t)msg_var.inner;
7352 if (msg_var.is_owned) {
7355 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
7356 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7357 CHECK_ACCESS(ret_ptr);
7358 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7359 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7362 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
7363 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7364 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7365 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
7366 LDKQueryChannelRange msg_var = msg;
7367 uint64_t msg_ref = 0;
7368 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7369 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7370 msg_ref = (uint64_t)msg_var.inner;
7371 if (msg_var.is_owned) {
7374 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
7375 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7376 CHECK_ACCESS(ret_ptr);
7377 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7378 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7381 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
7382 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7383 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7384 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
7385 LDKQueryShortChannelIds msg_var = msg;
7386 uint64_t msg_ref = 0;
7387 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7388 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7389 msg_ref = (uint64_t)msg_var.inner;
7390 if (msg_var.is_owned) {
7393 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
7394 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7395 CHECK_ACCESS(ret_ptr);
7396 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7397 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7400 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
7401 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
7402 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7403 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7405 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7406 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
7407 atomic_init(&calls->refcnt, 1);
7408 //TODO: Assign calls->o from o
7410 LDKRoutingMessageHandler ret = {
7411 .this_arg = (void*) calls,
7412 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
7413 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
7414 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
7415 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
7416 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
7417 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
7418 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
7419 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
7420 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
7421 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
7422 .free = LDKRoutingMessageHandler_JCalls_free,
7423 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7425 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7428 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7429 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
7430 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
7431 return (long)res_ptr;
7433 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
7434 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7435 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7436 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7437 LDKNodeAnnouncement msg_conv;
7438 msg_conv.inner = (void*)(msg & (~1));
7439 msg_conv.is_owned = false;
7440 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7441 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
7442 return (uint64_t)ret_conv;
7445 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
7446 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7447 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7448 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7449 LDKChannelAnnouncement msg_conv;
7450 msg_conv.inner = (void*)(msg & (~1));
7451 msg_conv.is_owned = false;
7452 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7453 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
7454 return (uint64_t)ret_conv;
7457 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
7458 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7459 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7460 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7461 LDKChannelUpdate msg_conv;
7462 msg_conv.inner = (void*)(msg & (~1));
7463 msg_conv.is_owned = false;
7464 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7465 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
7466 return (uint64_t)ret_conv;
7469 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
7470 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7471 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7472 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7473 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
7474 uint32_tArray ret_arr = NULL;
7475 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7476 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7477 for (size_t h = 0; h < ret_var.datalen; h++) {
7478 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7479 *ret_conv_59_conv = ret_var.data[h];
7480 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
7487 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
7488 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7489 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7490 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7491 LDKPublicKey starting_point_ref;
7492 CHECK(*((uint32_t*)starting_point) == 33);
7493 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
7494 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
7495 uint32_tArray ret_arr = NULL;
7496 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7497 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7498 for (size_t s = 0; s < ret_var.datalen; s++) {
7499 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
7500 uint64_t ret_conv_18_ref = 0;
7501 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7502 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7503 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
7504 if (ret_conv_18_var.is_owned) {
7505 ret_conv_18_ref |= 1;
7507 ret_arr_ptr[s] = ret_conv_18_ref;
7514 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7515 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7516 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7517 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7518 LDKPublicKey their_node_id_ref;
7519 CHECK(*((uint32_t*)their_node_id) == 33);
7520 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7522 init_conv.inner = (void*)(init & (~1));
7523 init_conv.is_owned = false;
7524 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7527 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7528 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7529 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7530 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7531 LDKPublicKey their_node_id_ref;
7532 CHECK(*((uint32_t*)their_node_id) == 33);
7533 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7534 LDKReplyChannelRange msg_conv;
7535 msg_conv.inner = (void*)(msg & (~1));
7536 msg_conv.is_owned = (msg & 1) || (msg == 0);
7537 msg_conv = ReplyChannelRange_clone(&msg_conv);
7538 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7539 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7540 return (uint64_t)ret_conv;
7543 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) {
7544 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7545 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7546 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7547 LDKPublicKey their_node_id_ref;
7548 CHECK(*((uint32_t*)their_node_id) == 33);
7549 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7550 LDKReplyShortChannelIdsEnd msg_conv;
7551 msg_conv.inner = (void*)(msg & (~1));
7552 msg_conv.is_owned = (msg & 1) || (msg == 0);
7553 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7554 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7555 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7556 return (uint64_t)ret_conv;
7559 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7560 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7561 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7562 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7563 LDKPublicKey their_node_id_ref;
7564 CHECK(*((uint32_t*)their_node_id) == 33);
7565 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7566 LDKQueryChannelRange msg_conv;
7567 msg_conv.inner = (void*)(msg & (~1));
7568 msg_conv.is_owned = (msg & 1) || (msg == 0);
7569 msg_conv = QueryChannelRange_clone(&msg_conv);
7570 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7571 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7572 return (uint64_t)ret_conv;
7575 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7576 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7578 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7579 LDKPublicKey their_node_id_ref;
7580 CHECK(*((uint32_t*)their_node_id) == 33);
7581 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7582 LDKQueryShortChannelIds msg_conv;
7583 msg_conv.inner = (void*)(msg & (~1));
7584 msg_conv.is_owned = (msg & 1) || (msg == 0);
7585 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7586 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7587 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7588 return (uint64_t)ret_conv;
7591 typedef struct LDKCustomMessageReader_JCalls {
7592 atomic_size_t refcnt;
7594 } LDKCustomMessageReader_JCalls;
7595 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7596 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7597 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7598 js_free(j_calls->read_meth);
7602 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7603 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7604 LDKu8slice buffer_var = buffer;
7605 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7606 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7607 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7608 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7609 CHECK_ACCESS(ret_ptr);
7610 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
7611 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
7614 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7615 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7616 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7618 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7619 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7620 atomic_init(&calls->refcnt, 1);
7621 //TODO: Assign calls->o from o
7623 LDKCustomMessageReader ret = {
7624 .this_arg = (void*) calls,
7625 .read = read_LDKCustomMessageReader_jcall,
7626 .free = LDKCustomMessageReader_JCalls_free,
7630 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7631 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7632 *res_ptr = LDKCustomMessageReader_init(o);
7633 return (long)res_ptr;
7635 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7636 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7637 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7638 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
7639 LDKu8slice buffer_ref;
7640 buffer_ref.datalen = *((uint32_t*)buffer);
7641 buffer_ref.data = (int8_t*)(buffer + 4);
7642 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7643 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7644 return (uint64_t)ret_conv;
7647 typedef struct LDKCustomMessageHandler_JCalls {
7648 atomic_size_t refcnt;
7649 LDKCustomMessageReader_JCalls* CustomMessageReader;
7650 uint32_t handle_custom_message_meth;
7651 uint32_t get_and_clear_pending_msg_meth;
7652 } LDKCustomMessageHandler_JCalls;
7653 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7654 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7655 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7656 js_free(j_calls->handle_custom_message_meth);
7657 js_free(j_calls->get_and_clear_pending_msg_meth);
7661 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7662 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7663 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
7665 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7666 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7667 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7668 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7669 CHECK_ACCESS(ret_ptr);
7670 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7671 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7674 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7675 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7676 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7677 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7678 ret_constr.datalen = *((uint32_t*)ret);
7679 if (ret_constr.datalen > 0)
7680 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7682 ret_constr.data = NULL;
7683 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7684 for (size_t z = 0; z < ret_constr.datalen; z++) {
7685 uint32_t ret_conv_25 = ret_vals[z];
7686 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
7687 CHECK_ACCESS(ret_conv_25_ptr);
7688 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
7689 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
7690 ret_constr.data[z] = ret_conv_25_conv;
7694 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7695 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7696 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7697 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7699 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7700 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7701 atomic_init(&calls->refcnt, 1);
7702 //TODO: Assign calls->o from o
7704 LDKCustomMessageHandler ret = {
7705 .this_arg = (void*) calls,
7706 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7707 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7708 .free = LDKCustomMessageHandler_JCalls_free,
7709 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7711 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7714 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7715 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7716 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7717 return (long)res_ptr;
7719 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7720 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7721 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7722 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7723 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
7724 CHECK_ACCESS(msg_ptr);
7725 LDKType msg_conv = *(LDKType*)(msg_ptr);
7726 LDKPublicKey sender_node_id_ref;
7727 CHECK(*((uint32_t*)sender_node_id) == 33);
7728 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7729 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7730 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7731 return (uint64_t)ret_conv;
7734 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7735 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7736 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7737 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
7738 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7739 uint32_tArray ret_arr = NULL;
7740 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7741 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7742 for (size_t z = 0; z < ret_var.datalen; z++) {
7743 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7744 *ret_conv_25_conv = ret_var.data[z];
7745 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7752 typedef struct LDKSocketDescriptor_JCalls {
7753 atomic_size_t refcnt;
7754 uint32_t send_data_meth;
7755 uint32_t disconnect_socket_meth;
7758 } LDKSocketDescriptor_JCalls;
7759 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7760 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7761 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7762 js_free(j_calls->send_data_meth);
7763 js_free(j_calls->disconnect_socket_meth);
7764 js_free(j_calls->eq_meth);
7765 js_free(j_calls->hash_meth);
7769 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7770 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7771 LDKu8slice data_var = data;
7772 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7773 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7774 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7776 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7777 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7778 js_invoke_function_0(j_calls->disconnect_socket_meth);
7780 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7781 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7782 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7783 *other_arg_clone = SocketDescriptor_clone(other_arg);
7784 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7786 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7787 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7788 return js_invoke_function_0(j_calls->hash_meth);
7790 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7791 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7792 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7794 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7795 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7796 atomic_init(&calls->refcnt, 1);
7797 //TODO: Assign calls->o from o
7799 LDKSocketDescriptor ret = {
7800 .this_arg = (void*) calls,
7801 .send_data = send_data_LDKSocketDescriptor_jcall,
7802 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7803 .eq = eq_LDKSocketDescriptor_jcall,
7804 .hash = hash_LDKSocketDescriptor_jcall,
7805 .cloned = LDKSocketDescriptor_JCalls_cloned,
7806 .free = LDKSocketDescriptor_JCalls_free,
7810 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7811 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7812 *res_ptr = LDKSocketDescriptor_init(o);
7813 return (long)res_ptr;
7815 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7816 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7817 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7818 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7819 LDKu8slice data_ref;
7820 data_ref.datalen = *((uint32_t*)data);
7821 data_ref.data = (int8_t*)(data + 4);
7822 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7826 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7827 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7828 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7829 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7830 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7833 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7834 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7835 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7836 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
7837 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7841 typedef struct LDKScore_JCalls {
7842 atomic_size_t refcnt;
7843 uint32_t channel_penalty_msat_meth;
7844 uint32_t payment_path_failed_meth;
7845 uint32_t write_meth;
7847 static void LDKScore_JCalls_free(void* this_arg) {
7848 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7849 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7850 js_free(j_calls->channel_penalty_msat_meth);
7851 js_free(j_calls->payment_path_failed_meth);
7852 js_free(j_calls->write_meth);
7856 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) {
7857 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7858 LDKNodeId source_var = *source;
7859 uint64_t source_ref = 0;
7860 source_var = NodeId_clone(source);
7861 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7862 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7863 source_ref = (uint64_t)source_var.inner;
7864 if (source_var.is_owned) {
7867 LDKNodeId target_var = *target;
7868 uint64_t target_ref = 0;
7869 target_var = NodeId_clone(target);
7870 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7871 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7872 target_ref = (uint64_t)target_var.inner;
7873 if (target_var.is_owned) {
7876 return js_invoke_function_3(j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref);
7878 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7879 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7880 LDKCVec_RouteHopZ path_var = path;
7881 uint32_tArray path_arr = NULL;
7882 path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7883 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
7884 for (size_t k = 0; k < path_var.datalen; k++) {
7885 LDKRouteHop path_conv_10_var = path_var.data[k];
7886 uint64_t path_conv_10_ref = 0;
7887 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7888 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7889 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
7890 if (path_conv_10_var.is_owned) {
7891 path_conv_10_ref |= 1;
7893 path_arr_ptr[k] = path_conv_10_ref;
7896 FREE(path_var.data);
7897 js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id);
7899 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7900 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7901 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
7902 LDKCVec_u8Z ret_ref;
7903 ret_ref.datalen = *((uint32_t*)ret);
7904 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7905 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
7908 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7909 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7910 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7912 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7913 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7914 atomic_init(&calls->refcnt, 1);
7915 //TODO: Assign calls->o from o
7918 .this_arg = (void*) calls,
7919 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7920 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7921 .write = write_LDKScore_jcall,
7922 .free = LDKScore_JCalls_free,
7926 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7927 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7928 *res_ptr = LDKScore_init(o);
7929 return (long)res_ptr;
7931 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, uint32_t source, uint32_t target) {
7932 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7933 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7934 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7935 LDKNodeId source_conv;
7936 source_conv.inner = (void*)(source & (~1));
7937 source_conv.is_owned = false;
7938 LDKNodeId target_conv;
7939 target_conv.inner = (void*)(target & (~1));
7940 target_conv.is_owned = false;
7941 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv);
7945 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
7946 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7947 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7948 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7949 LDKCVec_RouteHopZ path_constr;
7950 path_constr.datalen = *((uint32_t*)path);
7951 if (path_constr.datalen > 0)
7952 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7954 path_constr.data = NULL;
7955 uint32_t* path_vals = (uint32_t*)(path + 4);
7956 for (size_t k = 0; k < path_constr.datalen; k++) {
7957 uint32_t path_conv_10 = path_vals[k];
7958 LDKRouteHop path_conv_10_conv;
7959 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
7960 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
7961 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7962 path_constr.data[k] = path_conv_10_conv;
7964 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7967 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
7968 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7969 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7970 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7971 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
7974 CVec_u8Z_free(ret_var);
7978 typedef struct LDKChannelManagerPersister_JCalls {
7979 atomic_size_t refcnt;
7980 uint32_t persist_manager_meth;
7981 } LDKChannelManagerPersister_JCalls;
7982 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7983 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7984 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7985 js_free(j_calls->persist_manager_meth);
7989 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7990 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7991 LDKChannelManager channel_manager_var = *channel_manager;
7992 uint64_t channel_manager_ref = 0;
7993 // Warning: we may need a move here but no clone is available for LDKChannelManager
7994 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7995 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7996 channel_manager_ref = (uint64_t)channel_manager_var.inner;
7997 if (channel_manager_var.is_owned) {
7998 channel_manager_ref |= 1;
8000 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
8001 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8002 CHECK_ACCESS(ret_ptr);
8003 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8004 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8007 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
8008 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
8009 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8011 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
8012 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8013 atomic_init(&calls->refcnt, 1);
8014 //TODO: Assign calls->o from o
8016 LDKChannelManagerPersister ret = {
8017 .this_arg = (void*) calls,
8018 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8019 .free = LDKChannelManagerPersister_JCalls_free,
8023 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
8024 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8025 *res_ptr = LDKChannelManagerPersister_init(o);
8026 return (long)res_ptr;
8028 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
8029 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8031 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
8032 LDKChannelManager channel_manager_conv;
8033 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8034 channel_manager_conv.is_owned = false;
8035 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8036 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8037 return (uint64_t)ret_conv;
8040 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
8041 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8043 case LDKFallback_SegWitProgram: {
8044 uint8_t version_val = obj->seg_wit_program.version._0;
8045 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8046 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8047 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
8048 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
8050 case LDKFallback_PubKeyHash: {
8051 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
8052 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
8053 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
8055 case LDKFallback_ScriptHash: {
8056 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
8057 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
8058 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
8063 typedef struct LDKPayer_JCalls {
8064 atomic_size_t refcnt;
8065 uint32_t node_id_meth;
8066 uint32_t first_hops_meth;
8067 uint32_t send_payment_meth;
8068 uint32_t retry_payment_meth;
8070 static void LDKPayer_JCalls_free(void* this_arg) {
8071 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
8072 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8073 js_free(j_calls->node_id_meth);
8074 js_free(j_calls->first_hops_meth);
8075 js_free(j_calls->send_payment_meth);
8076 js_free(j_calls->retry_payment_meth);
8080 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
8081 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
8082 int8_tArray ret = js_invoke_function_0(j_calls->node_id_meth);
8083 LDKPublicKey ret_ref;
8084 CHECK(*((uint32_t*)ret) == 33);
8085 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
8088 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
8089 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
8090 uint32_tArray ret = js_invoke_function_0(j_calls->first_hops_meth);
8091 LDKCVec_ChannelDetailsZ ret_constr;
8092 ret_constr.datalen = *((uint32_t*)ret);
8093 if (ret_constr.datalen > 0)
8094 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8096 ret_constr.data = NULL;
8097 uint32_t* ret_vals = (uint32_t*)(ret + 4);
8098 for (size_t q = 0; q < ret_constr.datalen; q++) {
8099 uint32_t ret_conv_16 = ret_vals[q];
8100 LDKChannelDetails ret_conv_16_conv;
8101 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
8102 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
8103 ret_conv_16_conv = ChannelDetails_clone(&ret_conv_16_conv);
8104 ret_constr.data[q] = ret_conv_16_conv;
8108 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
8109 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
8110 LDKRoute route_var = *route;
8111 uint64_t route_ref = 0;
8112 route_var = Route_clone(route);
8113 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8114 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8115 route_ref = (uint64_t)route_var.inner;
8116 if (route_var.is_owned) {
8119 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
8120 memcpy((uint8_t*)(payment_hash_arr + 4), payment_hash.data, 32);
8121 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
8122 memcpy((uint8_t*)(payment_secret_arr + 4), payment_secret.data, 32);
8123 uint32_t ret = js_invoke_function_3(j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
8124 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8125 CHECK_ACCESS(ret_ptr);
8126 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
8127 ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone((LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)ret) & ~1));
8130 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
8131 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
8132 LDKRoute route_var = *route;
8133 uint64_t route_ref = 0;
8134 route_var = Route_clone(route);
8135 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8136 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8137 route_ref = (uint64_t)route_var.inner;
8138 if (route_var.is_owned) {
8141 int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
8142 memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32);
8143 uint32_t ret = js_invoke_function_2(j_calls->retry_payment_meth, route_ref, payment_id_arr);
8144 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8145 CHECK_ACCESS(ret_ptr);
8146 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
8147 ret_conv = CResult_NonePaymentSendFailureZ_clone((LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)ret) & ~1));
8150 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
8151 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
8152 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8154 static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) {
8155 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
8156 atomic_init(&calls->refcnt, 1);
8157 //TODO: Assign calls->o from o
8160 .this_arg = (void*) calls,
8161 .node_id = node_id_LDKPayer_jcall,
8162 .first_hops = first_hops_LDKPayer_jcall,
8163 .send_payment = send_payment_LDKPayer_jcall,
8164 .retry_payment = retry_payment_LDKPayer_jcall,
8165 .free = LDKPayer_JCalls_free,
8169 long __attribute__((visibility("default"))) TS_LDKPayer_new(/*TODO: JS Object Reference */void* o) {
8170 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
8171 *res_ptr = LDKPayer_init(o);
8172 return (long)res_ptr;
8174 int8_tArray __attribute__((visibility("default"))) TS_Payer_node_id(uint32_t this_arg) {
8175 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8176 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8177 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8178 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
8179 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
8183 uint32_tArray __attribute__((visibility("default"))) TS_Payer_first_hops(uint32_t this_arg) {
8184 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8185 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8186 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8187 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
8188 uint32_tArray ret_arr = NULL;
8189 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
8190 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
8191 for (size_t q = 0; q < ret_var.datalen; q++) {
8192 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
8193 uint64_t ret_conv_16_ref = 0;
8194 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8195 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8196 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
8197 if (ret_conv_16_var.is_owned) {
8198 ret_conv_16_ref |= 1;
8200 ret_arr_ptr[q] = ret_conv_16_ref;
8207 uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
8208 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8209 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8210 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8211 LDKRoute route_conv;
8212 route_conv.inner = (void*)(route & (~1));
8213 route_conv.is_owned = false;
8214 LDKThirtyTwoBytes payment_hash_ref;
8215 CHECK(*((uint32_t*)payment_hash) == 32);
8216 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
8217 LDKThirtyTwoBytes payment_secret_ref;
8218 CHECK(*((uint32_t*)payment_secret) == 32);
8219 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
8220 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
8221 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
8222 return (uint64_t)ret_conv;
8225 uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
8226 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8227 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8228 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
8229 LDKRoute route_conv;
8230 route_conv.inner = (void*)(route & (~1));
8231 route_conv.is_owned = false;
8232 LDKThirtyTwoBytes payment_id_ref;
8233 CHECK(*((uint32_t*)payment_id) == 32);
8234 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
8235 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8236 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
8237 return (uint64_t)ret_conv;
8240 typedef struct LDKRouter_JCalls {
8241 atomic_size_t refcnt;
8242 uint32_t find_route_meth;
8244 static void LDKRouter_JCalls_free(void* this_arg) {
8245 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8246 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8247 js_free(j_calls->find_route_meth);
8251 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
8252 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8253 int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
8254 memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33);
8255 LDKRouteParameters params_var = *params;
8256 uint64_t params_ref = 0;
8257 params_var = RouteParameters_clone(params);
8258 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8259 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8260 params_ref = (uint64_t)params_var.inner;
8261 if (params_var.is_owned) {
8264 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8265 uint32_tArray first_hops_arr = NULL;
8266 if (first_hops != NULL) {
8267 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8268 first_hops_arr = init_arr(first_hops_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
8269 uint32_t *first_hops_arr_ptr = (uint32_t*)(first_hops_arr + 4);
8270 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8271 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
8272 uint64_t first_hops_conv_16_ref = 0;
8273 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8274 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8275 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
8276 if (first_hops_conv_16_var.is_owned) {
8277 first_hops_conv_16_ref |= 1;
8279 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8283 // WARNING: This object doesn't live past this scope, needs clone!
8284 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
8285 uint32_t ret = js_invoke_function_4(j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer);
8286 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8287 CHECK_ACCESS(ret_ptr);
8288 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8289 ret_conv = CResult_RouteLightningErrorZ_clone((LDKCResult_RouteLightningErrorZ*)(((uint64_t)ret) & ~1));
8292 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8293 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8294 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8296 static inline LDKRouter LDKRouter_init (/*TODO: JS Object Reference */void* o) {
8297 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8298 atomic_init(&calls->refcnt, 1);
8299 //TODO: Assign calls->o from o
8302 .this_arg = (void*) calls,
8303 .find_route = find_route_LDKRouter_jcall,
8304 .free = LDKRouter_JCalls_free,
8308 long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object Reference */void* o) {
8309 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8310 *res_ptr = LDKRouter_init(o);
8311 return (long)res_ptr;
8313 uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, uint32_tArray first_hops, uint32_t scorer) {
8314 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8315 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8316 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8317 LDKPublicKey payer_ref;
8318 CHECK(*((uint32_t*)payer) == 33);
8319 memcpy(payer_ref.compressed_form, (uint8_t*)(payer + 4), 33);
8320 LDKRouteParameters params_conv;
8321 params_conv.inner = (void*)(params & (~1));
8322 params_conv.is_owned = false;
8323 LDKCVec_ChannelDetailsZ first_hops_constr;
8324 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8325 if (first_hops != 0) {
8326 first_hops_constr.datalen = *((uint32_t*)first_hops);
8327 if (first_hops_constr.datalen > 0)
8328 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8330 first_hops_constr.data = NULL;
8331 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
8332 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8333 uint32_t first_hops_conv_16 = first_hops_vals[q];
8334 LDKChannelDetails first_hops_conv_16_conv;
8335 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
8336 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
8337 first_hops_constr.data[q] = first_hops_conv_16_conv;
8339 first_hops_ptr = &first_hops_constr;
8341 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
8342 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
8343 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
8344 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8345 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv);
8346 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8347 return (uint64_t)ret_conv;
8350 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
8351 LDKStr ret_str = _ldk_get_compiled_version();
8352 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8357 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
8358 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8359 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8364 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
8365 LDKTransaction _res_ref;
8366 _res_ref.datalen = *((uint32_t*)_res);
8367 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8368 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8369 _res_ref.data_is_owned = true;
8370 Transaction_free(_res_ref);
8373 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8374 LDKCVec_u8Z script_pubkey_ref;
8375 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
8376 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8377 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
8378 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8379 *ret_ref = TxOut_new(script_pubkey_ref, value);
8380 return (uint64_t)ret_ref;
8383 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
8384 if ((_res & 1) != 0) return;
8385 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8386 CHECK_ACCESS(_res_ptr);
8387 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8389 TxOut_free(_res_conv);
8392 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
8393 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8394 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8395 *ret_ref = TxOut_clone(orig_conv);
8396 return (uint64_t)ret_ref;
8399 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
8400 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8404 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
8406 CHECK(*((uint32_t*)o) == 32);
8407 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
8408 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8409 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8410 return (uint64_t)ret_conv;
8413 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
8414 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8415 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8416 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8417 return (uint64_t)ret_conv;
8420 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
8421 if ((_res & 1) != 0) return;
8422 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8423 CHECK_ACCESS(_res_ptr);
8424 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
8426 CResult_SecretKeyErrorZ_free(_res_conv);
8429 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
8431 CHECK(*((uint32_t*)o) == 33);
8432 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
8433 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8434 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8435 return (uint64_t)ret_conv;
8438 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
8439 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8440 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8441 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8442 return (uint64_t)ret_conv;
8445 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
8446 if ((_res & 1) != 0) return;
8447 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8448 CHECK_ACCESS(_res_ptr);
8449 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
8451 CResult_PublicKeyErrorZ_free(_res_conv);
8454 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8455 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8456 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8457 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8458 return (uint64_t)ret_conv;
8461 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8462 LDKTxCreationKeys o_conv;
8463 o_conv.inner = (void*)(o & (~1));
8464 o_conv.is_owned = (o & 1) || (o == 0);
8465 o_conv = TxCreationKeys_clone(&o_conv);
8466 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8467 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8468 return (uint64_t)ret_conv;
8471 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8472 LDKDecodeError e_conv;
8473 e_conv.inner = (void*)(e & (~1));
8474 e_conv.is_owned = (e & 1) || (e == 0);
8475 e_conv = DecodeError_clone(&e_conv);
8476 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8477 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8478 return (uint64_t)ret_conv;
8481 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8482 if ((_res & 1) != 0) return;
8483 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8484 CHECK_ACCESS(_res_ptr);
8485 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8487 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8490 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8491 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8492 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8493 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8494 return (uint64_t)ret_conv;
8497 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8498 LDKChannelPublicKeys o_conv;
8499 o_conv.inner = (void*)(o & (~1));
8500 o_conv.is_owned = (o & 1) || (o == 0);
8501 o_conv = ChannelPublicKeys_clone(&o_conv);
8502 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8503 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8504 return (uint64_t)ret_conv;
8507 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8508 LDKDecodeError e_conv;
8509 e_conv.inner = (void*)(e & (~1));
8510 e_conv.is_owned = (e & 1) || (e == 0);
8511 e_conv = DecodeError_clone(&e_conv);
8512 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8513 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8514 return (uint64_t)ret_conv;
8517 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8518 if ((_res & 1) != 0) return;
8519 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8520 CHECK_ACCESS(_res_ptr);
8521 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8523 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8526 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8527 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8528 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8529 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8530 return (uint64_t)ret_conv;
8533 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8534 LDKTxCreationKeys o_conv;
8535 o_conv.inner = (void*)(o & (~1));
8536 o_conv.is_owned = (o & 1) || (o == 0);
8537 o_conv = TxCreationKeys_clone(&o_conv);
8538 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8539 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8540 return (uint64_t)ret_conv;
8543 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8544 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8545 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8546 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8547 return (uint64_t)ret_conv;
8550 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8551 if ((_res & 1) != 0) return;
8552 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8553 CHECK_ACCESS(_res_ptr);
8554 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
8556 CResult_TxCreationKeysErrorZ_free(_res_conv);
8559 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
8560 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8561 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8562 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8563 return (uint64_t)ret_conv;
8566 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
8567 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8568 *ret_copy = COption_u32Z_some(o);
8569 uint64_t ret_ref = (uint64_t)ret_copy;
8573 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
8574 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8575 *ret_copy = COption_u32Z_none();
8576 uint64_t ret_ref = (uint64_t)ret_copy;
8580 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
8581 if ((_res & 1) != 0) return;
8582 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8583 CHECK_ACCESS(_res_ptr);
8584 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
8586 COption_u32Z_free(_res_conv);
8589 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
8590 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8591 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8592 *ret_copy = COption_u32Z_clone(orig_conv);
8593 uint64_t ret_ref = (uint64_t)ret_copy;
8597 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
8598 LDKHTLCOutputInCommitment o_conv;
8599 o_conv.inner = (void*)(o & (~1));
8600 o_conv.is_owned = (o & 1) || (o == 0);
8601 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8602 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8603 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8604 return (uint64_t)ret_conv;
8607 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
8608 LDKDecodeError e_conv;
8609 e_conv.inner = (void*)(e & (~1));
8610 e_conv.is_owned = (e & 1) || (e == 0);
8611 e_conv = DecodeError_clone(&e_conv);
8612 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8613 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8614 return (uint64_t)ret_conv;
8617 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
8618 if ((_res & 1) != 0) return;
8619 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8620 CHECK_ACCESS(_res_ptr);
8621 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
8623 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8626 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
8627 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8628 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8629 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8630 return (uint64_t)ret_conv;
8633 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8634 LDKCounterpartyChannelTransactionParameters o_conv;
8635 o_conv.inner = (void*)(o & (~1));
8636 o_conv.is_owned = (o & 1) || (o == 0);
8637 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8638 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8639 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8640 return (uint64_t)ret_conv;
8643 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8644 LDKDecodeError e_conv;
8645 e_conv.inner = (void*)(e & (~1));
8646 e_conv.is_owned = (e & 1) || (e == 0);
8647 e_conv = DecodeError_clone(&e_conv);
8648 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8649 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8650 return (uint64_t)ret_conv;
8653 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8654 if ((_res & 1) != 0) return;
8655 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8656 CHECK_ACCESS(_res_ptr);
8657 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8659 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8662 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8663 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8664 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8665 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8666 return (uint64_t)ret_conv;
8669 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
8670 LDKChannelTransactionParameters o_conv;
8671 o_conv.inner = (void*)(o & (~1));
8672 o_conv.is_owned = (o & 1) || (o == 0);
8673 o_conv = ChannelTransactionParameters_clone(&o_conv);
8674 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8675 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8676 return (uint64_t)ret_conv;
8679 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
8680 LDKDecodeError e_conv;
8681 e_conv.inner = (void*)(e & (~1));
8682 e_conv.is_owned = (e & 1) || (e == 0);
8683 e_conv = DecodeError_clone(&e_conv);
8684 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8685 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8686 return (uint64_t)ret_conv;
8689 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
8690 if ((_res & 1) != 0) return;
8691 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8692 CHECK_ACCESS(_res_ptr);
8693 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
8695 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8698 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
8699 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8700 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8701 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8702 return (uint64_t)ret_conv;
8705 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
8706 LDKCVec_SignatureZ _res_constr;
8707 _res_constr.datalen = *((uint32_t*)_res);
8708 if (_res_constr.datalen > 0)
8709 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8711 _res_constr.data = NULL;
8712 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8713 for (size_t m = 0; m < _res_constr.datalen; m++) {
8714 int8_tArray _res_conv_12 = _res_vals[m];
8715 LDKSignature _res_conv_12_ref;
8716 CHECK(*((uint32_t*)_res_conv_12) == 64);
8717 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
8718 _res_constr.data[m] = _res_conv_12_ref;
8720 CVec_SignatureZ_free(_res_constr);
8723 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8724 LDKHolderCommitmentTransaction o_conv;
8725 o_conv.inner = (void*)(o & (~1));
8726 o_conv.is_owned = (o & 1) || (o == 0);
8727 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8728 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8729 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8730 return (uint64_t)ret_conv;
8733 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8734 LDKDecodeError e_conv;
8735 e_conv.inner = (void*)(e & (~1));
8736 e_conv.is_owned = (e & 1) || (e == 0);
8737 e_conv = DecodeError_clone(&e_conv);
8738 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8739 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8740 return (uint64_t)ret_conv;
8743 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8744 if ((_res & 1) != 0) return;
8745 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8746 CHECK_ACCESS(_res_ptr);
8747 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8749 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8752 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8753 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8754 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8755 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8756 return (uint64_t)ret_conv;
8759 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8760 LDKBuiltCommitmentTransaction o_conv;
8761 o_conv.inner = (void*)(o & (~1));
8762 o_conv.is_owned = (o & 1) || (o == 0);
8763 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8764 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8765 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8766 return (uint64_t)ret_conv;
8769 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8770 LDKDecodeError e_conv;
8771 e_conv.inner = (void*)(e & (~1));
8772 e_conv.is_owned = (e & 1) || (e == 0);
8773 e_conv = DecodeError_clone(&e_conv);
8774 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8775 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8776 return (uint64_t)ret_conv;
8779 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8780 if ((_res & 1) != 0) return;
8781 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8782 CHECK_ACCESS(_res_ptr);
8783 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
8785 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8788 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8789 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8790 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8791 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8792 return (uint64_t)ret_conv;
8795 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
8796 LDKTrustedClosingTransaction o_conv;
8797 o_conv.inner = (void*)(o & (~1));
8798 o_conv.is_owned = (o & 1) || (o == 0);
8799 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
8800 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8801 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
8802 return (uint64_t)ret_conv;
8805 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
8806 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
8807 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
8808 return (uint64_t)ret_conv;
8811 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
8812 if ((_res & 1) != 0) return;
8813 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8814 CHECK_ACCESS(_res_ptr);
8815 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
8817 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
8820 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
8821 LDKCommitmentTransaction o_conv;
8822 o_conv.inner = (void*)(o & (~1));
8823 o_conv.is_owned = (o & 1) || (o == 0);
8824 o_conv = CommitmentTransaction_clone(&o_conv);
8825 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8826 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
8827 return (uint64_t)ret_conv;
8830 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
8831 LDKDecodeError e_conv;
8832 e_conv.inner = (void*)(e & (~1));
8833 e_conv.is_owned = (e & 1) || (e == 0);
8834 e_conv = DecodeError_clone(&e_conv);
8835 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8836 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
8837 return (uint64_t)ret_conv;
8840 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
8841 if ((_res & 1) != 0) return;
8842 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8843 CHECK_ACCESS(_res_ptr);
8844 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
8846 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
8849 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
8850 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
8851 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
8852 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
8853 return (uint64_t)ret_conv;
8856 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
8857 LDKTrustedCommitmentTransaction o_conv;
8858 o_conv.inner = (void*)(o & (~1));
8859 o_conv.is_owned = (o & 1) || (o == 0);
8860 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
8861 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8862 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
8863 return (uint64_t)ret_conv;
8866 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
8867 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
8868 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
8869 return (uint64_t)ret_conv;
8872 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
8873 if ((_res & 1) != 0) return;
8874 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8875 CHECK_ACCESS(_res_ptr);
8876 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
8878 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
8881 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
8882 LDKCVec_SignatureZ o_constr;
8883 o_constr.datalen = *((uint32_t*)o);
8884 if (o_constr.datalen > 0)
8885 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8887 o_constr.data = NULL;
8888 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8889 for (size_t m = 0; m < o_constr.datalen; m++) {
8890 int8_tArray o_conv_12 = o_vals[m];
8891 LDKSignature o_conv_12_ref;
8892 CHECK(*((uint32_t*)o_conv_12) == 64);
8893 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
8894 o_constr.data[m] = o_conv_12_ref;
8896 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8897 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
8898 return (uint64_t)ret_conv;
8901 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
8902 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8903 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
8904 return (uint64_t)ret_conv;
8907 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
8908 if ((_res & 1) != 0) return;
8909 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8910 CHECK_ACCESS(_res_ptr);
8911 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
8913 CResult_CVec_SignatureZNoneZ_free(_res_conv);
8916 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
8917 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
8918 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8919 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
8920 return (uint64_t)ret_conv;
8923 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
8924 LDKShutdownScript o_conv;
8925 o_conv.inner = (void*)(o & (~1));
8926 o_conv.is_owned = (o & 1) || (o == 0);
8927 o_conv = ShutdownScript_clone(&o_conv);
8928 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8929 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
8930 return (uint64_t)ret_conv;
8933 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
8934 LDKDecodeError e_conv;
8935 e_conv.inner = (void*)(e & (~1));
8936 e_conv.is_owned = (e & 1) || (e == 0);
8937 e_conv = DecodeError_clone(&e_conv);
8938 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8939 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
8940 return (uint64_t)ret_conv;
8943 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
8944 if ((_res & 1) != 0) return;
8945 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8946 CHECK_ACCESS(_res_ptr);
8947 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
8949 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
8952 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
8953 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
8954 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
8955 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
8956 return (uint64_t)ret_conv;
8959 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8960 LDKShutdownScript o_conv;
8961 o_conv.inner = (void*)(o & (~1));
8962 o_conv.is_owned = (o & 1) || (o == 0);
8963 o_conv = ShutdownScript_clone(&o_conv);
8964 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8965 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8966 return (uint64_t)ret_conv;
8969 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8970 LDKInvalidShutdownScript e_conv;
8971 e_conv.inner = (void*)(e & (~1));
8972 e_conv.is_owned = (e & 1) || (e == 0);
8973 e_conv = InvalidShutdownScript_clone(&e_conv);
8974 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8975 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8976 return (uint64_t)ret_conv;
8979 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8980 if ((_res & 1) != 0) return;
8981 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8982 CHECK_ACCESS(_res_ptr);
8983 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
8985 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8988 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
8989 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
8990 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8991 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
8992 return (uint64_t)ret_conv;
8995 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8996 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8997 *ret_conv = CResult_NoneErrorZ_ok();
8998 return (uint64_t)ret_conv;
9001 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
9002 LDKIOError e_conv = LDKIOError_from_js(e);
9003 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9004 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9005 return (uint64_t)ret_conv;
9008 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
9009 if ((_res & 1) != 0) return;
9010 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9011 CHECK_ACCESS(_res_ptr);
9012 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
9014 CResult_NoneErrorZ_free(_res_conv);
9017 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
9018 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9019 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9020 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9021 return (uint64_t)ret_conv;
9024 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
9026 o_conv.inner = (void*)(o & (~1));
9027 o_conv.is_owned = (o & 1) || (o == 0);
9028 o_conv = RouteHop_clone(&o_conv);
9029 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9030 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9031 return (uint64_t)ret_conv;
9034 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
9035 LDKDecodeError e_conv;
9036 e_conv.inner = (void*)(e & (~1));
9037 e_conv.is_owned = (e & 1) || (e == 0);
9038 e_conv = DecodeError_clone(&e_conv);
9039 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9040 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9041 return (uint64_t)ret_conv;
9044 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
9045 if ((_res & 1) != 0) return;
9046 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9047 CHECK_ACCESS(_res_ptr);
9048 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
9050 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9053 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
9054 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9055 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9056 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9057 return (uint64_t)ret_conv;
9060 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
9061 LDKCVec_RouteHopZ _res_constr;
9062 _res_constr.datalen = *((uint32_t*)_res);
9063 if (_res_constr.datalen > 0)
9064 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9066 _res_constr.data = NULL;
9067 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9068 for (size_t k = 0; k < _res_constr.datalen; k++) {
9069 uint32_t _res_conv_10 = _res_vals[k];
9070 LDKRouteHop _res_conv_10_conv;
9071 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9072 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9073 _res_constr.data[k] = _res_conv_10_conv;
9075 CVec_RouteHopZ_free(_res_constr);
9078 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
9079 LDKCVec_CVec_RouteHopZZ _res_constr;
9080 _res_constr.datalen = *((uint32_t*)_res);
9081 if (_res_constr.datalen > 0)
9082 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9084 _res_constr.data = NULL;
9085 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
9086 for (size_t m = 0; m < _res_constr.datalen; m++) {
9087 uint32_tArray _res_conv_12 = _res_vals[m];
9088 LDKCVec_RouteHopZ _res_conv_12_constr;
9089 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
9090 if (_res_conv_12_constr.datalen > 0)
9091 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9093 _res_conv_12_constr.data = NULL;
9094 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
9095 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9096 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9097 LDKRouteHop _res_conv_12_conv_10_conv;
9098 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9099 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9100 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9102 _res_constr.data[m] = _res_conv_12_constr;
9104 CVec_CVec_RouteHopZZ_free(_res_constr);
9107 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
9109 o_conv.inner = (void*)(o & (~1));
9110 o_conv.is_owned = (o & 1) || (o == 0);
9111 o_conv = Route_clone(&o_conv);
9112 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9113 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9114 return (uint64_t)ret_conv;
9117 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
9118 LDKDecodeError e_conv;
9119 e_conv.inner = (void*)(e & (~1));
9120 e_conv.is_owned = (e & 1) || (e == 0);
9121 e_conv = DecodeError_clone(&e_conv);
9122 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9123 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9124 return (uint64_t)ret_conv;
9127 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
9128 if ((_res & 1) != 0) return;
9129 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9130 CHECK_ACCESS(_res_ptr);
9131 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
9133 CResult_RouteDecodeErrorZ_free(_res_conv);
9136 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
9137 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9138 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9139 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9140 return (uint64_t)ret_conv;
9143 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
9144 LDKRouteParameters o_conv;
9145 o_conv.inner = (void*)(o & (~1));
9146 o_conv.is_owned = (o & 1) || (o == 0);
9147 o_conv = RouteParameters_clone(&o_conv);
9148 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9149 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
9150 return (uint64_t)ret_conv;
9153 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
9154 LDKDecodeError e_conv;
9155 e_conv.inner = (void*)(e & (~1));
9156 e_conv.is_owned = (e & 1) || (e == 0);
9157 e_conv = DecodeError_clone(&e_conv);
9158 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9159 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
9160 return (uint64_t)ret_conv;
9163 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
9164 if ((_res & 1) != 0) return;
9165 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9166 CHECK_ACCESS(_res_ptr);
9167 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
9169 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
9172 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
9173 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
9174 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
9175 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
9176 return (uint64_t)ret_conv;
9179 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
9180 LDKCVec_RouteHintZ _res_constr;
9181 _res_constr.datalen = *((uint32_t*)_res);
9182 if (_res_constr.datalen > 0)
9183 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9185 _res_constr.data = NULL;
9186 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9187 for (size_t l = 0; l < _res_constr.datalen; l++) {
9188 uint32_t _res_conv_11 = _res_vals[l];
9189 LDKRouteHint _res_conv_11_conv;
9190 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9191 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9192 _res_constr.data[l] = _res_conv_11_conv;
9194 CVec_RouteHintZ_free(_res_constr);
9197 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
9198 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9199 *ret_copy = COption_u64Z_some(o);
9200 uint64_t ret_ref = (uint64_t)ret_copy;
9204 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
9205 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9206 *ret_copy = COption_u64Z_none();
9207 uint64_t ret_ref = (uint64_t)ret_copy;
9211 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
9212 if ((_res & 1) != 0) return;
9213 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9214 CHECK_ACCESS(_res_ptr);
9215 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
9217 COption_u64Z_free(_res_conv);
9220 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
9221 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9222 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9223 *ret_copy = COption_u64Z_clone(orig_conv);
9224 uint64_t ret_ref = (uint64_t)ret_copy;
9228 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
9230 o_conv.inner = (void*)(o & (~1));
9231 o_conv.is_owned = (o & 1) || (o == 0);
9232 o_conv = Payee_clone(&o_conv);
9233 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9234 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
9235 return (uint64_t)ret_conv;
9238 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
9239 LDKDecodeError e_conv;
9240 e_conv.inner = (void*)(e & (~1));
9241 e_conv.is_owned = (e & 1) || (e == 0);
9242 e_conv = DecodeError_clone(&e_conv);
9243 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9244 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
9245 return (uint64_t)ret_conv;
9248 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
9249 if ((_res & 1) != 0) return;
9250 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9251 CHECK_ACCESS(_res_ptr);
9252 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
9254 CResult_PayeeDecodeErrorZ_free(_res_conv);
9257 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
9258 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
9259 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
9260 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
9261 return (uint64_t)ret_conv;
9264 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
9265 LDKCVec_RouteHintHopZ _res_constr;
9266 _res_constr.datalen = *((uint32_t*)_res);
9267 if (_res_constr.datalen > 0)
9268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
9270 _res_constr.data = NULL;
9271 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9272 for (size_t o = 0; o < _res_constr.datalen; o++) {
9273 uint32_t _res_conv_14 = _res_vals[o];
9274 LDKRouteHintHop _res_conv_14_conv;
9275 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9276 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9277 _res_constr.data[o] = _res_conv_14_conv;
9279 CVec_RouteHintHopZ_free(_res_constr);
9282 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
9283 LDKRouteHint o_conv;
9284 o_conv.inner = (void*)(o & (~1));
9285 o_conv.is_owned = (o & 1) || (o == 0);
9286 o_conv = RouteHint_clone(&o_conv);
9287 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9288 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
9289 return (uint64_t)ret_conv;
9292 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
9293 LDKDecodeError e_conv;
9294 e_conv.inner = (void*)(e & (~1));
9295 e_conv.is_owned = (e & 1) || (e == 0);
9296 e_conv = DecodeError_clone(&e_conv);
9297 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9298 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
9299 return (uint64_t)ret_conv;
9302 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
9303 if ((_res & 1) != 0) return;
9304 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9305 CHECK_ACCESS(_res_ptr);
9306 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
9308 CResult_RouteHintDecodeErrorZ_free(_res_conv);
9311 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
9312 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
9313 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
9314 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
9315 return (uint64_t)ret_conv;
9318 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
9319 LDKRouteHintHop o_conv;
9320 o_conv.inner = (void*)(o & (~1));
9321 o_conv.is_owned = (o & 1) || (o == 0);
9322 o_conv = RouteHintHop_clone(&o_conv);
9323 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9324 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
9325 return (uint64_t)ret_conv;
9328 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
9329 LDKDecodeError e_conv;
9330 e_conv.inner = (void*)(e & (~1));
9331 e_conv.is_owned = (e & 1) || (e == 0);
9332 e_conv = DecodeError_clone(&e_conv);
9333 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9334 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
9335 return (uint64_t)ret_conv;
9338 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
9339 if ((_res & 1) != 0) return;
9340 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9341 CHECK_ACCESS(_res_ptr);
9342 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
9344 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
9347 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
9348 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
9349 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
9350 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
9351 return (uint64_t)ret_conv;
9354 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
9355 LDKCVec_ChannelDetailsZ _res_constr;
9356 _res_constr.datalen = *((uint32_t*)_res);
9357 if (_res_constr.datalen > 0)
9358 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9360 _res_constr.data = NULL;
9361 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9362 for (size_t q = 0; q < _res_constr.datalen; q++) {
9363 uint32_t _res_conv_16 = _res_vals[q];
9364 LDKChannelDetails _res_conv_16_conv;
9365 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9366 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9367 _res_constr.data[q] = _res_conv_16_conv;
9369 CVec_ChannelDetailsZ_free(_res_constr);
9372 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
9374 o_conv.inner = (void*)(o & (~1));
9375 o_conv.is_owned = (o & 1) || (o == 0);
9376 o_conv = Route_clone(&o_conv);
9377 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9378 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9379 return (uint64_t)ret_conv;
9382 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
9383 LDKLightningError e_conv;
9384 e_conv.inner = (void*)(e & (~1));
9385 e_conv.is_owned = (e & 1) || (e == 0);
9386 e_conv = LightningError_clone(&e_conv);
9387 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9388 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9389 return (uint64_t)ret_conv;
9392 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
9393 if ((_res & 1) != 0) return;
9394 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9395 CHECK_ACCESS(_res_ptr);
9396 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
9398 CResult_RouteLightningErrorZ_free(_res_conv);
9401 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
9402 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9403 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9404 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9405 return (uint64_t)ret_conv;
9408 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
9409 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9410 CHECK_ACCESS(o_ptr);
9411 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
9412 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
9413 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9414 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9415 return (uint64_t)ret_conv;
9418 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
9419 LDKAccessError e_conv = LDKAccessError_from_js(e);
9420 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9421 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9422 return (uint64_t)ret_conv;
9425 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
9426 if ((_res & 1) != 0) return;
9427 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9428 CHECK_ACCESS(_res_ptr);
9429 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
9431 CResult_TxOutAccessErrorZ_free(_res_conv);
9434 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
9435 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9436 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9437 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9438 return (uint64_t)ret_conv;
9441 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
9442 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9443 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9444 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
9445 return ((uint64_t)ret_conv);
9448 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
9449 LDKTransaction b_ref;
9450 b_ref.datalen = *((uint32_t*)b);
9451 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9452 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9453 b_ref.data_is_owned = true;
9454 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9455 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
9456 return ((uint64_t)ret_conv);
9459 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
9460 if ((_res & 1) != 0) return;
9461 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9462 CHECK_ACCESS(_res_ptr);
9463 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
9465 C2Tuple_usizeTransactionZ_free(_res_conv);
9468 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
9469 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9470 _res_constr.datalen = *((uint32_t*)_res);
9471 if (_res_constr.datalen > 0)
9472 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9474 _res_constr.data = NULL;
9475 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9476 for (size_t c = 0; c < _res_constr.datalen; c++) {
9477 uint32_t _res_conv_28 = _res_vals[c];
9478 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
9479 CHECK_ACCESS(_res_conv_28_ptr);
9480 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
9481 FREE((void*)_res_conv_28);
9482 _res_constr.data[c] = _res_conv_28_conv;
9484 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9487 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
9488 LDKCVec_TxidZ _res_constr;
9489 _res_constr.datalen = *((uint32_t*)_res);
9490 if (_res_constr.datalen > 0)
9491 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9493 _res_constr.data = NULL;
9494 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9495 for (size_t m = 0; m < _res_constr.datalen; m++) {
9496 int8_tArray _res_conv_12 = _res_vals[m];
9497 LDKThirtyTwoBytes _res_conv_12_ref;
9498 CHECK(*((uint32_t*)_res_conv_12) == 32);
9499 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
9500 _res_constr.data[m] = _res_conv_12_ref;
9502 CVec_TxidZ_free(_res_constr);
9505 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
9506 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9507 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9508 return (uint64_t)ret_conv;
9511 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
9512 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
9513 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9514 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9515 return (uint64_t)ret_conv;
9518 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
9519 if ((_res & 1) != 0) return;
9520 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9521 CHECK_ACCESS(_res_ptr);
9522 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
9524 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9527 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
9528 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9529 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9530 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9531 return (uint64_t)ret_conv;
9534 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
9535 LDKCVec_MonitorEventZ _res_constr;
9536 _res_constr.datalen = *((uint32_t*)_res);
9537 if (_res_constr.datalen > 0)
9538 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9540 _res_constr.data = NULL;
9541 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9542 for (size_t o = 0; o < _res_constr.datalen; o++) {
9543 uint32_t _res_conv_14 = _res_vals[o];
9544 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
9545 CHECK_ACCESS(_res_conv_14_ptr);
9546 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
9547 FREE((void*)_res_conv_14);
9548 _res_constr.data[o] = _res_conv_14_conv;
9550 CVec_MonitorEventZ_free(_res_constr);
9553 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
9554 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9555 CHECK_ACCESS(o_ptr);
9556 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
9557 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
9558 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9559 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9560 uint64_t ret_ref = (uint64_t)ret_copy;
9564 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
9565 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9566 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9567 uint64_t ret_ref = (uint64_t)ret_copy;
9571 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
9572 if ((_res & 1) != 0) return;
9573 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9574 CHECK_ACCESS(_res_ptr);
9575 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
9577 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9580 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
9581 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9582 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9583 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9584 uint64_t ret_ref = (uint64_t)ret_copy;
9588 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
9589 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9590 CHECK_ACCESS(o_ptr);
9591 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
9592 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
9593 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9594 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
9595 uint64_t ret_ref = (uint64_t)ret_copy;
9599 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
9600 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9601 *ret_copy = COption_NetworkUpdateZ_none();
9602 uint64_t ret_ref = (uint64_t)ret_copy;
9606 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
9607 if ((_res & 1) != 0) return;
9608 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9609 CHECK_ACCESS(_res_ptr);
9610 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
9612 COption_NetworkUpdateZ_free(_res_conv);
9615 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
9616 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
9617 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
9618 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
9619 uint64_t ret_ref = (uint64_t)ret_copy;
9623 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
9624 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9625 _res_constr.datalen = *((uint32_t*)_res);
9626 if (_res_constr.datalen > 0)
9627 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9629 _res_constr.data = NULL;
9630 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9631 for (size_t b = 0; b < _res_constr.datalen; b++) {
9632 uint32_t _res_conv_27 = _res_vals[b];
9633 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
9634 CHECK_ACCESS(_res_conv_27_ptr);
9635 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
9636 FREE((void*)_res_conv_27);
9637 _res_constr.data[b] = _res_conv_27_conv;
9639 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9642 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
9643 LDKCVec_MessageSendEventZ _res_constr;
9644 _res_constr.datalen = *((uint32_t*)_res);
9645 if (_res_constr.datalen > 0)
9646 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9648 _res_constr.data = NULL;
9649 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9650 for (size_t s = 0; s < _res_constr.datalen; s++) {
9651 uint32_t _res_conv_18 = _res_vals[s];
9652 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
9653 CHECK_ACCESS(_res_conv_18_ptr);
9654 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
9655 FREE((void*)_res_conv_18);
9656 _res_constr.data[s] = _res_conv_18_conv;
9658 CVec_MessageSendEventZ_free(_res_constr);
9661 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
9662 LDKInitFeatures o_conv;
9663 o_conv.inner = (void*)(o & (~1));
9664 o_conv.is_owned = (o & 1) || (o == 0);
9665 o_conv = InitFeatures_clone(&o_conv);
9666 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9667 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9668 return (uint64_t)ret_conv;
9671 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
9672 LDKDecodeError e_conv;
9673 e_conv.inner = (void*)(e & (~1));
9674 e_conv.is_owned = (e & 1) || (e == 0);
9675 e_conv = DecodeError_clone(&e_conv);
9676 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9677 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9678 return (uint64_t)ret_conv;
9681 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
9682 if ((_res & 1) != 0) return;
9683 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9684 CHECK_ACCESS(_res_ptr);
9685 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
9687 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9690 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
9691 LDKNodeFeatures o_conv;
9692 o_conv.inner = (void*)(o & (~1));
9693 o_conv.is_owned = (o & 1) || (o == 0);
9694 o_conv = NodeFeatures_clone(&o_conv);
9695 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9696 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9697 return (uint64_t)ret_conv;
9700 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
9701 LDKDecodeError e_conv;
9702 e_conv.inner = (void*)(e & (~1));
9703 e_conv.is_owned = (e & 1) || (e == 0);
9704 e_conv = DecodeError_clone(&e_conv);
9705 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9706 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9707 return (uint64_t)ret_conv;
9710 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
9711 if ((_res & 1) != 0) return;
9712 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9713 CHECK_ACCESS(_res_ptr);
9714 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
9716 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9719 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
9720 LDKChannelFeatures o_conv;
9721 o_conv.inner = (void*)(o & (~1));
9722 o_conv.is_owned = (o & 1) || (o == 0);
9723 o_conv = ChannelFeatures_clone(&o_conv);
9724 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9725 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9726 return (uint64_t)ret_conv;
9729 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
9730 LDKDecodeError e_conv;
9731 e_conv.inner = (void*)(e & (~1));
9732 e_conv.is_owned = (e & 1) || (e == 0);
9733 e_conv = DecodeError_clone(&e_conv);
9734 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9735 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9736 return (uint64_t)ret_conv;
9739 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
9740 if ((_res & 1) != 0) return;
9741 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9742 CHECK_ACCESS(_res_ptr);
9743 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
9745 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9748 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
9749 LDKInvoiceFeatures o_conv;
9750 o_conv.inner = (void*)(o & (~1));
9751 o_conv.is_owned = (o & 1) || (o == 0);
9752 o_conv = InvoiceFeatures_clone(&o_conv);
9753 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9754 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9755 return (uint64_t)ret_conv;
9758 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
9759 LDKDecodeError e_conv;
9760 e_conv.inner = (void*)(e & (~1));
9761 e_conv.is_owned = (e & 1) || (e == 0);
9762 e_conv = DecodeError_clone(&e_conv);
9763 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9764 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9765 return (uint64_t)ret_conv;
9768 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
9769 if ((_res & 1) != 0) return;
9770 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9771 CHECK_ACCESS(_res_ptr);
9772 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
9774 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9777 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
9778 LDKScoringParameters o_conv;
9779 o_conv.inner = (void*)(o & (~1));
9780 o_conv.is_owned = (o & 1) || (o == 0);
9781 // Warning: we need a move here but no clone is available for LDKScoringParameters
9782 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
9783 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
9784 return (uint64_t)ret_conv;
9787 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
9788 LDKDecodeError e_conv;
9789 e_conv.inner = (void*)(e & (~1));
9790 e_conv.is_owned = (e & 1) || (e == 0);
9791 e_conv = DecodeError_clone(&e_conv);
9792 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
9793 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
9794 return (uint64_t)ret_conv;
9797 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
9798 if ((_res & 1) != 0) return;
9799 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9800 CHECK_ACCESS(_res_ptr);
9801 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
9803 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
9806 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
9808 o_conv.inner = (void*)(o & (~1));
9809 o_conv.is_owned = (o & 1) || (o == 0);
9810 // Warning: we need a move here but no clone is available for LDKScorer
9811 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
9812 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
9813 return (uint64_t)ret_conv;
9816 uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
9817 LDKDecodeError e_conv;
9818 e_conv.inner = (void*)(e & (~1));
9819 e_conv.is_owned = (e & 1) || (e == 0);
9820 e_conv = DecodeError_clone(&e_conv);
9821 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
9822 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
9823 return (uint64_t)ret_conv;
9826 void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) {
9827 if ((_res & 1) != 0) return;
9828 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9829 CHECK_ACCESS(_res_ptr);
9830 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
9832 CResult_ScorerDecodeErrorZ_free(_res_conv);
9835 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
9836 LDKDelayedPaymentOutputDescriptor o_conv;
9837 o_conv.inner = (void*)(o & (~1));
9838 o_conv.is_owned = (o & 1) || (o == 0);
9839 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9840 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9841 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9842 return (uint64_t)ret_conv;
9845 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
9846 LDKDecodeError e_conv;
9847 e_conv.inner = (void*)(e & (~1));
9848 e_conv.is_owned = (e & 1) || (e == 0);
9849 e_conv = DecodeError_clone(&e_conv);
9850 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9851 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9852 return (uint64_t)ret_conv;
9855 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
9856 if ((_res & 1) != 0) return;
9857 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9858 CHECK_ACCESS(_res_ptr);
9859 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
9861 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9864 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
9865 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9866 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9867 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9868 return (uint64_t)ret_conv;
9871 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
9872 LDKStaticPaymentOutputDescriptor o_conv;
9873 o_conv.inner = (void*)(o & (~1));
9874 o_conv.is_owned = (o & 1) || (o == 0);
9875 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9876 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9877 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9878 return (uint64_t)ret_conv;
9881 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
9882 LDKDecodeError e_conv;
9883 e_conv.inner = (void*)(e & (~1));
9884 e_conv.is_owned = (e & 1) || (e == 0);
9885 e_conv = DecodeError_clone(&e_conv);
9886 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9887 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9888 return (uint64_t)ret_conv;
9891 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
9892 if ((_res & 1) != 0) return;
9893 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9894 CHECK_ACCESS(_res_ptr);
9895 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
9897 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9900 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
9901 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9902 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9903 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9904 return (uint64_t)ret_conv;
9907 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
9908 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9909 CHECK_ACCESS(o_ptr);
9910 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
9911 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
9912 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9913 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
9914 return (uint64_t)ret_conv;
9917 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
9918 LDKDecodeError e_conv;
9919 e_conv.inner = (void*)(e & (~1));
9920 e_conv.is_owned = (e & 1) || (e == 0);
9921 e_conv = DecodeError_clone(&e_conv);
9922 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9923 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
9924 return (uint64_t)ret_conv;
9927 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
9928 if ((_res & 1) != 0) return;
9929 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9930 CHECK_ACCESS(_res_ptr);
9931 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
9933 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
9936 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
9937 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
9938 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9939 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
9940 return (uint64_t)ret_conv;
9943 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
9944 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9945 *ret_conv = CResult_NoneNoneZ_ok();
9946 return (uint64_t)ret_conv;
9949 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
9950 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9951 *ret_conv = CResult_NoneNoneZ_err();
9952 return (uint64_t)ret_conv;
9955 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
9956 if ((_res & 1) != 0) return;
9957 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9958 CHECK_ACCESS(_res_ptr);
9959 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
9961 CResult_NoneNoneZ_free(_res_conv);
9964 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
9965 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
9966 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9967 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
9968 return (uint64_t)ret_conv;
9971 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
9972 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
9973 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9974 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
9975 return ((uint64_t)ret_conv);
9978 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
9980 CHECK(*((uint32_t*)a) == 64);
9981 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
9982 LDKCVec_SignatureZ b_constr;
9983 b_constr.datalen = *((uint32_t*)b);
9984 if (b_constr.datalen > 0)
9985 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9987 b_constr.data = NULL;
9988 int8_tArray* b_vals = (int8_tArray*)(b + 4);
9989 for (size_t m = 0; m < b_constr.datalen; m++) {
9990 int8_tArray b_conv_12 = b_vals[m];
9991 LDKSignature b_conv_12_ref;
9992 CHECK(*((uint32_t*)b_conv_12) == 64);
9993 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
9994 b_constr.data[m] = b_conv_12_ref;
9996 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9997 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
9998 return ((uint64_t)ret_conv);
10001 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
10002 if ((_res & 1) != 0) return;
10003 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10004 CHECK_ACCESS(_res_ptr);
10005 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
10007 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10010 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
10011 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10012 CHECK_ACCESS(o_ptr);
10013 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
10014 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
10015 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10016 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10017 return (uint64_t)ret_conv;
10020 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
10021 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10022 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10023 return (uint64_t)ret_conv;
10026 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
10027 if ((_res & 1) != 0) return;
10028 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10029 CHECK_ACCESS(_res_ptr);
10030 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
10032 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10035 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
10036 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10037 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10038 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10039 return (uint64_t)ret_conv;
10042 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
10043 LDKSignature o_ref;
10044 CHECK(*((uint32_t*)o) == 64);
10045 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
10046 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10047 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10048 return (uint64_t)ret_conv;
10051 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
10052 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10053 *ret_conv = CResult_SignatureNoneZ_err();
10054 return (uint64_t)ret_conv;
10057 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
10058 if ((_res & 1) != 0) return;
10059 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10060 CHECK_ACCESS(_res_ptr);
10061 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
10063 CResult_SignatureNoneZ_free(_res_conv);
10066 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
10067 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10068 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10069 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10070 return (uint64_t)ret_conv;
10073 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
10074 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10075 CHECK_ACCESS(o_ptr);
10076 LDKSign o_conv = *(LDKSign*)(o_ptr);
10077 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10078 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10079 return (uint64_t)ret_conv;
10082 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
10083 LDKDecodeError e_conv;
10084 e_conv.inner = (void*)(e & (~1));
10085 e_conv.is_owned = (e & 1) || (e == 0);
10086 e_conv = DecodeError_clone(&e_conv);
10087 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10088 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10089 return (uint64_t)ret_conv;
10092 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
10093 if ((_res & 1) != 0) return;
10094 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10095 CHECK_ACCESS(_res_ptr);
10096 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
10098 CResult_SignDecodeErrorZ_free(_res_conv);
10101 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
10102 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10103 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10104 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10105 return (uint64_t)ret_conv;
10108 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
10109 LDKCVec_u8Z _res_ref;
10110 _res_ref.datalen = *((uint32_t*)_res);
10111 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10112 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
10113 CVec_u8Z_free(_res_ref);
10116 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
10117 LDKRecoverableSignature arg_ref;
10118 CHECK(*((uint32_t*)arg) == 68);
10119 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
10120 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10121 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10122 return (uint64_t)ret_conv;
10125 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
10126 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10127 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10128 return (uint64_t)ret_conv;
10131 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
10132 if ((_res & 1) != 0) return;
10133 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10134 CHECK_ACCESS(_res_ptr);
10135 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
10137 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10140 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
10141 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10142 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10143 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10144 return (uint64_t)ret_conv;
10147 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
10148 LDKCVec_CVec_u8ZZ _res_constr;
10149 _res_constr.datalen = *((uint32_t*)_res);
10150 if (_res_constr.datalen > 0)
10151 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10153 _res_constr.data = NULL;
10154 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10155 for (size_t m = 0; m < _res_constr.datalen; m++) {
10156 int8_tArray _res_conv_12 = _res_vals[m];
10157 LDKCVec_u8Z _res_conv_12_ref;
10158 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10159 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10160 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10161 _res_constr.data[m] = _res_conv_12_ref;
10163 CVec_CVec_u8ZZ_free(_res_constr);
10166 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
10167 LDKCVec_CVec_u8ZZ o_constr;
10168 o_constr.datalen = *((uint32_t*)o);
10169 if (o_constr.datalen > 0)
10170 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10172 o_constr.data = NULL;
10173 int8_tArray* o_vals = (int8_tArray*)(o + 4);
10174 for (size_t m = 0; m < o_constr.datalen; m++) {
10175 int8_tArray o_conv_12 = o_vals[m];
10176 LDKCVec_u8Z o_conv_12_ref;
10177 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
10178 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
10179 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
10180 o_constr.data[m] = o_conv_12_ref;
10182 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10183 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10184 return (uint64_t)ret_conv;
10187 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
10188 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10189 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10190 return (uint64_t)ret_conv;
10193 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
10194 if ((_res & 1) != 0) return;
10195 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10196 CHECK_ACCESS(_res_ptr);
10197 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
10199 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10202 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
10203 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10204 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10205 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10206 return (uint64_t)ret_conv;
10209 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
10210 LDKInMemorySigner o_conv;
10211 o_conv.inner = (void*)(o & (~1));
10212 o_conv.is_owned = (o & 1) || (o == 0);
10213 o_conv = InMemorySigner_clone(&o_conv);
10214 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10215 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10216 return (uint64_t)ret_conv;
10219 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
10220 LDKDecodeError e_conv;
10221 e_conv.inner = (void*)(e & (~1));
10222 e_conv.is_owned = (e & 1) || (e == 0);
10223 e_conv = DecodeError_clone(&e_conv);
10224 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10225 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10226 return (uint64_t)ret_conv;
10229 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
10230 if ((_res & 1) != 0) return;
10231 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10232 CHECK_ACCESS(_res_ptr);
10233 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
10235 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10238 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
10239 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10240 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10241 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10242 return (uint64_t)ret_conv;
10245 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
10246 LDKCVec_TxOutZ _res_constr;
10247 _res_constr.datalen = *((uint32_t*)_res);
10248 if (_res_constr.datalen > 0)
10249 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10251 _res_constr.data = NULL;
10252 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10253 for (size_t h = 0; h < _res_constr.datalen; h++) {
10254 uint32_t _res_conv_7 = _res_vals[h];
10255 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10256 CHECK_ACCESS(_res_conv_7_ptr);
10257 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
10258 FREE((void*)_res_conv_7);
10259 _res_constr.data[h] = _res_conv_7_conv;
10261 CVec_TxOutZ_free(_res_constr);
10264 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
10265 LDKTransaction o_ref;
10266 o_ref.datalen = *((uint32_t*)o);
10267 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10268 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10269 o_ref.data_is_owned = true;
10270 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10271 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10272 return (uint64_t)ret_conv;
10275 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
10276 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10277 *ret_conv = CResult_TransactionNoneZ_err();
10278 return (uint64_t)ret_conv;
10281 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
10282 if ((_res & 1) != 0) return;
10283 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10284 CHECK_ACCESS(_res_ptr);
10285 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
10287 CResult_TransactionNoneZ_free(_res_conv);
10290 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
10291 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10292 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10293 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10294 return (uint64_t)ret_conv;
10297 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10298 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10299 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10300 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10301 return ((uint64_t)ret_conv);
10304 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10305 LDKThirtyTwoBytes a_ref;
10306 CHECK(*((uint32_t*)a) == 32);
10307 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10308 LDKChannelMonitor b_conv;
10309 b_conv.inner = (void*)(b & (~1));
10310 b_conv.is_owned = (b & 1) || (b == 0);
10311 b_conv = ChannelMonitor_clone(&b_conv);
10312 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10313 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10314 return ((uint64_t)ret_conv);
10317 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10318 if ((_res & 1) != 0) return;
10319 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10320 CHECK_ACCESS(_res_ptr);
10321 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10323 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10326 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
10327 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10328 _res_constr.datalen = *((uint32_t*)_res);
10329 if (_res_constr.datalen > 0)
10330 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10332 _res_constr.data = NULL;
10333 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10334 for (size_t j = 0; j < _res_constr.datalen; j++) {
10335 uint32_t _res_conv_35 = _res_vals[j];
10336 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
10337 CHECK_ACCESS(_res_conv_35_ptr);
10338 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
10339 FREE((void*)_res_conv_35);
10340 _res_constr.data[j] = _res_conv_35_conv;
10342 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10345 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
10346 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10347 o_constr.datalen = *((uint32_t*)o);
10348 if (o_constr.datalen > 0)
10349 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10351 o_constr.data = NULL;
10352 uint32_t* o_vals = (uint32_t*)(o + 4);
10353 for (size_t j = 0; j < o_constr.datalen; j++) {
10354 uint32_t o_conv_35 = o_vals[j];
10355 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
10356 CHECK_ACCESS(o_conv_35_ptr);
10357 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
10358 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
10359 o_constr.data[j] = o_conv_35_conv;
10361 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10362 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10363 return (uint64_t)ret_conv;
10366 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
10367 LDKIOError e_conv = LDKIOError_from_js(e);
10368 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10369 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10370 return (uint64_t)ret_conv;
10373 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
10374 if ((_res & 1) != 0) return;
10375 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10376 CHECK_ACCESS(_res_ptr);
10377 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
10379 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10382 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
10383 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
10384 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10385 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
10386 return (uint64_t)ret_conv;
10389 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
10390 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10391 *ret_copy = COption_u16Z_some(o);
10392 uint64_t ret_ref = (uint64_t)ret_copy;
10396 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
10397 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10398 *ret_copy = COption_u16Z_none();
10399 uint64_t ret_ref = (uint64_t)ret_copy;
10403 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
10404 if ((_res & 1) != 0) return;
10405 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10406 CHECK_ACCESS(_res_ptr);
10407 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
10409 COption_u16Z_free(_res_conv);
10412 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
10413 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10414 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10415 *ret_copy = COption_u16Z_clone(orig_conv);
10416 uint64_t ret_ref = (uint64_t)ret_copy;
10420 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
10421 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10422 *ret_conv = CResult_NoneAPIErrorZ_ok();
10423 return (uint64_t)ret_conv;
10426 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
10427 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10428 CHECK_ACCESS(e_ptr);
10429 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
10430 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
10431 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10432 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10433 return (uint64_t)ret_conv;
10436 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
10437 if ((_res & 1) != 0) return;
10438 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10439 CHECK_ACCESS(_res_ptr);
10440 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
10442 CResult_NoneAPIErrorZ_free(_res_conv);
10445 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
10446 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10447 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10448 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10449 return (uint64_t)ret_conv;
10452 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
10453 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10454 _res_constr.datalen = *((uint32_t*)_res);
10455 if (_res_constr.datalen > 0)
10456 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10458 _res_constr.data = NULL;
10459 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10460 for (size_t w = 0; w < _res_constr.datalen; w++) {
10461 uint32_t _res_conv_22 = _res_vals[w];
10462 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
10463 CHECK_ACCESS(_res_conv_22_ptr);
10464 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
10465 FREE((void*)_res_conv_22);
10466 _res_constr.data[w] = _res_conv_22_conv;
10468 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10471 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
10472 LDKCVec_APIErrorZ _res_constr;
10473 _res_constr.datalen = *((uint32_t*)_res);
10474 if (_res_constr.datalen > 0)
10475 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10477 _res_constr.data = NULL;
10478 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10479 for (size_t k = 0; k < _res_constr.datalen; k++) {
10480 uint32_t _res_conv_10 = _res_vals[k];
10481 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
10482 CHECK_ACCESS(_res_conv_10_ptr);
10483 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
10484 FREE((void*)_res_conv_10);
10485 _res_constr.data[k] = _res_conv_10_conv;
10487 CVec_APIErrorZ_free(_res_constr);
10490 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
10491 LDKThirtyTwoBytes o_ref;
10492 CHECK(*((uint32_t*)o) == 32);
10493 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
10494 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
10495 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
10496 return (uint64_t)ret_conv;
10499 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
10500 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10501 CHECK_ACCESS(e_ptr);
10502 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
10503 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
10504 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
10505 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
10506 return (uint64_t)ret_conv;
10509 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
10510 if ((_res & 1) != 0) return;
10511 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10512 CHECK_ACCESS(_res_ptr);
10513 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
10515 CResult__u832APIErrorZ_free(_res_conv);
10518 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
10519 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
10520 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
10521 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
10522 return (uint64_t)ret_conv;
10525 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
10526 LDKThirtyTwoBytes o_ref;
10527 CHECK(*((uint32_t*)o) == 32);
10528 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
10529 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10530 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
10531 return (uint64_t)ret_conv;
10534 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
10535 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10536 CHECK_ACCESS(e_ptr);
10537 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
10538 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
10539 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10540 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
10541 return (uint64_t)ret_conv;
10544 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
10545 if ((_res & 1) != 0) return;
10546 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10547 CHECK_ACCESS(_res_ptr);
10548 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
10550 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
10553 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
10554 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
10555 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10556 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
10557 return (uint64_t)ret_conv;
10560 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
10561 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10562 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10563 return (uint64_t)ret_conv;
10566 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
10567 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10568 CHECK_ACCESS(e_ptr);
10569 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
10570 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
10571 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10572 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10573 return (uint64_t)ret_conv;
10576 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
10577 if ((_res & 1) != 0) return;
10578 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10579 CHECK_ACCESS(_res_ptr);
10580 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
10582 CResult_NonePaymentSendFailureZ_free(_res_conv);
10585 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
10586 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10587 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10588 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10589 return (uint64_t)ret_conv;
10592 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
10593 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
10594 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
10595 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
10596 return ((uint64_t)ret_conv);
10599 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
10600 LDKThirtyTwoBytes a_ref;
10601 CHECK(*((uint32_t*)a) == 32);
10602 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10603 LDKThirtyTwoBytes b_ref;
10604 CHECK(*((uint32_t*)b) == 32);
10605 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
10606 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
10607 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
10608 return ((uint64_t)ret_conv);
10611 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
10612 if ((_res & 1) != 0) return;
10613 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10614 CHECK_ACCESS(_res_ptr);
10615 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
10617 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
10620 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
10621 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10622 CHECK_ACCESS(o_ptr);
10623 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
10624 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
10625 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
10626 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
10627 return (uint64_t)ret_conv;
10630 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
10631 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10632 CHECK_ACCESS(e_ptr);
10633 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
10634 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
10635 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
10636 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
10637 return (uint64_t)ret_conv;
10640 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
10641 if ((_res & 1) != 0) return;
10642 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10643 CHECK_ACCESS(_res_ptr);
10644 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
10646 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
10649 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
10650 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
10651 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
10652 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
10653 return (uint64_t)ret_conv;
10656 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
10657 LDKCVec_NetAddressZ _res_constr;
10658 _res_constr.datalen = *((uint32_t*)_res);
10659 if (_res_constr.datalen > 0)
10660 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10662 _res_constr.data = NULL;
10663 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10664 for (size_t m = 0; m < _res_constr.datalen; m++) {
10665 uint32_t _res_conv_12 = _res_vals[m];
10666 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
10667 CHECK_ACCESS(_res_conv_12_ptr);
10668 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
10669 FREE((void*)_res_conv_12);
10670 _res_constr.data[m] = _res_conv_12_conv;
10672 CVec_NetAddressZ_free(_res_constr);
10675 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
10676 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10677 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10678 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10679 return ((uint64_t)ret_conv);
10682 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
10683 LDKThirtyTwoBytes a_ref;
10684 CHECK(*((uint32_t*)a) == 32);
10685 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10686 LDKThirtyTwoBytes b_ref;
10687 CHECK(*((uint32_t*)b) == 32);
10688 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
10689 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10690 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10691 return ((uint64_t)ret_conv);
10694 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
10695 if ((_res & 1) != 0) return;
10696 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10697 CHECK_ACCESS(_res_ptr);
10698 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
10700 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10703 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
10704 LDKThirtyTwoBytes o_ref;
10705 CHECK(*((uint32_t*)o) == 32);
10706 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
10707 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10708 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10709 return (uint64_t)ret_conv;
10712 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
10713 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10714 CHECK_ACCESS(e_ptr);
10715 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
10716 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
10717 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10718 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10719 return (uint64_t)ret_conv;
10722 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
10723 if ((_res & 1) != 0) return;
10724 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10725 CHECK_ACCESS(_res_ptr);
10726 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
10728 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10731 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
10732 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10733 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10734 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10735 return (uint64_t)ret_conv;
10738 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
10739 LDKCVec_ChannelMonitorZ _res_constr;
10740 _res_constr.datalen = *((uint32_t*)_res);
10741 if (_res_constr.datalen > 0)
10742 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10744 _res_constr.data = NULL;
10745 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10746 for (size_t q = 0; q < _res_constr.datalen; q++) {
10747 uint32_t _res_conv_16 = _res_vals[q];
10748 LDKChannelMonitor _res_conv_16_conv;
10749 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10750 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10751 _res_constr.data[q] = _res_conv_16_conv;
10753 CVec_ChannelMonitorZ_free(_res_constr);
10756 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
10757 LDKThirtyTwoBytes a_ref;
10758 CHECK(*((uint32_t*)a) == 32);
10759 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10760 LDKChannelManager b_conv;
10761 b_conv.inner = (void*)(b & (~1));
10762 b_conv.is_owned = (b & 1) || (b == 0);
10763 // Warning: we need a move here but no clone is available for LDKChannelManager
10764 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10765 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10766 return ((uint64_t)ret_conv);
10769 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
10770 if ((_res & 1) != 0) return;
10771 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10772 CHECK_ACCESS(_res_ptr);
10773 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
10775 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10778 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
10779 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10780 CHECK_ACCESS(o_ptr);
10781 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
10782 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
10783 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10784 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10785 return (uint64_t)ret_conv;
10788 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
10789 LDKDecodeError e_conv;
10790 e_conv.inner = (void*)(e & (~1));
10791 e_conv.is_owned = (e & 1) || (e == 0);
10792 e_conv = DecodeError_clone(&e_conv);
10793 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10794 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10795 return (uint64_t)ret_conv;
10798 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
10799 if ((_res & 1) != 0) return;
10800 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10801 CHECK_ACCESS(_res_ptr);
10802 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
10804 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10807 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
10808 LDKChannelConfig o_conv;
10809 o_conv.inner = (void*)(o & (~1));
10810 o_conv.is_owned = (o & 1) || (o == 0);
10811 o_conv = ChannelConfig_clone(&o_conv);
10812 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10813 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10814 return (uint64_t)ret_conv;
10817 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
10818 LDKDecodeError e_conv;
10819 e_conv.inner = (void*)(e & (~1));
10820 e_conv.is_owned = (e & 1) || (e == 0);
10821 e_conv = DecodeError_clone(&e_conv);
10822 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10823 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10824 return (uint64_t)ret_conv;
10827 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
10828 if ((_res & 1) != 0) return;
10829 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10830 CHECK_ACCESS(_res_ptr);
10831 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
10833 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10836 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
10837 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10838 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10839 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10840 return (uint64_t)ret_conv;
10843 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
10844 LDKOutPoint o_conv;
10845 o_conv.inner = (void*)(o & (~1));
10846 o_conv.is_owned = (o & 1) || (o == 0);
10847 o_conv = OutPoint_clone(&o_conv);
10848 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10849 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10850 return (uint64_t)ret_conv;
10853 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
10854 LDKDecodeError e_conv;
10855 e_conv.inner = (void*)(e & (~1));
10856 e_conv.is_owned = (e & 1) || (e == 0);
10857 e_conv = DecodeError_clone(&e_conv);
10858 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10859 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10860 return (uint64_t)ret_conv;
10863 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
10864 if ((_res & 1) != 0) return;
10865 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10866 CHECK_ACCESS(_res_ptr);
10867 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
10869 CResult_OutPointDecodeErrorZ_free(_res_conv);
10872 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
10873 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10874 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10875 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10876 return (uint64_t)ret_conv;
10879 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
10880 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10881 CHECK_ACCESS(o_ptr);
10882 LDKType o_conv = *(LDKType*)(o_ptr);
10883 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10884 *ret_copy = COption_TypeZ_some(o_conv);
10885 uint64_t ret_ref = (uint64_t)ret_copy;
10889 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
10890 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10891 *ret_copy = COption_TypeZ_none();
10892 uint64_t ret_ref = (uint64_t)ret_copy;
10896 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
10897 if ((_res & 1) != 0) return;
10898 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10899 CHECK_ACCESS(_res_ptr);
10900 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
10902 COption_TypeZ_free(_res_conv);
10905 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
10906 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
10907 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10908 *ret_copy = COption_TypeZ_clone(orig_conv);
10909 uint64_t ret_ref = (uint64_t)ret_copy;
10913 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
10914 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10915 CHECK_ACCESS(o_ptr);
10916 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
10917 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
10918 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10919 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
10920 return (uint64_t)ret_conv;
10923 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_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_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10929 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
10930 return (uint64_t)ret_conv;
10933 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
10934 if ((_res & 1) != 0) return;
10935 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10936 CHECK_ACCESS(_res_ptr);
10937 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
10939 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
10942 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
10943 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
10944 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10945 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
10946 return (uint64_t)ret_conv;
10949 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
10950 LDKThirtyTwoBytes o_ref;
10951 CHECK(*((uint32_t*)o) == 32);
10952 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
10953 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
10954 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
10955 return (uint64_t)ret_conv;
10958 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
10959 void* e_ptr = (void*)(((uint64_t)e) & ~1);
10960 CHECK_ACCESS(e_ptr);
10961 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
10962 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
10963 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
10964 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
10965 return (uint64_t)ret_conv;
10968 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
10969 if ((_res & 1) != 0) return;
10970 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10971 CHECK_ACCESS(_res_ptr);
10972 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
10974 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
10977 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
10978 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
10979 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
10980 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
10981 return (uint64_t)ret_conv;
10984 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
10985 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
10986 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10987 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10988 return (uint64_t)ret_conv;
10991 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
10992 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10993 *ret_conv = CResult_SiPrefixNoneZ_err();
10994 return (uint64_t)ret_conv;
10997 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
10998 if ((_res & 1) != 0) return;
10999 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11000 CHECK_ACCESS(_res_ptr);
11001 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
11003 CResult_SiPrefixNoneZ_free(_res_conv);
11006 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
11007 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11008 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11009 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11010 return (uint64_t)ret_conv;
11013 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
11015 o_conv.inner = (void*)(o & (~1));
11016 o_conv.is_owned = (o & 1) || (o == 0);
11017 o_conv = Invoice_clone(&o_conv);
11018 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11019 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11020 return (uint64_t)ret_conv;
11023 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
11024 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11025 *ret_conv = CResult_InvoiceNoneZ_err();
11026 return (uint64_t)ret_conv;
11029 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
11030 if ((_res & 1) != 0) return;
11031 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11032 CHECK_ACCESS(_res_ptr);
11033 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
11035 CResult_InvoiceNoneZ_free(_res_conv);
11038 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
11039 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11040 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11041 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11042 return (uint64_t)ret_conv;
11045 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
11046 LDKSignedRawInvoice o_conv;
11047 o_conv.inner = (void*)(o & (~1));
11048 o_conv.is_owned = (o & 1) || (o == 0);
11049 o_conv = SignedRawInvoice_clone(&o_conv);
11050 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11051 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11052 return (uint64_t)ret_conv;
11055 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
11056 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11057 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11058 return (uint64_t)ret_conv;
11061 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
11062 if ((_res & 1) != 0) return;
11063 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11064 CHECK_ACCESS(_res_ptr);
11065 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
11067 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11070 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
11071 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11072 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11073 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11074 return (uint64_t)ret_conv;
11077 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
11078 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11079 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11080 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11081 return ((uint64_t)ret_conv);
11084 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
11085 LDKRawInvoice a_conv;
11086 a_conv.inner = (void*)(a & (~1));
11087 a_conv.is_owned = (a & 1) || (a == 0);
11088 a_conv = RawInvoice_clone(&a_conv);
11089 LDKThirtyTwoBytes b_ref;
11090 CHECK(*((uint32_t*)b) == 32);
11091 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
11092 LDKInvoiceSignature c_conv;
11093 c_conv.inner = (void*)(c & (~1));
11094 c_conv.is_owned = (c & 1) || (c == 0);
11095 c_conv = InvoiceSignature_clone(&c_conv);
11096 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11097 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11098 return ((uint64_t)ret_conv);
11101 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
11102 if ((_res & 1) != 0) return;
11103 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11104 CHECK_ACCESS(_res_ptr);
11105 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
11107 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11110 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
11111 LDKPayeePubKey o_conv;
11112 o_conv.inner = (void*)(o & (~1));
11113 o_conv.is_owned = (o & 1) || (o == 0);
11114 o_conv = PayeePubKey_clone(&o_conv);
11115 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11116 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11117 return (uint64_t)ret_conv;
11120 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
11121 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11122 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11123 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11124 return (uint64_t)ret_conv;
11127 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
11128 if ((_res & 1) != 0) return;
11129 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11130 CHECK_ACCESS(_res_ptr);
11131 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
11133 CResult_PayeePubKeyErrorZ_free(_res_conv);
11136 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
11137 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11138 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11139 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11140 return (uint64_t)ret_conv;
11143 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
11144 LDKCVec_PrivateRouteZ _res_constr;
11145 _res_constr.datalen = *((uint32_t*)_res);
11146 if (_res_constr.datalen > 0)
11147 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11149 _res_constr.data = NULL;
11150 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11151 for (size_t o = 0; o < _res_constr.datalen; o++) {
11152 uint32_t _res_conv_14 = _res_vals[o];
11153 LDKPrivateRoute _res_conv_14_conv;
11154 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11155 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11156 _res_constr.data[o] = _res_conv_14_conv;
11158 CVec_PrivateRouteZ_free(_res_constr);
11161 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
11162 LDKPositiveTimestamp o_conv;
11163 o_conv.inner = (void*)(o & (~1));
11164 o_conv.is_owned = (o & 1) || (o == 0);
11165 o_conv = PositiveTimestamp_clone(&o_conv);
11166 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11167 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
11168 return (uint64_t)ret_conv;
11171 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
11172 LDKCreationError e_conv = LDKCreationError_from_js(e);
11173 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11174 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
11175 return (uint64_t)ret_conv;
11178 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
11179 if ((_res & 1) != 0) return;
11180 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11181 CHECK_ACCESS(_res_ptr);
11182 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
11184 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
11187 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
11188 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
11189 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11190 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
11191 return (uint64_t)ret_conv;
11194 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
11195 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11196 *ret_conv = CResult_NoneSemanticErrorZ_ok();
11197 return (uint64_t)ret_conv;
11200 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
11201 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
11202 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11203 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
11204 return (uint64_t)ret_conv;
11207 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
11208 if ((_res & 1) != 0) return;
11209 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11210 CHECK_ACCESS(_res_ptr);
11211 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
11213 CResult_NoneSemanticErrorZ_free(_res_conv);
11216 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
11217 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
11218 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11219 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
11220 return (uint64_t)ret_conv;
11223 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
11225 o_conv.inner = (void*)(o & (~1));
11226 o_conv.is_owned = (o & 1) || (o == 0);
11227 o_conv = Invoice_clone(&o_conv);
11228 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11229 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
11230 return (uint64_t)ret_conv;
11233 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
11234 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
11235 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11236 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
11237 return (uint64_t)ret_conv;
11240 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
11241 if ((_res & 1) != 0) return;
11242 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11243 CHECK_ACCESS(_res_ptr);
11244 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
11246 CResult_InvoiceSemanticErrorZ_free(_res_conv);
11249 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
11250 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
11251 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11252 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
11253 return (uint64_t)ret_conv;
11256 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
11257 LDKDescription o_conv;
11258 o_conv.inner = (void*)(o & (~1));
11259 o_conv.is_owned = (o & 1) || (o == 0);
11260 o_conv = Description_clone(&o_conv);
11261 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11262 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
11263 return (uint64_t)ret_conv;
11266 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
11267 LDKCreationError e_conv = LDKCreationError_from_js(e);
11268 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11269 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
11270 return (uint64_t)ret_conv;
11273 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
11274 if ((_res & 1) != 0) return;
11275 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11276 CHECK_ACCESS(_res_ptr);
11277 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
11279 CResult_DescriptionCreationErrorZ_free(_res_conv);
11282 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
11283 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11284 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11285 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11286 return (uint64_t)ret_conv;
11289 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
11290 LDKExpiryTime o_conv;
11291 o_conv.inner = (void*)(o & (~1));
11292 o_conv.is_owned = (o & 1) || (o == 0);
11293 o_conv = ExpiryTime_clone(&o_conv);
11294 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11295 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11296 return (uint64_t)ret_conv;
11299 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
11300 LDKCreationError e_conv = LDKCreationError_from_js(e);
11301 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11302 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11303 return (uint64_t)ret_conv;
11306 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
11307 if ((_res & 1) != 0) return;
11308 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11309 CHECK_ACCESS(_res_ptr);
11310 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
11312 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11315 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
11316 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11317 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11318 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11319 return (uint64_t)ret_conv;
11322 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
11323 LDKPrivateRoute o_conv;
11324 o_conv.inner = (void*)(o & (~1));
11325 o_conv.is_owned = (o & 1) || (o == 0);
11326 o_conv = PrivateRoute_clone(&o_conv);
11327 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11328 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11329 return (uint64_t)ret_conv;
11332 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
11333 LDKCreationError e_conv = LDKCreationError_from_js(e);
11334 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11335 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11336 return (uint64_t)ret_conv;
11339 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
11340 if ((_res & 1) != 0) return;
11341 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11342 CHECK_ACCESS(_res_ptr);
11343 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
11345 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11348 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
11349 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11350 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11351 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11352 return (uint64_t)ret_conv;
11355 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
11356 LDKStr o_conv = str_ref_to_owned_c(o);
11357 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11358 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11359 return (uint64_t)ret_conv;
11362 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
11363 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11364 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11365 *ret_conv = CResult_StringErrorZ_err(e_conv);
11366 return (uint64_t)ret_conv;
11369 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
11370 if ((_res & 1) != 0) return;
11371 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11372 CHECK_ACCESS(_res_ptr);
11373 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
11375 CResult_StringErrorZ_free(_res_conv);
11378 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
11379 LDKChannelMonitorUpdate o_conv;
11380 o_conv.inner = (void*)(o & (~1));
11381 o_conv.is_owned = (o & 1) || (o == 0);
11382 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11383 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11384 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11385 return (uint64_t)ret_conv;
11388 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
11389 LDKDecodeError e_conv;
11390 e_conv.inner = (void*)(e & (~1));
11391 e_conv.is_owned = (e & 1) || (e == 0);
11392 e_conv = DecodeError_clone(&e_conv);
11393 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11394 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11395 return (uint64_t)ret_conv;
11398 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
11399 if ((_res & 1) != 0) return;
11400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11401 CHECK_ACCESS(_res_ptr);
11402 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
11404 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11407 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
11408 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11409 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11410 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11411 return (uint64_t)ret_conv;
11414 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
11415 LDKHTLCUpdate o_conv;
11416 o_conv.inner = (void*)(o & (~1));
11417 o_conv.is_owned = (o & 1) || (o == 0);
11418 o_conv = HTLCUpdate_clone(&o_conv);
11419 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11420 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11421 return (uint64_t)ret_conv;
11424 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
11425 LDKDecodeError e_conv;
11426 e_conv.inner = (void*)(e & (~1));
11427 e_conv.is_owned = (e & 1) || (e == 0);
11428 e_conv = DecodeError_clone(&e_conv);
11429 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11430 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11431 return (uint64_t)ret_conv;
11434 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
11435 if ((_res & 1) != 0) return;
11436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11437 CHECK_ACCESS(_res_ptr);
11438 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
11440 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11443 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
11444 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11445 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11446 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11447 return (uint64_t)ret_conv;
11450 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
11451 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11452 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11453 return (uint64_t)ret_conv;
11456 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
11457 LDKMonitorUpdateError e_conv;
11458 e_conv.inner = (void*)(e & (~1));
11459 e_conv.is_owned = (e & 1) || (e == 0);
11460 e_conv = MonitorUpdateError_clone(&e_conv);
11461 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11462 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11463 return (uint64_t)ret_conv;
11466 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
11467 if ((_res & 1) != 0) return;
11468 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11469 CHECK_ACCESS(_res_ptr);
11470 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
11472 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11475 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
11476 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11477 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11478 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11479 return (uint64_t)ret_conv;
11482 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
11483 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11484 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11485 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
11486 return ((uint64_t)ret_conv);
11489 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
11490 LDKOutPoint a_conv;
11491 a_conv.inner = (void*)(a & (~1));
11492 a_conv.is_owned = (a & 1) || (a == 0);
11493 a_conv = OutPoint_clone(&a_conv);
11495 b_ref.datalen = *((uint32_t*)b);
11496 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11497 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
11498 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11499 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11500 return ((uint64_t)ret_conv);
11503 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
11504 if ((_res & 1) != 0) return;
11505 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11506 CHECK_ACCESS(_res_ptr);
11507 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
11509 C2Tuple_OutPointScriptZ_free(_res_conv);
11512 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
11513 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11514 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11515 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
11516 return ((uint64_t)ret_conv);
11519 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
11521 b_ref.datalen = *((uint32_t*)b);
11522 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11523 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
11524 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11525 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
11526 return ((uint64_t)ret_conv);
11529 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
11530 if ((_res & 1) != 0) return;
11531 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11532 CHECK_ACCESS(_res_ptr);
11533 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
11535 C2Tuple_u32ScriptZ_free(_res_conv);
11538 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
11539 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11540 _res_constr.datalen = *((uint32_t*)_res);
11541 if (_res_constr.datalen > 0)
11542 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11544 _res_constr.data = NULL;
11545 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11546 for (size_t v = 0; v < _res_constr.datalen; v++) {
11547 uint32_t _res_conv_21 = _res_vals[v];
11548 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
11549 CHECK_ACCESS(_res_conv_21_ptr);
11550 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
11551 FREE((void*)_res_conv_21);
11552 _res_constr.data[v] = _res_conv_21_conv;
11554 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11557 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
11558 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11559 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11560 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11561 return ((uint64_t)ret_conv);
11564 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
11565 LDKThirtyTwoBytes a_ref;
11566 CHECK(*((uint32_t*)a) == 32);
11567 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11568 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11569 b_constr.datalen = *((uint32_t*)b);
11570 if (b_constr.datalen > 0)
11571 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11573 b_constr.data = NULL;
11574 uint32_t* b_vals = (uint32_t*)(b + 4);
11575 for (size_t v = 0; v < b_constr.datalen; v++) {
11576 uint32_t b_conv_21 = b_vals[v];
11577 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
11578 CHECK_ACCESS(b_conv_21_ptr);
11579 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
11580 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
11581 b_constr.data[v] = b_conv_21_conv;
11583 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11584 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11585 return ((uint64_t)ret_conv);
11588 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
11589 if ((_res & 1) != 0) return;
11590 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11591 CHECK_ACCESS(_res_ptr);
11592 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
11594 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11597 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
11598 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11599 _res_constr.datalen = *((uint32_t*)_res);
11600 if (_res_constr.datalen > 0)
11601 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11603 _res_constr.data = NULL;
11604 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11605 for (size_t o = 0; o < _res_constr.datalen; o++) {
11606 uint32_t _res_conv_40 = _res_vals[o];
11607 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
11608 CHECK_ACCESS(_res_conv_40_ptr);
11609 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
11610 FREE((void*)_res_conv_40);
11611 _res_constr.data[o] = _res_conv_40_conv;
11613 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11616 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
11617 LDKCVec_EventZ _res_constr;
11618 _res_constr.datalen = *((uint32_t*)_res);
11619 if (_res_constr.datalen > 0)
11620 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11622 _res_constr.data = NULL;
11623 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11624 for (size_t h = 0; h < _res_constr.datalen; h++) {
11625 uint32_t _res_conv_7 = _res_vals[h];
11626 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
11627 CHECK_ACCESS(_res_conv_7_ptr);
11628 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
11629 FREE((void*)_res_conv_7);
11630 _res_constr.data[h] = _res_conv_7_conv;
11632 CVec_EventZ_free(_res_constr);
11635 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
11636 LDKCVec_TransactionZ _res_constr;
11637 _res_constr.datalen = *((uint32_t*)_res);
11638 if (_res_constr.datalen > 0)
11639 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11641 _res_constr.data = NULL;
11642 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
11643 for (size_t m = 0; m < _res_constr.datalen; m++) {
11644 int8_tArray _res_conv_12 = _res_vals[m];
11645 LDKTransaction _res_conv_12_ref;
11646 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
11647 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
11648 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
11649 _res_conv_12_ref.data_is_owned = true;
11650 _res_constr.data[m] = _res_conv_12_ref;
11652 CVec_TransactionZ_free(_res_constr);
11655 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
11656 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11657 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11658 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
11659 return ((uint64_t)ret_conv);
11662 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
11663 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11664 CHECK_ACCESS(b_ptr);
11665 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
11666 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
11667 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11668 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
11669 return ((uint64_t)ret_conv);
11672 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
11673 if ((_res & 1) != 0) return;
11674 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11675 CHECK_ACCESS(_res_ptr);
11676 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
11678 C2Tuple_u32TxOutZ_free(_res_conv);
11681 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
11682 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11683 _res_constr.datalen = *((uint32_t*)_res);
11684 if (_res_constr.datalen > 0)
11685 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11687 _res_constr.data = NULL;
11688 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11689 for (size_t u = 0; u < _res_constr.datalen; u++) {
11690 uint32_t _res_conv_20 = _res_vals[u];
11691 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
11692 CHECK_ACCESS(_res_conv_20_ptr);
11693 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
11694 FREE((void*)_res_conv_20);
11695 _res_constr.data[u] = _res_conv_20_conv;
11697 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11700 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
11701 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11702 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11703 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11704 return ((uint64_t)ret_conv);
11707 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
11708 LDKThirtyTwoBytes a_ref;
11709 CHECK(*((uint32_t*)a) == 32);
11710 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11711 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11712 b_constr.datalen = *((uint32_t*)b);
11713 if (b_constr.datalen > 0)
11714 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11716 b_constr.data = NULL;
11717 uint32_t* b_vals = (uint32_t*)(b + 4);
11718 for (size_t u = 0; u < b_constr.datalen; u++) {
11719 uint32_t b_conv_20 = b_vals[u];
11720 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
11721 CHECK_ACCESS(b_conv_20_ptr);
11722 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
11723 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
11724 b_constr.data[u] = b_conv_20_conv;
11726 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11727 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11728 return ((uint64_t)ret_conv);
11731 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
11732 if ((_res & 1) != 0) return;
11733 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11734 CHECK_ACCESS(_res_ptr);
11735 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
11737 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11740 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
11741 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11742 _res_constr.datalen = *((uint32_t*)_res);
11743 if (_res_constr.datalen > 0)
11744 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11746 _res_constr.data = NULL;
11747 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11748 for (size_t n = 0; n < _res_constr.datalen; n++) {
11749 uint32_t _res_conv_39 = _res_vals[n];
11750 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
11751 CHECK_ACCESS(_res_conv_39_ptr);
11752 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
11753 FREE((void*)_res_conv_39);
11754 _res_constr.data[n] = _res_conv_39_conv;
11756 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11759 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
11760 LDKCVec_BalanceZ _res_constr;
11761 _res_constr.datalen = *((uint32_t*)_res);
11762 if (_res_constr.datalen > 0)
11763 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
11765 _res_constr.data = NULL;
11766 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11767 for (size_t j = 0; j < _res_constr.datalen; j++) {
11768 uint32_t _res_conv_9 = _res_vals[j];
11769 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
11770 CHECK_ACCESS(_res_conv_9_ptr);
11771 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
11772 FREE((void*)_res_conv_9);
11773 _res_constr.data[j] = _res_conv_9_conv;
11775 CVec_BalanceZ_free(_res_constr);
11778 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
11779 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11780 CHECK_ACCESS(o_ptr);
11781 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
11782 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
11783 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11784 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11785 return (uint64_t)ret_conv;
11788 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
11789 LDKDecodeError e_conv;
11790 e_conv.inner = (void*)(e & (~1));
11791 e_conv.is_owned = (e & 1) || (e == 0);
11792 e_conv = DecodeError_clone(&e_conv);
11793 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11794 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11795 return (uint64_t)ret_conv;
11798 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
11799 if ((_res & 1) != 0) return;
11800 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11801 CHECK_ACCESS(_res_ptr);
11802 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
11804 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11807 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
11808 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
11809 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11810 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
11811 return (uint64_t)ret_conv;
11814 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
11815 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11816 *ret_conv = CResult_NoneLightningErrorZ_ok();
11817 return (uint64_t)ret_conv;
11820 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
11821 LDKLightningError e_conv;
11822 e_conv.inner = (void*)(e & (~1));
11823 e_conv.is_owned = (e & 1) || (e == 0);
11824 e_conv = LightningError_clone(&e_conv);
11825 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11826 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11827 return (uint64_t)ret_conv;
11830 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
11831 if ((_res & 1) != 0) return;
11832 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11833 CHECK_ACCESS(_res_ptr);
11834 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
11836 CResult_NoneLightningErrorZ_free(_res_conv);
11839 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
11840 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11841 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11842 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11843 return (uint64_t)ret_conv;
11846 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
11847 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
11848 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11849 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
11850 return ((uint64_t)ret_conv);
11853 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
11854 LDKPublicKey a_ref;
11855 CHECK(*((uint32_t*)a) == 33);
11856 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
11857 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11858 CHECK_ACCESS(b_ptr);
11859 LDKType b_conv = *(LDKType*)(b_ptr);
11860 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11861 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
11862 return ((uint64_t)ret_conv);
11865 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
11866 if ((_res & 1) != 0) return;
11867 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11868 CHECK_ACCESS(_res_ptr);
11869 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
11871 C2Tuple_PublicKeyTypeZ_free(_res_conv);
11874 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
11875 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
11876 _res_constr.datalen = *((uint32_t*)_res);
11877 if (_res_constr.datalen > 0)
11878 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11880 _res_constr.data = NULL;
11881 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11882 for (size_t z = 0; z < _res_constr.datalen; z++) {
11883 uint32_t _res_conv_25 = _res_vals[z];
11884 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
11885 CHECK_ACCESS(_res_conv_25_ptr);
11886 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
11887 FREE((void*)_res_conv_25);
11888 _res_constr.data[z] = _res_conv_25_conv;
11890 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
11893 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
11894 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11895 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11896 return (uint64_t)ret_conv;
11899 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
11900 LDKLightningError e_conv;
11901 e_conv.inner = (void*)(e & (~1));
11902 e_conv.is_owned = (e & 1) || (e == 0);
11903 e_conv = LightningError_clone(&e_conv);
11904 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11905 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11906 return (uint64_t)ret_conv;
11909 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
11910 if ((_res & 1) != 0) return;
11911 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11912 CHECK_ACCESS(_res_ptr);
11913 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
11915 CResult_boolLightningErrorZ_free(_res_conv);
11918 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
11919 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11920 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11921 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11922 return (uint64_t)ret_conv;
11925 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
11926 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11927 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11928 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11929 return ((uint64_t)ret_conv);
11932 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
11933 LDKChannelAnnouncement a_conv;
11934 a_conv.inner = (void*)(a & (~1));
11935 a_conv.is_owned = (a & 1) || (a == 0);
11936 a_conv = ChannelAnnouncement_clone(&a_conv);
11937 LDKChannelUpdate b_conv;
11938 b_conv.inner = (void*)(b & (~1));
11939 b_conv.is_owned = (b & 1) || (b == 0);
11940 b_conv = ChannelUpdate_clone(&b_conv);
11941 LDKChannelUpdate c_conv;
11942 c_conv.inner = (void*)(c & (~1));
11943 c_conv.is_owned = (c & 1) || (c == 0);
11944 c_conv = ChannelUpdate_clone(&c_conv);
11945 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11946 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11947 return ((uint64_t)ret_conv);
11950 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
11951 if ((_res & 1) != 0) return;
11952 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11953 CHECK_ACCESS(_res_ptr);
11954 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
11956 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11959 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
11960 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11961 _res_constr.datalen = *((uint32_t*)_res);
11962 if (_res_constr.datalen > 0)
11963 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11965 _res_constr.data = NULL;
11966 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11967 for (size_t h = 0; h < _res_constr.datalen; h++) {
11968 uint32_t _res_conv_59 = _res_vals[h];
11969 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
11970 CHECK_ACCESS(_res_conv_59_ptr);
11971 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
11972 FREE((void*)_res_conv_59);
11973 _res_constr.data[h] = _res_conv_59_conv;
11975 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11978 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
11979 LDKCVec_NodeAnnouncementZ _res_constr;
11980 _res_constr.datalen = *((uint32_t*)_res);
11981 if (_res_constr.datalen > 0)
11982 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11984 _res_constr.data = NULL;
11985 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11986 for (size_t s = 0; s < _res_constr.datalen; s++) {
11987 uint32_t _res_conv_18 = _res_vals[s];
11988 LDKNodeAnnouncement _res_conv_18_conv;
11989 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11990 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11991 _res_constr.data[s] = _res_conv_18_conv;
11993 CVec_NodeAnnouncementZ_free(_res_constr);
11996 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11997 LDKCVec_PublicKeyZ _res_constr;
11998 _res_constr.datalen = *((uint32_t*)_res);
11999 if (_res_constr.datalen > 0)
12000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12002 _res_constr.data = NULL;
12003 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
12004 for (size_t m = 0; m < _res_constr.datalen; m++) {
12005 int8_tArray _res_conv_12 = _res_vals[m];
12006 LDKPublicKey _res_conv_12_ref;
12007 CHECK(*((uint32_t*)_res_conv_12) == 33);
12008 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
12009 _res_constr.data[m] = _res_conv_12_ref;
12011 CVec_PublicKeyZ_free(_res_constr);
12014 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
12016 o_ref.datalen = *((uint32_t*)o);
12017 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
12018 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
12019 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12020 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
12021 return (uint64_t)ret_conv;
12024 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
12025 LDKPeerHandleError e_conv;
12026 e_conv.inner = (void*)(e & (~1));
12027 e_conv.is_owned = (e & 1) || (e == 0);
12028 e_conv = PeerHandleError_clone(&e_conv);
12029 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12030 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
12031 return (uint64_t)ret_conv;
12034 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
12035 if ((_res & 1) != 0) return;
12036 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12037 CHECK_ACCESS(_res_ptr);
12038 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
12040 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
12043 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
12044 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
12045 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12046 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
12047 return (uint64_t)ret_conv;
12050 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
12051 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12052 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
12053 return (uint64_t)ret_conv;
12056 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
12057 LDKPeerHandleError e_conv;
12058 e_conv.inner = (void*)(e & (~1));
12059 e_conv.is_owned = (e & 1) || (e == 0);
12060 e_conv = PeerHandleError_clone(&e_conv);
12061 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12062 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
12063 return (uint64_t)ret_conv;
12066 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
12067 if ((_res & 1) != 0) return;
12068 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12069 CHECK_ACCESS(_res_ptr);
12070 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
12072 CResult_NonePeerHandleErrorZ_free(_res_conv);
12075 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
12076 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
12077 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12078 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
12079 return (uint64_t)ret_conv;
12082 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
12083 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12084 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
12085 return (uint64_t)ret_conv;
12088 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
12089 LDKPeerHandleError e_conv;
12090 e_conv.inner = (void*)(e & (~1));
12091 e_conv.is_owned = (e & 1) || (e == 0);
12092 e_conv = PeerHandleError_clone(&e_conv);
12093 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12094 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
12095 return (uint64_t)ret_conv;
12098 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
12099 if ((_res & 1) != 0) return;
12100 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12101 CHECK_ACCESS(_res_ptr);
12102 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
12104 CResult_boolPeerHandleErrorZ_free(_res_conv);
12107 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
12108 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
12109 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12110 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
12111 return (uint64_t)ret_conv;
12114 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
12116 o_conv.inner = (void*)(o & (~1));
12117 o_conv.is_owned = (o & 1) || (o == 0);
12118 o_conv = NodeId_clone(&o_conv);
12119 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12120 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
12121 return (uint64_t)ret_conv;
12124 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
12125 LDKDecodeError e_conv;
12126 e_conv.inner = (void*)(e & (~1));
12127 e_conv.is_owned = (e & 1) || (e == 0);
12128 e_conv = DecodeError_clone(&e_conv);
12129 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12130 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
12131 return (uint64_t)ret_conv;
12134 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
12135 if ((_res & 1) != 0) return;
12136 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12137 CHECK_ACCESS(_res_ptr);
12138 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
12140 CResult_NodeIdDecodeErrorZ_free(_res_conv);
12143 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
12144 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
12145 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12146 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
12147 return (uint64_t)ret_conv;
12150 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
12151 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12152 CHECK_ACCESS(o_ptr);
12153 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
12154 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12155 *ret_copy = COption_AccessZ_some(o_conv);
12156 uint64_t ret_ref = (uint64_t)ret_copy;
12160 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
12161 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12162 *ret_copy = COption_AccessZ_none();
12163 uint64_t ret_ref = (uint64_t)ret_copy;
12167 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
12168 if ((_res & 1) != 0) return;
12169 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12170 CHECK_ACCESS(_res_ptr);
12171 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
12173 COption_AccessZ_free(_res_conv);
12176 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
12177 LDKDirectionalChannelInfo o_conv;
12178 o_conv.inner = (void*)(o & (~1));
12179 o_conv.is_owned = (o & 1) || (o == 0);
12180 o_conv = DirectionalChannelInfo_clone(&o_conv);
12181 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12182 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12183 return (uint64_t)ret_conv;
12186 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
12187 LDKDecodeError e_conv;
12188 e_conv.inner = (void*)(e & (~1));
12189 e_conv.is_owned = (e & 1) || (e == 0);
12190 e_conv = DecodeError_clone(&e_conv);
12191 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12192 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12193 return (uint64_t)ret_conv;
12196 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
12197 if ((_res & 1) != 0) return;
12198 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12199 CHECK_ACCESS(_res_ptr);
12200 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
12202 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12205 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12206 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12207 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12208 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12209 return (uint64_t)ret_conv;
12212 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
12213 LDKChannelInfo o_conv;
12214 o_conv.inner = (void*)(o & (~1));
12215 o_conv.is_owned = (o & 1) || (o == 0);
12216 o_conv = ChannelInfo_clone(&o_conv);
12217 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12218 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12219 return (uint64_t)ret_conv;
12222 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
12223 LDKDecodeError e_conv;
12224 e_conv.inner = (void*)(e & (~1));
12225 e_conv.is_owned = (e & 1) || (e == 0);
12226 e_conv = DecodeError_clone(&e_conv);
12227 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12228 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12229 return (uint64_t)ret_conv;
12232 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
12233 if ((_res & 1) != 0) return;
12234 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12235 CHECK_ACCESS(_res_ptr);
12236 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
12238 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12241 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12242 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12243 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12244 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12245 return (uint64_t)ret_conv;
12248 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
12249 LDKRoutingFees o_conv;
12250 o_conv.inner = (void*)(o & (~1));
12251 o_conv.is_owned = (o & 1) || (o == 0);
12252 o_conv = RoutingFees_clone(&o_conv);
12253 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12254 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12255 return (uint64_t)ret_conv;
12258 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
12259 LDKDecodeError e_conv;
12260 e_conv.inner = (void*)(e & (~1));
12261 e_conv.is_owned = (e & 1) || (e == 0);
12262 e_conv = DecodeError_clone(&e_conv);
12263 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12264 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12265 return (uint64_t)ret_conv;
12268 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
12269 if ((_res & 1) != 0) return;
12270 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12271 CHECK_ACCESS(_res_ptr);
12272 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
12274 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12277 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
12278 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12279 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12280 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12281 return (uint64_t)ret_conv;
12284 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
12285 LDKNodeAnnouncementInfo o_conv;
12286 o_conv.inner = (void*)(o & (~1));
12287 o_conv.is_owned = (o & 1) || (o == 0);
12288 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12289 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12290 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12291 return (uint64_t)ret_conv;
12294 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
12295 LDKDecodeError e_conv;
12296 e_conv.inner = (void*)(e & (~1));
12297 e_conv.is_owned = (e & 1) || (e == 0);
12298 e_conv = DecodeError_clone(&e_conv);
12299 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12300 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12301 return (uint64_t)ret_conv;
12304 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
12305 if ((_res & 1) != 0) return;
12306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12307 CHECK_ACCESS(_res_ptr);
12308 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
12310 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12313 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
12314 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12315 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12316 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12317 return (uint64_t)ret_conv;
12320 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
12321 LDKCVec_u64Z _res_constr;
12322 _res_constr.datalen = *((uint32_t*)_res);
12323 if (_res_constr.datalen > 0)
12324 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12326 _res_constr.data = NULL;
12327 int64_t* _res_vals = (int64_t*)(_res + 4);
12328 for (size_t i = 0; i < _res_constr.datalen; i++) {
12329 int64_t _res_conv_8 = _res_vals[i];
12330 _res_constr.data[i] = _res_conv_8;
12332 CVec_u64Z_free(_res_constr);
12335 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
12336 LDKNodeInfo o_conv;
12337 o_conv.inner = (void*)(o & (~1));
12338 o_conv.is_owned = (o & 1) || (o == 0);
12339 o_conv = NodeInfo_clone(&o_conv);
12340 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12341 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12342 return (uint64_t)ret_conv;
12345 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
12346 LDKDecodeError e_conv;
12347 e_conv.inner = (void*)(e & (~1));
12348 e_conv.is_owned = (e & 1) || (e == 0);
12349 e_conv = DecodeError_clone(&e_conv);
12350 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12351 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12352 return (uint64_t)ret_conv;
12355 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
12356 if ((_res & 1) != 0) return;
12357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12358 CHECK_ACCESS(_res_ptr);
12359 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
12361 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12364 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
12365 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12366 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12367 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12368 return (uint64_t)ret_conv;
12371 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
12372 LDKNetworkGraph o_conv;
12373 o_conv.inner = (void*)(o & (~1));
12374 o_conv.is_owned = (o & 1) || (o == 0);
12375 o_conv = NetworkGraph_clone(&o_conv);
12376 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12377 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12378 return (uint64_t)ret_conv;
12381 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
12382 LDKDecodeError e_conv;
12383 e_conv.inner = (void*)(e & (~1));
12384 e_conv.is_owned = (e & 1) || (e == 0);
12385 e_conv = DecodeError_clone(&e_conv);
12386 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12387 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12388 return (uint64_t)ret_conv;
12391 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
12392 if ((_res & 1) != 0) return;
12393 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12394 CHECK_ACCESS(_res_ptr);
12395 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
12397 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12400 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
12401 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12402 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12403 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12404 return (uint64_t)ret_conv;
12407 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
12408 LDKCVec_NetAddressZ o_constr;
12409 o_constr.datalen = *((uint32_t*)o);
12410 if (o_constr.datalen > 0)
12411 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12413 o_constr.data = NULL;
12414 uint32_t* o_vals = (uint32_t*)(o + 4);
12415 for (size_t m = 0; m < o_constr.datalen; m++) {
12416 uint32_t o_conv_12 = o_vals[m];
12417 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
12418 CHECK_ACCESS(o_conv_12_ptr);
12419 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
12420 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
12421 o_constr.data[m] = o_conv_12_conv;
12423 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12424 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
12425 uint64_t ret_ref = (uint64_t)ret_copy;
12429 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
12430 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12431 *ret_copy = COption_CVec_NetAddressZZ_none();
12432 uint64_t ret_ref = (uint64_t)ret_copy;
12436 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
12437 if ((_res & 1) != 0) return;
12438 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12439 CHECK_ACCESS(_res_ptr);
12440 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
12442 COption_CVec_NetAddressZZ_free(_res_conv);
12445 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
12446 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
12447 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12448 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
12449 uint64_t ret_ref = (uint64_t)ret_copy;
12453 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
12454 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12455 CHECK_ACCESS(o_ptr);
12456 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
12457 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
12458 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12459 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12460 return (uint64_t)ret_conv;
12463 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
12464 LDKDecodeError e_conv;
12465 e_conv.inner = (void*)(e & (~1));
12466 e_conv.is_owned = (e & 1) || (e == 0);
12467 e_conv = DecodeError_clone(&e_conv);
12468 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12469 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12470 return (uint64_t)ret_conv;
12473 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
12474 if ((_res & 1) != 0) return;
12475 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12476 CHECK_ACCESS(_res_ptr);
12477 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
12479 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12482 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
12483 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12484 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12485 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12486 return (uint64_t)ret_conv;
12489 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
12490 LDKCVec_UpdateAddHTLCZ _res_constr;
12491 _res_constr.datalen = *((uint32_t*)_res);
12492 if (_res_constr.datalen > 0)
12493 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12495 _res_constr.data = NULL;
12496 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12497 for (size_t p = 0; p < _res_constr.datalen; p++) {
12498 uint32_t _res_conv_15 = _res_vals[p];
12499 LDKUpdateAddHTLC _res_conv_15_conv;
12500 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12501 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12502 _res_constr.data[p] = _res_conv_15_conv;
12504 CVec_UpdateAddHTLCZ_free(_res_constr);
12507 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
12508 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12509 _res_constr.datalen = *((uint32_t*)_res);
12510 if (_res_constr.datalen > 0)
12511 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12513 _res_constr.data = NULL;
12514 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12515 for (size_t t = 0; t < _res_constr.datalen; t++) {
12516 uint32_t _res_conv_19 = _res_vals[t];
12517 LDKUpdateFulfillHTLC _res_conv_19_conv;
12518 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12519 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12520 _res_constr.data[t] = _res_conv_19_conv;
12522 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12525 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
12526 LDKCVec_UpdateFailHTLCZ _res_constr;
12527 _res_constr.datalen = *((uint32_t*)_res);
12528 if (_res_constr.datalen > 0)
12529 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12531 _res_constr.data = NULL;
12532 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12533 for (size_t q = 0; q < _res_constr.datalen; q++) {
12534 uint32_t _res_conv_16 = _res_vals[q];
12535 LDKUpdateFailHTLC _res_conv_16_conv;
12536 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12537 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12538 _res_constr.data[q] = _res_conv_16_conv;
12540 CVec_UpdateFailHTLCZ_free(_res_constr);
12543 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
12544 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12545 _res_constr.datalen = *((uint32_t*)_res);
12546 if (_res_constr.datalen > 0)
12547 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12549 _res_constr.data = NULL;
12550 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12551 for (size_t z = 0; z < _res_constr.datalen; z++) {
12552 uint32_t _res_conv_25 = _res_vals[z];
12553 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12554 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12555 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12556 _res_constr.data[z] = _res_conv_25_conv;
12558 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12561 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
12562 LDKAcceptChannel o_conv;
12563 o_conv.inner = (void*)(o & (~1));
12564 o_conv.is_owned = (o & 1) || (o == 0);
12565 o_conv = AcceptChannel_clone(&o_conv);
12566 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12567 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12568 return (uint64_t)ret_conv;
12571 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
12572 LDKDecodeError e_conv;
12573 e_conv.inner = (void*)(e & (~1));
12574 e_conv.is_owned = (e & 1) || (e == 0);
12575 e_conv = DecodeError_clone(&e_conv);
12576 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12577 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12578 return (uint64_t)ret_conv;
12581 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
12582 if ((_res & 1) != 0) return;
12583 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12584 CHECK_ACCESS(_res_ptr);
12585 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
12587 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12590 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
12591 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12592 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12593 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12594 return (uint64_t)ret_conv;
12597 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
12598 LDKAnnouncementSignatures o_conv;
12599 o_conv.inner = (void*)(o & (~1));
12600 o_conv.is_owned = (o & 1) || (o == 0);
12601 o_conv = AnnouncementSignatures_clone(&o_conv);
12602 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12603 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12604 return (uint64_t)ret_conv;
12607 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
12608 LDKDecodeError e_conv;
12609 e_conv.inner = (void*)(e & (~1));
12610 e_conv.is_owned = (e & 1) || (e == 0);
12611 e_conv = DecodeError_clone(&e_conv);
12612 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12613 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12614 return (uint64_t)ret_conv;
12617 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
12618 if ((_res & 1) != 0) return;
12619 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12620 CHECK_ACCESS(_res_ptr);
12621 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
12623 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12626 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
12627 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12628 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12629 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12630 return (uint64_t)ret_conv;
12633 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
12634 LDKChannelReestablish o_conv;
12635 o_conv.inner = (void*)(o & (~1));
12636 o_conv.is_owned = (o & 1) || (o == 0);
12637 o_conv = ChannelReestablish_clone(&o_conv);
12638 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12639 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12640 return (uint64_t)ret_conv;
12643 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
12644 LDKDecodeError e_conv;
12645 e_conv.inner = (void*)(e & (~1));
12646 e_conv.is_owned = (e & 1) || (e == 0);
12647 e_conv = DecodeError_clone(&e_conv);
12648 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12649 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12650 return (uint64_t)ret_conv;
12653 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
12654 if ((_res & 1) != 0) return;
12655 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12656 CHECK_ACCESS(_res_ptr);
12657 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
12659 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12662 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
12663 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12664 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12665 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12666 return (uint64_t)ret_conv;
12669 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
12670 LDKClosingSigned o_conv;
12671 o_conv.inner = (void*)(o & (~1));
12672 o_conv.is_owned = (o & 1) || (o == 0);
12673 o_conv = ClosingSigned_clone(&o_conv);
12674 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12675 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12676 return (uint64_t)ret_conv;
12679 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
12680 LDKDecodeError e_conv;
12681 e_conv.inner = (void*)(e & (~1));
12682 e_conv.is_owned = (e & 1) || (e == 0);
12683 e_conv = DecodeError_clone(&e_conv);
12684 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12685 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12686 return (uint64_t)ret_conv;
12689 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
12690 if ((_res & 1) != 0) return;
12691 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12692 CHECK_ACCESS(_res_ptr);
12693 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
12695 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12698 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
12699 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12700 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12701 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12702 return (uint64_t)ret_conv;
12705 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
12706 LDKClosingSignedFeeRange o_conv;
12707 o_conv.inner = (void*)(o & (~1));
12708 o_conv.is_owned = (o & 1) || (o == 0);
12709 o_conv = ClosingSignedFeeRange_clone(&o_conv);
12710 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12711 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
12712 return (uint64_t)ret_conv;
12715 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
12716 LDKDecodeError e_conv;
12717 e_conv.inner = (void*)(e & (~1));
12718 e_conv.is_owned = (e & 1) || (e == 0);
12719 e_conv = DecodeError_clone(&e_conv);
12720 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12721 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
12722 return (uint64_t)ret_conv;
12725 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
12726 if ((_res & 1) != 0) return;
12727 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12728 CHECK_ACCESS(_res_ptr);
12729 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
12731 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
12734 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
12735 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
12736 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12737 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
12738 return (uint64_t)ret_conv;
12741 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
12742 LDKCommitmentSigned o_conv;
12743 o_conv.inner = (void*)(o & (~1));
12744 o_conv.is_owned = (o & 1) || (o == 0);
12745 o_conv = CommitmentSigned_clone(&o_conv);
12746 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12747 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12748 return (uint64_t)ret_conv;
12751 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
12752 LDKDecodeError e_conv;
12753 e_conv.inner = (void*)(e & (~1));
12754 e_conv.is_owned = (e & 1) || (e == 0);
12755 e_conv = DecodeError_clone(&e_conv);
12756 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12757 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12758 return (uint64_t)ret_conv;
12761 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
12762 if ((_res & 1) != 0) return;
12763 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12764 CHECK_ACCESS(_res_ptr);
12765 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
12767 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12770 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
12771 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12772 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12773 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12774 return (uint64_t)ret_conv;
12777 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
12778 LDKFundingCreated o_conv;
12779 o_conv.inner = (void*)(o & (~1));
12780 o_conv.is_owned = (o & 1) || (o == 0);
12781 o_conv = FundingCreated_clone(&o_conv);
12782 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12783 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12784 return (uint64_t)ret_conv;
12787 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
12788 LDKDecodeError e_conv;
12789 e_conv.inner = (void*)(e & (~1));
12790 e_conv.is_owned = (e & 1) || (e == 0);
12791 e_conv = DecodeError_clone(&e_conv);
12792 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12793 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12794 return (uint64_t)ret_conv;
12797 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
12798 if ((_res & 1) != 0) return;
12799 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12800 CHECK_ACCESS(_res_ptr);
12801 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
12803 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12806 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
12807 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12808 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12809 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12810 return (uint64_t)ret_conv;
12813 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
12814 LDKFundingSigned o_conv;
12815 o_conv.inner = (void*)(o & (~1));
12816 o_conv.is_owned = (o & 1) || (o == 0);
12817 o_conv = FundingSigned_clone(&o_conv);
12818 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12819 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12820 return (uint64_t)ret_conv;
12823 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
12824 LDKDecodeError e_conv;
12825 e_conv.inner = (void*)(e & (~1));
12826 e_conv.is_owned = (e & 1) || (e == 0);
12827 e_conv = DecodeError_clone(&e_conv);
12828 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12829 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12830 return (uint64_t)ret_conv;
12833 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
12834 if ((_res & 1) != 0) return;
12835 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12836 CHECK_ACCESS(_res_ptr);
12837 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
12839 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12842 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
12843 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12844 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12845 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12846 return (uint64_t)ret_conv;
12849 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
12850 LDKFundingLocked o_conv;
12851 o_conv.inner = (void*)(o & (~1));
12852 o_conv.is_owned = (o & 1) || (o == 0);
12853 o_conv = FundingLocked_clone(&o_conv);
12854 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12855 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12856 return (uint64_t)ret_conv;
12859 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
12860 LDKDecodeError e_conv;
12861 e_conv.inner = (void*)(e & (~1));
12862 e_conv.is_owned = (e & 1) || (e == 0);
12863 e_conv = DecodeError_clone(&e_conv);
12864 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12865 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12866 return (uint64_t)ret_conv;
12869 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
12870 if ((_res & 1) != 0) return;
12871 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12872 CHECK_ACCESS(_res_ptr);
12873 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
12875 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12878 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
12879 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12880 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12881 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12882 return (uint64_t)ret_conv;
12885 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
12887 o_conv.inner = (void*)(o & (~1));
12888 o_conv.is_owned = (o & 1) || (o == 0);
12889 o_conv = Init_clone(&o_conv);
12890 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12891 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12892 return (uint64_t)ret_conv;
12895 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
12896 LDKDecodeError e_conv;
12897 e_conv.inner = (void*)(e & (~1));
12898 e_conv.is_owned = (e & 1) || (e == 0);
12899 e_conv = DecodeError_clone(&e_conv);
12900 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12901 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12902 return (uint64_t)ret_conv;
12905 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
12906 if ((_res & 1) != 0) return;
12907 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12908 CHECK_ACCESS(_res_ptr);
12909 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
12911 CResult_InitDecodeErrorZ_free(_res_conv);
12914 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
12915 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12916 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12917 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12918 return (uint64_t)ret_conv;
12921 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
12922 LDKOpenChannel o_conv;
12923 o_conv.inner = (void*)(o & (~1));
12924 o_conv.is_owned = (o & 1) || (o == 0);
12925 o_conv = OpenChannel_clone(&o_conv);
12926 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12927 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12928 return (uint64_t)ret_conv;
12931 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
12932 LDKDecodeError e_conv;
12933 e_conv.inner = (void*)(e & (~1));
12934 e_conv.is_owned = (e & 1) || (e == 0);
12935 e_conv = DecodeError_clone(&e_conv);
12936 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12937 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12938 return (uint64_t)ret_conv;
12941 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
12942 if ((_res & 1) != 0) return;
12943 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12944 CHECK_ACCESS(_res_ptr);
12945 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
12947 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12950 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
12951 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12952 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12953 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12954 return (uint64_t)ret_conv;
12957 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
12958 LDKRevokeAndACK o_conv;
12959 o_conv.inner = (void*)(o & (~1));
12960 o_conv.is_owned = (o & 1) || (o == 0);
12961 o_conv = RevokeAndACK_clone(&o_conv);
12962 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12963 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12964 return (uint64_t)ret_conv;
12967 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
12968 LDKDecodeError e_conv;
12969 e_conv.inner = (void*)(e & (~1));
12970 e_conv.is_owned = (e & 1) || (e == 0);
12971 e_conv = DecodeError_clone(&e_conv);
12972 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12973 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12974 return (uint64_t)ret_conv;
12977 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
12978 if ((_res & 1) != 0) return;
12979 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12980 CHECK_ACCESS(_res_ptr);
12981 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
12983 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12986 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
12987 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12988 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12989 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12990 return (uint64_t)ret_conv;
12993 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
12994 LDKShutdown o_conv;
12995 o_conv.inner = (void*)(o & (~1));
12996 o_conv.is_owned = (o & 1) || (o == 0);
12997 o_conv = Shutdown_clone(&o_conv);
12998 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12999 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13000 return (uint64_t)ret_conv;
13003 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
13004 LDKDecodeError e_conv;
13005 e_conv.inner = (void*)(e & (~1));
13006 e_conv.is_owned = (e & 1) || (e == 0);
13007 e_conv = DecodeError_clone(&e_conv);
13008 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13009 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13010 return (uint64_t)ret_conv;
13013 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
13014 if ((_res & 1) != 0) return;
13015 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13016 CHECK_ACCESS(_res_ptr);
13017 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
13019 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13022 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
13023 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13024 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13025 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13026 return (uint64_t)ret_conv;
13029 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
13030 LDKUpdateFailHTLC o_conv;
13031 o_conv.inner = (void*)(o & (~1));
13032 o_conv.is_owned = (o & 1) || (o == 0);
13033 o_conv = UpdateFailHTLC_clone(&o_conv);
13034 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13035 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13036 return (uint64_t)ret_conv;
13039 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
13040 LDKDecodeError e_conv;
13041 e_conv.inner = (void*)(e & (~1));
13042 e_conv.is_owned = (e & 1) || (e == 0);
13043 e_conv = DecodeError_clone(&e_conv);
13044 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13045 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13046 return (uint64_t)ret_conv;
13049 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
13050 if ((_res & 1) != 0) return;
13051 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13052 CHECK_ACCESS(_res_ptr);
13053 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
13055 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13058 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
13059 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13060 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13061 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13062 return (uint64_t)ret_conv;
13065 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
13066 LDKUpdateFailMalformedHTLC o_conv;
13067 o_conv.inner = (void*)(o & (~1));
13068 o_conv.is_owned = (o & 1) || (o == 0);
13069 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13070 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13071 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
13072 return (uint64_t)ret_conv;
13075 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
13076 LDKDecodeError e_conv;
13077 e_conv.inner = (void*)(e & (~1));
13078 e_conv.is_owned = (e & 1) || (e == 0);
13079 e_conv = DecodeError_clone(&e_conv);
13080 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13081 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
13082 return (uint64_t)ret_conv;
13085 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
13086 if ((_res & 1) != 0) return;
13087 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13088 CHECK_ACCESS(_res_ptr);
13089 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
13091 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
13094 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
13095 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
13096 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13097 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
13098 return (uint64_t)ret_conv;
13101 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
13102 LDKUpdateFee o_conv;
13103 o_conv.inner = (void*)(o & (~1));
13104 o_conv.is_owned = (o & 1) || (o == 0);
13105 o_conv = UpdateFee_clone(&o_conv);
13106 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13107 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
13108 return (uint64_t)ret_conv;
13111 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
13112 LDKDecodeError e_conv;
13113 e_conv.inner = (void*)(e & (~1));
13114 e_conv.is_owned = (e & 1) || (e == 0);
13115 e_conv = DecodeError_clone(&e_conv);
13116 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13117 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
13118 return (uint64_t)ret_conv;
13121 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
13122 if ((_res & 1) != 0) return;
13123 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13124 CHECK_ACCESS(_res_ptr);
13125 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
13127 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
13130 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
13131 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
13132 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13133 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
13134 return (uint64_t)ret_conv;
13137 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
13138 LDKUpdateFulfillHTLC o_conv;
13139 o_conv.inner = (void*)(o & (~1));
13140 o_conv.is_owned = (o & 1) || (o == 0);
13141 o_conv = UpdateFulfillHTLC_clone(&o_conv);
13142 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13143 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
13144 return (uint64_t)ret_conv;
13147 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
13148 LDKDecodeError e_conv;
13149 e_conv.inner = (void*)(e & (~1));
13150 e_conv.is_owned = (e & 1) || (e == 0);
13151 e_conv = DecodeError_clone(&e_conv);
13152 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13153 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
13154 return (uint64_t)ret_conv;
13157 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
13158 if ((_res & 1) != 0) return;
13159 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13160 CHECK_ACCESS(_res_ptr);
13161 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
13163 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
13166 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
13167 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
13168 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13169 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
13170 return (uint64_t)ret_conv;
13173 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
13174 LDKUpdateAddHTLC o_conv;
13175 o_conv.inner = (void*)(o & (~1));
13176 o_conv.is_owned = (o & 1) || (o == 0);
13177 o_conv = UpdateAddHTLC_clone(&o_conv);
13178 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13179 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
13180 return (uint64_t)ret_conv;
13183 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
13184 LDKDecodeError e_conv;
13185 e_conv.inner = (void*)(e & (~1));
13186 e_conv.is_owned = (e & 1) || (e == 0);
13187 e_conv = DecodeError_clone(&e_conv);
13188 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13189 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
13190 return (uint64_t)ret_conv;
13193 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
13194 if ((_res & 1) != 0) return;
13195 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13196 CHECK_ACCESS(_res_ptr);
13197 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
13199 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
13202 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
13203 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
13204 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13205 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
13206 return (uint64_t)ret_conv;
13209 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
13211 o_conv.inner = (void*)(o & (~1));
13212 o_conv.is_owned = (o & 1) || (o == 0);
13213 o_conv = Ping_clone(&o_conv);
13214 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13215 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
13216 return (uint64_t)ret_conv;
13219 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
13220 LDKDecodeError e_conv;
13221 e_conv.inner = (void*)(e & (~1));
13222 e_conv.is_owned = (e & 1) || (e == 0);
13223 e_conv = DecodeError_clone(&e_conv);
13224 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13225 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
13226 return (uint64_t)ret_conv;
13229 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
13230 if ((_res & 1) != 0) return;
13231 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13232 CHECK_ACCESS(_res_ptr);
13233 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
13235 CResult_PingDecodeErrorZ_free(_res_conv);
13238 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
13239 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
13240 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13241 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
13242 return (uint64_t)ret_conv;
13245 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
13247 o_conv.inner = (void*)(o & (~1));
13248 o_conv.is_owned = (o & 1) || (o == 0);
13249 o_conv = Pong_clone(&o_conv);
13250 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13251 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
13252 return (uint64_t)ret_conv;
13255 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
13256 LDKDecodeError e_conv;
13257 e_conv.inner = (void*)(e & (~1));
13258 e_conv.is_owned = (e & 1) || (e == 0);
13259 e_conv = DecodeError_clone(&e_conv);
13260 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13261 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
13262 return (uint64_t)ret_conv;
13265 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
13266 if ((_res & 1) != 0) return;
13267 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13268 CHECK_ACCESS(_res_ptr);
13269 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
13271 CResult_PongDecodeErrorZ_free(_res_conv);
13274 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
13275 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13276 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13277 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13278 return (uint64_t)ret_conv;
13281 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13282 LDKUnsignedChannelAnnouncement o_conv;
13283 o_conv.inner = (void*)(o & (~1));
13284 o_conv.is_owned = (o & 1) || (o == 0);
13285 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13286 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13287 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13288 return (uint64_t)ret_conv;
13291 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13292 LDKDecodeError e_conv;
13293 e_conv.inner = (void*)(e & (~1));
13294 e_conv.is_owned = (e & 1) || (e == 0);
13295 e_conv = DecodeError_clone(&e_conv);
13296 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13297 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13298 return (uint64_t)ret_conv;
13301 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
13302 if ((_res & 1) != 0) return;
13303 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13304 CHECK_ACCESS(_res_ptr);
13305 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
13307 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13310 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13311 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13312 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13313 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13314 return (uint64_t)ret_conv;
13317 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13318 LDKChannelAnnouncement o_conv;
13319 o_conv.inner = (void*)(o & (~1));
13320 o_conv.is_owned = (o & 1) || (o == 0);
13321 o_conv = ChannelAnnouncement_clone(&o_conv);
13322 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13323 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13324 return (uint64_t)ret_conv;
13327 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13328 LDKDecodeError e_conv;
13329 e_conv.inner = (void*)(e & (~1));
13330 e_conv.is_owned = (e & 1) || (e == 0);
13331 e_conv = DecodeError_clone(&e_conv);
13332 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13333 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
13334 return (uint64_t)ret_conv;
13337 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
13338 if ((_res & 1) != 0) return;
13339 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13340 CHECK_ACCESS(_res_ptr);
13341 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
13343 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
13346 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13347 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13348 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13349 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13350 return (uint64_t)ret_conv;
13353 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
13354 LDKUnsignedChannelUpdate o_conv;
13355 o_conv.inner = (void*)(o & (~1));
13356 o_conv.is_owned = (o & 1) || (o == 0);
13357 o_conv = UnsignedChannelUpdate_clone(&o_conv);
13358 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13359 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
13360 return (uint64_t)ret_conv;
13363 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
13364 LDKDecodeError e_conv;
13365 e_conv.inner = (void*)(e & (~1));
13366 e_conv.is_owned = (e & 1) || (e == 0);
13367 e_conv = DecodeError_clone(&e_conv);
13368 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13369 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
13370 return (uint64_t)ret_conv;
13373 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
13374 if ((_res & 1) != 0) return;
13375 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13376 CHECK_ACCESS(_res_ptr);
13377 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
13379 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
13382 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
13383 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
13384 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13385 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
13386 return (uint64_t)ret_conv;
13389 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
13390 LDKChannelUpdate o_conv;
13391 o_conv.inner = (void*)(o & (~1));
13392 o_conv.is_owned = (o & 1) || (o == 0);
13393 o_conv = ChannelUpdate_clone(&o_conv);
13394 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13395 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
13396 return (uint64_t)ret_conv;
13399 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
13400 LDKDecodeError e_conv;
13401 e_conv.inner = (void*)(e & (~1));
13402 e_conv.is_owned = (e & 1) || (e == 0);
13403 e_conv = DecodeError_clone(&e_conv);
13404 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13405 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
13406 return (uint64_t)ret_conv;
13409 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
13410 if ((_res & 1) != 0) return;
13411 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13412 CHECK_ACCESS(_res_ptr);
13413 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
13415 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
13418 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
13419 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
13420 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13421 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
13422 return (uint64_t)ret_conv;
13425 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
13426 LDKErrorMessage o_conv;
13427 o_conv.inner = (void*)(o & (~1));
13428 o_conv.is_owned = (o & 1) || (o == 0);
13429 o_conv = ErrorMessage_clone(&o_conv);
13430 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13431 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
13432 return (uint64_t)ret_conv;
13435 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
13436 LDKDecodeError e_conv;
13437 e_conv.inner = (void*)(e & (~1));
13438 e_conv.is_owned = (e & 1) || (e == 0);
13439 e_conv = DecodeError_clone(&e_conv);
13440 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13441 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
13442 return (uint64_t)ret_conv;
13445 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
13446 if ((_res & 1) != 0) return;
13447 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13448 CHECK_ACCESS(_res_ptr);
13449 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
13451 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
13454 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
13455 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
13456 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13457 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
13458 return (uint64_t)ret_conv;
13461 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
13462 LDKUnsignedNodeAnnouncement o_conv;
13463 o_conv.inner = (void*)(o & (~1));
13464 o_conv.is_owned = (o & 1) || (o == 0);
13465 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
13466 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13467 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
13468 return (uint64_t)ret_conv;
13471 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
13472 LDKDecodeError e_conv;
13473 e_conv.inner = (void*)(e & (~1));
13474 e_conv.is_owned = (e & 1) || (e == 0);
13475 e_conv = DecodeError_clone(&e_conv);
13476 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13477 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
13478 return (uint64_t)ret_conv;
13481 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
13482 if ((_res & 1) != 0) return;
13483 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13484 CHECK_ACCESS(_res_ptr);
13485 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
13487 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
13490 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13491 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
13492 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13493 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
13494 return (uint64_t)ret_conv;
13497 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
13498 LDKNodeAnnouncement o_conv;
13499 o_conv.inner = (void*)(o & (~1));
13500 o_conv.is_owned = (o & 1) || (o == 0);
13501 o_conv = NodeAnnouncement_clone(&o_conv);
13502 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13503 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
13504 return (uint64_t)ret_conv;
13507 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
13508 LDKDecodeError e_conv;
13509 e_conv.inner = (void*)(e & (~1));
13510 e_conv.is_owned = (e & 1) || (e == 0);
13511 e_conv = DecodeError_clone(&e_conv);
13512 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13513 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
13514 return (uint64_t)ret_conv;
13517 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
13518 if ((_res & 1) != 0) return;
13519 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13520 CHECK_ACCESS(_res_ptr);
13521 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
13523 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
13526 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13527 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
13528 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13529 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
13530 return (uint64_t)ret_conv;
13533 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
13534 LDKQueryShortChannelIds o_conv;
13535 o_conv.inner = (void*)(o & (~1));
13536 o_conv.is_owned = (o & 1) || (o == 0);
13537 o_conv = QueryShortChannelIds_clone(&o_conv);
13538 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13539 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
13540 return (uint64_t)ret_conv;
13543 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
13544 LDKDecodeError e_conv;
13545 e_conv.inner = (void*)(e & (~1));
13546 e_conv.is_owned = (e & 1) || (e == 0);
13547 e_conv = DecodeError_clone(&e_conv);
13548 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13549 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
13550 return (uint64_t)ret_conv;
13553 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
13554 if ((_res & 1) != 0) return;
13555 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13556 CHECK_ACCESS(_res_ptr);
13557 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
13559 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13562 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
13563 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13564 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13565 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13566 return (uint64_t)ret_conv;
13569 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
13570 LDKReplyShortChannelIdsEnd o_conv;
13571 o_conv.inner = (void*)(o & (~1));
13572 o_conv.is_owned = (o & 1) || (o == 0);
13573 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13574 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13575 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13576 return (uint64_t)ret_conv;
13579 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
13580 LDKDecodeError e_conv;
13581 e_conv.inner = (void*)(e & (~1));
13582 e_conv.is_owned = (e & 1) || (e == 0);
13583 e_conv = DecodeError_clone(&e_conv);
13584 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13585 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13586 return (uint64_t)ret_conv;
13589 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
13590 if ((_res & 1) != 0) return;
13591 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13592 CHECK_ACCESS(_res_ptr);
13593 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
13595 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13598 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
13599 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13600 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13601 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13602 return (uint64_t)ret_conv;
13605 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
13606 LDKQueryChannelRange o_conv;
13607 o_conv.inner = (void*)(o & (~1));
13608 o_conv.is_owned = (o & 1) || (o == 0);
13609 o_conv = QueryChannelRange_clone(&o_conv);
13610 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13611 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13612 return (uint64_t)ret_conv;
13615 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
13616 LDKDecodeError e_conv;
13617 e_conv.inner = (void*)(e & (~1));
13618 e_conv.is_owned = (e & 1) || (e == 0);
13619 e_conv = DecodeError_clone(&e_conv);
13620 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13621 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13622 return (uint64_t)ret_conv;
13625 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
13626 if ((_res & 1) != 0) return;
13627 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13628 CHECK_ACCESS(_res_ptr);
13629 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
13631 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13634 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
13635 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13636 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13637 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13638 return (uint64_t)ret_conv;
13641 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
13642 LDKReplyChannelRange o_conv;
13643 o_conv.inner = (void*)(o & (~1));
13644 o_conv.is_owned = (o & 1) || (o == 0);
13645 o_conv = ReplyChannelRange_clone(&o_conv);
13646 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13647 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13648 return (uint64_t)ret_conv;
13651 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
13652 LDKDecodeError e_conv;
13653 e_conv.inner = (void*)(e & (~1));
13654 e_conv.is_owned = (e & 1) || (e == 0);
13655 e_conv = DecodeError_clone(&e_conv);
13656 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13657 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13658 return (uint64_t)ret_conv;
13661 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
13662 if ((_res & 1) != 0) return;
13663 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13664 CHECK_ACCESS(_res_ptr);
13665 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
13667 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13670 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
13671 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13672 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13673 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13674 return (uint64_t)ret_conv;
13677 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
13678 LDKGossipTimestampFilter o_conv;
13679 o_conv.inner = (void*)(o & (~1));
13680 o_conv.is_owned = (o & 1) || (o == 0);
13681 o_conv = GossipTimestampFilter_clone(&o_conv);
13682 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13683 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13684 return (uint64_t)ret_conv;
13687 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
13688 LDKDecodeError e_conv;
13689 e_conv.inner = (void*)(e & (~1));
13690 e_conv.is_owned = (e & 1) || (e == 0);
13691 e_conv = DecodeError_clone(&e_conv);
13692 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13693 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13694 return (uint64_t)ret_conv;
13697 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
13698 if ((_res & 1) != 0) return;
13699 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13700 CHECK_ACCESS(_res_ptr);
13701 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
13703 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13706 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
13707 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13708 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13709 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13710 return (uint64_t)ret_conv;
13713 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
13715 o_conv.inner = (void*)(o & (~1));
13716 o_conv.is_owned = (o & 1) || (o == 0);
13717 o_conv = Invoice_clone(&o_conv);
13718 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13719 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13720 return (uint64_t)ret_conv;
13723 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
13724 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13725 CHECK_ACCESS(e_ptr);
13726 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
13727 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
13728 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13729 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13730 return (uint64_t)ret_conv;
13733 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
13734 if ((_res & 1) != 0) return;
13735 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13736 CHECK_ACCESS(_res_ptr);
13737 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
13739 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13742 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
13743 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13744 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13745 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13746 return (uint64_t)ret_conv;
13749 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
13750 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13751 CHECK_ACCESS(o_ptr);
13752 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
13753 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
13754 *ret_copy = COption_FilterZ_some(o_conv);
13755 uint64_t ret_ref = (uint64_t)ret_copy;
13759 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
13760 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
13761 *ret_copy = COption_FilterZ_none();
13762 uint64_t ret_ref = (uint64_t)ret_copy;
13766 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
13767 if ((_res & 1) != 0) return;
13768 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13769 CHECK_ACCESS(_res_ptr);
13770 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
13772 COption_FilterZ_free(_res_conv);
13775 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
13776 LDKLockedChannelMonitor o_conv;
13777 o_conv.inner = (void*)(o & (~1));
13778 o_conv.is_owned = (o & 1) || (o == 0);
13779 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
13780 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
13781 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
13782 return (uint64_t)ret_conv;
13785 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
13786 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
13787 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
13788 return (uint64_t)ret_conv;
13791 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
13792 if ((_res & 1) != 0) return;
13793 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13794 CHECK_ACCESS(_res_ptr);
13795 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
13797 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
13800 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
13801 LDKCVec_OutPointZ _res_constr;
13802 _res_constr.datalen = *((uint32_t*)_res);
13803 if (_res_constr.datalen > 0)
13804 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
13806 _res_constr.data = NULL;
13807 uint32_t* _res_vals = (uint32_t*)(_res + 4);
13808 for (size_t k = 0; k < _res_constr.datalen; k++) {
13809 uint32_t _res_conv_10 = _res_vals[k];
13810 LDKOutPoint _res_conv_10_conv;
13811 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
13812 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
13813 _res_constr.data[k] = _res_conv_10_conv;
13815 CVec_OutPointZ_free(_res_constr);
13818 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
13819 if ((this_ptr & 1) != 0) return;
13820 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13821 CHECK_ACCESS(this_ptr_ptr);
13822 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
13823 FREE((void*)this_ptr);
13824 PaymentPurpose_free(this_ptr_conv);
13827 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
13828 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
13829 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13830 *ret_copy = PaymentPurpose_clone(orig_conv);
13831 uint64_t ret_ref = (uint64_t)ret_copy;
13835 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
13836 LDKThirtyTwoBytes payment_preimage_ref;
13837 CHECK(*((uint32_t*)payment_preimage) == 32);
13838 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
13839 LDKThirtyTwoBytes payment_secret_ref;
13840 CHECK(*((uint32_t*)payment_secret) == 32);
13841 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
13842 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13843 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
13844 uint64_t ret_ref = (uint64_t)ret_copy;
13848 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
13849 LDKThirtyTwoBytes a_ref;
13850 CHECK(*((uint32_t*)a) == 32);
13851 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
13852 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13853 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
13854 uint64_t ret_ref = (uint64_t)ret_copy;
13858 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
13859 if ((this_ptr & 1) != 0) return;
13860 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13861 CHECK_ACCESS(this_ptr_ptr);
13862 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
13863 FREE((void*)this_ptr);
13864 ClosureReason_free(this_ptr_conv);
13867 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
13868 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
13869 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13870 *ret_copy = ClosureReason_clone(orig_conv);
13871 uint64_t ret_ref = (uint64_t)ret_copy;
13875 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
13876 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
13877 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13878 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
13879 uint64_t ret_ref = (uint64_t)ret_copy;
13883 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
13884 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13885 *ret_copy = ClosureReason_holder_force_closed();
13886 uint64_t ret_ref = (uint64_t)ret_copy;
13890 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
13891 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13892 *ret_copy = ClosureReason_cooperative_closure();
13893 uint64_t ret_ref = (uint64_t)ret_copy;
13897 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
13898 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13899 *ret_copy = ClosureReason_commitment_tx_confirmed();
13900 uint64_t ret_ref = (uint64_t)ret_copy;
13904 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
13905 LDKStr err_conv = str_ref_to_owned_c(err);
13906 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13907 *ret_copy = ClosureReason_processing_error(err_conv);
13908 uint64_t ret_ref = (uint64_t)ret_copy;
13912 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
13913 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13914 *ret_copy = ClosureReason_disconnected_peer();
13915 uint64_t ret_ref = (uint64_t)ret_copy;
13919 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
13920 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
13921 *ret_copy = ClosureReason_outdated_channel_manager();
13922 uint64_t ret_ref = (uint64_t)ret_copy;
13926 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
13927 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
13928 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
13929 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13930 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13931 CVec_u8Z_free(ret_var);
13935 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
13936 if ((this_ptr & 1) != 0) return;
13937 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
13938 CHECK_ACCESS(this_ptr_ptr);
13939 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
13940 FREE((void*)this_ptr);
13941 Event_free(this_ptr_conv);
13944 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
13945 LDKEvent* orig_conv = (LDKEvent*)orig;
13946 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13947 *ret_copy = Event_clone(orig_conv);
13948 uint64_t ret_ref = (uint64_t)ret_copy;
13952 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) {
13953 LDKThirtyTwoBytes temporary_channel_id_ref;
13954 CHECK(*((uint32_t*)temporary_channel_id) == 32);
13955 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
13956 LDKCVec_u8Z output_script_ref;
13957 output_script_ref.datalen = *((uint32_t*)output_script);
13958 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
13959 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
13960 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13961 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
13962 uint64_t ret_ref = (uint64_t)ret_copy;
13966 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
13967 LDKThirtyTwoBytes payment_hash_ref;
13968 CHECK(*((uint32_t*)payment_hash) == 32);
13969 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
13970 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
13971 CHECK_ACCESS(purpose_ptr);
13972 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
13973 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
13974 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13975 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
13976 uint64_t ret_ref = (uint64_t)ret_copy;
13980 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint32_t fee_paid_msat) {
13981 LDKThirtyTwoBytes payment_id_ref;
13982 CHECK(*((uint32_t*)payment_id) == 32);
13983 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
13984 LDKThirtyTwoBytes payment_preimage_ref;
13985 CHECK(*((uint32_t*)payment_preimage) == 32);
13986 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
13987 LDKThirtyTwoBytes payment_hash_ref;
13988 CHECK(*((uint32_t*)payment_hash) == 32);
13989 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
13990 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
13991 CHECK_ACCESS(fee_paid_msat_ptr);
13992 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
13993 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
13994 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13995 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
13996 uint64_t ret_ref = (uint64_t)ret_copy;
14000 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id, uint32_t retry) {
14001 LDKThirtyTwoBytes payment_id_ref;
14002 CHECK(*((uint32_t*)payment_id) == 32);
14003 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
14004 LDKThirtyTwoBytes payment_hash_ref;
14005 CHECK(*((uint32_t*)payment_hash) == 32);
14006 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14007 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
14008 CHECK_ACCESS(network_update_ptr);
14009 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
14010 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
14011 LDKCVec_RouteHopZ path_constr;
14012 path_constr.datalen = *((uint32_t*)path);
14013 if (path_constr.datalen > 0)
14014 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14016 path_constr.data = NULL;
14017 uint32_t* path_vals = (uint32_t*)(path + 4);
14018 for (size_t k = 0; k < path_constr.datalen; k++) {
14019 uint32_t path_conv_10 = path_vals[k];
14020 LDKRouteHop path_conv_10_conv;
14021 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
14022 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
14023 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14024 path_constr.data[k] = path_conv_10_conv;
14026 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
14027 CHECK_ACCESS(short_channel_id_ptr);
14028 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
14029 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
14030 LDKRouteParameters retry_conv;
14031 retry_conv.inner = (void*)(retry & (~1));
14032 retry_conv.is_owned = (retry & 1) || (retry == 0);
14033 retry_conv = RouteParameters_clone(&retry_conv);
14034 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14035 *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
14036 uint64_t ret_ref = (uint64_t)ret_copy;
14040 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
14041 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14042 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
14043 uint64_t ret_ref = (uint64_t)ret_copy;
14047 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
14048 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
14049 outputs_constr.datalen = *((uint32_t*)outputs);
14050 if (outputs_constr.datalen > 0)
14051 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14053 outputs_constr.data = NULL;
14054 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
14055 for (size_t b = 0; b < outputs_constr.datalen; b++) {
14056 uint32_t outputs_conv_27 = outputs_vals[b];
14057 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
14058 CHECK_ACCESS(outputs_conv_27_ptr);
14059 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
14060 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
14061 outputs_constr.data[b] = outputs_conv_27_conv;
14063 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14064 *ret_copy = Event_spendable_outputs(outputs_constr);
14065 uint64_t ret_ref = (uint64_t)ret_copy;
14069 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
14070 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
14071 CHECK_ACCESS(fee_earned_msat_ptr);
14072 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
14073 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
14074 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14075 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
14076 uint64_t ret_ref = (uint64_t)ret_copy;
14080 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
14081 LDKThirtyTwoBytes channel_id_ref;
14082 CHECK(*((uint32_t*)channel_id) == 32);
14083 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
14084 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
14085 CHECK_ACCESS(reason_ptr);
14086 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
14087 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
14088 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14089 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
14090 uint64_t ret_ref = (uint64_t)ret_copy;
14094 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
14095 LDKThirtyTwoBytes channel_id_ref;
14096 CHECK(*((uint32_t*)channel_id) == 32);
14097 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
14098 LDKTransaction transaction_ref;
14099 transaction_ref.datalen = *((uint32_t*)transaction);
14100 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
14101 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
14102 transaction_ref.data_is_owned = true;
14103 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14104 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
14105 uint64_t ret_ref = (uint64_t)ret_copy;
14109 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
14110 LDKEvent* obj_conv = (LDKEvent*)obj;
14111 LDKCVec_u8Z ret_var = Event_write(obj_conv);
14112 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14113 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14114 CVec_u8Z_free(ret_var);
14118 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
14119 if ((this_ptr & 1) != 0) return;
14120 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14121 CHECK_ACCESS(this_ptr_ptr);
14122 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
14123 FREE((void*)this_ptr);
14124 MessageSendEvent_free(this_ptr_conv);
14127 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
14128 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
14129 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14130 *ret_copy = MessageSendEvent_clone(orig_conv);
14131 uint64_t ret_ref = (uint64_t)ret_copy;
14135 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
14136 LDKPublicKey node_id_ref;
14137 CHECK(*((uint32_t*)node_id) == 33);
14138 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14139 LDKAcceptChannel msg_conv;
14140 msg_conv.inner = (void*)(msg & (~1));
14141 msg_conv.is_owned = (msg & 1) || (msg == 0);
14142 msg_conv = AcceptChannel_clone(&msg_conv);
14143 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14144 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
14145 uint64_t ret_ref = (uint64_t)ret_copy;
14149 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
14150 LDKPublicKey node_id_ref;
14151 CHECK(*((uint32_t*)node_id) == 33);
14152 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14153 LDKOpenChannel msg_conv;
14154 msg_conv.inner = (void*)(msg & (~1));
14155 msg_conv.is_owned = (msg & 1) || (msg == 0);
14156 msg_conv = OpenChannel_clone(&msg_conv);
14157 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14158 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
14159 uint64_t ret_ref = (uint64_t)ret_copy;
14163 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
14164 LDKPublicKey node_id_ref;
14165 CHECK(*((uint32_t*)node_id) == 33);
14166 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14167 LDKFundingCreated msg_conv;
14168 msg_conv.inner = (void*)(msg & (~1));
14169 msg_conv.is_owned = (msg & 1) || (msg == 0);
14170 msg_conv = FundingCreated_clone(&msg_conv);
14171 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14172 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
14173 uint64_t ret_ref = (uint64_t)ret_copy;
14177 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
14178 LDKPublicKey node_id_ref;
14179 CHECK(*((uint32_t*)node_id) == 33);
14180 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14181 LDKFundingSigned msg_conv;
14182 msg_conv.inner = (void*)(msg & (~1));
14183 msg_conv.is_owned = (msg & 1) || (msg == 0);
14184 msg_conv = FundingSigned_clone(&msg_conv);
14185 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14186 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
14187 uint64_t ret_ref = (uint64_t)ret_copy;
14191 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
14192 LDKPublicKey node_id_ref;
14193 CHECK(*((uint32_t*)node_id) == 33);
14194 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14195 LDKFundingLocked msg_conv;
14196 msg_conv.inner = (void*)(msg & (~1));
14197 msg_conv.is_owned = (msg & 1) || (msg == 0);
14198 msg_conv = FundingLocked_clone(&msg_conv);
14199 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14200 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
14201 uint64_t ret_ref = (uint64_t)ret_copy;
14205 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
14206 LDKPublicKey node_id_ref;
14207 CHECK(*((uint32_t*)node_id) == 33);
14208 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14209 LDKAnnouncementSignatures msg_conv;
14210 msg_conv.inner = (void*)(msg & (~1));
14211 msg_conv.is_owned = (msg & 1) || (msg == 0);
14212 msg_conv = AnnouncementSignatures_clone(&msg_conv);
14213 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14214 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
14215 uint64_t ret_ref = (uint64_t)ret_copy;
14219 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
14220 LDKPublicKey node_id_ref;
14221 CHECK(*((uint32_t*)node_id) == 33);
14222 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14223 LDKCommitmentUpdate updates_conv;
14224 updates_conv.inner = (void*)(updates & (~1));
14225 updates_conv.is_owned = (updates & 1) || (updates == 0);
14226 updates_conv = CommitmentUpdate_clone(&updates_conv);
14227 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14228 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
14229 uint64_t ret_ref = (uint64_t)ret_copy;
14233 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
14234 LDKPublicKey node_id_ref;
14235 CHECK(*((uint32_t*)node_id) == 33);
14236 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14237 LDKRevokeAndACK msg_conv;
14238 msg_conv.inner = (void*)(msg & (~1));
14239 msg_conv.is_owned = (msg & 1) || (msg == 0);
14240 msg_conv = RevokeAndACK_clone(&msg_conv);
14241 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14242 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
14243 uint64_t ret_ref = (uint64_t)ret_copy;
14247 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
14248 LDKPublicKey node_id_ref;
14249 CHECK(*((uint32_t*)node_id) == 33);
14250 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14251 LDKClosingSigned msg_conv;
14252 msg_conv.inner = (void*)(msg & (~1));
14253 msg_conv.is_owned = (msg & 1) || (msg == 0);
14254 msg_conv = ClosingSigned_clone(&msg_conv);
14255 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14256 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
14257 uint64_t ret_ref = (uint64_t)ret_copy;
14261 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
14262 LDKPublicKey node_id_ref;
14263 CHECK(*((uint32_t*)node_id) == 33);
14264 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14265 LDKShutdown msg_conv;
14266 msg_conv.inner = (void*)(msg & (~1));
14267 msg_conv.is_owned = (msg & 1) || (msg == 0);
14268 msg_conv = Shutdown_clone(&msg_conv);
14269 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14270 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
14271 uint64_t ret_ref = (uint64_t)ret_copy;
14275 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
14276 LDKPublicKey node_id_ref;
14277 CHECK(*((uint32_t*)node_id) == 33);
14278 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14279 LDKChannelReestablish msg_conv;
14280 msg_conv.inner = (void*)(msg & (~1));
14281 msg_conv.is_owned = (msg & 1) || (msg == 0);
14282 msg_conv = ChannelReestablish_clone(&msg_conv);
14283 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14284 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
14285 uint64_t ret_ref = (uint64_t)ret_copy;
14289 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
14290 LDKChannelAnnouncement msg_conv;
14291 msg_conv.inner = (void*)(msg & (~1));
14292 msg_conv.is_owned = (msg & 1) || (msg == 0);
14293 msg_conv = ChannelAnnouncement_clone(&msg_conv);
14294 LDKChannelUpdate update_msg_conv;
14295 update_msg_conv.inner = (void*)(update_msg & (~1));
14296 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
14297 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
14298 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14299 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
14300 uint64_t ret_ref = (uint64_t)ret_copy;
14304 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
14305 LDKNodeAnnouncement msg_conv;
14306 msg_conv.inner = (void*)(msg & (~1));
14307 msg_conv.is_owned = (msg & 1) || (msg == 0);
14308 msg_conv = NodeAnnouncement_clone(&msg_conv);
14309 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14310 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
14311 uint64_t ret_ref = (uint64_t)ret_copy;
14315 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
14316 LDKChannelUpdate msg_conv;
14317 msg_conv.inner = (void*)(msg & (~1));
14318 msg_conv.is_owned = (msg & 1) || (msg == 0);
14319 msg_conv = ChannelUpdate_clone(&msg_conv);
14320 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14321 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
14322 uint64_t ret_ref = (uint64_t)ret_copy;
14326 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
14327 LDKPublicKey node_id_ref;
14328 CHECK(*((uint32_t*)node_id) == 33);
14329 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14330 LDKChannelUpdate msg_conv;
14331 msg_conv.inner = (void*)(msg & (~1));
14332 msg_conv.is_owned = (msg & 1) || (msg == 0);
14333 msg_conv = ChannelUpdate_clone(&msg_conv);
14334 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14335 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
14336 uint64_t ret_ref = (uint64_t)ret_copy;
14340 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
14341 LDKPublicKey node_id_ref;
14342 CHECK(*((uint32_t*)node_id) == 33);
14343 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14344 void* action_ptr = (void*)(((uint64_t)action) & ~1);
14345 CHECK_ACCESS(action_ptr);
14346 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
14347 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
14348 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14349 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
14350 uint64_t ret_ref = (uint64_t)ret_copy;
14354 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
14355 LDKPublicKey node_id_ref;
14356 CHECK(*((uint32_t*)node_id) == 33);
14357 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14358 LDKQueryChannelRange msg_conv;
14359 msg_conv.inner = (void*)(msg & (~1));
14360 msg_conv.is_owned = (msg & 1) || (msg == 0);
14361 msg_conv = QueryChannelRange_clone(&msg_conv);
14362 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14363 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
14364 uint64_t ret_ref = (uint64_t)ret_copy;
14368 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
14369 LDKPublicKey node_id_ref;
14370 CHECK(*((uint32_t*)node_id) == 33);
14371 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14372 LDKQueryShortChannelIds msg_conv;
14373 msg_conv.inner = (void*)(msg & (~1));
14374 msg_conv.is_owned = (msg & 1) || (msg == 0);
14375 msg_conv = QueryShortChannelIds_clone(&msg_conv);
14376 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14377 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
14378 uint64_t ret_ref = (uint64_t)ret_copy;
14382 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
14383 LDKPublicKey node_id_ref;
14384 CHECK(*((uint32_t*)node_id) == 33);
14385 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
14386 LDKReplyChannelRange msg_conv;
14387 msg_conv.inner = (void*)(msg & (~1));
14388 msg_conv.is_owned = (msg & 1) || (msg == 0);
14389 msg_conv = ReplyChannelRange_clone(&msg_conv);
14390 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14391 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
14392 uint64_t ret_ref = (uint64_t)ret_copy;
14396 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
14397 if ((this_ptr & 1) != 0) return;
14398 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14399 CHECK_ACCESS(this_ptr_ptr);
14400 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
14401 FREE((void*)this_ptr);
14402 MessageSendEventsProvider_free(this_ptr_conv);
14405 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
14406 if ((this_ptr & 1) != 0) return;
14407 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14408 CHECK_ACCESS(this_ptr_ptr);
14409 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
14410 FREE((void*)this_ptr);
14411 EventsProvider_free(this_ptr_conv);
14414 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
14415 if ((this_ptr & 1) != 0) return;
14416 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14417 CHECK_ACCESS(this_ptr_ptr);
14418 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
14419 FREE((void*)this_ptr);
14420 EventHandler_free(this_ptr_conv);
14423 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
14424 if ((this_ptr & 1) != 0) return;
14425 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14426 CHECK_ACCESS(this_ptr_ptr);
14427 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
14428 FREE((void*)this_ptr);
14429 APIError_free(this_ptr_conv);
14432 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
14433 LDKAPIError* orig_conv = (LDKAPIError*)orig;
14434 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14435 *ret_copy = APIError_clone(orig_conv);
14436 uint64_t ret_ref = (uint64_t)ret_copy;
14440 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
14441 LDKStr err_conv = str_ref_to_owned_c(err);
14442 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14443 *ret_copy = APIError_apimisuse_error(err_conv);
14444 uint64_t ret_ref = (uint64_t)ret_copy;
14448 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
14449 LDKStr err_conv = str_ref_to_owned_c(err);
14450 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14451 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
14452 uint64_t ret_ref = (uint64_t)ret_copy;
14456 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
14457 LDKStr err_conv = str_ref_to_owned_c(err);
14458 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14459 *ret_copy = APIError_route_error(err_conv);
14460 uint64_t ret_ref = (uint64_t)ret_copy;
14464 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
14465 LDKStr err_conv = str_ref_to_owned_c(err);
14466 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14467 *ret_copy = APIError_channel_unavailable(err_conv);
14468 uint64_t ret_ref = (uint64_t)ret_copy;
14472 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
14473 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14474 *ret_copy = APIError_monitor_update_failed();
14475 uint64_t ret_ref = (uint64_t)ret_copy;
14479 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
14480 LDKShutdownScript script_conv;
14481 script_conv.inner = (void*)(script & (~1));
14482 script_conv.is_owned = (script & 1) || (script == 0);
14483 script_conv = ShutdownScript_clone(&script_conv);
14484 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14485 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
14486 uint64_t ret_ref = (uint64_t)ret_copy;
14490 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
14491 LDKu8slice msg_ref;
14492 msg_ref.datalen = *((uint32_t*)msg);
14493 msg_ref.data = (int8_t*)(msg + 4);
14494 unsigned char sk_arr[32];
14495 CHECK(*((uint32_t*)sk) == 32);
14496 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
14497 unsigned char (*sk_ref)[32] = &sk_arr;
14498 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
14499 *ret_conv = sign(msg_ref, sk_ref);
14500 return (uint64_t)ret_conv;
14503 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
14504 LDKu8slice msg_ref;
14505 msg_ref.datalen = *((uint32_t*)msg);
14506 msg_ref.data = (int8_t*)(msg + 4);
14507 LDKStr sig_conv = str_ref_to_owned_c(sig);
14508 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14509 *ret_conv = recover_pk(msg_ref, sig_conv);
14510 return (uint64_t)ret_conv;
14513 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
14514 LDKu8slice msg_ref;
14515 msg_ref.datalen = *((uint32_t*)msg);
14516 msg_ref.data = (int8_t*)(msg + 4);
14517 LDKStr sig_conv = str_ref_to_owned_c(sig);
14518 LDKPublicKey pk_ref;
14519 CHECK(*((uint32_t*)pk) == 33);
14520 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
14521 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
14525 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
14526 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
14527 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
14531 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
14532 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
14536 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
14537 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
14541 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
14542 uint32_t ret_conv = LDKLevel_to_js(Level_info());
14546 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
14547 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
14551 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
14552 uint32_t ret_conv = LDKLevel_to_js(Level_error());
14556 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
14557 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
14558 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
14559 jboolean ret_val = Level_eq(a_conv, b_conv);
14563 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
14564 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
14565 int64_t ret_val = Level_hash(o_conv);
14569 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
14570 uint32_t ret_conv = LDKLevel_to_js(Level_max());
14574 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
14575 if ((this_ptr & 1) != 0) return;
14576 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
14577 CHECK_ACCESS(this_ptr_ptr);
14578 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
14579 FREE((void*)this_ptr);
14580 Logger_free(this_ptr_conv);
14583 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
14584 LDKChannelHandshakeConfig this_obj_conv;
14585 this_obj_conv.inner = (void*)(this_obj & (~1));
14586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14587 ChannelHandshakeConfig_free(this_obj_conv);
14590 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
14591 LDKChannelHandshakeConfig this_ptr_conv;
14592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14593 this_ptr_conv.is_owned = false;
14594 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
14598 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
14599 LDKChannelHandshakeConfig this_ptr_conv;
14600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14601 this_ptr_conv.is_owned = false;
14602 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
14605 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
14606 LDKChannelHandshakeConfig this_ptr_conv;
14607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14608 this_ptr_conv.is_owned = false;
14609 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
14613 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
14614 LDKChannelHandshakeConfig this_ptr_conv;
14615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14616 this_ptr_conv.is_owned = false;
14617 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
14620 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
14621 LDKChannelHandshakeConfig this_ptr_conv;
14622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14623 this_ptr_conv.is_owned = false;
14624 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
14628 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14629 LDKChannelHandshakeConfig this_ptr_conv;
14630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14631 this_ptr_conv.is_owned = false;
14632 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
14635 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) {
14636 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
14637 uint64_t ret_ref = 0;
14638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14640 ret_ref = (uint64_t)ret_var.inner;
14641 if (ret_var.is_owned) {
14647 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
14648 LDKChannelHandshakeConfig orig_conv;
14649 orig_conv.inner = (void*)(orig & (~1));
14650 orig_conv.is_owned = false;
14651 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
14652 uint64_t ret_ref = 0;
14653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14655 ret_ref = (uint64_t)ret_var.inner;
14656 if (ret_var.is_owned) {
14662 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
14663 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
14664 uint64_t ret_ref = 0;
14665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14667 ret_ref = (uint64_t)ret_var.inner;
14668 if (ret_var.is_owned) {
14674 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
14675 LDKChannelHandshakeLimits this_obj_conv;
14676 this_obj_conv.inner = (void*)(this_obj & (~1));
14677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14678 ChannelHandshakeLimits_free(this_obj_conv);
14681 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
14682 LDKChannelHandshakeLimits this_ptr_conv;
14683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14684 this_ptr_conv.is_owned = false;
14685 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
14689 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
14690 LDKChannelHandshakeLimits this_ptr_conv;
14691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14692 this_ptr_conv.is_owned = false;
14693 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
14696 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
14697 LDKChannelHandshakeLimits this_ptr_conv;
14698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14699 this_ptr_conv.is_owned = false;
14700 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
14704 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14705 LDKChannelHandshakeLimits this_ptr_conv;
14706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14707 this_ptr_conv.is_owned = false;
14708 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
14711 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
14712 LDKChannelHandshakeLimits this_ptr_conv;
14713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14714 this_ptr_conv.is_owned = false;
14715 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
14719 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
14720 LDKChannelHandshakeLimits this_ptr_conv;
14721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14722 this_ptr_conv.is_owned = false;
14723 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
14726 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
14727 LDKChannelHandshakeLimits this_ptr_conv;
14728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14729 this_ptr_conv.is_owned = false;
14730 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
14734 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
14735 LDKChannelHandshakeLimits this_ptr_conv;
14736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14737 this_ptr_conv.is_owned = false;
14738 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
14741 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
14742 LDKChannelHandshakeLimits this_ptr_conv;
14743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14744 this_ptr_conv.is_owned = false;
14745 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
14749 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
14750 LDKChannelHandshakeLimits this_ptr_conv;
14751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14752 this_ptr_conv.is_owned = false;
14753 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
14756 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
14757 LDKChannelHandshakeLimits this_ptr_conv;
14758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14759 this_ptr_conv.is_owned = false;
14760 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
14764 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
14765 LDKChannelHandshakeLimits this_ptr_conv;
14766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14767 this_ptr_conv.is_owned = false;
14768 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
14771 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
14772 LDKChannelHandshakeLimits this_ptr_conv;
14773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14774 this_ptr_conv.is_owned = false;
14775 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
14779 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
14780 LDKChannelHandshakeLimits this_ptr_conv;
14781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14782 this_ptr_conv.is_owned = false;
14783 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
14786 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
14787 LDKChannelHandshakeLimits this_ptr_conv;
14788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14789 this_ptr_conv.is_owned = false;
14790 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
14794 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
14795 LDKChannelHandshakeLimits this_ptr_conv;
14796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14797 this_ptr_conv.is_owned = false;
14798 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
14801 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) {
14802 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);
14803 uint64_t ret_ref = 0;
14804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14806 ret_ref = (uint64_t)ret_var.inner;
14807 if (ret_var.is_owned) {
14813 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
14814 LDKChannelHandshakeLimits orig_conv;
14815 orig_conv.inner = (void*)(orig & (~1));
14816 orig_conv.is_owned = false;
14817 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
14818 uint64_t ret_ref = 0;
14819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14821 ret_ref = (uint64_t)ret_var.inner;
14822 if (ret_var.is_owned) {
14828 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
14829 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
14830 uint64_t ret_ref = 0;
14831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14833 ret_ref = (uint64_t)ret_var.inner;
14834 if (ret_var.is_owned) {
14840 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
14841 LDKChannelConfig this_obj_conv;
14842 this_obj_conv.inner = (void*)(this_obj & (~1));
14843 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14844 ChannelConfig_free(this_obj_conv);
14847 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
14848 LDKChannelConfig this_ptr_conv;
14849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14850 this_ptr_conv.is_owned = false;
14851 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
14855 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14856 LDKChannelConfig this_ptr_conv;
14857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14858 this_ptr_conv.is_owned = false;
14859 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
14862 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
14863 LDKChannelConfig this_ptr_conv;
14864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14865 this_ptr_conv.is_owned = false;
14866 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
14870 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
14871 LDKChannelConfig this_ptr_conv;
14872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14873 this_ptr_conv.is_owned = false;
14874 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
14877 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
14878 LDKChannelConfig this_ptr_conv;
14879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14880 this_ptr_conv.is_owned = false;
14881 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
14885 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14886 LDKChannelConfig this_ptr_conv;
14887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14888 this_ptr_conv.is_owned = false;
14889 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
14892 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
14893 LDKChannelConfig this_ptr_conv;
14894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14895 this_ptr_conv.is_owned = false;
14896 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
14900 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
14901 LDKChannelConfig this_ptr_conv;
14902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14903 this_ptr_conv.is_owned = false;
14904 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
14907 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
14908 LDKChannelConfig this_ptr_conv;
14909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14910 this_ptr_conv.is_owned = false;
14911 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
14915 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
14916 LDKChannelConfig this_ptr_conv;
14917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14918 this_ptr_conv.is_owned = false;
14919 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
14922 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
14923 LDKChannelConfig this_ptr_conv;
14924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14925 this_ptr_conv.is_owned = false;
14926 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
14930 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
14931 LDKChannelConfig this_ptr_conv;
14932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14933 this_ptr_conv.is_owned = false;
14934 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
14937 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
14938 LDKChannelConfig this_ptr_conv;
14939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14940 this_ptr_conv.is_owned = false;
14941 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
14945 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
14946 LDKChannelConfig this_ptr_conv;
14947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14948 this_ptr_conv.is_owned = false;
14949 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
14952 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) {
14953 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);
14954 uint64_t ret_ref = 0;
14955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14957 ret_ref = (uint64_t)ret_var.inner;
14958 if (ret_var.is_owned) {
14964 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
14965 LDKChannelConfig orig_conv;
14966 orig_conv.inner = (void*)(orig & (~1));
14967 orig_conv.is_owned = false;
14968 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
14969 uint64_t ret_ref = 0;
14970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14972 ret_ref = (uint64_t)ret_var.inner;
14973 if (ret_var.is_owned) {
14979 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
14980 LDKChannelConfig ret_var = ChannelConfig_default();
14981 uint64_t ret_ref = 0;
14982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14984 ret_ref = (uint64_t)ret_var.inner;
14985 if (ret_var.is_owned) {
14991 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
14992 LDKChannelConfig obj_conv;
14993 obj_conv.inner = (void*)(obj & (~1));
14994 obj_conv.is_owned = false;
14995 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
14996 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14997 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14998 CVec_u8Z_free(ret_var);
15002 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
15003 LDKu8slice ser_ref;
15004 ser_ref.datalen = *((uint32_t*)ser);
15005 ser_ref.data = (int8_t*)(ser + 4);
15006 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15007 *ret_conv = ChannelConfig_read(ser_ref);
15008 return (uint64_t)ret_conv;
15011 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
15012 LDKUserConfig this_obj_conv;
15013 this_obj_conv.inner = (void*)(this_obj & (~1));
15014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15015 UserConfig_free(this_obj_conv);
15018 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
15019 LDKUserConfig this_ptr_conv;
15020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15021 this_ptr_conv.is_owned = false;
15022 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
15023 uint64_t ret_ref = 0;
15024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15026 ret_ref = (uint64_t)ret_var.inner;
15027 if (ret_var.is_owned) {
15033 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
15034 LDKUserConfig this_ptr_conv;
15035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15036 this_ptr_conv.is_owned = false;
15037 LDKChannelHandshakeConfig val_conv;
15038 val_conv.inner = (void*)(val & (~1));
15039 val_conv.is_owned = (val & 1) || (val == 0);
15040 val_conv = ChannelHandshakeConfig_clone(&val_conv);
15041 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
15044 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
15045 LDKUserConfig this_ptr_conv;
15046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15047 this_ptr_conv.is_owned = false;
15048 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
15049 uint64_t ret_ref = 0;
15050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15052 ret_ref = (uint64_t)ret_var.inner;
15053 if (ret_var.is_owned) {
15059 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
15060 LDKUserConfig this_ptr_conv;
15061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15062 this_ptr_conv.is_owned = false;
15063 LDKChannelHandshakeLimits val_conv;
15064 val_conv.inner = (void*)(val & (~1));
15065 val_conv.is_owned = (val & 1) || (val == 0);
15066 val_conv = ChannelHandshakeLimits_clone(&val_conv);
15067 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
15070 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
15071 LDKUserConfig this_ptr_conv;
15072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15073 this_ptr_conv.is_owned = false;
15074 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
15075 uint64_t ret_ref = 0;
15076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15078 ret_ref = (uint64_t)ret_var.inner;
15079 if (ret_var.is_owned) {
15085 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
15086 LDKUserConfig this_ptr_conv;
15087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15088 this_ptr_conv.is_owned = false;
15089 LDKChannelConfig val_conv;
15090 val_conv.inner = (void*)(val & (~1));
15091 val_conv.is_owned = (val & 1) || (val == 0);
15092 val_conv = ChannelConfig_clone(&val_conv);
15093 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
15096 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
15097 LDKUserConfig this_ptr_conv;
15098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15099 this_ptr_conv.is_owned = false;
15100 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
15104 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
15105 LDKUserConfig this_ptr_conv;
15106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15107 this_ptr_conv.is_owned = false;
15108 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
15111 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) {
15112 LDKChannelHandshakeConfig own_channel_config_arg_conv;
15113 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
15114 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
15115 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
15116 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
15117 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
15118 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
15119 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
15120 LDKChannelConfig channel_options_arg_conv;
15121 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
15122 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
15123 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
15124 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);
15125 uint64_t ret_ref = 0;
15126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15128 ret_ref = (uint64_t)ret_var.inner;
15129 if (ret_var.is_owned) {
15135 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
15136 LDKUserConfig orig_conv;
15137 orig_conv.inner = (void*)(orig & (~1));
15138 orig_conv.is_owned = false;
15139 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
15140 uint64_t ret_ref = 0;
15141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15143 ret_ref = (uint64_t)ret_var.inner;
15144 if (ret_var.is_owned) {
15150 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
15151 LDKUserConfig ret_var = UserConfig_default();
15152 uint64_t ret_ref = 0;
15153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15155 ret_ref = (uint64_t)ret_var.inner;
15156 if (ret_var.is_owned) {
15162 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
15163 LDKBestBlock this_obj_conv;
15164 this_obj_conv.inner = (void*)(this_obj & (~1));
15165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15166 BestBlock_free(this_obj_conv);
15169 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
15170 LDKBestBlock orig_conv;
15171 orig_conv.inner = (void*)(orig & (~1));
15172 orig_conv.is_owned = false;
15173 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15174 uint64_t ret_ref = 0;
15175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15177 ret_ref = (uint64_t)ret_var.inner;
15178 if (ret_var.is_owned) {
15184 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
15185 LDKNetwork network_conv = LDKNetwork_from_js(network);
15186 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15187 uint64_t ret_ref = 0;
15188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15190 ret_ref = (uint64_t)ret_var.inner;
15191 if (ret_var.is_owned) {
15197 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
15198 LDKThirtyTwoBytes block_hash_ref;
15199 CHECK(*((uint32_t*)block_hash) == 32);
15200 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
15201 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15202 uint64_t ret_ref = 0;
15203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15205 ret_ref = (uint64_t)ret_var.inner;
15206 if (ret_var.is_owned) {
15212 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
15213 LDKBestBlock this_arg_conv;
15214 this_arg_conv.inner = (void*)(this_arg & (~1));
15215 this_arg_conv.is_owned = false;
15216 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15217 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
15221 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
15222 LDKBestBlock this_arg_conv;
15223 this_arg_conv.inner = (void*)(this_arg & (~1));
15224 this_arg_conv.is_owned = false;
15225 int32_t ret_val = BestBlock_height(&this_arg_conv);
15229 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
15230 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
15231 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
15235 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
15236 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
15240 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
15241 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
15245 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
15246 if ((this_ptr & 1) != 0) return;
15247 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15248 CHECK_ACCESS(this_ptr_ptr);
15249 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
15250 FREE((void*)this_ptr);
15251 Access_free(this_ptr_conv);
15254 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
15255 if ((this_ptr & 1) != 0) return;
15256 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15257 CHECK_ACCESS(this_ptr_ptr);
15258 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
15259 FREE((void*)this_ptr);
15260 Listen_free(this_ptr_conv);
15263 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
15264 if ((this_ptr & 1) != 0) return;
15265 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15266 CHECK_ACCESS(this_ptr_ptr);
15267 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
15268 FREE((void*)this_ptr);
15269 Confirm_free(this_ptr_conv);
15272 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
15273 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
15274 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
15278 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
15279 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
15283 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
15284 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
15288 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
15289 if ((this_ptr & 1) != 0) return;
15290 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15291 CHECK_ACCESS(this_ptr_ptr);
15292 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
15293 FREE((void*)this_ptr);
15294 Watch_free(this_ptr_conv);
15297 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
15298 if ((this_ptr & 1) != 0) return;
15299 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15300 CHECK_ACCESS(this_ptr_ptr);
15301 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
15302 FREE((void*)this_ptr);
15303 Filter_free(this_ptr_conv);
15306 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
15307 LDKWatchedOutput this_obj_conv;
15308 this_obj_conv.inner = (void*)(this_obj & (~1));
15309 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15310 WatchedOutput_free(this_obj_conv);
15313 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
15314 LDKWatchedOutput this_ptr_conv;
15315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15316 this_ptr_conv.is_owned = false;
15317 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15318 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
15322 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
15323 LDKWatchedOutput this_ptr_conv;
15324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15325 this_ptr_conv.is_owned = false;
15326 LDKThirtyTwoBytes val_ref;
15327 CHECK(*((uint32_t*)val) == 32);
15328 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15329 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
15332 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
15333 LDKWatchedOutput this_ptr_conv;
15334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15335 this_ptr_conv.is_owned = false;
15336 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
15337 uint64_t ret_ref = 0;
15338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15340 ret_ref = (uint64_t)ret_var.inner;
15341 if (ret_var.is_owned) {
15347 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
15348 LDKWatchedOutput this_ptr_conv;
15349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15350 this_ptr_conv.is_owned = false;
15351 LDKOutPoint val_conv;
15352 val_conv.inner = (void*)(val & (~1));
15353 val_conv.is_owned = (val & 1) || (val == 0);
15354 val_conv = OutPoint_clone(&val_conv);
15355 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
15358 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
15359 LDKWatchedOutput this_ptr_conv;
15360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15361 this_ptr_conv.is_owned = false;
15362 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
15363 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15364 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15368 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
15369 LDKWatchedOutput this_ptr_conv;
15370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15371 this_ptr_conv.is_owned = false;
15372 LDKCVec_u8Z val_ref;
15373 val_ref.datalen = *((uint32_t*)val);
15374 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15375 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15376 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
15379 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
15380 LDKThirtyTwoBytes block_hash_arg_ref;
15381 CHECK(*((uint32_t*)block_hash_arg) == 32);
15382 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
15383 LDKOutPoint outpoint_arg_conv;
15384 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15385 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15386 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15387 LDKCVec_u8Z script_pubkey_arg_ref;
15388 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
15389 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15390 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
15391 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
15392 uint64_t ret_ref = 0;
15393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15395 ret_ref = (uint64_t)ret_var.inner;
15396 if (ret_var.is_owned) {
15402 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
15403 LDKWatchedOutput orig_conv;
15404 orig_conv.inner = (void*)(orig & (~1));
15405 orig_conv.is_owned = false;
15406 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
15407 uint64_t ret_ref = 0;
15408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15410 ret_ref = (uint64_t)ret_var.inner;
15411 if (ret_var.is_owned) {
15417 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
15418 LDKWatchedOutput o_conv;
15419 o_conv.inner = (void*)(o & (~1));
15420 o_conv.is_owned = false;
15421 int64_t ret_val = WatchedOutput_hash(&o_conv);
15425 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
15426 if ((this_ptr & 1) != 0) return;
15427 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15428 CHECK_ACCESS(this_ptr_ptr);
15429 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
15430 FREE((void*)this_ptr);
15431 BroadcasterInterface_free(this_ptr_conv);
15434 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
15435 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
15436 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
15440 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
15441 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
15445 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
15446 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
15450 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
15451 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
15455 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
15456 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
15457 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
15458 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
15462 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
15463 if ((this_ptr & 1) != 0) return;
15464 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15465 CHECK_ACCESS(this_ptr_ptr);
15466 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
15467 FREE((void*)this_ptr);
15468 FeeEstimator_free(this_ptr_conv);
15471 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
15472 LDKMonitorUpdateId this_obj_conv;
15473 this_obj_conv.inner = (void*)(this_obj & (~1));
15474 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15475 MonitorUpdateId_free(this_obj_conv);
15478 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
15479 LDKMonitorUpdateId orig_conv;
15480 orig_conv.inner = (void*)(orig & (~1));
15481 orig_conv.is_owned = false;
15482 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
15483 uint64_t ret_ref = 0;
15484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15486 ret_ref = (uint64_t)ret_var.inner;
15487 if (ret_var.is_owned) {
15493 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
15494 LDKMonitorUpdateId o_conv;
15495 o_conv.inner = (void*)(o & (~1));
15496 o_conv.is_owned = false;
15497 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
15501 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
15502 LDKMonitorUpdateId a_conv;
15503 a_conv.inner = (void*)(a & (~1));
15504 a_conv.is_owned = false;
15505 LDKMonitorUpdateId b_conv;
15506 b_conv.inner = (void*)(b & (~1));
15507 b_conv.is_owned = false;
15508 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
15512 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
15513 if ((this_ptr & 1) != 0) return;
15514 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15515 CHECK_ACCESS(this_ptr_ptr);
15516 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
15517 FREE((void*)this_ptr);
15518 Persist_free(this_ptr_conv);
15521 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
15522 LDKLockedChannelMonitor this_obj_conv;
15523 this_obj_conv.inner = (void*)(this_obj & (~1));
15524 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15525 LockedChannelMonitor_free(this_obj_conv);
15528 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
15529 LDKChainMonitor this_obj_conv;
15530 this_obj_conv.inner = (void*)(this_obj & (~1));
15531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15532 ChainMonitor_free(this_obj_conv);
15535 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
15536 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
15537 CHECK_ACCESS(chain_source_ptr);
15538 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
15539 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
15540 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
15541 // Manually implement clone for Java trait instances
15543 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
15544 CHECK_ACCESS(broadcaster_ptr);
15545 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
15546 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
15547 CHECK_ACCESS(logger_ptr);
15548 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
15549 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
15550 CHECK_ACCESS(feeest_ptr);
15551 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
15552 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
15553 CHECK_ACCESS(persister_ptr);
15554 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
15555 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
15556 uint64_t ret_ref = 0;
15557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15559 ret_ref = (uint64_t)ret_var.inner;
15560 if (ret_var.is_owned) {
15566 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
15567 LDKChainMonitor this_arg_conv;
15568 this_arg_conv.inner = (void*)(this_arg & (~1));
15569 this_arg_conv.is_owned = false;
15570 LDKCVec_ChannelDetailsZ ignored_channels_constr;
15571 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
15572 if (ignored_channels_constr.datalen > 0)
15573 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15575 ignored_channels_constr.data = NULL;
15576 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
15577 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
15578 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
15579 LDKChannelDetails ignored_channels_conv_16_conv;
15580 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
15581 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
15582 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
15583 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
15585 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
15586 uint32_tArray ret_arr = NULL;
15587 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15588 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15589 for (size_t j = 0; j < ret_var.datalen; j++) {
15590 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15591 *ret_conv_9_copy = ret_var.data[j];
15592 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
15593 ret_arr_ptr[j] = ret_conv_9_ref;
15596 FREE(ret_var.data);
15600 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
15601 LDKChainMonitor this_arg_conv;
15602 this_arg_conv.inner = (void*)(this_arg & (~1));
15603 this_arg_conv.is_owned = false;
15604 LDKOutPoint funding_txo_conv;
15605 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15606 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
15607 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
15608 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15609 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
15610 return (uint64_t)ret_conv;
15613 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
15614 LDKChainMonitor this_arg_conv;
15615 this_arg_conv.inner = (void*)(this_arg & (~1));
15616 this_arg_conv.is_owned = false;
15617 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
15618 uint32_tArray ret_arr = NULL;
15619 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15620 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15621 for (size_t k = 0; k < ret_var.datalen; k++) {
15622 LDKOutPoint ret_conv_10_var = ret_var.data[k];
15623 uint64_t ret_conv_10_ref = 0;
15624 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15625 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15626 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
15627 if (ret_conv_10_var.is_owned) {
15628 ret_conv_10_ref |= 1;
15630 ret_arr_ptr[k] = ret_conv_10_ref;
15633 FREE(ret_var.data);
15637 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
15638 LDKChainMonitor this_arg_conv;
15639 this_arg_conv.inner = (void*)(this_arg & (~1));
15640 this_arg_conv.is_owned = false;
15641 LDKOutPoint funding_txo_conv;
15642 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15643 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
15644 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
15645 LDKMonitorUpdateId completed_update_id_conv;
15646 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
15647 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
15648 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
15649 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15650 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
15651 return (uint64_t)ret_conv;
15654 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
15655 LDKChainMonitor this_arg_conv;
15656 this_arg_conv.inner = (void*)(this_arg & (~1));
15657 this_arg_conv.is_owned = false;
15658 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
15659 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
15660 return (uint64_t)ret_ret;
15663 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
15664 LDKChainMonitor this_arg_conv;
15665 this_arg_conv.inner = (void*)(this_arg & (~1));
15666 this_arg_conv.is_owned = false;
15667 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15668 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
15669 return (uint64_t)ret_ret;
15672 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
15673 LDKChainMonitor this_arg_conv;
15674 this_arg_conv.inner = (void*)(this_arg & (~1));
15675 this_arg_conv.is_owned = false;
15676 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
15677 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
15678 return (uint64_t)ret_ret;
15681 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
15682 LDKChainMonitor this_arg_conv;
15683 this_arg_conv.inner = (void*)(this_arg & (~1));
15684 this_arg_conv.is_owned = false;
15685 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15686 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
15687 return (uint64_t)ret_ret;
15690 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
15691 LDKChannelMonitorUpdate this_obj_conv;
15692 this_obj_conv.inner = (void*)(this_obj & (~1));
15693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15694 ChannelMonitorUpdate_free(this_obj_conv);
15697 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
15698 LDKChannelMonitorUpdate this_ptr_conv;
15699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15700 this_ptr_conv.is_owned = false;
15701 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
15705 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
15706 LDKChannelMonitorUpdate this_ptr_conv;
15707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15708 this_ptr_conv.is_owned = false;
15709 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
15712 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
15713 LDKChannelMonitorUpdate orig_conv;
15714 orig_conv.inner = (void*)(orig & (~1));
15715 orig_conv.is_owned = false;
15716 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
15717 uint64_t ret_ref = 0;
15718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15720 ret_ref = (uint64_t)ret_var.inner;
15721 if (ret_var.is_owned) {
15727 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
15728 LDKChannelMonitorUpdate obj_conv;
15729 obj_conv.inner = (void*)(obj & (~1));
15730 obj_conv.is_owned = false;
15731 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
15732 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15733 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15734 CVec_u8Z_free(ret_var);
15738 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
15739 LDKu8slice ser_ref;
15740 ser_ref.datalen = *((uint32_t*)ser);
15741 ser_ref.data = (int8_t*)(ser + 4);
15742 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15743 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
15744 return (uint64_t)ret_conv;
15747 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
15748 LDKMonitorUpdateError this_obj_conv;
15749 this_obj_conv.inner = (void*)(this_obj & (~1));
15750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15751 MonitorUpdateError_free(this_obj_conv);
15754 jstring __attribute__((visibility("default"))) TS_MonitorUpdateError_get_a(uint32_t this_ptr) {
15755 LDKMonitorUpdateError this_ptr_conv;
15756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15757 this_ptr_conv.is_owned = false;
15758 LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv);
15759 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15764 void __attribute__((visibility("default"))) TS_MonitorUpdateError_set_a(uint32_t this_ptr, jstring val) {
15765 LDKMonitorUpdateError this_ptr_conv;
15766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15767 this_ptr_conv.is_owned = false;
15768 LDKStr val_conv = str_ref_to_owned_c(val);
15769 MonitorUpdateError_set_a(&this_ptr_conv, val_conv);
15772 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_new(jstring a_arg) {
15773 LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
15774 LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv);
15775 uint64_t ret_ref = 0;
15776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15778 ret_ref = (uint64_t)ret_var.inner;
15779 if (ret_var.is_owned) {
15785 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
15786 LDKMonitorUpdateError orig_conv;
15787 orig_conv.inner = (void*)(orig & (~1));
15788 orig_conv.is_owned = false;
15789 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
15790 uint64_t ret_ref = 0;
15791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15793 ret_ref = (uint64_t)ret_var.inner;
15794 if (ret_var.is_owned) {
15800 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
15801 if ((this_ptr & 1) != 0) return;
15802 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15803 CHECK_ACCESS(this_ptr_ptr);
15804 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
15805 FREE((void*)this_ptr);
15806 MonitorEvent_free(this_ptr_conv);
15809 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
15810 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
15811 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15812 *ret_copy = MonitorEvent_clone(orig_conv);
15813 uint64_t ret_ref = (uint64_t)ret_copy;
15817 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
15818 LDKHTLCUpdate a_conv;
15819 a_conv.inner = (void*)(a & (~1));
15820 a_conv.is_owned = (a & 1) || (a == 0);
15821 a_conv = HTLCUpdate_clone(&a_conv);
15822 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15823 *ret_copy = MonitorEvent_htlcevent(a_conv);
15824 uint64_t ret_ref = (uint64_t)ret_copy;
15828 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
15829 LDKOutPoint a_conv;
15830 a_conv.inner = (void*)(a & (~1));
15831 a_conv.is_owned = (a & 1) || (a == 0);
15832 a_conv = OutPoint_clone(&a_conv);
15833 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15834 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
15835 uint64_t ret_ref = (uint64_t)ret_copy;
15839 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
15840 LDKOutPoint funding_txo_conv;
15841 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15842 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
15843 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
15844 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15845 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
15846 uint64_t ret_ref = (uint64_t)ret_copy;
15850 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
15851 LDKOutPoint a_conv;
15852 a_conv.inner = (void*)(a & (~1));
15853 a_conv.is_owned = (a & 1) || (a == 0);
15854 a_conv = OutPoint_clone(&a_conv);
15855 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15856 *ret_copy = MonitorEvent_update_failed(a_conv);
15857 uint64_t ret_ref = (uint64_t)ret_copy;
15861 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
15862 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
15863 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
15864 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15865 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15866 CVec_u8Z_free(ret_var);
15870 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
15871 LDKHTLCUpdate this_obj_conv;
15872 this_obj_conv.inner = (void*)(this_obj & (~1));
15873 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15874 HTLCUpdate_free(this_obj_conv);
15877 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
15878 LDKHTLCUpdate orig_conv;
15879 orig_conv.inner = (void*)(orig & (~1));
15880 orig_conv.is_owned = false;
15881 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
15882 uint64_t ret_ref = 0;
15883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15885 ret_ref = (uint64_t)ret_var.inner;
15886 if (ret_var.is_owned) {
15892 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
15893 LDKHTLCUpdate obj_conv;
15894 obj_conv.inner = (void*)(obj & (~1));
15895 obj_conv.is_owned = false;
15896 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
15897 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15898 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15899 CVec_u8Z_free(ret_var);
15903 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
15904 LDKu8slice ser_ref;
15905 ser_ref.datalen = *((uint32_t*)ser);
15906 ser_ref.data = (int8_t*)(ser + 4);
15907 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15908 *ret_conv = HTLCUpdate_read(ser_ref);
15909 return (uint64_t)ret_conv;
15912 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
15913 if ((this_ptr & 1) != 0) return;
15914 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15915 CHECK_ACCESS(this_ptr_ptr);
15916 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
15917 FREE((void*)this_ptr);
15918 Balance_free(this_ptr_conv);
15921 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
15922 LDKBalance* orig_conv = (LDKBalance*)orig;
15923 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15924 *ret_copy = Balance_clone(orig_conv);
15925 uint64_t ret_ref = (uint64_t)ret_copy;
15929 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
15930 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15931 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
15932 uint64_t ret_ref = (uint64_t)ret_copy;
15936 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
15937 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15938 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
15939 uint64_t ret_ref = (uint64_t)ret_copy;
15943 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
15944 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15945 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
15946 uint64_t ret_ref = (uint64_t)ret_copy;
15950 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
15951 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
15952 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
15953 uint64_t ret_ref = (uint64_t)ret_copy;
15957 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
15958 LDKBalance* a_conv = (LDKBalance*)a;
15959 LDKBalance* b_conv = (LDKBalance*)b;
15960 jboolean ret_val = Balance_eq(a_conv, b_conv);
15964 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
15965 LDKChannelMonitor this_obj_conv;
15966 this_obj_conv.inner = (void*)(this_obj & (~1));
15967 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15968 ChannelMonitor_free(this_obj_conv);
15971 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
15972 LDKChannelMonitor orig_conv;
15973 orig_conv.inner = (void*)(orig & (~1));
15974 orig_conv.is_owned = false;
15975 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
15976 uint64_t ret_ref = 0;
15977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15979 ret_ref = (uint64_t)ret_var.inner;
15980 if (ret_var.is_owned) {
15986 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
15987 LDKChannelMonitor obj_conv;
15988 obj_conv.inner = (void*)(obj & (~1));
15989 obj_conv.is_owned = false;
15990 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
15991 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15992 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15993 CVec_u8Z_free(ret_var);
15997 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) {
15998 LDKChannelMonitor this_arg_conv;
15999 this_arg_conv.inner = (void*)(this_arg & (~1));
16000 this_arg_conv.is_owned = false;
16001 LDKChannelMonitorUpdate updates_conv;
16002 updates_conv.inner = (void*)(updates & (~1));
16003 updates_conv.is_owned = false;
16004 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16005 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
16006 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
16007 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16008 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
16009 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
16010 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16011 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
16012 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
16013 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
16014 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
16015 return (uint64_t)ret_conv;
16018 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
16019 LDKChannelMonitor this_arg_conv;
16020 this_arg_conv.inner = (void*)(this_arg & (~1));
16021 this_arg_conv.is_owned = false;
16022 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
16026 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
16027 LDKChannelMonitor this_arg_conv;
16028 this_arg_conv.inner = (void*)(this_arg & (~1));
16029 this_arg_conv.is_owned = false;
16030 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16031 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
16032 return ((uint64_t)ret_conv);
16035 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
16036 LDKChannelMonitor this_arg_conv;
16037 this_arg_conv.inner = (void*)(this_arg & (~1));
16038 this_arg_conv.is_owned = false;
16039 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
16040 uint32_tArray ret_arr = NULL;
16041 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16042 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16043 for (size_t o = 0; o < ret_var.datalen; o++) {
16044 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16045 *ret_conv_40_conv = ret_var.data[o];
16046 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
16049 FREE(ret_var.data);
16053 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
16054 LDKChannelMonitor this_arg_conv;
16055 this_arg_conv.inner = (void*)(this_arg & (~1));
16056 this_arg_conv.is_owned = false;
16057 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
16058 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
16059 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
16060 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
16063 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
16064 LDKChannelMonitor this_arg_conv;
16065 this_arg_conv.inner = (void*)(this_arg & (~1));
16066 this_arg_conv.is_owned = false;
16067 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
16068 uint32_tArray ret_arr = NULL;
16069 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16070 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16071 for (size_t o = 0; o < ret_var.datalen; o++) {
16072 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16073 *ret_conv_14_copy = ret_var.data[o];
16074 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
16075 ret_arr_ptr[o] = ret_conv_14_ref;
16078 FREE(ret_var.data);
16082 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
16083 LDKChannelMonitor this_arg_conv;
16084 this_arg_conv.inner = (void*)(this_arg & (~1));
16085 this_arg_conv.is_owned = false;
16086 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
16087 uint32_tArray ret_arr = NULL;
16088 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16089 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16090 for (size_t h = 0; h < ret_var.datalen; h++) {
16091 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16092 *ret_conv_7_copy = ret_var.data[h];
16093 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
16094 ret_arr_ptr[h] = ret_conv_7_ref;
16097 FREE(ret_var.data);
16101 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
16102 LDKChannelMonitor this_arg_conv;
16103 this_arg_conv.inner = (void*)(this_arg & (~1));
16104 this_arg_conv.is_owned = false;
16105 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16106 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
16107 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
16108 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
16109 ptrArray ret_arr = NULL;
16110 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
16111 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
16112 for (size_t m = 0; m < ret_var.datalen; m++) {
16113 LDKTransaction ret_conv_12_var = ret_var.data[m];
16114 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16115 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
16116 Transaction_free(ret_conv_12_var);
16117 ret_arr_ptr[m] = ret_conv_12_arr;
16120 FREE(ret_var.data);
16124 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) {
16125 LDKChannelMonitor this_arg_conv;
16126 this_arg_conv.inner = (void*)(this_arg & (~1));
16127 this_arg_conv.is_owned = false;
16128 unsigned char header_arr[80];
16129 CHECK(*((uint32_t*)header) == 80);
16130 memcpy(header_arr, (uint8_t*)(header + 4), 80);
16131 unsigned char (*header_ref)[80] = &header_arr;
16132 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16133 txdata_constr.datalen = *((uint32_t*)txdata);
16134 if (txdata_constr.datalen > 0)
16135 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16137 txdata_constr.data = NULL;
16138 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
16139 for (size_t c = 0; c < txdata_constr.datalen; c++) {
16140 uint32_t txdata_conv_28 = txdata_vals[c];
16141 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
16142 CHECK_ACCESS(txdata_conv_28_ptr);
16143 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
16144 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
16145 txdata_constr.data[c] = txdata_conv_28_conv;
16147 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16148 CHECK_ACCESS(broadcaster_ptr);
16149 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
16150 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16151 CHECK_ACCESS(fee_estimator_ptr);
16152 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
16153 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16154 CHECK_ACCESS(logger_ptr);
16155 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16156 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);
16157 uint32_tArray ret_arr = NULL;
16158 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16159 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16160 for (size_t n = 0; n < ret_var.datalen; n++) {
16161 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16162 *ret_conv_39_conv = ret_var.data[n];
16163 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
16166 FREE(ret_var.data);
16170 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) {
16171 LDKChannelMonitor this_arg_conv;
16172 this_arg_conv.inner = (void*)(this_arg & (~1));
16173 this_arg_conv.is_owned = false;
16174 unsigned char header_arr[80];
16175 CHECK(*((uint32_t*)header) == 80);
16176 memcpy(header_arr, (uint8_t*)(header + 4), 80);
16177 unsigned char (*header_ref)[80] = &header_arr;
16178 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16179 CHECK_ACCESS(broadcaster_ptr);
16180 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
16181 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16182 CHECK_ACCESS(fee_estimator_ptr);
16183 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
16184 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16185 CHECK_ACCESS(logger_ptr);
16186 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16187 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16190 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) {
16191 LDKChannelMonitor this_arg_conv;
16192 this_arg_conv.inner = (void*)(this_arg & (~1));
16193 this_arg_conv.is_owned = false;
16194 unsigned char header_arr[80];
16195 CHECK(*((uint32_t*)header) == 80);
16196 memcpy(header_arr, (uint8_t*)(header + 4), 80);
16197 unsigned char (*header_ref)[80] = &header_arr;
16198 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16199 txdata_constr.datalen = *((uint32_t*)txdata);
16200 if (txdata_constr.datalen > 0)
16201 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16203 txdata_constr.data = NULL;
16204 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
16205 for (size_t c = 0; c < txdata_constr.datalen; c++) {
16206 uint32_t txdata_conv_28 = txdata_vals[c];
16207 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
16208 CHECK_ACCESS(txdata_conv_28_ptr);
16209 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
16210 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
16211 txdata_constr.data[c] = txdata_conv_28_conv;
16213 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16214 CHECK_ACCESS(broadcaster_ptr);
16215 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
16216 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16217 CHECK_ACCESS(fee_estimator_ptr);
16218 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
16219 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16220 CHECK_ACCESS(logger_ptr);
16221 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16222 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);
16223 uint32_tArray ret_arr = NULL;
16224 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16225 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16226 for (size_t n = 0; n < ret_var.datalen; n++) {
16227 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16228 *ret_conv_39_conv = ret_var.data[n];
16229 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
16232 FREE(ret_var.data);
16236 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) {
16237 LDKChannelMonitor this_arg_conv;
16238 this_arg_conv.inner = (void*)(this_arg & (~1));
16239 this_arg_conv.is_owned = false;
16240 unsigned char txid_arr[32];
16241 CHECK(*((uint32_t*)txid) == 32);
16242 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
16243 unsigned char (*txid_ref)[32] = &txid_arr;
16244 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16245 CHECK_ACCESS(broadcaster_ptr);
16246 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
16247 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16248 CHECK_ACCESS(fee_estimator_ptr);
16249 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
16250 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16251 CHECK_ACCESS(logger_ptr);
16252 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16253 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
16256 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) {
16257 LDKChannelMonitor this_arg_conv;
16258 this_arg_conv.inner = (void*)(this_arg & (~1));
16259 this_arg_conv.is_owned = false;
16260 unsigned char header_arr[80];
16261 CHECK(*((uint32_t*)header) == 80);
16262 memcpy(header_arr, (uint8_t*)(header + 4), 80);
16263 unsigned char (*header_ref)[80] = &header_arr;
16264 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
16265 CHECK_ACCESS(broadcaster_ptr);
16266 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
16267 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
16268 CHECK_ACCESS(fee_estimator_ptr);
16269 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
16270 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
16271 CHECK_ACCESS(logger_ptr);
16272 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
16273 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16274 uint32_tArray ret_arr = NULL;
16275 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16276 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16277 for (size_t n = 0; n < ret_var.datalen; n++) {
16278 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16279 *ret_conv_39_conv = ret_var.data[n];
16280 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
16283 FREE(ret_var.data);
16287 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
16288 LDKChannelMonitor this_arg_conv;
16289 this_arg_conv.inner = (void*)(this_arg & (~1));
16290 this_arg_conv.is_owned = false;
16291 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
16292 ptrArray ret_arr = NULL;
16293 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
16294 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
16295 for (size_t m = 0; m < ret_var.datalen; m++) {
16296 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16297 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
16298 ret_arr_ptr[m] = ret_conv_12_arr;
16301 FREE(ret_var.data);
16305 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
16306 LDKChannelMonitor this_arg_conv;
16307 this_arg_conv.inner = (void*)(this_arg & (~1));
16308 this_arg_conv.is_owned = false;
16309 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
16310 uint64_t ret_ref = 0;
16311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16313 ret_ref = (uint64_t)ret_var.inner;
16314 if (ret_var.is_owned) {
16320 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
16321 LDKChannelMonitor this_arg_conv;
16322 this_arg_conv.inner = (void*)(this_arg & (~1));
16323 this_arg_conv.is_owned = false;
16324 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
16325 uint32_tArray ret_arr = NULL;
16326 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16327 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16328 for (size_t j = 0; j < ret_var.datalen; j++) {
16329 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16330 *ret_conv_9_copy = ret_var.data[j];
16331 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16332 ret_arr_ptr[j] = ret_conv_9_ref;
16335 FREE(ret_var.data);
16339 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
16340 LDKu8slice ser_ref;
16341 ser_ref.datalen = *((uint32_t*)ser);
16342 ser_ref.data = (int8_t*)(ser + 4);
16343 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
16344 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
16345 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
16346 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16347 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
16348 return (uint64_t)ret_conv;
16351 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
16352 LDKOutPoint this_obj_conv;
16353 this_obj_conv.inner = (void*)(this_obj & (~1));
16354 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16355 OutPoint_free(this_obj_conv);
16358 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
16359 LDKOutPoint this_ptr_conv;
16360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16361 this_ptr_conv.is_owned = false;
16362 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16363 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
16367 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
16368 LDKOutPoint this_ptr_conv;
16369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16370 this_ptr_conv.is_owned = false;
16371 LDKThirtyTwoBytes val_ref;
16372 CHECK(*((uint32_t*)val) == 32);
16373 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16374 OutPoint_set_txid(&this_ptr_conv, val_ref);
16377 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
16378 LDKOutPoint this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
16385 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
16386 LDKOutPoint this_ptr_conv;
16387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16388 this_ptr_conv.is_owned = false;
16389 OutPoint_set_index(&this_ptr_conv, val);
16392 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
16393 LDKThirtyTwoBytes txid_arg_ref;
16394 CHECK(*((uint32_t*)txid_arg) == 32);
16395 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
16396 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
16397 uint64_t ret_ref = 0;
16398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16400 ret_ref = (uint64_t)ret_var.inner;
16401 if (ret_var.is_owned) {
16407 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
16408 LDKOutPoint orig_conv;
16409 orig_conv.inner = (void*)(orig & (~1));
16410 orig_conv.is_owned = false;
16411 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
16412 uint64_t ret_ref = 0;
16413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16415 ret_ref = (uint64_t)ret_var.inner;
16416 if (ret_var.is_owned) {
16422 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
16423 LDKOutPoint a_conv;
16424 a_conv.inner = (void*)(a & (~1));
16425 a_conv.is_owned = false;
16426 LDKOutPoint b_conv;
16427 b_conv.inner = (void*)(b & (~1));
16428 b_conv.is_owned = false;
16429 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
16433 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
16434 LDKOutPoint o_conv;
16435 o_conv.inner = (void*)(o & (~1));
16436 o_conv.is_owned = false;
16437 int64_t ret_val = OutPoint_hash(&o_conv);
16441 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
16442 LDKOutPoint this_arg_conv;
16443 this_arg_conv.inner = (void*)(this_arg & (~1));
16444 this_arg_conv.is_owned = false;
16445 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16446 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
16450 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
16451 LDKOutPoint obj_conv;
16452 obj_conv.inner = (void*)(obj & (~1));
16453 obj_conv.is_owned = false;
16454 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
16455 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16456 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16457 CVec_u8Z_free(ret_var);
16461 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
16462 LDKu8slice ser_ref;
16463 ser_ref.datalen = *((uint32_t*)ser);
16464 ser_ref.data = (int8_t*)(ser + 4);
16465 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16466 *ret_conv = OutPoint_read(ser_ref);
16467 return (uint64_t)ret_conv;
16470 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
16471 LDKDelayedPaymentOutputDescriptor this_obj_conv;
16472 this_obj_conv.inner = (void*)(this_obj & (~1));
16473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16474 DelayedPaymentOutputDescriptor_free(this_obj_conv);
16477 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
16478 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16480 this_ptr_conv.is_owned = false;
16481 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
16482 uint64_t ret_ref = 0;
16483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16485 ret_ref = (uint64_t)ret_var.inner;
16486 if (ret_var.is_owned) {
16492 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
16493 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16495 this_ptr_conv.is_owned = false;
16496 LDKOutPoint val_conv;
16497 val_conv.inner = (void*)(val & (~1));
16498 val_conv.is_owned = (val & 1) || (val == 0);
16499 val_conv = OutPoint_clone(&val_conv);
16500 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
16503 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
16504 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16506 this_ptr_conv.is_owned = false;
16507 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16508 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16512 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16513 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16515 this_ptr_conv.is_owned = false;
16516 LDKPublicKey val_ref;
16517 CHECK(*((uint32_t*)val) == 33);
16518 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16519 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
16522 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
16523 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16525 this_ptr_conv.is_owned = false;
16526 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
16530 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16531 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16533 this_ptr_conv.is_owned = false;
16534 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
16537 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
16538 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16540 this_ptr_conv.is_owned = false;
16541 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16542 CHECK_ACCESS(val_ptr);
16543 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
16544 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
16545 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
16548 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
16549 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16551 this_ptr_conv.is_owned = false;
16552 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16553 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
16557 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
16558 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16560 this_ptr_conv.is_owned = false;
16561 LDKPublicKey val_ref;
16562 CHECK(*((uint32_t*)val) == 33);
16563 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16564 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
16567 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
16568 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16570 this_ptr_conv.is_owned = false;
16571 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16572 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
16576 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
16577 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 LDKThirtyTwoBytes val_ref;
16581 CHECK(*((uint32_t*)val) == 32);
16582 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16583 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
16586 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
16587 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16589 this_ptr_conv.is_owned = false;
16590 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
16594 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
16595 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
16596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16597 this_ptr_conv.is_owned = false;
16598 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
16601 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) {
16602 LDKOutPoint outpoint_arg_conv;
16603 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16604 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16605 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16606 LDKPublicKey per_commitment_point_arg_ref;
16607 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
16608 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
16609 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
16610 CHECK_ACCESS(output_arg_ptr);
16611 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
16612 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
16613 LDKPublicKey revocation_pubkey_arg_ref;
16614 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
16615 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
16616 LDKThirtyTwoBytes channel_keys_id_arg_ref;
16617 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
16618 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
16619 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);
16620 uint64_t ret_ref = 0;
16621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16623 ret_ref = (uint64_t)ret_var.inner;
16624 if (ret_var.is_owned) {
16630 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
16631 LDKDelayedPaymentOutputDescriptor orig_conv;
16632 orig_conv.inner = (void*)(orig & (~1));
16633 orig_conv.is_owned = false;
16634 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
16635 uint64_t ret_ref = 0;
16636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16638 ret_ref = (uint64_t)ret_var.inner;
16639 if (ret_var.is_owned) {
16645 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
16646 LDKDelayedPaymentOutputDescriptor obj_conv;
16647 obj_conv.inner = (void*)(obj & (~1));
16648 obj_conv.is_owned = false;
16649 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
16650 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16651 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16652 CVec_u8Z_free(ret_var);
16656 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
16657 LDKu8slice ser_ref;
16658 ser_ref.datalen = *((uint32_t*)ser);
16659 ser_ref.data = (int8_t*)(ser + 4);
16660 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16661 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
16662 return (uint64_t)ret_conv;
16665 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
16666 LDKStaticPaymentOutputDescriptor this_obj_conv;
16667 this_obj_conv.inner = (void*)(this_obj & (~1));
16668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16669 StaticPaymentOutputDescriptor_free(this_obj_conv);
16672 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
16673 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
16677 uint64_t ret_ref = 0;
16678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16680 ret_ref = (uint64_t)ret_var.inner;
16681 if (ret_var.is_owned) {
16687 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
16688 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16690 this_ptr_conv.is_owned = false;
16691 LDKOutPoint val_conv;
16692 val_conv.inner = (void*)(val & (~1));
16693 val_conv.is_owned = (val & 1) || (val == 0);
16694 val_conv = OutPoint_clone(&val_conv);
16695 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
16698 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
16699 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16701 this_ptr_conv.is_owned = false;
16702 void* val_ptr = (void*)(((uint64_t)val) & ~1);
16703 CHECK_ACCESS(val_ptr);
16704 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
16705 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
16706 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
16709 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
16710 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16712 this_ptr_conv.is_owned = false;
16713 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16714 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
16718 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
16719 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16721 this_ptr_conv.is_owned = false;
16722 LDKThirtyTwoBytes val_ref;
16723 CHECK(*((uint32_t*)val) == 32);
16724 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16725 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
16728 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
16729 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16731 this_ptr_conv.is_owned = false;
16732 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
16736 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
16737 LDKStaticPaymentOutputDescriptor this_ptr_conv;
16738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16739 this_ptr_conv.is_owned = false;
16740 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
16743 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) {
16744 LDKOutPoint outpoint_arg_conv;
16745 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16746 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16747 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16748 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
16749 CHECK_ACCESS(output_arg_ptr);
16750 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
16751 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
16752 LDKThirtyTwoBytes channel_keys_id_arg_ref;
16753 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
16754 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
16755 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
16756 uint64_t ret_ref = 0;
16757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16759 ret_ref = (uint64_t)ret_var.inner;
16760 if (ret_var.is_owned) {
16766 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
16767 LDKStaticPaymentOutputDescriptor orig_conv;
16768 orig_conv.inner = (void*)(orig & (~1));
16769 orig_conv.is_owned = false;
16770 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
16771 uint64_t ret_ref = 0;
16772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16774 ret_ref = (uint64_t)ret_var.inner;
16775 if (ret_var.is_owned) {
16781 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
16782 LDKStaticPaymentOutputDescriptor obj_conv;
16783 obj_conv.inner = (void*)(obj & (~1));
16784 obj_conv.is_owned = false;
16785 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
16786 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16787 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16788 CVec_u8Z_free(ret_var);
16792 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
16793 LDKu8slice ser_ref;
16794 ser_ref.datalen = *((uint32_t*)ser);
16795 ser_ref.data = (int8_t*)(ser + 4);
16796 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16797 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
16798 return (uint64_t)ret_conv;
16801 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
16802 if ((this_ptr & 1) != 0) return;
16803 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16804 CHECK_ACCESS(this_ptr_ptr);
16805 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
16806 FREE((void*)this_ptr);
16807 SpendableOutputDescriptor_free(this_ptr_conv);
16810 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
16811 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
16812 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16813 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
16814 uint64_t ret_ref = (uint64_t)ret_copy;
16818 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
16819 LDKOutPoint outpoint_conv;
16820 outpoint_conv.inner = (void*)(outpoint & (~1));
16821 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
16822 outpoint_conv = OutPoint_clone(&outpoint_conv);
16823 void* output_ptr = (void*)(((uint64_t)output) & ~1);
16824 CHECK_ACCESS(output_ptr);
16825 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
16826 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
16827 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16828 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
16829 uint64_t ret_ref = (uint64_t)ret_copy;
16833 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
16834 LDKDelayedPaymentOutputDescriptor a_conv;
16835 a_conv.inner = (void*)(a & (~1));
16836 a_conv.is_owned = (a & 1) || (a == 0);
16837 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
16838 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16839 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
16840 uint64_t ret_ref = (uint64_t)ret_copy;
16844 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
16845 LDKStaticPaymentOutputDescriptor a_conv;
16846 a_conv.inner = (void*)(a & (~1));
16847 a_conv.is_owned = (a & 1) || (a == 0);
16848 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
16849 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16850 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
16851 uint64_t ret_ref = (uint64_t)ret_copy;
16855 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
16856 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
16857 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
16858 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16859 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16860 CVec_u8Z_free(ret_var);
16864 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
16865 LDKu8slice ser_ref;
16866 ser_ref.datalen = *((uint32_t*)ser);
16867 ser_ref.data = (int8_t*)(ser + 4);
16868 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16869 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
16870 return (uint64_t)ret_conv;
16873 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
16874 if ((this_ptr & 1) != 0) return;
16875 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16876 CHECK_ACCESS(this_ptr_ptr);
16877 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
16878 FREE((void*)this_ptr);
16879 BaseSign_free(this_ptr_conv);
16882 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
16883 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
16884 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
16885 LDKSign* orig_conv = (LDKSign*)orig_ptr;
16886 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
16887 *ret_ret = Sign_clone(orig_conv);
16888 return (uint64_t)ret_ret;
16891 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
16892 if ((this_ptr & 1) != 0) return;
16893 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16894 CHECK_ACCESS(this_ptr_ptr);
16895 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
16896 FREE((void*)this_ptr);
16897 Sign_free(this_ptr_conv);
16900 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
16901 if ((this_ptr & 1) != 0) return;
16902 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16903 CHECK_ACCESS(this_ptr_ptr);
16904 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
16905 FREE((void*)this_ptr);
16906 KeysInterface_free(this_ptr_conv);
16909 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
16910 LDKInMemorySigner this_obj_conv;
16911 this_obj_conv.inner = (void*)(this_obj & (~1));
16912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16913 InMemorySigner_free(this_obj_conv);
16916 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
16917 LDKInMemorySigner this_ptr_conv;
16918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16919 this_ptr_conv.is_owned = false;
16920 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16921 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
16925 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
16926 LDKInMemorySigner this_ptr_conv;
16927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16928 this_ptr_conv.is_owned = false;
16929 LDKSecretKey val_ref;
16930 CHECK(*((uint32_t*)val) == 32);
16931 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
16932 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
16935 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
16936 LDKInMemorySigner this_ptr_conv;
16937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16938 this_ptr_conv.is_owned = false;
16939 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16940 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
16944 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
16945 LDKInMemorySigner this_ptr_conv;
16946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16947 this_ptr_conv.is_owned = false;
16948 LDKSecretKey val_ref;
16949 CHECK(*((uint32_t*)val) == 32);
16950 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
16951 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
16954 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
16955 LDKInMemorySigner this_ptr_conv;
16956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16957 this_ptr_conv.is_owned = false;
16958 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16959 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
16963 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
16964 LDKInMemorySigner this_ptr_conv;
16965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16966 this_ptr_conv.is_owned = false;
16967 LDKSecretKey val_ref;
16968 CHECK(*((uint32_t*)val) == 32);
16969 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
16970 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
16973 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
16974 LDKInMemorySigner this_ptr_conv;
16975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16976 this_ptr_conv.is_owned = false;
16977 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16978 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
16982 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
16983 LDKInMemorySigner this_ptr_conv;
16984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16985 this_ptr_conv.is_owned = false;
16986 LDKSecretKey val_ref;
16987 CHECK(*((uint32_t*)val) == 32);
16988 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
16989 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
16992 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
16993 LDKInMemorySigner this_ptr_conv;
16994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16995 this_ptr_conv.is_owned = false;
16996 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16997 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
17001 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
17002 LDKInMemorySigner this_ptr_conv;
17003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17004 this_ptr_conv.is_owned = false;
17005 LDKSecretKey val_ref;
17006 CHECK(*((uint32_t*)val) == 32);
17007 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
17008 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
17011 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
17012 LDKInMemorySigner this_ptr_conv;
17013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17014 this_ptr_conv.is_owned = false;
17015 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17016 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
17020 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
17021 LDKInMemorySigner this_ptr_conv;
17022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17023 this_ptr_conv.is_owned = false;
17024 LDKThirtyTwoBytes val_ref;
17025 CHECK(*((uint32_t*)val) == 32);
17026 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17027 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
17030 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
17031 LDKInMemorySigner orig_conv;
17032 orig_conv.inner = (void*)(orig & (~1));
17033 orig_conv.is_owned = false;
17034 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
17035 uint64_t ret_ref = 0;
17036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17038 ret_ref = (uint64_t)ret_var.inner;
17039 if (ret_var.is_owned) {
17045 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) {
17046 LDKSecretKey funding_key_ref;
17047 CHECK(*((uint32_t*)funding_key) == 32);
17048 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
17049 LDKSecretKey revocation_base_key_ref;
17050 CHECK(*((uint32_t*)revocation_base_key) == 32);
17051 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
17052 LDKSecretKey payment_key_ref;
17053 CHECK(*((uint32_t*)payment_key) == 32);
17054 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
17055 LDKSecretKey delayed_payment_base_key_ref;
17056 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
17057 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
17058 LDKSecretKey htlc_base_key_ref;
17059 CHECK(*((uint32_t*)htlc_base_key) == 32);
17060 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
17061 LDKThirtyTwoBytes commitment_seed_ref;
17062 CHECK(*((uint32_t*)commitment_seed) == 32);
17063 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
17064 LDKThirtyTwoBytes channel_keys_id_ref;
17065 CHECK(*((uint32_t*)channel_keys_id) == 32);
17066 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
17067 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);
17068 uint64_t ret_ref = 0;
17069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17071 ret_ref = (uint64_t)ret_var.inner;
17072 if (ret_var.is_owned) {
17078 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
17079 LDKInMemorySigner this_arg_conv;
17080 this_arg_conv.inner = (void*)(this_arg & (~1));
17081 this_arg_conv.is_owned = false;
17082 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
17083 uint64_t ret_ref = 0;
17084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17086 ret_ref = (uint64_t)ret_var.inner;
17087 if (ret_var.is_owned) {
17093 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
17094 LDKInMemorySigner this_arg_conv;
17095 this_arg_conv.inner = (void*)(this_arg & (~1));
17096 this_arg_conv.is_owned = false;
17097 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
17101 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
17102 LDKInMemorySigner this_arg_conv;
17103 this_arg_conv.inner = (void*)(this_arg & (~1));
17104 this_arg_conv.is_owned = false;
17105 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
17109 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
17110 LDKInMemorySigner this_arg_conv;
17111 this_arg_conv.inner = (void*)(this_arg & (~1));
17112 this_arg_conv.is_owned = false;
17113 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
17117 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
17118 LDKInMemorySigner this_arg_conv;
17119 this_arg_conv.inner = (void*)(this_arg & (~1));
17120 this_arg_conv.is_owned = false;
17121 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
17122 uint64_t ret_ref = 0;
17123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17125 ret_ref = (uint64_t)ret_var.inner;
17126 if (ret_var.is_owned) {
17132 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
17133 LDKInMemorySigner this_arg_conv;
17134 this_arg_conv.inner = (void*)(this_arg & (~1));
17135 this_arg_conv.is_owned = false;
17136 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
17137 uint64_t ret_ref = 0;
17138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17140 ret_ref = (uint64_t)ret_var.inner;
17141 if (ret_var.is_owned) {
17147 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) {
17148 LDKInMemorySigner this_arg_conv;
17149 this_arg_conv.inner = (void*)(this_arg & (~1));
17150 this_arg_conv.is_owned = false;
17151 LDKTransaction spend_tx_ref;
17152 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
17153 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17154 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
17155 spend_tx_ref.data_is_owned = true;
17156 LDKStaticPaymentOutputDescriptor descriptor_conv;
17157 descriptor_conv.inner = (void*)(descriptor & (~1));
17158 descriptor_conv.is_owned = false;
17159 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17160 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17161 return (uint64_t)ret_conv;
17164 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) {
17165 LDKInMemorySigner this_arg_conv;
17166 this_arg_conv.inner = (void*)(this_arg & (~1));
17167 this_arg_conv.is_owned = false;
17168 LDKTransaction spend_tx_ref;
17169 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
17170 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17171 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
17172 spend_tx_ref.data_is_owned = true;
17173 LDKDelayedPaymentOutputDescriptor descriptor_conv;
17174 descriptor_conv.inner = (void*)(descriptor & (~1));
17175 descriptor_conv.is_owned = false;
17176 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17177 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17178 return (uint64_t)ret_conv;
17181 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
17182 LDKInMemorySigner this_arg_conv;
17183 this_arg_conv.inner = (void*)(this_arg & (~1));
17184 this_arg_conv.is_owned = false;
17185 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
17186 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
17187 return (uint64_t)ret_ret;
17190 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
17191 LDKInMemorySigner this_arg_conv;
17192 this_arg_conv.inner = (void*)(this_arg & (~1));
17193 this_arg_conv.is_owned = false;
17194 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
17195 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
17196 return (uint64_t)ret_ret;
17199 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
17200 LDKInMemorySigner obj_conv;
17201 obj_conv.inner = (void*)(obj & (~1));
17202 obj_conv.is_owned = false;
17203 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
17204 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17205 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17206 CVec_u8Z_free(ret_var);
17210 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
17211 LDKu8slice ser_ref;
17212 ser_ref.datalen = *((uint32_t*)ser);
17213 ser_ref.data = (int8_t*)(ser + 4);
17214 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17215 *ret_conv = InMemorySigner_read(ser_ref);
17216 return (uint64_t)ret_conv;
17219 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
17220 LDKKeysManager this_obj_conv;
17221 this_obj_conv.inner = (void*)(this_obj & (~1));
17222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17223 KeysManager_free(this_obj_conv);
17226 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
17227 unsigned char seed_arr[32];
17228 CHECK(*((uint32_t*)seed) == 32);
17229 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
17230 unsigned char (*seed_ref)[32] = &seed_arr;
17231 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
17232 uint64_t ret_ref = 0;
17233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17235 ret_ref = (uint64_t)ret_var.inner;
17236 if (ret_var.is_owned) {
17242 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
17243 LDKKeysManager this_arg_conv;
17244 this_arg_conv.inner = (void*)(this_arg & (~1));
17245 this_arg_conv.is_owned = false;
17246 unsigned char params_arr[32];
17247 CHECK(*((uint32_t*)params) == 32);
17248 memcpy(params_arr, (uint8_t*)(params + 4), 32);
17249 unsigned char (*params_ref)[32] = ¶ms_arr;
17250 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
17251 uint64_t ret_ref = 0;
17252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17254 ret_ref = (uint64_t)ret_var.inner;
17255 if (ret_var.is_owned) {
17261 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) {
17262 LDKKeysManager this_arg_conv;
17263 this_arg_conv.inner = (void*)(this_arg & (~1));
17264 this_arg_conv.is_owned = false;
17265 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17266 descriptors_constr.datalen = *((uint32_t*)descriptors);
17267 if (descriptors_constr.datalen > 0)
17268 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17270 descriptors_constr.data = NULL;
17271 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
17272 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17273 uint32_t descriptors_conv_27 = descriptors_vals[b];
17274 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
17275 CHECK_ACCESS(descriptors_conv_27_ptr);
17276 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
17277 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
17278 descriptors_constr.data[b] = descriptors_conv_27_conv;
17280 LDKCVec_TxOutZ outputs_constr;
17281 outputs_constr.datalen = *((uint32_t*)outputs);
17282 if (outputs_constr.datalen > 0)
17283 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17285 outputs_constr.data = NULL;
17286 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
17287 for (size_t h = 0; h < outputs_constr.datalen; h++) {
17288 uint32_t outputs_conv_7 = outputs_vals[h];
17289 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
17290 CHECK_ACCESS(outputs_conv_7_ptr);
17291 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
17292 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
17293 outputs_constr.data[h] = outputs_conv_7_conv;
17295 LDKCVec_u8Z change_destination_script_ref;
17296 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
17297 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17298 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
17299 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17300 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
17301 return (uint64_t)ret_conv;
17304 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
17305 LDKKeysManager this_arg_conv;
17306 this_arg_conv.inner = (void*)(this_arg & (~1));
17307 this_arg_conv.is_owned = false;
17308 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
17309 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
17310 return (uint64_t)ret_ret;
17313 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
17314 LDKChannelManager this_obj_conv;
17315 this_obj_conv.inner = (void*)(this_obj & (~1));
17316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17317 ChannelManager_free(this_obj_conv);
17320 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
17321 LDKChainParameters this_obj_conv;
17322 this_obj_conv.inner = (void*)(this_obj & (~1));
17323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17324 ChainParameters_free(this_obj_conv);
17327 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
17328 LDKChainParameters this_ptr_conv;
17329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17330 this_ptr_conv.is_owned = false;
17331 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
17335 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
17336 LDKChainParameters this_ptr_conv;
17337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17338 this_ptr_conv.is_owned = false;
17339 LDKNetwork val_conv = LDKNetwork_from_js(val);
17340 ChainParameters_set_network(&this_ptr_conv, val_conv);
17343 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
17344 LDKChainParameters this_ptr_conv;
17345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17346 this_ptr_conv.is_owned = false;
17347 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
17348 uint64_t ret_ref = 0;
17349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17351 ret_ref = (uint64_t)ret_var.inner;
17352 if (ret_var.is_owned) {
17358 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
17359 LDKChainParameters this_ptr_conv;
17360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17361 this_ptr_conv.is_owned = false;
17362 LDKBestBlock val_conv;
17363 val_conv.inner = (void*)(val & (~1));
17364 val_conv.is_owned = (val & 1) || (val == 0);
17365 val_conv = BestBlock_clone(&val_conv);
17366 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
17369 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
17370 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
17371 LDKBestBlock best_block_arg_conv;
17372 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
17373 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
17374 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
17375 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
17376 uint64_t ret_ref = 0;
17377 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17378 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17379 ret_ref = (uint64_t)ret_var.inner;
17380 if (ret_var.is_owned) {
17386 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
17387 LDKChainParameters orig_conv;
17388 orig_conv.inner = (void*)(orig & (~1));
17389 orig_conv.is_owned = false;
17390 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
17391 uint64_t ret_ref = 0;
17392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17394 ret_ref = (uint64_t)ret_var.inner;
17395 if (ret_var.is_owned) {
17401 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
17402 LDKCounterpartyForwardingInfo this_obj_conv;
17403 this_obj_conv.inner = (void*)(this_obj & (~1));
17404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17405 CounterpartyForwardingInfo_free(this_obj_conv);
17408 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
17409 LDKCounterpartyForwardingInfo this_ptr_conv;
17410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17411 this_ptr_conv.is_owned = false;
17412 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
17416 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
17417 LDKCounterpartyForwardingInfo this_ptr_conv;
17418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17419 this_ptr_conv.is_owned = false;
17420 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
17423 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
17424 LDKCounterpartyForwardingInfo this_ptr_conv;
17425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17426 this_ptr_conv.is_owned = false;
17427 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
17431 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17432 LDKCounterpartyForwardingInfo this_ptr_conv;
17433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17434 this_ptr_conv.is_owned = false;
17435 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
17438 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
17439 LDKCounterpartyForwardingInfo this_ptr_conv;
17440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17441 this_ptr_conv.is_owned = false;
17442 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
17446 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17447 LDKCounterpartyForwardingInfo this_ptr_conv;
17448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17449 this_ptr_conv.is_owned = false;
17450 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
17453 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) {
17454 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
17455 uint64_t ret_ref = 0;
17456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17458 ret_ref = (uint64_t)ret_var.inner;
17459 if (ret_var.is_owned) {
17465 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
17466 LDKCounterpartyForwardingInfo orig_conv;
17467 orig_conv.inner = (void*)(orig & (~1));
17468 orig_conv.is_owned = false;
17469 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
17470 uint64_t ret_ref = 0;
17471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17473 ret_ref = (uint64_t)ret_var.inner;
17474 if (ret_var.is_owned) {
17480 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
17481 LDKChannelCounterparty this_obj_conv;
17482 this_obj_conv.inner = (void*)(this_obj & (~1));
17483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17484 ChannelCounterparty_free(this_obj_conv);
17487 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
17488 LDKChannelCounterparty this_ptr_conv;
17489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17490 this_ptr_conv.is_owned = false;
17491 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17492 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
17496 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
17497 LDKChannelCounterparty this_ptr_conv;
17498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17499 this_ptr_conv.is_owned = false;
17500 LDKPublicKey val_ref;
17501 CHECK(*((uint32_t*)val) == 33);
17502 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17503 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
17506 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
17507 LDKChannelCounterparty this_ptr_conv;
17508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17509 this_ptr_conv.is_owned = false;
17510 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
17511 uint64_t ret_ref = 0;
17512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17514 ret_ref = (uint64_t)ret_var.inner;
17515 if (ret_var.is_owned) {
17521 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
17522 LDKChannelCounterparty this_ptr_conv;
17523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17524 this_ptr_conv.is_owned = false;
17525 LDKInitFeatures val_conv;
17526 val_conv.inner = (void*)(val & (~1));
17527 val_conv.is_owned = (val & 1) || (val == 0);
17528 val_conv = InitFeatures_clone(&val_conv);
17529 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
17532 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
17533 LDKChannelCounterparty this_ptr_conv;
17534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17535 this_ptr_conv.is_owned = false;
17536 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
17540 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
17541 LDKChannelCounterparty this_ptr_conv;
17542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17543 this_ptr_conv.is_owned = false;
17544 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
17547 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
17548 LDKChannelCounterparty this_ptr_conv;
17549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17550 this_ptr_conv.is_owned = false;
17551 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
17552 uint64_t ret_ref = 0;
17553 if ((uint64_t)ret_var.inner > 4096) {
17554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17556 ret_ref = (uint64_t)ret_var.inner;
17557 if (ret_var.is_owned) {
17564 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
17565 LDKChannelCounterparty this_ptr_conv;
17566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17567 this_ptr_conv.is_owned = false;
17568 LDKCounterpartyForwardingInfo val_conv;
17569 val_conv.inner = (void*)(val & (~1));
17570 val_conv.is_owned = (val & 1) || (val == 0);
17571 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
17572 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
17575 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) {
17576 LDKPublicKey node_id_arg_ref;
17577 CHECK(*((uint32_t*)node_id_arg) == 33);
17578 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
17579 LDKInitFeatures features_arg_conv;
17580 features_arg_conv.inner = (void*)(features_arg & (~1));
17581 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17582 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17583 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
17584 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
17585 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
17586 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
17587 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
17588 uint64_t ret_ref = 0;
17589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17591 ret_ref = (uint64_t)ret_var.inner;
17592 if (ret_var.is_owned) {
17598 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
17599 LDKChannelCounterparty orig_conv;
17600 orig_conv.inner = (void*)(orig & (~1));
17601 orig_conv.is_owned = false;
17602 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
17603 uint64_t ret_ref = 0;
17604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17606 ret_ref = (uint64_t)ret_var.inner;
17607 if (ret_var.is_owned) {
17613 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
17614 LDKChannelDetails this_obj_conv;
17615 this_obj_conv.inner = (void*)(this_obj & (~1));
17616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17617 ChannelDetails_free(this_obj_conv);
17620 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
17621 LDKChannelDetails this_ptr_conv;
17622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17623 this_ptr_conv.is_owned = false;
17624 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17625 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
17629 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17630 LDKChannelDetails this_ptr_conv;
17631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17632 this_ptr_conv.is_owned = false;
17633 LDKThirtyTwoBytes val_ref;
17634 CHECK(*((uint32_t*)val) == 32);
17635 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17636 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
17639 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
17640 LDKChannelDetails this_ptr_conv;
17641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17642 this_ptr_conv.is_owned = false;
17643 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
17644 uint64_t ret_ref = 0;
17645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17647 ret_ref = (uint64_t)ret_var.inner;
17648 if (ret_var.is_owned) {
17654 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
17655 LDKChannelDetails this_ptr_conv;
17656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17657 this_ptr_conv.is_owned = false;
17658 LDKChannelCounterparty val_conv;
17659 val_conv.inner = (void*)(val & (~1));
17660 val_conv.is_owned = (val & 1) || (val == 0);
17661 val_conv = ChannelCounterparty_clone(&val_conv);
17662 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
17665 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
17666 LDKChannelDetails this_ptr_conv;
17667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17668 this_ptr_conv.is_owned = false;
17669 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
17670 uint64_t ret_ref = 0;
17671 if ((uint64_t)ret_var.inner > 4096) {
17672 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17673 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17674 ret_ref = (uint64_t)ret_var.inner;
17675 if (ret_var.is_owned) {
17682 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
17683 LDKChannelDetails this_ptr_conv;
17684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17685 this_ptr_conv.is_owned = false;
17686 LDKOutPoint val_conv;
17687 val_conv.inner = (void*)(val & (~1));
17688 val_conv.is_owned = (val & 1) || (val == 0);
17689 val_conv = OutPoint_clone(&val_conv);
17690 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
17693 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
17694 LDKChannelDetails this_ptr_conv;
17695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17696 this_ptr_conv.is_owned = false;
17697 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17698 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
17699 uint64_t ret_ref = (uint64_t)ret_copy;
17703 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
17704 LDKChannelDetails this_ptr_conv;
17705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17706 this_ptr_conv.is_owned = false;
17707 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17708 CHECK_ACCESS(val_ptr);
17709 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
17710 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
17711 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
17714 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
17715 LDKChannelDetails this_ptr_conv;
17716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17717 this_ptr_conv.is_owned = false;
17718 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
17722 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
17723 LDKChannelDetails this_ptr_conv;
17724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17725 this_ptr_conv.is_owned = false;
17726 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
17729 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
17730 LDKChannelDetails this_ptr_conv;
17731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17732 this_ptr_conv.is_owned = false;
17733 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17734 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
17735 uint64_t ret_ref = (uint64_t)ret_copy;
17739 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
17740 LDKChannelDetails this_ptr_conv;
17741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17742 this_ptr_conv.is_owned = false;
17743 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17744 CHECK_ACCESS(val_ptr);
17745 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
17746 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
17747 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
17750 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
17751 LDKChannelDetails this_ptr_conv;
17752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17753 this_ptr_conv.is_owned = false;
17754 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
17758 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
17759 LDKChannelDetails this_ptr_conv;
17760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17761 this_ptr_conv.is_owned = false;
17762 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
17765 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
17766 LDKChannelDetails this_ptr_conv;
17767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17768 this_ptr_conv.is_owned = false;
17769 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
17773 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
17774 LDKChannelDetails this_ptr_conv;
17775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17776 this_ptr_conv.is_owned = false;
17777 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
17780 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
17781 LDKChannelDetails this_ptr_conv;
17782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17783 this_ptr_conv.is_owned = false;
17784 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
17788 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
17789 LDKChannelDetails this_ptr_conv;
17790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17791 this_ptr_conv.is_owned = false;
17792 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
17795 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
17796 LDKChannelDetails this_ptr_conv;
17797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17798 this_ptr_conv.is_owned = false;
17799 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17800 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
17801 uint64_t ret_ref = (uint64_t)ret_copy;
17805 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
17806 LDKChannelDetails this_ptr_conv;
17807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17808 this_ptr_conv.is_owned = false;
17809 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17810 CHECK_ACCESS(val_ptr);
17811 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
17812 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
17813 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
17816 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
17817 LDKChannelDetails this_ptr_conv;
17818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17819 this_ptr_conv.is_owned = false;
17820 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17821 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
17822 uint64_t ret_ref = (uint64_t)ret_copy;
17826 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
17827 LDKChannelDetails this_ptr_conv;
17828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17829 this_ptr_conv.is_owned = false;
17830 void* val_ptr = (void*)(((uint64_t)val) & ~1);
17831 CHECK_ACCESS(val_ptr);
17832 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
17833 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
17834 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
17837 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
17838 LDKChannelDetails this_ptr_conv;
17839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17840 this_ptr_conv.is_owned = false;
17841 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
17845 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
17846 LDKChannelDetails this_ptr_conv;
17847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17848 this_ptr_conv.is_owned = false;
17849 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
17852 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
17853 LDKChannelDetails this_ptr_conv;
17854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17855 this_ptr_conv.is_owned = false;
17856 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
17860 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
17861 LDKChannelDetails this_ptr_conv;
17862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17863 this_ptr_conv.is_owned = false;
17864 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
17867 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
17868 LDKChannelDetails this_ptr_conv;
17869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17870 this_ptr_conv.is_owned = false;
17871 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
17875 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
17876 LDKChannelDetails this_ptr_conv;
17877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17878 this_ptr_conv.is_owned = false;
17879 ChannelDetails_set_is_usable(&this_ptr_conv, val);
17882 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
17883 LDKChannelDetails this_ptr_conv;
17884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17885 this_ptr_conv.is_owned = false;
17886 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
17890 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
17891 LDKChannelDetails this_ptr_conv;
17892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17893 this_ptr_conv.is_owned = false;
17894 ChannelDetails_set_is_public(&this_ptr_conv, val);
17897 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
17898 LDKThirtyTwoBytes channel_id_arg_ref;
17899 CHECK(*((uint32_t*)channel_id_arg) == 32);
17900 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17901 LDKChannelCounterparty counterparty_arg_conv;
17902 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
17903 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
17904 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
17905 LDKOutPoint funding_txo_arg_conv;
17906 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
17907 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
17908 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
17909 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
17910 CHECK_ACCESS(short_channel_id_arg_ptr);
17911 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
17912 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
17913 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
17914 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
17915 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
17916 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
17917 CHECK_ACCESS(confirmations_required_arg_ptr);
17918 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
17919 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
17920 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
17921 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
17922 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
17923 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
17924 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
17925 uint64_t ret_ref = 0;
17926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17928 ret_ref = (uint64_t)ret_var.inner;
17929 if (ret_var.is_owned) {
17935 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
17936 LDKChannelDetails orig_conv;
17937 orig_conv.inner = (void*)(orig & (~1));
17938 orig_conv.is_owned = false;
17939 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
17940 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
17944 if (ret_var.is_owned) {
17950 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
17951 if ((this_ptr & 1) != 0) return;
17952 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17953 CHECK_ACCESS(this_ptr_ptr);
17954 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
17955 FREE((void*)this_ptr);
17956 PaymentSendFailure_free(this_ptr_conv);
17959 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
17960 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
17961 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17962 *ret_copy = PaymentSendFailure_clone(orig_conv);
17963 uint64_t ret_ref = (uint64_t)ret_copy;
17967 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
17968 void* a_ptr = (void*)(((uint64_t)a) & ~1);
17969 CHECK_ACCESS(a_ptr);
17970 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
17971 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
17972 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17973 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
17974 uint64_t ret_ref = (uint64_t)ret_copy;
17978 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
17979 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
17980 a_constr.datalen = *((uint32_t*)a);
17981 if (a_constr.datalen > 0)
17982 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17984 a_constr.data = NULL;
17985 uint32_t* a_vals = (uint32_t*)(a + 4);
17986 for (size_t w = 0; w < a_constr.datalen; w++) {
17987 uint32_t a_conv_22 = a_vals[w];
17988 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
17989 CHECK_ACCESS(a_conv_22_ptr);
17990 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
17991 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
17992 a_constr.data[w] = a_conv_22_conv;
17994 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17995 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
17996 uint64_t ret_ref = (uint64_t)ret_copy;
18000 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
18001 LDKCVec_APIErrorZ a_constr;
18002 a_constr.datalen = *((uint32_t*)a);
18003 if (a_constr.datalen > 0)
18004 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18006 a_constr.data = NULL;
18007 uint32_t* a_vals = (uint32_t*)(a + 4);
18008 for (size_t k = 0; k < a_constr.datalen; k++) {
18009 uint32_t a_conv_10 = a_vals[k];
18010 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
18011 CHECK_ACCESS(a_conv_10_ptr);
18012 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
18013 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
18014 a_constr.data[k] = a_conv_10_conv;
18016 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18017 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
18018 uint64_t ret_ref = (uint64_t)ret_copy;
18022 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
18023 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
18024 results_constr.datalen = *((uint32_t*)results);
18025 if (results_constr.datalen > 0)
18026 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18028 results_constr.data = NULL;
18029 uint32_t* results_vals = (uint32_t*)(results + 4);
18030 for (size_t w = 0; w < results_constr.datalen; w++) {
18031 uint32_t results_conv_22 = results_vals[w];
18032 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
18033 CHECK_ACCESS(results_conv_22_ptr);
18034 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
18035 results_constr.data[w] = results_conv_22_conv;
18037 LDKRouteParameters failed_paths_retry_conv;
18038 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
18039 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
18040 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
18041 LDKThirtyTwoBytes payment_id_ref;
18042 CHECK(*((uint32_t*)payment_id) == 32);
18043 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
18044 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18045 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
18046 uint64_t ret_ref = (uint64_t)ret_copy;
18050 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) {
18051 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
18052 CHECK_ACCESS(fee_est_ptr);
18053 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
18054 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
18055 CHECK_ACCESS(chain_monitor_ptr);
18056 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
18057 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
18058 CHECK_ACCESS(tx_broadcaster_ptr);
18059 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
18060 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18061 CHECK_ACCESS(logger_ptr);
18062 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18063 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
18064 CHECK_ACCESS(keys_manager_ptr);
18065 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
18066 LDKUserConfig config_conv;
18067 config_conv.inner = (void*)(config & (~1));
18068 config_conv.is_owned = (config & 1) || (config == 0);
18069 config_conv = UserConfig_clone(&config_conv);
18070 LDKChainParameters params_conv;
18071 params_conv.inner = (void*)(params & (~1));
18072 params_conv.is_owned = (params & 1) || (params == 0);
18073 params_conv = ChainParameters_clone(¶ms_conv);
18074 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
18075 uint64_t ret_ref = 0;
18076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18078 ret_ref = (uint64_t)ret_var.inner;
18079 if (ret_var.is_owned) {
18085 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
18086 LDKChannelManager this_arg_conv;
18087 this_arg_conv.inner = (void*)(this_arg & (~1));
18088 this_arg_conv.is_owned = false;
18089 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
18090 uint64_t ret_ref = 0;
18091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18093 ret_ref = (uint64_t)ret_var.inner;
18094 if (ret_var.is_owned) {
18100 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
18101 LDKChannelManager this_arg_conv;
18102 this_arg_conv.inner = (void*)(this_arg & (~1));
18103 this_arg_conv.is_owned = false;
18104 LDKPublicKey their_network_key_ref;
18105 CHECK(*((uint32_t*)their_network_key) == 33);
18106 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
18107 LDKUserConfig override_config_conv;
18108 override_config_conv.inner = (void*)(override_config & (~1));
18109 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
18110 override_config_conv = UserConfig_clone(&override_config_conv);
18111 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18112 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
18113 return (uint64_t)ret_conv;
18116 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
18117 LDKChannelManager this_arg_conv;
18118 this_arg_conv.inner = (void*)(this_arg & (~1));
18119 this_arg_conv.is_owned = false;
18120 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
18121 uint32_tArray ret_arr = NULL;
18122 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18123 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18124 for (size_t q = 0; q < ret_var.datalen; q++) {
18125 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18126 uint64_t ret_conv_16_ref = 0;
18127 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18128 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18129 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18130 if (ret_conv_16_var.is_owned) {
18131 ret_conv_16_ref |= 1;
18133 ret_arr_ptr[q] = ret_conv_16_ref;
18136 FREE(ret_var.data);
18140 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
18141 LDKChannelManager this_arg_conv;
18142 this_arg_conv.inner = (void*)(this_arg & (~1));
18143 this_arg_conv.is_owned = false;
18144 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
18145 uint32_tArray ret_arr = NULL;
18146 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
18147 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18148 for (size_t q = 0; q < ret_var.datalen; q++) {
18149 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18150 uint64_t ret_conv_16_ref = 0;
18151 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18152 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18153 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18154 if (ret_conv_16_var.is_owned) {
18155 ret_conv_16_ref |= 1;
18157 ret_arr_ptr[q] = ret_conv_16_ref;
18160 FREE(ret_var.data);
18164 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
18165 LDKChannelManager this_arg_conv;
18166 this_arg_conv.inner = (void*)(this_arg & (~1));
18167 this_arg_conv.is_owned = false;
18168 unsigned char channel_id_arr[32];
18169 CHECK(*((uint32_t*)channel_id) == 32);
18170 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
18171 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18172 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18173 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
18174 return (uint64_t)ret_conv;
18177 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) {
18178 LDKChannelManager this_arg_conv;
18179 this_arg_conv.inner = (void*)(this_arg & (~1));
18180 this_arg_conv.is_owned = false;
18181 unsigned char channel_id_arr[32];
18182 CHECK(*((uint32_t*)channel_id) == 32);
18183 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
18184 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18185 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18186 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
18187 return (uint64_t)ret_conv;
18190 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
18191 LDKChannelManager this_arg_conv;
18192 this_arg_conv.inner = (void*)(this_arg & (~1));
18193 this_arg_conv.is_owned = false;
18194 unsigned char channel_id_arr[32];
18195 CHECK(*((uint32_t*)channel_id) == 32);
18196 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
18197 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18198 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18199 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
18200 return (uint64_t)ret_conv;
18203 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
18204 LDKChannelManager this_arg_conv;
18205 this_arg_conv.inner = (void*)(this_arg & (~1));
18206 this_arg_conv.is_owned = false;
18207 ChannelManager_force_close_all_channels(&this_arg_conv);
18210 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
18211 LDKChannelManager this_arg_conv;
18212 this_arg_conv.inner = (void*)(this_arg & (~1));
18213 this_arg_conv.is_owned = false;
18214 LDKRoute route_conv;
18215 route_conv.inner = (void*)(route & (~1));
18216 route_conv.is_owned = false;
18217 LDKThirtyTwoBytes payment_hash_ref;
18218 CHECK(*((uint32_t*)payment_hash) == 32);
18219 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
18220 LDKThirtyTwoBytes payment_secret_ref;
18221 CHECK(*((uint32_t*)payment_secret) == 32);
18222 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
18223 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18224 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
18225 return (uint64_t)ret_conv;
18228 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
18229 LDKChannelManager this_arg_conv;
18230 this_arg_conv.inner = (void*)(this_arg & (~1));
18231 this_arg_conv.is_owned = false;
18232 LDKRoute route_conv;
18233 route_conv.inner = (void*)(route & (~1));
18234 route_conv.is_owned = false;
18235 LDKThirtyTwoBytes payment_id_ref;
18236 CHECK(*((uint32_t*)payment_id) == 32);
18237 memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
18238 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18239 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
18240 return (uint64_t)ret_conv;
18243 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
18244 LDKChannelManager this_arg_conv;
18245 this_arg_conv.inner = (void*)(this_arg & (~1));
18246 this_arg_conv.is_owned = false;
18247 LDKRoute route_conv;
18248 route_conv.inner = (void*)(route & (~1));
18249 route_conv.is_owned = false;
18250 LDKThirtyTwoBytes payment_preimage_ref;
18251 CHECK(*((uint32_t*)payment_preimage) == 32);
18252 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
18253 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18254 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
18255 return (uint64_t)ret_conv;
18258 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
18259 LDKChannelManager this_arg_conv;
18260 this_arg_conv.inner = (void*)(this_arg & (~1));
18261 this_arg_conv.is_owned = false;
18262 unsigned char temporary_channel_id_arr[32];
18263 CHECK(*((uint32_t*)temporary_channel_id) == 32);
18264 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
18265 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
18266 LDKTransaction funding_transaction_ref;
18267 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
18268 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
18269 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
18270 funding_transaction_ref.data_is_owned = true;
18271 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18272 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
18273 return (uint64_t)ret_conv;
18276 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
18277 LDKChannelManager this_arg_conv;
18278 this_arg_conv.inner = (void*)(this_arg & (~1));
18279 this_arg_conv.is_owned = false;
18280 LDKThreeBytes rgb_ref;
18281 CHECK(*((uint32_t*)rgb) == 3);
18282 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
18283 LDKThirtyTwoBytes alias_ref;
18284 CHECK(*((uint32_t*)alias) == 32);
18285 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
18286 LDKCVec_NetAddressZ addresses_constr;
18287 addresses_constr.datalen = *((uint32_t*)addresses);
18288 if (addresses_constr.datalen > 0)
18289 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18291 addresses_constr.data = NULL;
18292 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
18293 for (size_t m = 0; m < addresses_constr.datalen; m++) {
18294 uint32_t addresses_conv_12 = addresses_vals[m];
18295 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
18296 CHECK_ACCESS(addresses_conv_12_ptr);
18297 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
18298 addresses_constr.data[m] = addresses_conv_12_conv;
18300 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
18303 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
18304 LDKChannelManager this_arg_conv;
18305 this_arg_conv.inner = (void*)(this_arg & (~1));
18306 this_arg_conv.is_owned = false;
18307 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
18310 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
18311 LDKChannelManager this_arg_conv;
18312 this_arg_conv.inner = (void*)(this_arg & (~1));
18313 this_arg_conv.is_owned = false;
18314 ChannelManager_timer_tick_occurred(&this_arg_conv);
18317 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
18318 LDKChannelManager this_arg_conv;
18319 this_arg_conv.inner = (void*)(this_arg & (~1));
18320 this_arg_conv.is_owned = false;
18321 unsigned char payment_hash_arr[32];
18322 CHECK(*((uint32_t*)payment_hash) == 32);
18323 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
18324 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
18325 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
18329 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
18330 LDKChannelManager this_arg_conv;
18331 this_arg_conv.inner = (void*)(this_arg & (~1));
18332 this_arg_conv.is_owned = false;
18333 LDKThirtyTwoBytes payment_preimage_ref;
18334 CHECK(*((uint32_t*)payment_preimage) == 32);
18335 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
18336 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
18340 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
18341 LDKChannelManager this_arg_conv;
18342 this_arg_conv.inner = (void*)(this_arg & (~1));
18343 this_arg_conv.is_owned = false;
18344 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18345 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
18349 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) {
18350 LDKChannelManager this_arg_conv;
18351 this_arg_conv.inner = (void*)(this_arg & (~1));
18352 this_arg_conv.is_owned = false;
18353 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
18354 CHECK_ACCESS(min_value_msat_ptr);
18355 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
18356 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18357 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18358 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
18359 return ((uint64_t)ret_conv);
18362 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) {
18363 LDKChannelManager this_arg_conv;
18364 this_arg_conv.inner = (void*)(this_arg & (~1));
18365 this_arg_conv.is_owned = false;
18366 LDKThirtyTwoBytes payment_hash_ref;
18367 CHECK(*((uint32_t*)payment_hash) == 32);
18368 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
18369 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
18370 CHECK_ACCESS(min_value_msat_ptr);
18371 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
18372 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18373 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18374 *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);
18375 return (uint64_t)ret_conv;
18378 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
18379 LDKChannelManager this_arg_conv;
18380 this_arg_conv.inner = (void*)(this_arg & (~1));
18381 this_arg_conv.is_owned = false;
18382 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18383 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
18384 return (uint64_t)ret_ret;
18387 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
18388 LDKChannelManager this_arg_conv;
18389 this_arg_conv.inner = (void*)(this_arg & (~1));
18390 this_arg_conv.is_owned = false;
18391 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18392 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
18393 return (uint64_t)ret_ret;
18396 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
18397 LDKChannelManager this_arg_conv;
18398 this_arg_conv.inner = (void*)(this_arg & (~1));
18399 this_arg_conv.is_owned = false;
18400 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18401 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
18402 return (uint64_t)ret_ret;
18405 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
18406 LDKChannelManager this_arg_conv;
18407 this_arg_conv.inner = (void*)(this_arg & (~1));
18408 this_arg_conv.is_owned = false;
18409 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18410 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
18411 return (uint64_t)ret_ret;
18414 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
18415 LDKChannelManager this_arg_conv;
18416 this_arg_conv.inner = (void*)(this_arg & (~1));
18417 this_arg_conv.is_owned = false;
18418 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
18422 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
18423 LDKChannelManager this_arg_conv;
18424 this_arg_conv.inner = (void*)(this_arg & (~1));
18425 this_arg_conv.is_owned = false;
18426 ChannelManager_await_persistable_update(&this_arg_conv);
18429 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
18430 LDKChannelManager this_arg_conv;
18431 this_arg_conv.inner = (void*)(this_arg & (~1));
18432 this_arg_conv.is_owned = false;
18433 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
18434 uint64_t ret_ref = 0;
18435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18437 ret_ref = (uint64_t)ret_var.inner;
18438 if (ret_var.is_owned) {
18444 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
18445 LDKChannelManager this_arg_conv;
18446 this_arg_conv.inner = (void*)(this_arg & (~1));
18447 this_arg_conv.is_owned = false;
18448 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
18449 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
18450 return (uint64_t)ret_ret;
18453 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
18454 LDKChannelManager obj_conv;
18455 obj_conv.inner = (void*)(obj & (~1));
18456 obj_conv.is_owned = false;
18457 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
18458 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18459 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18460 CVec_u8Z_free(ret_var);
18464 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
18465 LDKChannelManagerReadArgs this_obj_conv;
18466 this_obj_conv.inner = (void*)(this_obj & (~1));
18467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18468 ChannelManagerReadArgs_free(this_obj_conv);
18471 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
18472 LDKChannelManagerReadArgs this_ptr_conv;
18473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18474 this_ptr_conv.is_owned = false;
18475 // WARNING: This object doesn't live past this scope, needs clone!
18476 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
18480 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
18481 LDKChannelManagerReadArgs this_ptr_conv;
18482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18483 this_ptr_conv.is_owned = false;
18484 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18485 CHECK_ACCESS(val_ptr);
18486 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
18487 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
18490 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
18491 LDKChannelManagerReadArgs this_ptr_conv;
18492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18493 this_ptr_conv.is_owned = false;
18494 // WARNING: This object doesn't live past this scope, needs clone!
18495 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
18499 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
18500 LDKChannelManagerReadArgs this_ptr_conv;
18501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18502 this_ptr_conv.is_owned = false;
18503 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18504 CHECK_ACCESS(val_ptr);
18505 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
18506 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
18509 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
18510 LDKChannelManagerReadArgs this_ptr_conv;
18511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18512 this_ptr_conv.is_owned = false;
18513 // WARNING: This object doesn't live past this scope, needs clone!
18514 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
18518 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
18519 LDKChannelManagerReadArgs this_ptr_conv;
18520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18521 this_ptr_conv.is_owned = false;
18522 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18523 CHECK_ACCESS(val_ptr);
18524 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
18525 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
18528 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
18529 LDKChannelManagerReadArgs this_ptr_conv;
18530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18531 this_ptr_conv.is_owned = false;
18532 // WARNING: This object doesn't live past this scope, needs clone!
18533 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
18537 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
18538 LDKChannelManagerReadArgs this_ptr_conv;
18539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18540 this_ptr_conv.is_owned = false;
18541 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18542 CHECK_ACCESS(val_ptr);
18543 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
18544 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
18547 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
18548 LDKChannelManagerReadArgs this_ptr_conv;
18549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18550 this_ptr_conv.is_owned = false;
18551 // WARNING: This object doesn't live past this scope, needs clone!
18552 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
18556 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
18557 LDKChannelManagerReadArgs this_ptr_conv;
18558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18559 this_ptr_conv.is_owned = false;
18560 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18561 CHECK_ACCESS(val_ptr);
18562 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
18563 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
18566 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
18567 LDKChannelManagerReadArgs this_ptr_conv;
18568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18569 this_ptr_conv.is_owned = false;
18570 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
18571 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
18575 if (ret_var.is_owned) {
18581 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
18582 LDKChannelManagerReadArgs this_ptr_conv;
18583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18584 this_ptr_conv.is_owned = false;
18585 LDKUserConfig val_conv;
18586 val_conv.inner = (void*)(val & (~1));
18587 val_conv.is_owned = (val & 1) || (val == 0);
18588 val_conv = UserConfig_clone(&val_conv);
18589 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
18592 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) {
18593 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
18594 CHECK_ACCESS(keys_manager_ptr);
18595 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
18596 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18597 CHECK_ACCESS(fee_estimator_ptr);
18598 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18599 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
18600 CHECK_ACCESS(chain_monitor_ptr);
18601 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
18602 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
18603 CHECK_ACCESS(tx_broadcaster_ptr);
18604 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
18605 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18606 CHECK_ACCESS(logger_ptr);
18607 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18608 LDKUserConfig default_config_conv;
18609 default_config_conv.inner = (void*)(default_config & (~1));
18610 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
18611 default_config_conv = UserConfig_clone(&default_config_conv);
18612 LDKCVec_ChannelMonitorZ channel_monitors_constr;
18613 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
18614 if (channel_monitors_constr.datalen > 0)
18615 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
18617 channel_monitors_constr.data = NULL;
18618 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
18619 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
18620 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
18621 LDKChannelMonitor channel_monitors_conv_16_conv;
18622 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
18623 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
18624 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
18626 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);
18627 uint64_t ret_ref = 0;
18628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18630 ret_ref = (uint64_t)ret_var.inner;
18631 if (ret_var.is_owned) {
18637 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
18638 LDKu8slice ser_ref;
18639 ser_ref.datalen = *((uint32_t*)ser);
18640 ser_ref.data = (int8_t*)(ser + 4);
18641 LDKChannelManagerReadArgs arg_conv;
18642 arg_conv.inner = (void*)(arg & (~1));
18643 arg_conv.is_owned = (arg & 1) || (arg == 0);
18644 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
18645 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18646 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
18647 return (uint64_t)ret_conv;
18650 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
18651 LDKDecodeError this_obj_conv;
18652 this_obj_conv.inner = (void*)(this_obj & (~1));
18653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18654 DecodeError_free(this_obj_conv);
18657 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
18658 LDKDecodeError orig_conv;
18659 orig_conv.inner = (void*)(orig & (~1));
18660 orig_conv.is_owned = false;
18661 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
18662 uint64_t ret_ref = 0;
18663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18665 ret_ref = (uint64_t)ret_var.inner;
18666 if (ret_var.is_owned) {
18672 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
18673 LDKInit this_obj_conv;
18674 this_obj_conv.inner = (void*)(this_obj & (~1));
18675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18676 Init_free(this_obj_conv);
18679 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
18680 LDKInit this_ptr_conv;
18681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18682 this_ptr_conv.is_owned = false;
18683 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
18684 uint64_t ret_ref = 0;
18685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18687 ret_ref = (uint64_t)ret_var.inner;
18688 if (ret_var.is_owned) {
18694 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
18695 LDKInit this_ptr_conv;
18696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18697 this_ptr_conv.is_owned = false;
18698 LDKInitFeatures val_conv;
18699 val_conv.inner = (void*)(val & (~1));
18700 val_conv.is_owned = (val & 1) || (val == 0);
18701 val_conv = InitFeatures_clone(&val_conv);
18702 Init_set_features(&this_ptr_conv, val_conv);
18705 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
18706 LDKInitFeatures features_arg_conv;
18707 features_arg_conv.inner = (void*)(features_arg & (~1));
18708 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18709 features_arg_conv = InitFeatures_clone(&features_arg_conv);
18710 LDKInit ret_var = Init_new(features_arg_conv);
18711 uint64_t ret_ref = 0;
18712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18714 ret_ref = (uint64_t)ret_var.inner;
18715 if (ret_var.is_owned) {
18721 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
18723 orig_conv.inner = (void*)(orig & (~1));
18724 orig_conv.is_owned = false;
18725 LDKInit ret_var = Init_clone(&orig_conv);
18726 uint64_t ret_ref = 0;
18727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18729 ret_ref = (uint64_t)ret_var.inner;
18730 if (ret_var.is_owned) {
18736 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
18737 LDKErrorMessage this_obj_conv;
18738 this_obj_conv.inner = (void*)(this_obj & (~1));
18739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18740 ErrorMessage_free(this_obj_conv);
18743 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
18744 LDKErrorMessage this_ptr_conv;
18745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18746 this_ptr_conv.is_owned = false;
18747 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18748 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
18752 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18753 LDKErrorMessage this_ptr_conv;
18754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18755 this_ptr_conv.is_owned = false;
18756 LDKThirtyTwoBytes val_ref;
18757 CHECK(*((uint32_t*)val) == 32);
18758 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18759 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
18762 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
18763 LDKErrorMessage this_ptr_conv;
18764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18765 this_ptr_conv.is_owned = false;
18766 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
18767 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18772 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
18773 LDKErrorMessage this_ptr_conv;
18774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18775 this_ptr_conv.is_owned = false;
18776 LDKStr val_conv = str_ref_to_owned_c(val);
18777 ErrorMessage_set_data(&this_ptr_conv, val_conv);
18780 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
18781 LDKThirtyTwoBytes channel_id_arg_ref;
18782 CHECK(*((uint32_t*)channel_id_arg) == 32);
18783 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18784 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
18785 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
18786 uint64_t ret_ref = 0;
18787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18789 ret_ref = (uint64_t)ret_var.inner;
18790 if (ret_var.is_owned) {
18796 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
18797 LDKErrorMessage orig_conv;
18798 orig_conv.inner = (void*)(orig & (~1));
18799 orig_conv.is_owned = false;
18800 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
18801 uint64_t ret_ref = 0;
18802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18804 ret_ref = (uint64_t)ret_var.inner;
18805 if (ret_var.is_owned) {
18811 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
18812 LDKPing this_obj_conv;
18813 this_obj_conv.inner = (void*)(this_obj & (~1));
18814 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18815 Ping_free(this_obj_conv);
18818 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
18819 LDKPing this_ptr_conv;
18820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18821 this_ptr_conv.is_owned = false;
18822 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
18826 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
18827 LDKPing this_ptr_conv;
18828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18829 this_ptr_conv.is_owned = false;
18830 Ping_set_ponglen(&this_ptr_conv, val);
18833 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
18834 LDKPing this_ptr_conv;
18835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18836 this_ptr_conv.is_owned = false;
18837 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
18841 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
18842 LDKPing this_ptr_conv;
18843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18844 this_ptr_conv.is_owned = false;
18845 Ping_set_byteslen(&this_ptr_conv, val);
18848 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
18849 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
18850 uint64_t ret_ref = 0;
18851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18853 ret_ref = (uint64_t)ret_var.inner;
18854 if (ret_var.is_owned) {
18860 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
18862 orig_conv.inner = (void*)(orig & (~1));
18863 orig_conv.is_owned = false;
18864 LDKPing ret_var = Ping_clone(&orig_conv);
18865 uint64_t ret_ref = 0;
18866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18868 ret_ref = (uint64_t)ret_var.inner;
18869 if (ret_var.is_owned) {
18875 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
18876 LDKPong this_obj_conv;
18877 this_obj_conv.inner = (void*)(this_obj & (~1));
18878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18879 Pong_free(this_obj_conv);
18882 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
18883 LDKPong this_ptr_conv;
18884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18885 this_ptr_conv.is_owned = false;
18886 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
18890 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
18891 LDKPong this_ptr_conv;
18892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18893 this_ptr_conv.is_owned = false;
18894 Pong_set_byteslen(&this_ptr_conv, val);
18897 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
18898 LDKPong ret_var = Pong_new(byteslen_arg);
18899 uint64_t ret_ref = 0;
18900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18902 ret_ref = (uint64_t)ret_var.inner;
18903 if (ret_var.is_owned) {
18909 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
18911 orig_conv.inner = (void*)(orig & (~1));
18912 orig_conv.is_owned = false;
18913 LDKPong ret_var = Pong_clone(&orig_conv);
18914 uint64_t ret_ref = 0;
18915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18917 ret_ref = (uint64_t)ret_var.inner;
18918 if (ret_var.is_owned) {
18924 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
18925 LDKOpenChannel this_obj_conv;
18926 this_obj_conv.inner = (void*)(this_obj & (~1));
18927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18928 OpenChannel_free(this_obj_conv);
18931 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
18932 LDKOpenChannel this_ptr_conv;
18933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18934 this_ptr_conv.is_owned = false;
18935 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18936 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
18940 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18941 LDKOpenChannel this_ptr_conv;
18942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18943 this_ptr_conv.is_owned = false;
18944 LDKThirtyTwoBytes val_ref;
18945 CHECK(*((uint32_t*)val) == 32);
18946 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18947 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
18950 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
18951 LDKOpenChannel this_ptr_conv;
18952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18953 this_ptr_conv.is_owned = false;
18954 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18955 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
18959 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
18960 LDKOpenChannel this_ptr_conv;
18961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18962 this_ptr_conv.is_owned = false;
18963 LDKThirtyTwoBytes val_ref;
18964 CHECK(*((uint32_t*)val) == 32);
18965 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18966 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18969 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
18970 LDKOpenChannel this_ptr_conv;
18971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18972 this_ptr_conv.is_owned = false;
18973 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
18977 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
18978 LDKOpenChannel this_ptr_conv;
18979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18980 this_ptr_conv.is_owned = false;
18981 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
18984 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
18985 LDKOpenChannel this_ptr_conv;
18986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18987 this_ptr_conv.is_owned = false;
18988 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
18992 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
18993 LDKOpenChannel this_ptr_conv;
18994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18995 this_ptr_conv.is_owned = false;
18996 OpenChannel_set_push_msat(&this_ptr_conv, val);
18999 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
19000 LDKOpenChannel this_ptr_conv;
19001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19002 this_ptr_conv.is_owned = false;
19003 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
19007 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
19008 LDKOpenChannel this_ptr_conv;
19009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19010 this_ptr_conv.is_owned = false;
19011 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19014 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
19015 LDKOpenChannel this_ptr_conv;
19016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19017 this_ptr_conv.is_owned = false;
19018 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19022 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
19023 LDKOpenChannel this_ptr_conv;
19024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19025 this_ptr_conv.is_owned = false;
19026 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19029 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
19030 LDKOpenChannel this_ptr_conv;
19031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19032 this_ptr_conv.is_owned = false;
19033 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19037 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
19038 LDKOpenChannel this_ptr_conv;
19039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19040 this_ptr_conv.is_owned = false;
19041 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19044 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
19045 LDKOpenChannel this_ptr_conv;
19046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19047 this_ptr_conv.is_owned = false;
19048 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
19052 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19053 LDKOpenChannel this_ptr_conv;
19054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19055 this_ptr_conv.is_owned = false;
19056 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19059 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
19060 LDKOpenChannel this_ptr_conv;
19061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19062 this_ptr_conv.is_owned = false;
19063 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
19067 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
19068 LDKOpenChannel this_ptr_conv;
19069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19070 this_ptr_conv.is_owned = false;
19071 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
19074 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
19075 LDKOpenChannel this_ptr_conv;
19076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19077 this_ptr_conv.is_owned = false;
19078 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
19082 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19083 LDKOpenChannel this_ptr_conv;
19084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19085 this_ptr_conv.is_owned = false;
19086 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
19089 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
19090 LDKOpenChannel this_ptr_conv;
19091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19092 this_ptr_conv.is_owned = false;
19093 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
19097 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
19098 LDKOpenChannel this_ptr_conv;
19099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19100 this_ptr_conv.is_owned = false;
19101 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19104 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
19105 LDKOpenChannel this_ptr_conv;
19106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19107 this_ptr_conv.is_owned = false;
19108 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19109 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
19113 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
19114 LDKOpenChannel this_ptr_conv;
19115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19116 this_ptr_conv.is_owned = false;
19117 LDKPublicKey val_ref;
19118 CHECK(*((uint32_t*)val) == 33);
19119 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19120 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19123 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
19124 LDKOpenChannel this_ptr_conv;
19125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19126 this_ptr_conv.is_owned = false;
19127 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19128 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
19132 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
19133 LDKOpenChannel this_ptr_conv;
19134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19135 this_ptr_conv.is_owned = false;
19136 LDKPublicKey val_ref;
19137 CHECK(*((uint32_t*)val) == 33);
19138 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19139 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19142 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
19143 LDKOpenChannel this_ptr_conv;
19144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19145 this_ptr_conv.is_owned = false;
19146 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19147 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
19151 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
19152 LDKOpenChannel this_ptr_conv;
19153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19154 this_ptr_conv.is_owned = false;
19155 LDKPublicKey val_ref;
19156 CHECK(*((uint32_t*)val) == 33);
19157 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19158 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
19161 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
19162 LDKOpenChannel this_ptr_conv;
19163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19164 this_ptr_conv.is_owned = false;
19165 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19166 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
19170 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
19171 LDKOpenChannel this_ptr_conv;
19172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19173 this_ptr_conv.is_owned = false;
19174 LDKPublicKey val_ref;
19175 CHECK(*((uint32_t*)val) == 33);
19176 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19177 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19180 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
19181 LDKOpenChannel this_ptr_conv;
19182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19183 this_ptr_conv.is_owned = false;
19184 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19185 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
19189 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
19190 LDKOpenChannel this_ptr_conv;
19191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19192 this_ptr_conv.is_owned = false;
19193 LDKPublicKey val_ref;
19194 CHECK(*((uint32_t*)val) == 33);
19195 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19196 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19199 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
19200 LDKOpenChannel this_ptr_conv;
19201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19202 this_ptr_conv.is_owned = false;
19203 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19204 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19208 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19209 LDKOpenChannel this_ptr_conv;
19210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19211 this_ptr_conv.is_owned = false;
19212 LDKPublicKey val_ref;
19213 CHECK(*((uint32_t*)val) == 33);
19214 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19215 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
19218 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
19219 LDKOpenChannel this_ptr_conv;
19220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19221 this_ptr_conv.is_owned = false;
19222 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
19226 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
19227 LDKOpenChannel this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 OpenChannel_set_channel_flags(&this_ptr_conv, val);
19233 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
19234 LDKOpenChannel orig_conv;
19235 orig_conv.inner = (void*)(orig & (~1));
19236 orig_conv.is_owned = false;
19237 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
19238 uint64_t ret_ref = 0;
19239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19241 ret_ref = (uint64_t)ret_var.inner;
19242 if (ret_var.is_owned) {
19248 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
19249 LDKAcceptChannel this_obj_conv;
19250 this_obj_conv.inner = (void*)(this_obj & (~1));
19251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19252 AcceptChannel_free(this_obj_conv);
19255 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
19256 LDKAcceptChannel this_ptr_conv;
19257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19258 this_ptr_conv.is_owned = false;
19259 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19260 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
19264 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
19265 LDKAcceptChannel this_ptr_conv;
19266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19267 this_ptr_conv.is_owned = false;
19268 LDKThirtyTwoBytes val_ref;
19269 CHECK(*((uint32_t*)val) == 32);
19270 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19271 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19274 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
19275 LDKAcceptChannel this_ptr_conv;
19276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19277 this_ptr_conv.is_owned = false;
19278 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
19282 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
19283 LDKAcceptChannel this_ptr_conv;
19284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19285 this_ptr_conv.is_owned = false;
19286 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19289 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
19290 LDKAcceptChannel this_ptr_conv;
19291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19292 this_ptr_conv.is_owned = false;
19293 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19297 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
19298 LDKAcceptChannel this_ptr_conv;
19299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19300 this_ptr_conv.is_owned = false;
19301 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19304 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
19305 LDKAcceptChannel this_ptr_conv;
19306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19307 this_ptr_conv.is_owned = false;
19308 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19312 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
19313 LDKAcceptChannel this_ptr_conv;
19314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19315 this_ptr_conv.is_owned = false;
19316 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19319 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
19320 LDKAcceptChannel this_ptr_conv;
19321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19322 this_ptr_conv.is_owned = false;
19323 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
19327 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19328 LDKAcceptChannel this_ptr_conv;
19329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19330 this_ptr_conv.is_owned = false;
19331 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19334 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
19335 LDKAcceptChannel this_ptr_conv;
19336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19337 this_ptr_conv.is_owned = false;
19338 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
19342 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
19343 LDKAcceptChannel this_ptr_conv;
19344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19345 this_ptr_conv.is_owned = false;
19346 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
19349 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
19350 LDKAcceptChannel this_ptr_conv;
19351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19352 this_ptr_conv.is_owned = false;
19353 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
19357 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19358 LDKAcceptChannel this_ptr_conv;
19359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19360 this_ptr_conv.is_owned = false;
19361 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
19364 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
19365 LDKAcceptChannel this_ptr_conv;
19366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19367 this_ptr_conv.is_owned = false;
19368 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
19372 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
19373 LDKAcceptChannel this_ptr_conv;
19374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19375 this_ptr_conv.is_owned = false;
19376 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19379 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
19380 LDKAcceptChannel this_ptr_conv;
19381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19382 this_ptr_conv.is_owned = false;
19383 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19384 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
19388 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
19389 LDKAcceptChannel this_ptr_conv;
19390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19391 this_ptr_conv.is_owned = false;
19392 LDKPublicKey val_ref;
19393 CHECK(*((uint32_t*)val) == 33);
19394 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19395 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19398 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
19399 LDKAcceptChannel this_ptr_conv;
19400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19401 this_ptr_conv.is_owned = false;
19402 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19403 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
19407 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
19408 LDKAcceptChannel this_ptr_conv;
19409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19410 this_ptr_conv.is_owned = false;
19411 LDKPublicKey val_ref;
19412 CHECK(*((uint32_t*)val) == 33);
19413 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19414 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19417 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
19418 LDKAcceptChannel this_ptr_conv;
19419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19420 this_ptr_conv.is_owned = false;
19421 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19422 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
19426 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
19427 LDKAcceptChannel this_ptr_conv;
19428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19429 this_ptr_conv.is_owned = false;
19430 LDKPublicKey val_ref;
19431 CHECK(*((uint32_t*)val) == 33);
19432 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19433 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
19436 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
19437 LDKAcceptChannel this_ptr_conv;
19438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19439 this_ptr_conv.is_owned = false;
19440 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19441 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
19445 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
19446 LDKAcceptChannel this_ptr_conv;
19447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19448 this_ptr_conv.is_owned = false;
19449 LDKPublicKey val_ref;
19450 CHECK(*((uint32_t*)val) == 33);
19451 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19452 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19455 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
19456 LDKAcceptChannel this_ptr_conv;
19457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19458 this_ptr_conv.is_owned = false;
19459 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19460 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
19464 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
19465 LDKAcceptChannel this_ptr_conv;
19466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19467 this_ptr_conv.is_owned = false;
19468 LDKPublicKey val_ref;
19469 CHECK(*((uint32_t*)val) == 33);
19470 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19471 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19474 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
19475 LDKAcceptChannel this_ptr_conv;
19476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19477 this_ptr_conv.is_owned = false;
19478 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19479 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19483 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19484 LDKAcceptChannel this_ptr_conv;
19485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19486 this_ptr_conv.is_owned = false;
19487 LDKPublicKey val_ref;
19488 CHECK(*((uint32_t*)val) == 33);
19489 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19490 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
19493 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
19494 LDKAcceptChannel orig_conv;
19495 orig_conv.inner = (void*)(orig & (~1));
19496 orig_conv.is_owned = false;
19497 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
19498 uint64_t ret_ref = 0;
19499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19501 ret_ref = (uint64_t)ret_var.inner;
19502 if (ret_var.is_owned) {
19508 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
19509 LDKFundingCreated this_obj_conv;
19510 this_obj_conv.inner = (void*)(this_obj & (~1));
19511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19512 FundingCreated_free(this_obj_conv);
19515 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
19516 LDKFundingCreated this_ptr_conv;
19517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19518 this_ptr_conv.is_owned = false;
19519 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19520 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
19524 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
19525 LDKFundingCreated this_ptr_conv;
19526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19527 this_ptr_conv.is_owned = false;
19528 LDKThirtyTwoBytes val_ref;
19529 CHECK(*((uint32_t*)val) == 32);
19530 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19531 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
19534 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
19535 LDKFundingCreated this_ptr_conv;
19536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19537 this_ptr_conv.is_owned = false;
19538 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19539 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
19543 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
19544 LDKFundingCreated this_ptr_conv;
19545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19546 this_ptr_conv.is_owned = false;
19547 LDKThirtyTwoBytes val_ref;
19548 CHECK(*((uint32_t*)val) == 32);
19549 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19550 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
19553 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
19554 LDKFundingCreated this_ptr_conv;
19555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19556 this_ptr_conv.is_owned = false;
19557 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
19561 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
19562 LDKFundingCreated this_ptr_conv;
19563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19564 this_ptr_conv.is_owned = false;
19565 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
19568 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
19569 LDKFundingCreated this_ptr_conv;
19570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19571 this_ptr_conv.is_owned = false;
19572 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19573 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
19577 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
19578 LDKFundingCreated this_ptr_conv;
19579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19580 this_ptr_conv.is_owned = false;
19581 LDKSignature val_ref;
19582 CHECK(*((uint32_t*)val) == 64);
19583 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19584 FundingCreated_set_signature(&this_ptr_conv, val_ref);
19587 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) {
19588 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
19589 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
19590 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
19591 LDKThirtyTwoBytes funding_txid_arg_ref;
19592 CHECK(*((uint32_t*)funding_txid_arg) == 32);
19593 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
19594 LDKSignature signature_arg_ref;
19595 CHECK(*((uint32_t*)signature_arg) == 64);
19596 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19597 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
19598 uint64_t ret_ref = 0;
19599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19601 ret_ref = (uint64_t)ret_var.inner;
19602 if (ret_var.is_owned) {
19608 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
19609 LDKFundingCreated orig_conv;
19610 orig_conv.inner = (void*)(orig & (~1));
19611 orig_conv.is_owned = false;
19612 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
19613 uint64_t ret_ref = 0;
19614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19616 ret_ref = (uint64_t)ret_var.inner;
19617 if (ret_var.is_owned) {
19623 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
19624 LDKFundingSigned this_obj_conv;
19625 this_obj_conv.inner = (void*)(this_obj & (~1));
19626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19627 FundingSigned_free(this_obj_conv);
19630 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
19631 LDKFundingSigned this_ptr_conv;
19632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19633 this_ptr_conv.is_owned = false;
19634 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19635 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
19639 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19640 LDKFundingSigned this_ptr_conv;
19641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19642 this_ptr_conv.is_owned = false;
19643 LDKThirtyTwoBytes val_ref;
19644 CHECK(*((uint32_t*)val) == 32);
19645 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19646 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
19649 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
19650 LDKFundingSigned this_ptr_conv;
19651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19652 this_ptr_conv.is_owned = false;
19653 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19654 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
19658 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
19659 LDKFundingSigned this_ptr_conv;
19660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19661 this_ptr_conv.is_owned = false;
19662 LDKSignature val_ref;
19663 CHECK(*((uint32_t*)val) == 64);
19664 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19665 FundingSigned_set_signature(&this_ptr_conv, val_ref);
19668 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
19669 LDKThirtyTwoBytes channel_id_arg_ref;
19670 CHECK(*((uint32_t*)channel_id_arg) == 32);
19671 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19672 LDKSignature signature_arg_ref;
19673 CHECK(*((uint32_t*)signature_arg) == 64);
19674 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19675 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
19676 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
19680 if (ret_var.is_owned) {
19686 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
19687 LDKFundingSigned orig_conv;
19688 orig_conv.inner = (void*)(orig & (~1));
19689 orig_conv.is_owned = false;
19690 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
19691 uint64_t ret_ref = 0;
19692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19694 ret_ref = (uint64_t)ret_var.inner;
19695 if (ret_var.is_owned) {
19701 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
19702 LDKFundingLocked this_obj_conv;
19703 this_obj_conv.inner = (void*)(this_obj & (~1));
19704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19705 FundingLocked_free(this_obj_conv);
19708 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
19709 LDKFundingLocked this_ptr_conv;
19710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19711 this_ptr_conv.is_owned = false;
19712 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19713 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
19717 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19718 LDKFundingLocked this_ptr_conv;
19719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19720 this_ptr_conv.is_owned = false;
19721 LDKThirtyTwoBytes val_ref;
19722 CHECK(*((uint32_t*)val) == 32);
19723 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19724 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
19727 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
19728 LDKFundingLocked this_ptr_conv;
19729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19730 this_ptr_conv.is_owned = false;
19731 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19732 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19736 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19737 LDKFundingLocked this_ptr_conv;
19738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19739 this_ptr_conv.is_owned = false;
19740 LDKPublicKey val_ref;
19741 CHECK(*((uint32_t*)val) == 33);
19742 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19743 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
19746 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
19747 LDKThirtyTwoBytes channel_id_arg_ref;
19748 CHECK(*((uint32_t*)channel_id_arg) == 32);
19749 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19750 LDKPublicKey next_per_commitment_point_arg_ref;
19751 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
19752 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
19753 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
19754 uint64_t ret_ref = 0;
19755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19757 ret_ref = (uint64_t)ret_var.inner;
19758 if (ret_var.is_owned) {
19764 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
19765 LDKFundingLocked orig_conv;
19766 orig_conv.inner = (void*)(orig & (~1));
19767 orig_conv.is_owned = false;
19768 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
19769 uint64_t ret_ref = 0;
19770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19772 ret_ref = (uint64_t)ret_var.inner;
19773 if (ret_var.is_owned) {
19779 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
19780 LDKShutdown this_obj_conv;
19781 this_obj_conv.inner = (void*)(this_obj & (~1));
19782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19783 Shutdown_free(this_obj_conv);
19786 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
19787 LDKShutdown this_ptr_conv;
19788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19789 this_ptr_conv.is_owned = false;
19790 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19791 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
19795 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19796 LDKShutdown this_ptr_conv;
19797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19798 this_ptr_conv.is_owned = false;
19799 LDKThirtyTwoBytes val_ref;
19800 CHECK(*((uint32_t*)val) == 32);
19801 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19802 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
19805 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
19806 LDKShutdown this_ptr_conv;
19807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19808 this_ptr_conv.is_owned = false;
19809 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
19810 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19811 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19815 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
19816 LDKShutdown this_ptr_conv;
19817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19818 this_ptr_conv.is_owned = false;
19819 LDKCVec_u8Z val_ref;
19820 val_ref.datalen = *((uint32_t*)val);
19821 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
19822 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
19823 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
19826 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
19827 LDKThirtyTwoBytes channel_id_arg_ref;
19828 CHECK(*((uint32_t*)channel_id_arg) == 32);
19829 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19830 LDKCVec_u8Z scriptpubkey_arg_ref;
19831 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
19832 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
19833 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
19834 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
19835 uint64_t ret_ref = 0;
19836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19837 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19838 ret_ref = (uint64_t)ret_var.inner;
19839 if (ret_var.is_owned) {
19845 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
19846 LDKShutdown orig_conv;
19847 orig_conv.inner = (void*)(orig & (~1));
19848 orig_conv.is_owned = false;
19849 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
19850 uint64_t ret_ref = 0;
19851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19853 ret_ref = (uint64_t)ret_var.inner;
19854 if (ret_var.is_owned) {
19860 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
19861 LDKClosingSignedFeeRange this_obj_conv;
19862 this_obj_conv.inner = (void*)(this_obj & (~1));
19863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19864 ClosingSignedFeeRange_free(this_obj_conv);
19867 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
19868 LDKClosingSignedFeeRange this_ptr_conv;
19869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19870 this_ptr_conv.is_owned = false;
19871 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
19875 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
19876 LDKClosingSignedFeeRange this_ptr_conv;
19877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19878 this_ptr_conv.is_owned = false;
19879 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
19882 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
19883 LDKClosingSignedFeeRange this_ptr_conv;
19884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19885 this_ptr_conv.is_owned = false;
19886 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
19890 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
19891 LDKClosingSignedFeeRange this_ptr_conv;
19892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19893 this_ptr_conv.is_owned = false;
19894 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
19897 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
19898 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
19899 uint64_t ret_ref = 0;
19900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19902 ret_ref = (uint64_t)ret_var.inner;
19903 if (ret_var.is_owned) {
19909 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
19910 LDKClosingSignedFeeRange orig_conv;
19911 orig_conv.inner = (void*)(orig & (~1));
19912 orig_conv.is_owned = false;
19913 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
19914 uint64_t ret_ref = 0;
19915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19917 ret_ref = (uint64_t)ret_var.inner;
19918 if (ret_var.is_owned) {
19924 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
19925 LDKClosingSigned this_obj_conv;
19926 this_obj_conv.inner = (void*)(this_obj & (~1));
19927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19928 ClosingSigned_free(this_obj_conv);
19931 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
19932 LDKClosingSigned this_ptr_conv;
19933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19934 this_ptr_conv.is_owned = false;
19935 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19936 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
19940 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
19941 LDKClosingSigned this_ptr_conv;
19942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19943 this_ptr_conv.is_owned = false;
19944 LDKThirtyTwoBytes val_ref;
19945 CHECK(*((uint32_t*)val) == 32);
19946 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19947 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
19950 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
19951 LDKClosingSigned this_ptr_conv;
19952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19953 this_ptr_conv.is_owned = false;
19954 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
19958 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
19959 LDKClosingSigned this_ptr_conv;
19960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19961 this_ptr_conv.is_owned = false;
19962 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
19965 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
19966 LDKClosingSigned this_ptr_conv;
19967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19968 this_ptr_conv.is_owned = false;
19969 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19970 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
19974 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
19975 LDKClosingSigned this_ptr_conv;
19976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19977 this_ptr_conv.is_owned = false;
19978 LDKSignature val_ref;
19979 CHECK(*((uint32_t*)val) == 64);
19980 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19981 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
19984 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
19985 LDKClosingSigned this_ptr_conv;
19986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19987 this_ptr_conv.is_owned = false;
19988 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
19989 uint64_t ret_ref = 0;
19990 if ((uint64_t)ret_var.inner > 4096) {
19991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19993 ret_ref = (uint64_t)ret_var.inner;
19994 if (ret_var.is_owned) {
20001 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
20002 LDKClosingSigned this_ptr_conv;
20003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20004 this_ptr_conv.is_owned = false;
20005 LDKClosingSignedFeeRange val_conv;
20006 val_conv.inner = (void*)(val & (~1));
20007 val_conv.is_owned = (val & 1) || (val == 0);
20008 val_conv = ClosingSignedFeeRange_clone(&val_conv);
20009 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
20012 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) {
20013 LDKThirtyTwoBytes channel_id_arg_ref;
20014 CHECK(*((uint32_t*)channel_id_arg) == 32);
20015 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20016 LDKSignature signature_arg_ref;
20017 CHECK(*((uint32_t*)signature_arg) == 64);
20018 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
20019 LDKClosingSignedFeeRange fee_range_arg_conv;
20020 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
20021 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
20022 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
20023 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
20024 uint64_t ret_ref = 0;
20025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20027 ret_ref = (uint64_t)ret_var.inner;
20028 if (ret_var.is_owned) {
20034 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
20035 LDKClosingSigned orig_conv;
20036 orig_conv.inner = (void*)(orig & (~1));
20037 orig_conv.is_owned = false;
20038 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
20039 uint64_t ret_ref = 0;
20040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20042 ret_ref = (uint64_t)ret_var.inner;
20043 if (ret_var.is_owned) {
20049 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
20050 LDKUpdateAddHTLC this_obj_conv;
20051 this_obj_conv.inner = (void*)(this_obj & (~1));
20052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20053 UpdateAddHTLC_free(this_obj_conv);
20056 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
20057 LDKUpdateAddHTLC this_ptr_conv;
20058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20059 this_ptr_conv.is_owned = false;
20060 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20061 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
20065 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20066 LDKUpdateAddHTLC this_ptr_conv;
20067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20068 this_ptr_conv.is_owned = false;
20069 LDKThirtyTwoBytes val_ref;
20070 CHECK(*((uint32_t*)val) == 32);
20071 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20072 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
20075 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
20076 LDKUpdateAddHTLC this_ptr_conv;
20077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20078 this_ptr_conv.is_owned = false;
20079 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
20083 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
20084 LDKUpdateAddHTLC this_ptr_conv;
20085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20086 this_ptr_conv.is_owned = false;
20087 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
20090 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
20091 LDKUpdateAddHTLC this_ptr_conv;
20092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20093 this_ptr_conv.is_owned = false;
20094 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
20098 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
20099 LDKUpdateAddHTLC this_ptr_conv;
20100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20101 this_ptr_conv.is_owned = false;
20102 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
20105 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
20106 LDKUpdateAddHTLC this_ptr_conv;
20107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20108 this_ptr_conv.is_owned = false;
20109 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20110 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
20114 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
20115 LDKUpdateAddHTLC this_ptr_conv;
20116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20117 this_ptr_conv.is_owned = false;
20118 LDKThirtyTwoBytes val_ref;
20119 CHECK(*((uint32_t*)val) == 32);
20120 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20121 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
20124 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
20125 LDKUpdateAddHTLC this_ptr_conv;
20126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20127 this_ptr_conv.is_owned = false;
20128 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
20132 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
20133 LDKUpdateAddHTLC this_ptr_conv;
20134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20135 this_ptr_conv.is_owned = false;
20136 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
20139 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
20140 LDKUpdateAddHTLC orig_conv;
20141 orig_conv.inner = (void*)(orig & (~1));
20142 orig_conv.is_owned = false;
20143 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
20144 uint64_t ret_ref = 0;
20145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20147 ret_ref = (uint64_t)ret_var.inner;
20148 if (ret_var.is_owned) {
20154 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
20155 LDKUpdateFulfillHTLC this_obj_conv;
20156 this_obj_conv.inner = (void*)(this_obj & (~1));
20157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20158 UpdateFulfillHTLC_free(this_obj_conv);
20161 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
20162 LDKUpdateFulfillHTLC this_ptr_conv;
20163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20164 this_ptr_conv.is_owned = false;
20165 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20166 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
20170 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20171 LDKUpdateFulfillHTLC this_ptr_conv;
20172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20173 this_ptr_conv.is_owned = false;
20174 LDKThirtyTwoBytes val_ref;
20175 CHECK(*((uint32_t*)val) == 32);
20176 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20177 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
20180 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
20181 LDKUpdateFulfillHTLC this_ptr_conv;
20182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20183 this_ptr_conv.is_owned = false;
20184 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
20188 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
20189 LDKUpdateFulfillHTLC this_ptr_conv;
20190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20191 this_ptr_conv.is_owned = false;
20192 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
20195 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
20196 LDKUpdateFulfillHTLC this_ptr_conv;
20197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20198 this_ptr_conv.is_owned = false;
20199 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20200 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
20204 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
20205 LDKUpdateFulfillHTLC this_ptr_conv;
20206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20207 this_ptr_conv.is_owned = false;
20208 LDKThirtyTwoBytes val_ref;
20209 CHECK(*((uint32_t*)val) == 32);
20210 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20211 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
20214 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
20215 LDKThirtyTwoBytes channel_id_arg_ref;
20216 CHECK(*((uint32_t*)channel_id_arg) == 32);
20217 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20218 LDKThirtyTwoBytes payment_preimage_arg_ref;
20219 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
20220 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
20221 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
20222 uint64_t ret_ref = 0;
20223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20225 ret_ref = (uint64_t)ret_var.inner;
20226 if (ret_var.is_owned) {
20232 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
20233 LDKUpdateFulfillHTLC orig_conv;
20234 orig_conv.inner = (void*)(orig & (~1));
20235 orig_conv.is_owned = false;
20236 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
20237 uint64_t ret_ref = 0;
20238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20240 ret_ref = (uint64_t)ret_var.inner;
20241 if (ret_var.is_owned) {
20247 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
20248 LDKUpdateFailHTLC this_obj_conv;
20249 this_obj_conv.inner = (void*)(this_obj & (~1));
20250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20251 UpdateFailHTLC_free(this_obj_conv);
20254 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
20255 LDKUpdateFailHTLC this_ptr_conv;
20256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20257 this_ptr_conv.is_owned = false;
20258 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20259 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
20263 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20264 LDKUpdateFailHTLC this_ptr_conv;
20265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20266 this_ptr_conv.is_owned = false;
20267 LDKThirtyTwoBytes val_ref;
20268 CHECK(*((uint32_t*)val) == 32);
20269 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20270 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
20273 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
20274 LDKUpdateFailHTLC this_ptr_conv;
20275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20276 this_ptr_conv.is_owned = false;
20277 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
20281 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
20282 LDKUpdateFailHTLC this_ptr_conv;
20283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20284 this_ptr_conv.is_owned = false;
20285 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
20288 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
20289 LDKUpdateFailHTLC orig_conv;
20290 orig_conv.inner = (void*)(orig & (~1));
20291 orig_conv.is_owned = false;
20292 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
20293 uint64_t ret_ref = 0;
20294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20296 ret_ref = (uint64_t)ret_var.inner;
20297 if (ret_var.is_owned) {
20303 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
20304 LDKUpdateFailMalformedHTLC this_obj_conv;
20305 this_obj_conv.inner = (void*)(this_obj & (~1));
20306 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20307 UpdateFailMalformedHTLC_free(this_obj_conv);
20310 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
20311 LDKUpdateFailMalformedHTLC this_ptr_conv;
20312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20313 this_ptr_conv.is_owned = false;
20314 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20315 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
20319 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20320 LDKUpdateFailMalformedHTLC this_ptr_conv;
20321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20322 this_ptr_conv.is_owned = false;
20323 LDKThirtyTwoBytes val_ref;
20324 CHECK(*((uint32_t*)val) == 32);
20325 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20326 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
20329 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
20330 LDKUpdateFailMalformedHTLC this_ptr_conv;
20331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20332 this_ptr_conv.is_owned = false;
20333 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
20337 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
20338 LDKUpdateFailMalformedHTLC this_ptr_conv;
20339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20340 this_ptr_conv.is_owned = false;
20341 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
20344 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
20345 LDKUpdateFailMalformedHTLC this_ptr_conv;
20346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20347 this_ptr_conv.is_owned = false;
20348 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
20352 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
20353 LDKUpdateFailMalformedHTLC this_ptr_conv;
20354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20355 this_ptr_conv.is_owned = false;
20356 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
20359 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
20360 LDKUpdateFailMalformedHTLC orig_conv;
20361 orig_conv.inner = (void*)(orig & (~1));
20362 orig_conv.is_owned = false;
20363 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
20364 uint64_t ret_ref = 0;
20365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20367 ret_ref = (uint64_t)ret_var.inner;
20368 if (ret_var.is_owned) {
20374 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
20375 LDKCommitmentSigned this_obj_conv;
20376 this_obj_conv.inner = (void*)(this_obj & (~1));
20377 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20378 CommitmentSigned_free(this_obj_conv);
20381 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
20382 LDKCommitmentSigned this_ptr_conv;
20383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20384 this_ptr_conv.is_owned = false;
20385 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20386 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
20390 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20391 LDKCommitmentSigned this_ptr_conv;
20392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20393 this_ptr_conv.is_owned = false;
20394 LDKThirtyTwoBytes val_ref;
20395 CHECK(*((uint32_t*)val) == 32);
20396 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20397 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
20400 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
20401 LDKCommitmentSigned this_ptr_conv;
20402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20403 this_ptr_conv.is_owned = false;
20404 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20405 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
20409 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
20410 LDKCommitmentSigned this_ptr_conv;
20411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20412 this_ptr_conv.is_owned = false;
20413 LDKSignature val_ref;
20414 CHECK(*((uint32_t*)val) == 64);
20415 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20416 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
20419 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
20420 LDKCommitmentSigned this_ptr_conv;
20421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20422 this_ptr_conv.is_owned = false;
20423 LDKCVec_SignatureZ val_constr;
20424 val_constr.datalen = *((uint32_t*)val);
20425 if (val_constr.datalen > 0)
20426 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20428 val_constr.data = NULL;
20429 int8_tArray* val_vals = (int8_tArray*)(val + 4);
20430 for (size_t m = 0; m < val_constr.datalen; m++) {
20431 int8_tArray val_conv_12 = val_vals[m];
20432 LDKSignature val_conv_12_ref;
20433 CHECK(*((uint32_t*)val_conv_12) == 64);
20434 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
20435 val_constr.data[m] = val_conv_12_ref;
20437 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
20440 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
20441 LDKThirtyTwoBytes channel_id_arg_ref;
20442 CHECK(*((uint32_t*)channel_id_arg) == 32);
20443 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20444 LDKSignature signature_arg_ref;
20445 CHECK(*((uint32_t*)signature_arg) == 64);
20446 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
20447 LDKCVec_SignatureZ htlc_signatures_arg_constr;
20448 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
20449 if (htlc_signatures_arg_constr.datalen > 0)
20450 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20452 htlc_signatures_arg_constr.data = NULL;
20453 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
20454 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
20455 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
20456 LDKSignature htlc_signatures_arg_conv_12_ref;
20457 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
20458 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
20459 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
20461 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
20462 uint64_t ret_ref = 0;
20463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20465 ret_ref = (uint64_t)ret_var.inner;
20466 if (ret_var.is_owned) {
20472 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
20473 LDKCommitmentSigned orig_conv;
20474 orig_conv.inner = (void*)(orig & (~1));
20475 orig_conv.is_owned = false;
20476 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
20477 uint64_t ret_ref = 0;
20478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20480 ret_ref = (uint64_t)ret_var.inner;
20481 if (ret_var.is_owned) {
20487 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
20488 LDKRevokeAndACK this_obj_conv;
20489 this_obj_conv.inner = (void*)(this_obj & (~1));
20490 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20491 RevokeAndACK_free(this_obj_conv);
20494 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
20495 LDKRevokeAndACK this_ptr_conv;
20496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20497 this_ptr_conv.is_owned = false;
20498 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20499 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
20503 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20504 LDKRevokeAndACK this_ptr_conv;
20505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20506 this_ptr_conv.is_owned = false;
20507 LDKThirtyTwoBytes val_ref;
20508 CHECK(*((uint32_t*)val) == 32);
20509 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20510 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
20513 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
20514 LDKRevokeAndACK this_ptr_conv;
20515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20516 this_ptr_conv.is_owned = false;
20517 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20518 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
20522 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
20523 LDKRevokeAndACK this_ptr_conv;
20524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20525 this_ptr_conv.is_owned = false;
20526 LDKThirtyTwoBytes val_ref;
20527 CHECK(*((uint32_t*)val) == 32);
20528 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20529 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
20532 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
20533 LDKRevokeAndACK this_ptr_conv;
20534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20535 this_ptr_conv.is_owned = false;
20536 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20537 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
20541 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
20542 LDKRevokeAndACK this_ptr_conv;
20543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20544 this_ptr_conv.is_owned = false;
20545 LDKPublicKey val_ref;
20546 CHECK(*((uint32_t*)val) == 33);
20547 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20548 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
20551 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) {
20552 LDKThirtyTwoBytes channel_id_arg_ref;
20553 CHECK(*((uint32_t*)channel_id_arg) == 32);
20554 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20555 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
20556 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
20557 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
20558 LDKPublicKey next_per_commitment_point_arg_ref;
20559 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
20560 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
20561 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
20562 uint64_t ret_ref = 0;
20563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20565 ret_ref = (uint64_t)ret_var.inner;
20566 if (ret_var.is_owned) {
20572 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
20573 LDKRevokeAndACK orig_conv;
20574 orig_conv.inner = (void*)(orig & (~1));
20575 orig_conv.is_owned = false;
20576 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
20577 uint64_t ret_ref = 0;
20578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20580 ret_ref = (uint64_t)ret_var.inner;
20581 if (ret_var.is_owned) {
20587 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
20588 LDKUpdateFee this_obj_conv;
20589 this_obj_conv.inner = (void*)(this_obj & (~1));
20590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20591 UpdateFee_free(this_obj_conv);
20594 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
20595 LDKUpdateFee this_ptr_conv;
20596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20597 this_ptr_conv.is_owned = false;
20598 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20599 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
20603 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20604 LDKUpdateFee this_ptr_conv;
20605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20606 this_ptr_conv.is_owned = false;
20607 LDKThirtyTwoBytes val_ref;
20608 CHECK(*((uint32_t*)val) == 32);
20609 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20610 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
20613 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
20614 LDKUpdateFee this_ptr_conv;
20615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20616 this_ptr_conv.is_owned = false;
20617 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
20621 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
20622 LDKUpdateFee this_ptr_conv;
20623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20624 this_ptr_conv.is_owned = false;
20625 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
20628 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
20629 LDKThirtyTwoBytes channel_id_arg_ref;
20630 CHECK(*((uint32_t*)channel_id_arg) == 32);
20631 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20632 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
20633 uint64_t ret_ref = 0;
20634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20636 ret_ref = (uint64_t)ret_var.inner;
20637 if (ret_var.is_owned) {
20643 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
20644 LDKUpdateFee orig_conv;
20645 orig_conv.inner = (void*)(orig & (~1));
20646 orig_conv.is_owned = false;
20647 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
20648 uint64_t ret_ref = 0;
20649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20651 ret_ref = (uint64_t)ret_var.inner;
20652 if (ret_var.is_owned) {
20658 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
20659 LDKDataLossProtect this_obj_conv;
20660 this_obj_conv.inner = (void*)(this_obj & (~1));
20661 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20662 DataLossProtect_free(this_obj_conv);
20665 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
20666 LDKDataLossProtect this_ptr_conv;
20667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20668 this_ptr_conv.is_owned = false;
20669 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20670 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
20674 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
20675 LDKDataLossProtect this_ptr_conv;
20676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20677 this_ptr_conv.is_owned = false;
20678 LDKThirtyTwoBytes val_ref;
20679 CHECK(*((uint32_t*)val) == 32);
20680 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20681 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
20684 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
20685 LDKDataLossProtect this_ptr_conv;
20686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20687 this_ptr_conv.is_owned = false;
20688 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20689 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
20693 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
20694 LDKDataLossProtect this_ptr_conv;
20695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20696 this_ptr_conv.is_owned = false;
20697 LDKPublicKey val_ref;
20698 CHECK(*((uint32_t*)val) == 33);
20699 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20700 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
20703 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
20704 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
20705 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
20706 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
20707 LDKPublicKey my_current_per_commitment_point_arg_ref;
20708 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
20709 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
20710 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
20711 uint64_t ret_ref = 0;
20712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20714 ret_ref = (uint64_t)ret_var.inner;
20715 if (ret_var.is_owned) {
20721 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
20722 LDKDataLossProtect orig_conv;
20723 orig_conv.inner = (void*)(orig & (~1));
20724 orig_conv.is_owned = false;
20725 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
20726 uint64_t ret_ref = 0;
20727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20729 ret_ref = (uint64_t)ret_var.inner;
20730 if (ret_var.is_owned) {
20736 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
20737 LDKChannelReestablish this_obj_conv;
20738 this_obj_conv.inner = (void*)(this_obj & (~1));
20739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20740 ChannelReestablish_free(this_obj_conv);
20743 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
20744 LDKChannelReestablish this_ptr_conv;
20745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20746 this_ptr_conv.is_owned = false;
20747 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20748 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
20752 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20753 LDKChannelReestablish this_ptr_conv;
20754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20755 this_ptr_conv.is_owned = false;
20756 LDKThirtyTwoBytes val_ref;
20757 CHECK(*((uint32_t*)val) == 32);
20758 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20759 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
20762 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
20763 LDKChannelReestablish this_ptr_conv;
20764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20765 this_ptr_conv.is_owned = false;
20766 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
20770 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
20771 LDKChannelReestablish this_ptr_conv;
20772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20773 this_ptr_conv.is_owned = false;
20774 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
20777 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
20778 LDKChannelReestablish this_ptr_conv;
20779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20780 this_ptr_conv.is_owned = false;
20781 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
20785 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
20786 LDKChannelReestablish this_ptr_conv;
20787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20788 this_ptr_conv.is_owned = false;
20789 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
20792 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
20793 LDKChannelReestablish orig_conv;
20794 orig_conv.inner = (void*)(orig & (~1));
20795 orig_conv.is_owned = false;
20796 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
20797 uint64_t ret_ref = 0;
20798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20800 ret_ref = (uint64_t)ret_var.inner;
20801 if (ret_var.is_owned) {
20807 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
20808 LDKAnnouncementSignatures this_obj_conv;
20809 this_obj_conv.inner = (void*)(this_obj & (~1));
20810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20811 AnnouncementSignatures_free(this_obj_conv);
20814 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
20815 LDKAnnouncementSignatures this_ptr_conv;
20816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20817 this_ptr_conv.is_owned = false;
20818 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20819 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
20823 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20824 LDKAnnouncementSignatures this_ptr_conv;
20825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20826 this_ptr_conv.is_owned = false;
20827 LDKThirtyTwoBytes val_ref;
20828 CHECK(*((uint32_t*)val) == 32);
20829 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20830 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
20833 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
20834 LDKAnnouncementSignatures this_ptr_conv;
20835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20836 this_ptr_conv.is_owned = false;
20837 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
20841 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
20842 LDKAnnouncementSignatures this_ptr_conv;
20843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20844 this_ptr_conv.is_owned = false;
20845 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
20848 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
20849 LDKAnnouncementSignatures this_ptr_conv;
20850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20851 this_ptr_conv.is_owned = false;
20852 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20853 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
20857 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
20858 LDKAnnouncementSignatures this_ptr_conv;
20859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20860 this_ptr_conv.is_owned = false;
20861 LDKSignature val_ref;
20862 CHECK(*((uint32_t*)val) == 64);
20863 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20864 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
20867 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
20868 LDKAnnouncementSignatures this_ptr_conv;
20869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20870 this_ptr_conv.is_owned = false;
20871 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20872 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
20876 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
20877 LDKAnnouncementSignatures this_ptr_conv;
20878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20879 this_ptr_conv.is_owned = false;
20880 LDKSignature val_ref;
20881 CHECK(*((uint32_t*)val) == 64);
20882 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20883 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
20886 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) {
20887 LDKThirtyTwoBytes channel_id_arg_ref;
20888 CHECK(*((uint32_t*)channel_id_arg) == 32);
20889 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
20890 LDKSignature node_signature_arg_ref;
20891 CHECK(*((uint32_t*)node_signature_arg) == 64);
20892 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
20893 LDKSignature bitcoin_signature_arg_ref;
20894 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
20895 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
20896 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
20897 uint64_t ret_ref = 0;
20898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20900 ret_ref = (uint64_t)ret_var.inner;
20901 if (ret_var.is_owned) {
20907 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
20908 LDKAnnouncementSignatures orig_conv;
20909 orig_conv.inner = (void*)(orig & (~1));
20910 orig_conv.is_owned = false;
20911 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
20912 uint64_t ret_ref = 0;
20913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20915 ret_ref = (uint64_t)ret_var.inner;
20916 if (ret_var.is_owned) {
20922 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
20923 if ((this_ptr & 1) != 0) return;
20924 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20925 CHECK_ACCESS(this_ptr_ptr);
20926 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
20927 FREE((void*)this_ptr);
20928 NetAddress_free(this_ptr_conv);
20931 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
20932 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
20933 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
20934 *ret_copy = NetAddress_clone(orig_conv);
20935 uint64_t ret_ref = (uint64_t)ret_copy;
20939 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
20940 LDKFourBytes addr_ref;
20941 CHECK(*((uint32_t*)addr) == 4);
20942 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
20943 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
20944 *ret_copy = NetAddress_ipv4(addr_ref, port);
20945 uint64_t ret_ref = (uint64_t)ret_copy;
20949 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
20950 LDKSixteenBytes addr_ref;
20951 CHECK(*((uint32_t*)addr) == 16);
20952 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
20953 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
20954 *ret_copy = NetAddress_ipv6(addr_ref, port);
20955 uint64_t ret_ref = (uint64_t)ret_copy;
20959 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
20960 LDKTenBytes addr_ref;
20961 CHECK(*((uint32_t*)addr) == 10);
20962 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
20963 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
20964 *ret_copy = NetAddress_onion_v2(addr_ref, port);
20965 uint64_t ret_ref = (uint64_t)ret_copy;
20969 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
20970 LDKThirtyTwoBytes ed25519_pubkey_ref;
20971 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
20972 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
20973 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
20974 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
20975 uint64_t ret_ref = (uint64_t)ret_copy;
20979 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
20980 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
20981 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
20982 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20983 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20984 CVec_u8Z_free(ret_var);
20988 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
20989 LDKu8slice ser_ref;
20990 ser_ref.datalen = *((uint32_t*)ser);
20991 ser_ref.data = (int8_t*)(ser + 4);
20992 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20993 *ret_conv = NetAddress_read(ser_ref);
20994 return (uint64_t)ret_conv;
20997 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
20998 LDKUnsignedNodeAnnouncement this_obj_conv;
20999 this_obj_conv.inner = (void*)(this_obj & (~1));
21000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21001 UnsignedNodeAnnouncement_free(this_obj_conv);
21004 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
21005 LDKUnsignedNodeAnnouncement this_ptr_conv;
21006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21007 this_ptr_conv.is_owned = false;
21008 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
21009 uint64_t ret_ref = 0;
21010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21012 ret_ref = (uint64_t)ret_var.inner;
21013 if (ret_var.is_owned) {
21019 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
21020 LDKUnsignedNodeAnnouncement this_ptr_conv;
21021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21022 this_ptr_conv.is_owned = false;
21023 LDKNodeFeatures val_conv;
21024 val_conv.inner = (void*)(val & (~1));
21025 val_conv.is_owned = (val & 1) || (val == 0);
21026 val_conv = NodeFeatures_clone(&val_conv);
21027 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
21030 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
21031 LDKUnsignedNodeAnnouncement this_ptr_conv;
21032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21033 this_ptr_conv.is_owned = false;
21034 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
21038 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
21039 LDKUnsignedNodeAnnouncement this_ptr_conv;
21040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21041 this_ptr_conv.is_owned = false;
21042 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
21045 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
21046 LDKUnsignedNodeAnnouncement this_ptr_conv;
21047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21048 this_ptr_conv.is_owned = false;
21049 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21050 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
21054 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
21055 LDKUnsignedNodeAnnouncement this_ptr_conv;
21056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21057 this_ptr_conv.is_owned = false;
21058 LDKPublicKey val_ref;
21059 CHECK(*((uint32_t*)val) == 33);
21060 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21061 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
21064 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
21065 LDKUnsignedNodeAnnouncement this_ptr_conv;
21066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21067 this_ptr_conv.is_owned = false;
21068 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
21069 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
21073 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
21074 LDKUnsignedNodeAnnouncement this_ptr_conv;
21075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21076 this_ptr_conv.is_owned = false;
21077 LDKThreeBytes val_ref;
21078 CHECK(*((uint32_t*)val) == 3);
21079 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
21080 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
21083 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
21084 LDKUnsignedNodeAnnouncement this_ptr_conv;
21085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21086 this_ptr_conv.is_owned = false;
21087 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21088 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
21092 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
21093 LDKUnsignedNodeAnnouncement this_ptr_conv;
21094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21095 this_ptr_conv.is_owned = false;
21096 LDKThirtyTwoBytes val_ref;
21097 CHECK(*((uint32_t*)val) == 32);
21098 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21099 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
21102 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
21103 LDKUnsignedNodeAnnouncement this_ptr_conv;
21104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21105 this_ptr_conv.is_owned = false;
21106 LDKCVec_NetAddressZ val_constr;
21107 val_constr.datalen = *((uint32_t*)val);
21108 if (val_constr.datalen > 0)
21109 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21111 val_constr.data = NULL;
21112 uint32_t* val_vals = (uint32_t*)(val + 4);
21113 for (size_t m = 0; m < val_constr.datalen; m++) {
21114 uint32_t val_conv_12 = val_vals[m];
21115 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
21116 CHECK_ACCESS(val_conv_12_ptr);
21117 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
21118 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
21119 val_constr.data[m] = val_conv_12_conv;
21121 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
21124 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
21125 LDKUnsignedNodeAnnouncement orig_conv;
21126 orig_conv.inner = (void*)(orig & (~1));
21127 orig_conv.is_owned = false;
21128 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
21129 uint64_t ret_ref = 0;
21130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21132 ret_ref = (uint64_t)ret_var.inner;
21133 if (ret_var.is_owned) {
21139 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
21140 LDKNodeAnnouncement this_obj_conv;
21141 this_obj_conv.inner = (void*)(this_obj & (~1));
21142 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21143 NodeAnnouncement_free(this_obj_conv);
21146 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
21147 LDKNodeAnnouncement this_ptr_conv;
21148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21149 this_ptr_conv.is_owned = false;
21150 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21151 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
21155 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
21156 LDKNodeAnnouncement this_ptr_conv;
21157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21158 this_ptr_conv.is_owned = false;
21159 LDKSignature val_ref;
21160 CHECK(*((uint32_t*)val) == 64);
21161 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21162 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
21165 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
21166 LDKNodeAnnouncement this_ptr_conv;
21167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21168 this_ptr_conv.is_owned = false;
21169 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
21170 uint64_t ret_ref = 0;
21171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21173 ret_ref = (uint64_t)ret_var.inner;
21174 if (ret_var.is_owned) {
21180 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
21181 LDKNodeAnnouncement this_ptr_conv;
21182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21183 this_ptr_conv.is_owned = false;
21184 LDKUnsignedNodeAnnouncement val_conv;
21185 val_conv.inner = (void*)(val & (~1));
21186 val_conv.is_owned = (val & 1) || (val == 0);
21187 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
21188 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
21191 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
21192 LDKSignature signature_arg_ref;
21193 CHECK(*((uint32_t*)signature_arg) == 64);
21194 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
21195 LDKUnsignedNodeAnnouncement contents_arg_conv;
21196 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21197 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21198 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
21199 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
21200 uint64_t ret_ref = 0;
21201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21203 ret_ref = (uint64_t)ret_var.inner;
21204 if (ret_var.is_owned) {
21210 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
21211 LDKNodeAnnouncement orig_conv;
21212 orig_conv.inner = (void*)(orig & (~1));
21213 orig_conv.is_owned = false;
21214 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
21215 uint64_t ret_ref = 0;
21216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21218 ret_ref = (uint64_t)ret_var.inner;
21219 if (ret_var.is_owned) {
21225 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
21226 LDKUnsignedChannelAnnouncement this_obj_conv;
21227 this_obj_conv.inner = (void*)(this_obj & (~1));
21228 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21229 UnsignedChannelAnnouncement_free(this_obj_conv);
21232 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
21233 LDKUnsignedChannelAnnouncement this_ptr_conv;
21234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21235 this_ptr_conv.is_owned = false;
21236 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
21237 uint64_t ret_ref = 0;
21238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21240 ret_ref = (uint64_t)ret_var.inner;
21241 if (ret_var.is_owned) {
21247 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
21248 LDKUnsignedChannelAnnouncement this_ptr_conv;
21249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21250 this_ptr_conv.is_owned = false;
21251 LDKChannelFeatures val_conv;
21252 val_conv.inner = (void*)(val & (~1));
21253 val_conv.is_owned = (val & 1) || (val == 0);
21254 val_conv = ChannelFeatures_clone(&val_conv);
21255 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
21258 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
21259 LDKUnsignedChannelAnnouncement this_ptr_conv;
21260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21261 this_ptr_conv.is_owned = false;
21262 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21263 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
21267 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
21268 LDKUnsignedChannelAnnouncement this_ptr_conv;
21269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21270 this_ptr_conv.is_owned = false;
21271 LDKThirtyTwoBytes val_ref;
21272 CHECK(*((uint32_t*)val) == 32);
21273 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21274 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
21277 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
21278 LDKUnsignedChannelAnnouncement this_ptr_conv;
21279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21280 this_ptr_conv.is_owned = false;
21281 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
21285 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21286 LDKUnsignedChannelAnnouncement this_ptr_conv;
21287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21288 this_ptr_conv.is_owned = false;
21289 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
21292 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
21293 LDKUnsignedChannelAnnouncement this_ptr_conv;
21294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21295 this_ptr_conv.is_owned = false;
21296 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21297 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
21301 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
21302 LDKUnsignedChannelAnnouncement this_ptr_conv;
21303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21304 this_ptr_conv.is_owned = false;
21305 LDKPublicKey val_ref;
21306 CHECK(*((uint32_t*)val) == 33);
21307 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21308 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
21311 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
21312 LDKUnsignedChannelAnnouncement this_ptr_conv;
21313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21314 this_ptr_conv.is_owned = false;
21315 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21316 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
21320 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
21321 LDKUnsignedChannelAnnouncement this_ptr_conv;
21322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21323 this_ptr_conv.is_owned = false;
21324 LDKPublicKey val_ref;
21325 CHECK(*((uint32_t*)val) == 33);
21326 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21327 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
21330 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
21331 LDKUnsignedChannelAnnouncement this_ptr_conv;
21332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21333 this_ptr_conv.is_owned = false;
21334 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21335 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
21339 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
21340 LDKUnsignedChannelAnnouncement this_ptr_conv;
21341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21342 this_ptr_conv.is_owned = false;
21343 LDKPublicKey val_ref;
21344 CHECK(*((uint32_t*)val) == 33);
21345 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21346 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
21349 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
21350 LDKUnsignedChannelAnnouncement this_ptr_conv;
21351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21352 this_ptr_conv.is_owned = false;
21353 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21354 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
21358 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
21359 LDKUnsignedChannelAnnouncement this_ptr_conv;
21360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21361 this_ptr_conv.is_owned = false;
21362 LDKPublicKey val_ref;
21363 CHECK(*((uint32_t*)val) == 33);
21364 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21365 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
21368 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
21369 LDKUnsignedChannelAnnouncement orig_conv;
21370 orig_conv.inner = (void*)(orig & (~1));
21371 orig_conv.is_owned = false;
21372 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
21373 uint64_t ret_ref = 0;
21374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21376 ret_ref = (uint64_t)ret_var.inner;
21377 if (ret_var.is_owned) {
21383 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
21384 LDKChannelAnnouncement this_obj_conv;
21385 this_obj_conv.inner = (void*)(this_obj & (~1));
21386 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21387 ChannelAnnouncement_free(this_obj_conv);
21390 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
21391 LDKChannelAnnouncement this_ptr_conv;
21392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21393 this_ptr_conv.is_owned = false;
21394 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21395 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
21399 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
21400 LDKChannelAnnouncement this_ptr_conv;
21401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21402 this_ptr_conv.is_owned = false;
21403 LDKSignature val_ref;
21404 CHECK(*((uint32_t*)val) == 64);
21405 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21406 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
21409 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
21410 LDKChannelAnnouncement this_ptr_conv;
21411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21412 this_ptr_conv.is_owned = false;
21413 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21414 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
21418 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
21419 LDKChannelAnnouncement this_ptr_conv;
21420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21421 this_ptr_conv.is_owned = false;
21422 LDKSignature val_ref;
21423 CHECK(*((uint32_t*)val) == 64);
21424 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21425 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
21428 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
21429 LDKChannelAnnouncement this_ptr_conv;
21430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21431 this_ptr_conv.is_owned = false;
21432 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21433 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
21437 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
21438 LDKChannelAnnouncement this_ptr_conv;
21439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21440 this_ptr_conv.is_owned = false;
21441 LDKSignature val_ref;
21442 CHECK(*((uint32_t*)val) == 64);
21443 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21444 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
21447 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
21448 LDKChannelAnnouncement this_ptr_conv;
21449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21450 this_ptr_conv.is_owned = false;
21451 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21452 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
21456 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
21457 LDKChannelAnnouncement this_ptr_conv;
21458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21459 this_ptr_conv.is_owned = false;
21460 LDKSignature val_ref;
21461 CHECK(*((uint32_t*)val) == 64);
21462 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21463 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
21466 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
21467 LDKChannelAnnouncement this_ptr_conv;
21468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21469 this_ptr_conv.is_owned = false;
21470 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
21471 uint64_t ret_ref = 0;
21472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21474 ret_ref = (uint64_t)ret_var.inner;
21475 if (ret_var.is_owned) {
21481 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
21482 LDKChannelAnnouncement this_ptr_conv;
21483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21484 this_ptr_conv.is_owned = false;
21485 LDKUnsignedChannelAnnouncement val_conv;
21486 val_conv.inner = (void*)(val & (~1));
21487 val_conv.is_owned = (val & 1) || (val == 0);
21488 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
21489 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
21492 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) {
21493 LDKSignature node_signature_1_arg_ref;
21494 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
21495 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
21496 LDKSignature node_signature_2_arg_ref;
21497 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
21498 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
21499 LDKSignature bitcoin_signature_1_arg_ref;
21500 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
21501 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
21502 LDKSignature bitcoin_signature_2_arg_ref;
21503 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
21504 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
21505 LDKUnsignedChannelAnnouncement contents_arg_conv;
21506 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21507 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21508 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
21509 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);
21510 uint64_t ret_ref = 0;
21511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21513 ret_ref = (uint64_t)ret_var.inner;
21514 if (ret_var.is_owned) {
21520 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
21521 LDKChannelAnnouncement orig_conv;
21522 orig_conv.inner = (void*)(orig & (~1));
21523 orig_conv.is_owned = false;
21524 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
21525 uint64_t ret_ref = 0;
21526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21528 ret_ref = (uint64_t)ret_var.inner;
21529 if (ret_var.is_owned) {
21535 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
21536 LDKUnsignedChannelUpdate this_obj_conv;
21537 this_obj_conv.inner = (void*)(this_obj & (~1));
21538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21539 UnsignedChannelUpdate_free(this_obj_conv);
21542 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
21543 LDKUnsignedChannelUpdate this_ptr_conv;
21544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21545 this_ptr_conv.is_owned = false;
21546 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21547 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
21551 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
21552 LDKUnsignedChannelUpdate this_ptr_conv;
21553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21554 this_ptr_conv.is_owned = false;
21555 LDKThirtyTwoBytes val_ref;
21556 CHECK(*((uint32_t*)val) == 32);
21557 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21558 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
21561 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
21562 LDKUnsignedChannelUpdate this_ptr_conv;
21563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21564 this_ptr_conv.is_owned = false;
21565 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
21569 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21570 LDKUnsignedChannelUpdate this_ptr_conv;
21571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21572 this_ptr_conv.is_owned = false;
21573 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
21576 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
21577 LDKUnsignedChannelUpdate this_ptr_conv;
21578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21579 this_ptr_conv.is_owned = false;
21580 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
21584 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
21585 LDKUnsignedChannelUpdate this_ptr_conv;
21586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21587 this_ptr_conv.is_owned = false;
21588 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
21591 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
21592 LDKUnsignedChannelUpdate this_ptr_conv;
21593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21594 this_ptr_conv.is_owned = false;
21595 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
21599 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
21600 LDKUnsignedChannelUpdate this_ptr_conv;
21601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21602 this_ptr_conv.is_owned = false;
21603 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
21606 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
21607 LDKUnsignedChannelUpdate this_ptr_conv;
21608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21609 this_ptr_conv.is_owned = false;
21610 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
21614 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21615 LDKUnsignedChannelUpdate this_ptr_conv;
21616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21617 this_ptr_conv.is_owned = false;
21618 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
21621 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
21622 LDKUnsignedChannelUpdate this_ptr_conv;
21623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21624 this_ptr_conv.is_owned = false;
21625 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
21629 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
21630 LDKUnsignedChannelUpdate this_ptr_conv;
21631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21632 this_ptr_conv.is_owned = false;
21633 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
21636 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
21637 LDKUnsignedChannelUpdate this_ptr_conv;
21638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21639 this_ptr_conv.is_owned = false;
21640 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
21644 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
21645 LDKUnsignedChannelUpdate this_ptr_conv;
21646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21647 this_ptr_conv.is_owned = false;
21648 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
21651 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
21652 LDKUnsignedChannelUpdate this_ptr_conv;
21653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21654 this_ptr_conv.is_owned = false;
21655 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
21659 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
21660 LDKUnsignedChannelUpdate this_ptr_conv;
21661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21662 this_ptr_conv.is_owned = false;
21663 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
21666 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
21667 LDKUnsignedChannelUpdate orig_conv;
21668 orig_conv.inner = (void*)(orig & (~1));
21669 orig_conv.is_owned = false;
21670 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
21671 uint64_t ret_ref = 0;
21672 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21673 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21674 ret_ref = (uint64_t)ret_var.inner;
21675 if (ret_var.is_owned) {
21681 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
21682 LDKChannelUpdate this_obj_conv;
21683 this_obj_conv.inner = (void*)(this_obj & (~1));
21684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21685 ChannelUpdate_free(this_obj_conv);
21688 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
21689 LDKChannelUpdate this_ptr_conv;
21690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21691 this_ptr_conv.is_owned = false;
21692 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21693 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
21697 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
21698 LDKChannelUpdate this_ptr_conv;
21699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21700 this_ptr_conv.is_owned = false;
21701 LDKSignature val_ref;
21702 CHECK(*((uint32_t*)val) == 64);
21703 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
21704 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
21707 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
21708 LDKChannelUpdate this_ptr_conv;
21709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21710 this_ptr_conv.is_owned = false;
21711 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
21712 uint64_t ret_ref = 0;
21713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21715 ret_ref = (uint64_t)ret_var.inner;
21716 if (ret_var.is_owned) {
21722 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
21723 LDKChannelUpdate this_ptr_conv;
21724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21725 this_ptr_conv.is_owned = false;
21726 LDKUnsignedChannelUpdate val_conv;
21727 val_conv.inner = (void*)(val & (~1));
21728 val_conv.is_owned = (val & 1) || (val == 0);
21729 val_conv = UnsignedChannelUpdate_clone(&val_conv);
21730 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
21733 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
21734 LDKSignature signature_arg_ref;
21735 CHECK(*((uint32_t*)signature_arg) == 64);
21736 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
21737 LDKUnsignedChannelUpdate contents_arg_conv;
21738 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21739 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21740 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
21741 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
21742 uint64_t ret_ref = 0;
21743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21745 ret_ref = (uint64_t)ret_var.inner;
21746 if (ret_var.is_owned) {
21752 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
21753 LDKChannelUpdate orig_conv;
21754 orig_conv.inner = (void*)(orig & (~1));
21755 orig_conv.is_owned = false;
21756 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
21757 uint64_t ret_ref = 0;
21758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21760 ret_ref = (uint64_t)ret_var.inner;
21761 if (ret_var.is_owned) {
21767 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
21768 LDKQueryChannelRange this_obj_conv;
21769 this_obj_conv.inner = (void*)(this_obj & (~1));
21770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21771 QueryChannelRange_free(this_obj_conv);
21774 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
21775 LDKQueryChannelRange this_ptr_conv;
21776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21777 this_ptr_conv.is_owned = false;
21778 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21779 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
21783 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
21784 LDKQueryChannelRange this_ptr_conv;
21785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21786 this_ptr_conv.is_owned = false;
21787 LDKThirtyTwoBytes val_ref;
21788 CHECK(*((uint32_t*)val) == 32);
21789 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21790 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
21793 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
21794 LDKQueryChannelRange this_ptr_conv;
21795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21796 this_ptr_conv.is_owned = false;
21797 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
21801 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
21802 LDKQueryChannelRange this_ptr_conv;
21803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21804 this_ptr_conv.is_owned = false;
21805 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
21808 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
21809 LDKQueryChannelRange this_ptr_conv;
21810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21811 this_ptr_conv.is_owned = false;
21812 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
21816 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
21817 LDKQueryChannelRange this_ptr_conv;
21818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21819 this_ptr_conv.is_owned = false;
21820 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
21823 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
21824 LDKThirtyTwoBytes chain_hash_arg_ref;
21825 CHECK(*((uint32_t*)chain_hash_arg) == 32);
21826 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
21827 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
21828 uint64_t ret_ref = 0;
21829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21831 ret_ref = (uint64_t)ret_var.inner;
21832 if (ret_var.is_owned) {
21838 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
21839 LDKQueryChannelRange orig_conv;
21840 orig_conv.inner = (void*)(orig & (~1));
21841 orig_conv.is_owned = false;
21842 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
21843 uint64_t ret_ref = 0;
21844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21846 ret_ref = (uint64_t)ret_var.inner;
21847 if (ret_var.is_owned) {
21853 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
21854 LDKReplyChannelRange this_obj_conv;
21855 this_obj_conv.inner = (void*)(this_obj & (~1));
21856 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21857 ReplyChannelRange_free(this_obj_conv);
21860 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
21861 LDKReplyChannelRange this_ptr_conv;
21862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21863 this_ptr_conv.is_owned = false;
21864 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21865 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
21869 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
21870 LDKReplyChannelRange this_ptr_conv;
21871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21872 this_ptr_conv.is_owned = false;
21873 LDKThirtyTwoBytes val_ref;
21874 CHECK(*((uint32_t*)val) == 32);
21875 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21876 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
21879 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
21880 LDKReplyChannelRange this_ptr_conv;
21881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21882 this_ptr_conv.is_owned = false;
21883 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
21887 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
21888 LDKReplyChannelRange this_ptr_conv;
21889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21890 this_ptr_conv.is_owned = false;
21891 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
21894 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
21895 LDKReplyChannelRange this_ptr_conv;
21896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21897 this_ptr_conv.is_owned = false;
21898 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
21902 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
21903 LDKReplyChannelRange this_ptr_conv;
21904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21905 this_ptr_conv.is_owned = false;
21906 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
21909 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
21910 LDKReplyChannelRange this_ptr_conv;
21911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21912 this_ptr_conv.is_owned = false;
21913 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
21917 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
21918 LDKReplyChannelRange this_ptr_conv;
21919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21920 this_ptr_conv.is_owned = false;
21921 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
21924 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
21925 LDKReplyChannelRange this_ptr_conv;
21926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21927 this_ptr_conv.is_owned = false;
21928 LDKCVec_u64Z val_constr;
21929 val_constr.datalen = *((uint32_t*)val);
21930 if (val_constr.datalen > 0)
21931 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21933 val_constr.data = NULL;
21934 int64_t* val_vals = (int64_t*)(val + 4);
21935 for (size_t i = 0; i < val_constr.datalen; i++) {
21936 int64_t val_conv_8 = val_vals[i];
21937 val_constr.data[i] = val_conv_8;
21939 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
21942 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) {
21943 LDKThirtyTwoBytes chain_hash_arg_ref;
21944 CHECK(*((uint32_t*)chain_hash_arg) == 32);
21945 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
21946 LDKCVec_u64Z short_channel_ids_arg_constr;
21947 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
21948 if (short_channel_ids_arg_constr.datalen > 0)
21949 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21951 short_channel_ids_arg_constr.data = NULL;
21952 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
21953 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
21954 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
21955 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
21957 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
21958 uint64_t ret_ref = 0;
21959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21961 ret_ref = (uint64_t)ret_var.inner;
21962 if (ret_var.is_owned) {
21968 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
21969 LDKReplyChannelRange orig_conv;
21970 orig_conv.inner = (void*)(orig & (~1));
21971 orig_conv.is_owned = false;
21972 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
21973 uint64_t ret_ref = 0;
21974 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21975 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21976 ret_ref = (uint64_t)ret_var.inner;
21977 if (ret_var.is_owned) {
21983 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
21984 LDKQueryShortChannelIds this_obj_conv;
21985 this_obj_conv.inner = (void*)(this_obj & (~1));
21986 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21987 QueryShortChannelIds_free(this_obj_conv);
21990 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
21991 LDKQueryShortChannelIds this_ptr_conv;
21992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21993 this_ptr_conv.is_owned = false;
21994 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21995 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
21999 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22000 LDKQueryShortChannelIds this_ptr_conv;
22001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22002 this_ptr_conv.is_owned = false;
22003 LDKThirtyTwoBytes val_ref;
22004 CHECK(*((uint32_t*)val) == 32);
22005 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22006 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
22009 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
22010 LDKQueryShortChannelIds this_ptr_conv;
22011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22012 this_ptr_conv.is_owned = false;
22013 LDKCVec_u64Z val_constr;
22014 val_constr.datalen = *((uint32_t*)val);
22015 if (val_constr.datalen > 0)
22016 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22018 val_constr.data = NULL;
22019 int64_t* val_vals = (int64_t*)(val + 4);
22020 for (size_t i = 0; i < val_constr.datalen; i++) {
22021 int64_t val_conv_8 = val_vals[i];
22022 val_constr.data[i] = val_conv_8;
22024 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
22027 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
22028 LDKThirtyTwoBytes chain_hash_arg_ref;
22029 CHECK(*((uint32_t*)chain_hash_arg) == 32);
22030 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
22031 LDKCVec_u64Z short_channel_ids_arg_constr;
22032 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
22033 if (short_channel_ids_arg_constr.datalen > 0)
22034 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22036 short_channel_ids_arg_constr.data = NULL;
22037 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
22038 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
22039 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
22040 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
22042 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
22043 uint64_t ret_ref = 0;
22044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22046 ret_ref = (uint64_t)ret_var.inner;
22047 if (ret_var.is_owned) {
22053 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
22054 LDKQueryShortChannelIds orig_conv;
22055 orig_conv.inner = (void*)(orig & (~1));
22056 orig_conv.is_owned = false;
22057 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
22058 uint64_t ret_ref = 0;
22059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22061 ret_ref = (uint64_t)ret_var.inner;
22062 if (ret_var.is_owned) {
22068 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
22069 LDKReplyShortChannelIdsEnd this_obj_conv;
22070 this_obj_conv.inner = (void*)(this_obj & (~1));
22071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22072 ReplyShortChannelIdsEnd_free(this_obj_conv);
22075 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
22076 LDKReplyShortChannelIdsEnd this_ptr_conv;
22077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22078 this_ptr_conv.is_owned = false;
22079 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22080 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
22084 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22085 LDKReplyShortChannelIdsEnd this_ptr_conv;
22086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22087 this_ptr_conv.is_owned = false;
22088 LDKThirtyTwoBytes val_ref;
22089 CHECK(*((uint32_t*)val) == 32);
22090 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22091 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
22094 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
22095 LDKReplyShortChannelIdsEnd this_ptr_conv;
22096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22097 this_ptr_conv.is_owned = false;
22098 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
22102 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
22103 LDKReplyShortChannelIdsEnd this_ptr_conv;
22104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22105 this_ptr_conv.is_owned = false;
22106 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
22109 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
22110 LDKThirtyTwoBytes chain_hash_arg_ref;
22111 CHECK(*((uint32_t*)chain_hash_arg) == 32);
22112 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
22113 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
22114 uint64_t ret_ref = 0;
22115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22117 ret_ref = (uint64_t)ret_var.inner;
22118 if (ret_var.is_owned) {
22124 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
22125 LDKReplyShortChannelIdsEnd orig_conv;
22126 orig_conv.inner = (void*)(orig & (~1));
22127 orig_conv.is_owned = false;
22128 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
22129 uint64_t ret_ref = 0;
22130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22132 ret_ref = (uint64_t)ret_var.inner;
22133 if (ret_var.is_owned) {
22139 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
22140 LDKGossipTimestampFilter this_obj_conv;
22141 this_obj_conv.inner = (void*)(this_obj & (~1));
22142 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22143 GossipTimestampFilter_free(this_obj_conv);
22146 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
22147 LDKGossipTimestampFilter this_ptr_conv;
22148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22149 this_ptr_conv.is_owned = false;
22150 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22151 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
22155 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22156 LDKGossipTimestampFilter this_ptr_conv;
22157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22158 this_ptr_conv.is_owned = false;
22159 LDKThirtyTwoBytes val_ref;
22160 CHECK(*((uint32_t*)val) == 32);
22161 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22162 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
22165 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
22166 LDKGossipTimestampFilter this_ptr_conv;
22167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22168 this_ptr_conv.is_owned = false;
22169 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
22173 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
22174 LDKGossipTimestampFilter this_ptr_conv;
22175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22176 this_ptr_conv.is_owned = false;
22177 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
22180 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
22181 LDKGossipTimestampFilter this_ptr_conv;
22182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22183 this_ptr_conv.is_owned = false;
22184 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
22188 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
22189 LDKGossipTimestampFilter this_ptr_conv;
22190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22191 this_ptr_conv.is_owned = false;
22192 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
22195 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
22196 LDKThirtyTwoBytes chain_hash_arg_ref;
22197 CHECK(*((uint32_t*)chain_hash_arg) == 32);
22198 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
22199 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
22200 uint64_t ret_ref = 0;
22201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22203 ret_ref = (uint64_t)ret_var.inner;
22204 if (ret_var.is_owned) {
22210 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
22211 LDKGossipTimestampFilter orig_conv;
22212 orig_conv.inner = (void*)(orig & (~1));
22213 orig_conv.is_owned = false;
22214 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
22215 uint64_t ret_ref = 0;
22216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22218 ret_ref = (uint64_t)ret_var.inner;
22219 if (ret_var.is_owned) {
22225 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
22226 if ((this_ptr & 1) != 0) return;
22227 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22228 CHECK_ACCESS(this_ptr_ptr);
22229 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
22230 FREE((void*)this_ptr);
22231 ErrorAction_free(this_ptr_conv);
22234 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
22235 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
22236 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22237 *ret_copy = ErrorAction_clone(orig_conv);
22238 uint64_t ret_ref = (uint64_t)ret_copy;
22242 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
22243 LDKErrorMessage msg_conv;
22244 msg_conv.inner = (void*)(msg & (~1));
22245 msg_conv.is_owned = (msg & 1) || (msg == 0);
22246 msg_conv = ErrorMessage_clone(&msg_conv);
22247 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22248 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
22249 uint64_t ret_ref = (uint64_t)ret_copy;
22253 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
22254 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22255 *ret_copy = ErrorAction_ignore_error();
22256 uint64_t ret_ref = (uint64_t)ret_copy;
22260 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
22261 LDKLevel a_conv = LDKLevel_from_js(a);
22262 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22263 *ret_copy = ErrorAction_ignore_and_log(a_conv);
22264 uint64_t ret_ref = (uint64_t)ret_copy;
22268 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
22269 LDKErrorMessage msg_conv;
22270 msg_conv.inner = (void*)(msg & (~1));
22271 msg_conv.is_owned = (msg & 1) || (msg == 0);
22272 msg_conv = ErrorMessage_clone(&msg_conv);
22273 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22274 *ret_copy = ErrorAction_send_error_message(msg_conv);
22275 uint64_t ret_ref = (uint64_t)ret_copy;
22279 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
22280 LDKLightningError this_obj_conv;
22281 this_obj_conv.inner = (void*)(this_obj & (~1));
22282 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22283 LightningError_free(this_obj_conv);
22286 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
22287 LDKLightningError this_ptr_conv;
22288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22289 this_ptr_conv.is_owned = false;
22290 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
22291 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22296 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
22297 LDKLightningError this_ptr_conv;
22298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22299 this_ptr_conv.is_owned = false;
22300 LDKStr val_conv = str_ref_to_owned_c(val);
22301 LightningError_set_err(&this_ptr_conv, val_conv);
22304 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
22305 LDKLightningError this_ptr_conv;
22306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22307 this_ptr_conv.is_owned = false;
22308 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22309 *ret_copy = LightningError_get_action(&this_ptr_conv);
22310 uint64_t ret_ref = (uint64_t)ret_copy;
22314 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
22315 LDKLightningError this_ptr_conv;
22316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22317 this_ptr_conv.is_owned = false;
22318 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22319 CHECK_ACCESS(val_ptr);
22320 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
22321 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
22322 LightningError_set_action(&this_ptr_conv, val_conv);
22325 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
22326 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
22327 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
22328 CHECK_ACCESS(action_arg_ptr);
22329 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
22330 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
22331 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
22332 uint64_t ret_ref = 0;
22333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22335 ret_ref = (uint64_t)ret_var.inner;
22336 if (ret_var.is_owned) {
22342 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
22343 LDKLightningError orig_conv;
22344 orig_conv.inner = (void*)(orig & (~1));
22345 orig_conv.is_owned = false;
22346 LDKLightningError ret_var = LightningError_clone(&orig_conv);
22347 uint64_t ret_ref = 0;
22348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22350 ret_ref = (uint64_t)ret_var.inner;
22351 if (ret_var.is_owned) {
22357 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
22358 LDKCommitmentUpdate 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 CommitmentUpdate_free(this_obj_conv);
22364 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
22365 LDKCommitmentUpdate this_ptr_conv;
22366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22367 this_ptr_conv.is_owned = false;
22368 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
22369 uint32_tArray ret_arr = NULL;
22370 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
22371 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
22372 for (size_t p = 0; p < ret_var.datalen; p++) {
22373 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
22374 uint64_t ret_conv_15_ref = 0;
22375 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22376 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22377 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
22378 if (ret_conv_15_var.is_owned) {
22379 ret_conv_15_ref |= 1;
22381 ret_arr_ptr[p] = ret_conv_15_ref;
22384 FREE(ret_var.data);
22388 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
22389 LDKCommitmentUpdate this_ptr_conv;
22390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22391 this_ptr_conv.is_owned = false;
22392 LDKCVec_UpdateAddHTLCZ val_constr;
22393 val_constr.datalen = *((uint32_t*)val);
22394 if (val_constr.datalen > 0)
22395 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22397 val_constr.data = NULL;
22398 uint32_t* val_vals = (uint32_t*)(val + 4);
22399 for (size_t p = 0; p < val_constr.datalen; p++) {
22400 uint32_t val_conv_15 = val_vals[p];
22401 LDKUpdateAddHTLC val_conv_15_conv;
22402 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
22403 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
22404 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
22405 val_constr.data[p] = val_conv_15_conv;
22407 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
22410 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
22411 LDKCommitmentUpdate this_ptr_conv;
22412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22413 this_ptr_conv.is_owned = false;
22414 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
22415 uint32_tArray ret_arr = NULL;
22416 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
22417 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
22418 for (size_t t = 0; t < ret_var.datalen; t++) {
22419 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
22420 uint64_t ret_conv_19_ref = 0;
22421 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22422 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22423 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
22424 if (ret_conv_19_var.is_owned) {
22425 ret_conv_19_ref |= 1;
22427 ret_arr_ptr[t] = ret_conv_19_ref;
22430 FREE(ret_var.data);
22434 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
22435 LDKCommitmentUpdate this_ptr_conv;
22436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22437 this_ptr_conv.is_owned = false;
22438 LDKCVec_UpdateFulfillHTLCZ val_constr;
22439 val_constr.datalen = *((uint32_t*)val);
22440 if (val_constr.datalen > 0)
22441 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22443 val_constr.data = NULL;
22444 uint32_t* val_vals = (uint32_t*)(val + 4);
22445 for (size_t t = 0; t < val_constr.datalen; t++) {
22446 uint32_t val_conv_19 = val_vals[t];
22447 LDKUpdateFulfillHTLC val_conv_19_conv;
22448 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
22449 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
22450 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
22451 val_constr.data[t] = val_conv_19_conv;
22453 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
22456 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
22457 LDKCommitmentUpdate this_ptr_conv;
22458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22459 this_ptr_conv.is_owned = false;
22460 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
22461 uint32_tArray ret_arr = NULL;
22462 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
22463 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
22464 for (size_t q = 0; q < ret_var.datalen; q++) {
22465 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
22466 uint64_t ret_conv_16_ref = 0;
22467 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22468 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22469 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
22470 if (ret_conv_16_var.is_owned) {
22471 ret_conv_16_ref |= 1;
22473 ret_arr_ptr[q] = ret_conv_16_ref;
22476 FREE(ret_var.data);
22480 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
22481 LDKCommitmentUpdate this_ptr_conv;
22482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22483 this_ptr_conv.is_owned = false;
22484 LDKCVec_UpdateFailHTLCZ val_constr;
22485 val_constr.datalen = *((uint32_t*)val);
22486 if (val_constr.datalen > 0)
22487 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22489 val_constr.data = NULL;
22490 uint32_t* val_vals = (uint32_t*)(val + 4);
22491 for (size_t q = 0; q < val_constr.datalen; q++) {
22492 uint32_t val_conv_16 = val_vals[q];
22493 LDKUpdateFailHTLC val_conv_16_conv;
22494 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
22495 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
22496 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
22497 val_constr.data[q] = val_conv_16_conv;
22499 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
22502 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
22503 LDKCommitmentUpdate this_ptr_conv;
22504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22505 this_ptr_conv.is_owned = false;
22506 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
22507 uint32_tArray ret_arr = NULL;
22508 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
22509 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
22510 for (size_t z = 0; z < ret_var.datalen; z++) {
22511 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
22512 uint64_t ret_conv_25_ref = 0;
22513 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22514 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22515 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
22516 if (ret_conv_25_var.is_owned) {
22517 ret_conv_25_ref |= 1;
22519 ret_arr_ptr[z] = ret_conv_25_ref;
22522 FREE(ret_var.data);
22526 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
22527 LDKCommitmentUpdate this_ptr_conv;
22528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22529 this_ptr_conv.is_owned = false;
22530 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
22531 val_constr.datalen = *((uint32_t*)val);
22532 if (val_constr.datalen > 0)
22533 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22535 val_constr.data = NULL;
22536 uint32_t* val_vals = (uint32_t*)(val + 4);
22537 for (size_t z = 0; z < val_constr.datalen; z++) {
22538 uint32_t val_conv_25 = val_vals[z];
22539 LDKUpdateFailMalformedHTLC val_conv_25_conv;
22540 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
22541 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
22542 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
22543 val_constr.data[z] = val_conv_25_conv;
22545 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
22548 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
22549 LDKCommitmentUpdate this_ptr_conv;
22550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22551 this_ptr_conv.is_owned = false;
22552 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
22553 uint64_t ret_ref = 0;
22554 if ((uint64_t)ret_var.inner > 4096) {
22555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22557 ret_ref = (uint64_t)ret_var.inner;
22558 if (ret_var.is_owned) {
22565 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
22566 LDKCommitmentUpdate this_ptr_conv;
22567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22568 this_ptr_conv.is_owned = false;
22569 LDKUpdateFee val_conv;
22570 val_conv.inner = (void*)(val & (~1));
22571 val_conv.is_owned = (val & 1) || (val == 0);
22572 val_conv = UpdateFee_clone(&val_conv);
22573 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
22576 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
22577 LDKCommitmentUpdate this_ptr_conv;
22578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22579 this_ptr_conv.is_owned = false;
22580 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
22581 uint64_t ret_ref = 0;
22582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22584 ret_ref = (uint64_t)ret_var.inner;
22585 if (ret_var.is_owned) {
22591 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
22592 LDKCommitmentUpdate this_ptr_conv;
22593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22594 this_ptr_conv.is_owned = false;
22595 LDKCommitmentSigned val_conv;
22596 val_conv.inner = (void*)(val & (~1));
22597 val_conv.is_owned = (val & 1) || (val == 0);
22598 val_conv = CommitmentSigned_clone(&val_conv);
22599 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
22602 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) {
22603 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
22604 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
22605 if (update_add_htlcs_arg_constr.datalen > 0)
22606 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22608 update_add_htlcs_arg_constr.data = NULL;
22609 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
22610 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
22611 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
22612 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
22613 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
22614 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
22615 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
22616 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
22618 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
22619 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
22620 if (update_fulfill_htlcs_arg_constr.datalen > 0)
22621 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22623 update_fulfill_htlcs_arg_constr.data = NULL;
22624 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
22625 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
22626 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
22627 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
22628 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
22629 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
22630 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
22631 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
22633 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
22634 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
22635 if (update_fail_htlcs_arg_constr.datalen > 0)
22636 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22638 update_fail_htlcs_arg_constr.data = NULL;
22639 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
22640 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
22641 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
22642 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
22643 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
22644 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
22645 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
22646 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
22648 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
22649 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
22650 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
22651 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22653 update_fail_malformed_htlcs_arg_constr.data = NULL;
22654 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
22655 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
22656 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
22657 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
22658 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
22659 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);
22660 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
22661 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
22663 LDKUpdateFee update_fee_arg_conv;
22664 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
22665 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
22666 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
22667 LDKCommitmentSigned commitment_signed_arg_conv;
22668 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
22669 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
22670 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
22671 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);
22672 uint64_t ret_ref = 0;
22673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22675 ret_ref = (uint64_t)ret_var.inner;
22676 if (ret_var.is_owned) {
22682 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
22683 LDKCommitmentUpdate orig_conv;
22684 orig_conv.inner = (void*)(orig & (~1));
22685 orig_conv.is_owned = false;
22686 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
22687 uint64_t ret_ref = 0;
22688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22690 ret_ref = (uint64_t)ret_var.inner;
22691 if (ret_var.is_owned) {
22697 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
22698 if ((this_ptr & 1) != 0) return;
22699 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22700 CHECK_ACCESS(this_ptr_ptr);
22701 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
22702 FREE((void*)this_ptr);
22703 ChannelMessageHandler_free(this_ptr_conv);
22706 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
22707 if ((this_ptr & 1) != 0) return;
22708 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22709 CHECK_ACCESS(this_ptr_ptr);
22710 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
22711 FREE((void*)this_ptr);
22712 RoutingMessageHandler_free(this_ptr_conv);
22715 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
22716 LDKAcceptChannel obj_conv;
22717 obj_conv.inner = (void*)(obj & (~1));
22718 obj_conv.is_owned = false;
22719 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
22720 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22721 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22722 CVec_u8Z_free(ret_var);
22726 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
22727 LDKu8slice ser_ref;
22728 ser_ref.datalen = *((uint32_t*)ser);
22729 ser_ref.data = (int8_t*)(ser + 4);
22730 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22731 *ret_conv = AcceptChannel_read(ser_ref);
22732 return (uint64_t)ret_conv;
22735 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
22736 LDKAnnouncementSignatures obj_conv;
22737 obj_conv.inner = (void*)(obj & (~1));
22738 obj_conv.is_owned = false;
22739 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
22740 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22741 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22742 CVec_u8Z_free(ret_var);
22746 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
22747 LDKu8slice ser_ref;
22748 ser_ref.datalen = *((uint32_t*)ser);
22749 ser_ref.data = (int8_t*)(ser + 4);
22750 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22751 *ret_conv = AnnouncementSignatures_read(ser_ref);
22752 return (uint64_t)ret_conv;
22755 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
22756 LDKChannelReestablish obj_conv;
22757 obj_conv.inner = (void*)(obj & (~1));
22758 obj_conv.is_owned = false;
22759 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
22760 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22761 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22762 CVec_u8Z_free(ret_var);
22766 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
22767 LDKu8slice ser_ref;
22768 ser_ref.datalen = *((uint32_t*)ser);
22769 ser_ref.data = (int8_t*)(ser + 4);
22770 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22771 *ret_conv = ChannelReestablish_read(ser_ref);
22772 return (uint64_t)ret_conv;
22775 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
22776 LDKClosingSigned obj_conv;
22777 obj_conv.inner = (void*)(obj & (~1));
22778 obj_conv.is_owned = false;
22779 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
22780 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22781 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22782 CVec_u8Z_free(ret_var);
22786 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
22787 LDKu8slice ser_ref;
22788 ser_ref.datalen = *((uint32_t*)ser);
22789 ser_ref.data = (int8_t*)(ser + 4);
22790 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22791 *ret_conv = ClosingSigned_read(ser_ref);
22792 return (uint64_t)ret_conv;
22795 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
22796 LDKClosingSignedFeeRange obj_conv;
22797 obj_conv.inner = (void*)(obj & (~1));
22798 obj_conv.is_owned = false;
22799 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
22800 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22801 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22802 CVec_u8Z_free(ret_var);
22806 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
22807 LDKu8slice ser_ref;
22808 ser_ref.datalen = *((uint32_t*)ser);
22809 ser_ref.data = (int8_t*)(ser + 4);
22810 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22811 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
22812 return (uint64_t)ret_conv;
22815 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
22816 LDKCommitmentSigned obj_conv;
22817 obj_conv.inner = (void*)(obj & (~1));
22818 obj_conv.is_owned = false;
22819 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
22820 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22821 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22822 CVec_u8Z_free(ret_var);
22826 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
22827 LDKu8slice ser_ref;
22828 ser_ref.datalen = *((uint32_t*)ser);
22829 ser_ref.data = (int8_t*)(ser + 4);
22830 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22831 *ret_conv = CommitmentSigned_read(ser_ref);
22832 return (uint64_t)ret_conv;
22835 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
22836 LDKFundingCreated obj_conv;
22837 obj_conv.inner = (void*)(obj & (~1));
22838 obj_conv.is_owned = false;
22839 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
22840 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22841 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22842 CVec_u8Z_free(ret_var);
22846 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
22847 LDKu8slice ser_ref;
22848 ser_ref.datalen = *((uint32_t*)ser);
22849 ser_ref.data = (int8_t*)(ser + 4);
22850 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22851 *ret_conv = FundingCreated_read(ser_ref);
22852 return (uint64_t)ret_conv;
22855 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
22856 LDKFundingSigned obj_conv;
22857 obj_conv.inner = (void*)(obj & (~1));
22858 obj_conv.is_owned = false;
22859 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
22860 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22861 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22862 CVec_u8Z_free(ret_var);
22866 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
22867 LDKu8slice ser_ref;
22868 ser_ref.datalen = *((uint32_t*)ser);
22869 ser_ref.data = (int8_t*)(ser + 4);
22870 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22871 *ret_conv = FundingSigned_read(ser_ref);
22872 return (uint64_t)ret_conv;
22875 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
22876 LDKFundingLocked obj_conv;
22877 obj_conv.inner = (void*)(obj & (~1));
22878 obj_conv.is_owned = false;
22879 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
22880 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22881 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22882 CVec_u8Z_free(ret_var);
22886 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
22887 LDKu8slice ser_ref;
22888 ser_ref.datalen = *((uint32_t*)ser);
22889 ser_ref.data = (int8_t*)(ser + 4);
22890 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
22891 *ret_conv = FundingLocked_read(ser_ref);
22892 return (uint64_t)ret_conv;
22895 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
22897 obj_conv.inner = (void*)(obj & (~1));
22898 obj_conv.is_owned = false;
22899 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
22900 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22901 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22902 CVec_u8Z_free(ret_var);
22906 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
22907 LDKu8slice ser_ref;
22908 ser_ref.datalen = *((uint32_t*)ser);
22909 ser_ref.data = (int8_t*)(ser + 4);
22910 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22911 *ret_conv = Init_read(ser_ref);
22912 return (uint64_t)ret_conv;
22915 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
22916 LDKOpenChannel obj_conv;
22917 obj_conv.inner = (void*)(obj & (~1));
22918 obj_conv.is_owned = false;
22919 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
22920 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22921 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22922 CVec_u8Z_free(ret_var);
22926 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
22927 LDKu8slice ser_ref;
22928 ser_ref.datalen = *((uint32_t*)ser);
22929 ser_ref.data = (int8_t*)(ser + 4);
22930 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22931 *ret_conv = OpenChannel_read(ser_ref);
22932 return (uint64_t)ret_conv;
22935 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
22936 LDKRevokeAndACK obj_conv;
22937 obj_conv.inner = (void*)(obj & (~1));
22938 obj_conv.is_owned = false;
22939 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
22940 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22941 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22942 CVec_u8Z_free(ret_var);
22946 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
22947 LDKu8slice ser_ref;
22948 ser_ref.datalen = *((uint32_t*)ser);
22949 ser_ref.data = (int8_t*)(ser + 4);
22950 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22951 *ret_conv = RevokeAndACK_read(ser_ref);
22952 return (uint64_t)ret_conv;
22955 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
22956 LDKShutdown obj_conv;
22957 obj_conv.inner = (void*)(obj & (~1));
22958 obj_conv.is_owned = false;
22959 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
22960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22962 CVec_u8Z_free(ret_var);
22966 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
22967 LDKu8slice ser_ref;
22968 ser_ref.datalen = *((uint32_t*)ser);
22969 ser_ref.data = (int8_t*)(ser + 4);
22970 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22971 *ret_conv = Shutdown_read(ser_ref);
22972 return (uint64_t)ret_conv;
22975 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
22976 LDKUpdateFailHTLC obj_conv;
22977 obj_conv.inner = (void*)(obj & (~1));
22978 obj_conv.is_owned = false;
22979 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
22980 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22981 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22982 CVec_u8Z_free(ret_var);
22986 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
22987 LDKu8slice ser_ref;
22988 ser_ref.datalen = *((uint32_t*)ser);
22989 ser_ref.data = (int8_t*)(ser + 4);
22990 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22991 *ret_conv = UpdateFailHTLC_read(ser_ref);
22992 return (uint64_t)ret_conv;
22995 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
22996 LDKUpdateFailMalformedHTLC obj_conv;
22997 obj_conv.inner = (void*)(obj & (~1));
22998 obj_conv.is_owned = false;
22999 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_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_UpdateFailMalformedHTLC_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_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23011 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
23012 return (uint64_t)ret_conv;
23015 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
23016 LDKUpdateFee obj_conv;
23017 obj_conv.inner = (void*)(obj & (~1));
23018 obj_conv.is_owned = false;
23019 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
23020 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23021 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23022 CVec_u8Z_free(ret_var);
23026 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
23027 LDKu8slice ser_ref;
23028 ser_ref.datalen = *((uint32_t*)ser);
23029 ser_ref.data = (int8_t*)(ser + 4);
23030 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23031 *ret_conv = UpdateFee_read(ser_ref);
23032 return (uint64_t)ret_conv;
23035 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
23036 LDKUpdateFulfillHTLC obj_conv;
23037 obj_conv.inner = (void*)(obj & (~1));
23038 obj_conv.is_owned = false;
23039 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
23040 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23041 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23042 CVec_u8Z_free(ret_var);
23046 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
23047 LDKu8slice ser_ref;
23048 ser_ref.datalen = *((uint32_t*)ser);
23049 ser_ref.data = (int8_t*)(ser + 4);
23050 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23051 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
23052 return (uint64_t)ret_conv;
23055 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
23056 LDKUpdateAddHTLC obj_conv;
23057 obj_conv.inner = (void*)(obj & (~1));
23058 obj_conv.is_owned = false;
23059 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
23060 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23061 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23062 CVec_u8Z_free(ret_var);
23066 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
23067 LDKu8slice ser_ref;
23068 ser_ref.datalen = *((uint32_t*)ser);
23069 ser_ref.data = (int8_t*)(ser + 4);
23070 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23071 *ret_conv = UpdateAddHTLC_read(ser_ref);
23072 return (uint64_t)ret_conv;
23075 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
23077 obj_conv.inner = (void*)(obj & (~1));
23078 obj_conv.is_owned = false;
23079 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
23080 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23081 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23082 CVec_u8Z_free(ret_var);
23086 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
23087 LDKu8slice ser_ref;
23088 ser_ref.datalen = *((uint32_t*)ser);
23089 ser_ref.data = (int8_t*)(ser + 4);
23090 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23091 *ret_conv = Ping_read(ser_ref);
23092 return (uint64_t)ret_conv;
23095 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
23097 obj_conv.inner = (void*)(obj & (~1));
23098 obj_conv.is_owned = false;
23099 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
23100 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23101 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23102 CVec_u8Z_free(ret_var);
23106 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
23107 LDKu8slice ser_ref;
23108 ser_ref.datalen = *((uint32_t*)ser);
23109 ser_ref.data = (int8_t*)(ser + 4);
23110 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23111 *ret_conv = Pong_read(ser_ref);
23112 return (uint64_t)ret_conv;
23115 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
23116 LDKUnsignedChannelAnnouncement obj_conv;
23117 obj_conv.inner = (void*)(obj & (~1));
23118 obj_conv.is_owned = false;
23119 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
23120 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23121 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23122 CVec_u8Z_free(ret_var);
23126 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
23127 LDKu8slice ser_ref;
23128 ser_ref.datalen = *((uint32_t*)ser);
23129 ser_ref.data = (int8_t*)(ser + 4);
23130 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23131 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
23132 return (uint64_t)ret_conv;
23135 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
23136 LDKChannelAnnouncement obj_conv;
23137 obj_conv.inner = (void*)(obj & (~1));
23138 obj_conv.is_owned = false;
23139 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
23140 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23141 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23142 CVec_u8Z_free(ret_var);
23146 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
23147 LDKu8slice ser_ref;
23148 ser_ref.datalen = *((uint32_t*)ser);
23149 ser_ref.data = (int8_t*)(ser + 4);
23150 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23151 *ret_conv = ChannelAnnouncement_read(ser_ref);
23152 return (uint64_t)ret_conv;
23155 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
23156 LDKUnsignedChannelUpdate obj_conv;
23157 obj_conv.inner = (void*)(obj & (~1));
23158 obj_conv.is_owned = false;
23159 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
23160 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23161 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23162 CVec_u8Z_free(ret_var);
23166 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
23167 LDKu8slice ser_ref;
23168 ser_ref.datalen = *((uint32_t*)ser);
23169 ser_ref.data = (int8_t*)(ser + 4);
23170 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23171 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
23172 return (uint64_t)ret_conv;
23175 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
23176 LDKChannelUpdate obj_conv;
23177 obj_conv.inner = (void*)(obj & (~1));
23178 obj_conv.is_owned = false;
23179 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
23180 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23181 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23182 CVec_u8Z_free(ret_var);
23186 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
23187 LDKu8slice ser_ref;
23188 ser_ref.datalen = *((uint32_t*)ser);
23189 ser_ref.data = (int8_t*)(ser + 4);
23190 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23191 *ret_conv = ChannelUpdate_read(ser_ref);
23192 return (uint64_t)ret_conv;
23195 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
23196 LDKErrorMessage obj_conv;
23197 obj_conv.inner = (void*)(obj & (~1));
23198 obj_conv.is_owned = false;
23199 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
23200 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23201 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23202 CVec_u8Z_free(ret_var);
23206 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
23207 LDKu8slice ser_ref;
23208 ser_ref.datalen = *((uint32_t*)ser);
23209 ser_ref.data = (int8_t*)(ser + 4);
23210 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23211 *ret_conv = ErrorMessage_read(ser_ref);
23212 return (uint64_t)ret_conv;
23215 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
23216 LDKUnsignedNodeAnnouncement obj_conv;
23217 obj_conv.inner = (void*)(obj & (~1));
23218 obj_conv.is_owned = false;
23219 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
23220 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23221 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23222 CVec_u8Z_free(ret_var);
23226 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
23227 LDKu8slice ser_ref;
23228 ser_ref.datalen = *((uint32_t*)ser);
23229 ser_ref.data = (int8_t*)(ser + 4);
23230 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23231 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
23232 return (uint64_t)ret_conv;
23235 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
23236 LDKNodeAnnouncement obj_conv;
23237 obj_conv.inner = (void*)(obj & (~1));
23238 obj_conv.is_owned = false;
23239 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
23240 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23241 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23242 CVec_u8Z_free(ret_var);
23246 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
23247 LDKu8slice ser_ref;
23248 ser_ref.datalen = *((uint32_t*)ser);
23249 ser_ref.data = (int8_t*)(ser + 4);
23250 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23251 *ret_conv = NodeAnnouncement_read(ser_ref);
23252 return (uint64_t)ret_conv;
23255 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
23256 LDKu8slice ser_ref;
23257 ser_ref.datalen = *((uint32_t*)ser);
23258 ser_ref.data = (int8_t*)(ser + 4);
23259 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23260 *ret_conv = QueryShortChannelIds_read(ser_ref);
23261 return (uint64_t)ret_conv;
23264 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
23265 LDKQueryShortChannelIds obj_conv;
23266 obj_conv.inner = (void*)(obj & (~1));
23267 obj_conv.is_owned = false;
23268 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
23269 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23270 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23271 CVec_u8Z_free(ret_var);
23275 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
23276 LDKReplyShortChannelIdsEnd obj_conv;
23277 obj_conv.inner = (void*)(obj & (~1));
23278 obj_conv.is_owned = false;
23279 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
23280 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23281 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23282 CVec_u8Z_free(ret_var);
23286 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
23287 LDKu8slice ser_ref;
23288 ser_ref.datalen = *((uint32_t*)ser);
23289 ser_ref.data = (int8_t*)(ser + 4);
23290 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23291 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
23292 return (uint64_t)ret_conv;
23295 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
23296 LDKQueryChannelRange this_arg_conv;
23297 this_arg_conv.inner = (void*)(this_arg & (~1));
23298 this_arg_conv.is_owned = false;
23299 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
23303 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
23304 LDKQueryChannelRange obj_conv;
23305 obj_conv.inner = (void*)(obj & (~1));
23306 obj_conv.is_owned = false;
23307 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
23308 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23309 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23310 CVec_u8Z_free(ret_var);
23314 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
23315 LDKu8slice ser_ref;
23316 ser_ref.datalen = *((uint32_t*)ser);
23317 ser_ref.data = (int8_t*)(ser + 4);
23318 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23319 *ret_conv = QueryChannelRange_read(ser_ref);
23320 return (uint64_t)ret_conv;
23323 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
23324 LDKu8slice ser_ref;
23325 ser_ref.datalen = *((uint32_t*)ser);
23326 ser_ref.data = (int8_t*)(ser + 4);
23327 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23328 *ret_conv = ReplyChannelRange_read(ser_ref);
23329 return (uint64_t)ret_conv;
23332 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
23333 LDKReplyChannelRange obj_conv;
23334 obj_conv.inner = (void*)(obj & (~1));
23335 obj_conv.is_owned = false;
23336 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
23337 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23338 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23339 CVec_u8Z_free(ret_var);
23343 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
23344 LDKGossipTimestampFilter obj_conv;
23345 obj_conv.inner = (void*)(obj & (~1));
23346 obj_conv.is_owned = false;
23347 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
23348 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23349 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23350 CVec_u8Z_free(ret_var);
23354 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
23355 LDKu8slice ser_ref;
23356 ser_ref.datalen = *((uint32_t*)ser);
23357 ser_ref.data = (int8_t*)(ser + 4);
23358 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23359 *ret_conv = GossipTimestampFilter_read(ser_ref);
23360 return (uint64_t)ret_conv;
23363 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
23364 if ((this_ptr & 1) != 0) return;
23365 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23366 CHECK_ACCESS(this_ptr_ptr);
23367 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
23368 FREE((void*)this_ptr);
23369 CustomMessageHandler_free(this_ptr_conv);
23372 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
23373 LDKIgnoringMessageHandler this_obj_conv;
23374 this_obj_conv.inner = (void*)(this_obj & (~1));
23375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23376 IgnoringMessageHandler_free(this_obj_conv);
23379 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
23380 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
23381 uint64_t ret_ref = 0;
23382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23384 ret_ref = (uint64_t)ret_var.inner;
23385 if (ret_var.is_owned) {
23391 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
23392 LDKIgnoringMessageHandler this_arg_conv;
23393 this_arg_conv.inner = (void*)(this_arg & (~1));
23394 this_arg_conv.is_owned = false;
23395 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23396 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23397 return (uint64_t)ret_ret;
23400 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
23401 LDKIgnoringMessageHandler this_arg_conv;
23402 this_arg_conv.inner = (void*)(this_arg & (~1));
23403 this_arg_conv.is_owned = false;
23404 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23405 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
23406 return (uint64_t)ret_ret;
23409 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
23410 LDKIgnoringMessageHandler this_arg_conv;
23411 this_arg_conv.inner = (void*)(this_arg & (~1));
23412 this_arg_conv.is_owned = false;
23413 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
23414 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
23415 return (uint64_t)ret_ret;
23418 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
23419 LDKIgnoringMessageHandler this_arg_conv;
23420 this_arg_conv.inner = (void*)(this_arg & (~1));
23421 this_arg_conv.is_owned = false;
23422 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
23423 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
23424 return (uint64_t)ret_ret;
23427 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
23428 LDKErroringMessageHandler this_obj_conv;
23429 this_obj_conv.inner = (void*)(this_obj & (~1));
23430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23431 ErroringMessageHandler_free(this_obj_conv);
23434 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
23435 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
23436 uint64_t ret_ref = 0;
23437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23439 ret_ref = (uint64_t)ret_var.inner;
23440 if (ret_var.is_owned) {
23446 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
23447 LDKErroringMessageHandler this_arg_conv;
23448 this_arg_conv.inner = (void*)(this_arg & (~1));
23449 this_arg_conv.is_owned = false;
23450 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23451 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23452 return (uint64_t)ret_ret;
23455 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
23456 LDKErroringMessageHandler this_arg_conv;
23457 this_arg_conv.inner = (void*)(this_arg & (~1));
23458 this_arg_conv.is_owned = false;
23459 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
23460 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
23461 return (uint64_t)ret_ret;
23464 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
23465 LDKMessageHandler this_obj_conv;
23466 this_obj_conv.inner = (void*)(this_obj & (~1));
23467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23468 MessageHandler_free(this_obj_conv);
23471 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
23472 LDKMessageHandler this_ptr_conv;
23473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23474 this_ptr_conv.is_owned = false;
23475 // WARNING: This object doesn't live past this scope, needs clone!
23476 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
23480 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
23481 LDKMessageHandler this_ptr_conv;
23482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23483 this_ptr_conv.is_owned = false;
23484 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23485 CHECK_ACCESS(val_ptr);
23486 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
23487 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
23490 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
23491 LDKMessageHandler this_ptr_conv;
23492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23493 this_ptr_conv.is_owned = false;
23494 // WARNING: This object doesn't live past this scope, needs clone!
23495 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
23499 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
23500 LDKMessageHandler this_ptr_conv;
23501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23502 this_ptr_conv.is_owned = false;
23503 void* val_ptr = (void*)(((uint64_t)val) & ~1);
23504 CHECK_ACCESS(val_ptr);
23505 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
23506 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
23509 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
23510 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
23511 CHECK_ACCESS(chan_handler_arg_ptr);
23512 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
23513 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
23514 CHECK_ACCESS(route_handler_arg_ptr);
23515 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
23516 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
23517 uint64_t ret_ref = 0;
23518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23520 ret_ref = (uint64_t)ret_var.inner;
23521 if (ret_var.is_owned) {
23527 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
23528 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
23529 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
23530 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
23531 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
23532 *ret_ret = SocketDescriptor_clone(orig_conv);
23533 return (uint64_t)ret_ret;
23536 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
23537 if ((this_ptr & 1) != 0) return;
23538 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
23539 CHECK_ACCESS(this_ptr_ptr);
23540 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
23541 FREE((void*)this_ptr);
23542 SocketDescriptor_free(this_ptr_conv);
23545 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
23546 LDKPeerHandleError this_obj_conv;
23547 this_obj_conv.inner = (void*)(this_obj & (~1));
23548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23549 PeerHandleError_free(this_obj_conv);
23552 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
23553 LDKPeerHandleError this_ptr_conv;
23554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23555 this_ptr_conv.is_owned = false;
23556 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
23560 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
23561 LDKPeerHandleError this_ptr_conv;
23562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23563 this_ptr_conv.is_owned = false;
23564 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
23567 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
23568 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
23569 uint64_t ret_ref = 0;
23570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23572 ret_ref = (uint64_t)ret_var.inner;
23573 if (ret_var.is_owned) {
23579 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
23580 LDKPeerHandleError orig_conv;
23581 orig_conv.inner = (void*)(orig & (~1));
23582 orig_conv.is_owned = false;
23583 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
23584 uint64_t ret_ref = 0;
23585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23587 ret_ref = (uint64_t)ret_var.inner;
23588 if (ret_var.is_owned) {
23594 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
23595 LDKPeerManager this_obj_conv;
23596 this_obj_conv.inner = (void*)(this_obj & (~1));
23597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23598 PeerManager_free(this_obj_conv);
23601 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) {
23602 LDKMessageHandler message_handler_conv;
23603 message_handler_conv.inner = (void*)(message_handler & (~1));
23604 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
23605 // Warning: we need a move here but no clone is available for LDKMessageHandler
23606 LDKSecretKey our_node_secret_ref;
23607 CHECK(*((uint32_t*)our_node_secret) == 32);
23608 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
23609 unsigned char ephemeral_random_data_arr[32];
23610 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
23611 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
23612 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
23613 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
23614 CHECK_ACCESS(logger_ptr);
23615 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23616 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
23617 CHECK_ACCESS(custom_message_handler_ptr);
23618 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
23619 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
23620 uint64_t ret_ref = 0;
23621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23623 ret_ref = (uint64_t)ret_var.inner;
23624 if (ret_var.is_owned) {
23630 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
23631 LDKPeerManager this_arg_conv;
23632 this_arg_conv.inner = (void*)(this_arg & (~1));
23633 this_arg_conv.is_owned = false;
23634 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
23635 ptrArray ret_arr = NULL;
23636 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
23637 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
23638 for (size_t m = 0; m < ret_var.datalen; m++) {
23639 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23640 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
23641 ret_arr_ptr[m] = ret_conv_12_arr;
23644 FREE(ret_var.data);
23648 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
23649 LDKPeerManager this_arg_conv;
23650 this_arg_conv.inner = (void*)(this_arg & (~1));
23651 this_arg_conv.is_owned = false;
23652 LDKPublicKey their_node_id_ref;
23653 CHECK(*((uint32_t*)their_node_id) == 33);
23654 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
23655 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
23656 CHECK_ACCESS(descriptor_ptr);
23657 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
23658 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23659 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
23660 return (uint64_t)ret_conv;
23663 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
23664 LDKPeerManager this_arg_conv;
23665 this_arg_conv.inner = (void*)(this_arg & (~1));
23666 this_arg_conv.is_owned = false;
23667 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
23668 CHECK_ACCESS(descriptor_ptr);
23669 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
23670 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23671 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
23672 return (uint64_t)ret_conv;
23675 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
23676 LDKPeerManager this_arg_conv;
23677 this_arg_conv.inner = (void*)(this_arg & (~1));
23678 this_arg_conv.is_owned = false;
23679 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
23680 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
23681 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
23682 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23683 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
23684 return (uint64_t)ret_conv;
23687 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
23688 LDKPeerManager this_arg_conv;
23689 this_arg_conv.inner = (void*)(this_arg & (~1));
23690 this_arg_conv.is_owned = false;
23691 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
23692 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
23693 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
23694 LDKu8slice data_ref;
23695 data_ref.datalen = *((uint32_t*)data);
23696 data_ref.data = (int8_t*)(data + 4);
23697 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23698 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
23699 return (uint64_t)ret_conv;
23702 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
23703 LDKPeerManager this_arg_conv;
23704 this_arg_conv.inner = (void*)(this_arg & (~1));
23705 this_arg_conv.is_owned = false;
23706 PeerManager_process_events(&this_arg_conv);
23709 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
23710 LDKPeerManager this_arg_conv;
23711 this_arg_conv.inner = (void*)(this_arg & (~1));
23712 this_arg_conv.is_owned = false;
23713 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
23714 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
23715 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
23716 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
23719 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
23720 LDKPeerManager this_arg_conv;
23721 this_arg_conv.inner = (void*)(this_arg & (~1));
23722 this_arg_conv.is_owned = false;
23723 LDKPublicKey node_id_ref;
23724 CHECK(*((uint32_t*)node_id) == 33);
23725 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
23726 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
23729 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
23730 LDKPeerManager this_arg_conv;
23731 this_arg_conv.inner = (void*)(this_arg & (~1));
23732 this_arg_conv.is_owned = false;
23733 PeerManager_disconnect_all_peers(&this_arg_conv);
23736 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
23737 LDKPeerManager this_arg_conv;
23738 this_arg_conv.inner = (void*)(this_arg & (~1));
23739 this_arg_conv.is_owned = false;
23740 PeerManager_timer_tick_occurred(&this_arg_conv);
23743 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
23744 unsigned char commitment_seed_arr[32];
23745 CHECK(*((uint32_t*)commitment_seed) == 32);
23746 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
23747 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
23748 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23749 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
23753 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) {
23754 LDKCVec_u8Z to_holder_script_ref;
23755 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
23756 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
23757 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
23758 LDKCVec_u8Z to_counterparty_script_ref;
23759 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
23760 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
23761 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
23762 LDKOutPoint funding_outpoint_conv;
23763 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23764 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23765 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23766 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);
23767 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23768 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23769 Transaction_free(ret_var);
23773 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
23774 LDKPublicKey per_commitment_point_ref;
23775 CHECK(*((uint32_t*)per_commitment_point) == 33);
23776 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
23777 unsigned char base_secret_arr[32];
23778 CHECK(*((uint32_t*)base_secret) == 32);
23779 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
23780 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
23781 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
23782 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
23783 return (uint64_t)ret_conv;
23786 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
23787 LDKPublicKey per_commitment_point_ref;
23788 CHECK(*((uint32_t*)per_commitment_point) == 33);
23789 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
23790 LDKPublicKey base_point_ref;
23791 CHECK(*((uint32_t*)base_point) == 33);
23792 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
23793 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23794 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
23795 return (uint64_t)ret_conv;
23798 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
23799 unsigned char per_commitment_secret_arr[32];
23800 CHECK(*((uint32_t*)per_commitment_secret) == 32);
23801 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
23802 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
23803 unsigned char countersignatory_revocation_base_secret_arr[32];
23804 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
23805 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
23806 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
23807 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
23808 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
23809 return (uint64_t)ret_conv;
23812 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
23813 LDKPublicKey per_commitment_point_ref;
23814 CHECK(*((uint32_t*)per_commitment_point) == 33);
23815 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
23816 LDKPublicKey countersignatory_revocation_base_point_ref;
23817 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
23818 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
23819 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23820 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
23821 return (uint64_t)ret_conv;
23824 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
23825 LDKTxCreationKeys this_obj_conv;
23826 this_obj_conv.inner = (void*)(this_obj & (~1));
23827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23828 TxCreationKeys_free(this_obj_conv);
23831 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
23832 LDKTxCreationKeys this_ptr_conv;
23833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23834 this_ptr_conv.is_owned = false;
23835 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23836 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23840 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23841 LDKTxCreationKeys this_ptr_conv;
23842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23843 this_ptr_conv.is_owned = false;
23844 LDKPublicKey val_ref;
23845 CHECK(*((uint32_t*)val) == 33);
23846 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23847 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
23850 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
23851 LDKTxCreationKeys this_ptr_conv;
23852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23853 this_ptr_conv.is_owned = false;
23854 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23855 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
23859 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
23860 LDKTxCreationKeys this_ptr_conv;
23861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23862 this_ptr_conv.is_owned = false;
23863 LDKPublicKey val_ref;
23864 CHECK(*((uint32_t*)val) == 33);
23865 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23866 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
23869 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
23870 LDKTxCreationKeys this_ptr_conv;
23871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23872 this_ptr_conv.is_owned = false;
23873 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23874 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
23878 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
23879 LDKTxCreationKeys this_ptr_conv;
23880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23881 this_ptr_conv.is_owned = false;
23882 LDKPublicKey val_ref;
23883 CHECK(*((uint32_t*)val) == 33);
23884 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23885 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
23888 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
23889 LDKTxCreationKeys this_ptr_conv;
23890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23891 this_ptr_conv.is_owned = false;
23892 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23893 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
23897 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
23898 LDKTxCreationKeys this_ptr_conv;
23899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23900 this_ptr_conv.is_owned = false;
23901 LDKPublicKey val_ref;
23902 CHECK(*((uint32_t*)val) == 33);
23903 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23904 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
23907 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
23908 LDKTxCreationKeys this_ptr_conv;
23909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23910 this_ptr_conv.is_owned = false;
23911 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23912 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
23916 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
23917 LDKTxCreationKeys this_ptr_conv;
23918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23919 this_ptr_conv.is_owned = false;
23920 LDKPublicKey val_ref;
23921 CHECK(*((uint32_t*)val) == 33);
23922 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23923 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
23926 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) {
23927 LDKPublicKey per_commitment_point_arg_ref;
23928 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
23929 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
23930 LDKPublicKey revocation_key_arg_ref;
23931 CHECK(*((uint32_t*)revocation_key_arg) == 33);
23932 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
23933 LDKPublicKey broadcaster_htlc_key_arg_ref;
23934 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
23935 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
23936 LDKPublicKey countersignatory_htlc_key_arg_ref;
23937 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
23938 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
23939 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
23940 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
23941 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
23942 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);
23943 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
23947 if (ret_var.is_owned) {
23953 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
23954 LDKTxCreationKeys orig_conv;
23955 orig_conv.inner = (void*)(orig & (~1));
23956 orig_conv.is_owned = false;
23957 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
23958 uint64_t ret_ref = 0;
23959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23961 ret_ref = (uint64_t)ret_var.inner;
23962 if (ret_var.is_owned) {
23968 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
23969 LDKTxCreationKeys obj_conv;
23970 obj_conv.inner = (void*)(obj & (~1));
23971 obj_conv.is_owned = false;
23972 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
23973 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23974 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23975 CVec_u8Z_free(ret_var);
23979 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
23980 LDKu8slice ser_ref;
23981 ser_ref.datalen = *((uint32_t*)ser);
23982 ser_ref.data = (int8_t*)(ser + 4);
23983 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
23984 *ret_conv = TxCreationKeys_read(ser_ref);
23985 return (uint64_t)ret_conv;
23988 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
23989 LDKChannelPublicKeys this_obj_conv;
23990 this_obj_conv.inner = (void*)(this_obj & (~1));
23991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23992 ChannelPublicKeys_free(this_obj_conv);
23995 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
23996 LDKChannelPublicKeys this_ptr_conv;
23997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23998 this_ptr_conv.is_owned = false;
23999 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24000 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
24004 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
24005 LDKChannelPublicKeys this_ptr_conv;
24006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24007 this_ptr_conv.is_owned = false;
24008 LDKPublicKey val_ref;
24009 CHECK(*((uint32_t*)val) == 33);
24010 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24011 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
24014 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
24015 LDKChannelPublicKeys this_ptr_conv;
24016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24017 this_ptr_conv.is_owned = false;
24018 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24019 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
24023 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
24024 LDKChannelPublicKeys this_ptr_conv;
24025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24026 this_ptr_conv.is_owned = false;
24027 LDKPublicKey val_ref;
24028 CHECK(*((uint32_t*)val) == 33);
24029 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24030 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
24033 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
24034 LDKChannelPublicKeys this_ptr_conv;
24035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24036 this_ptr_conv.is_owned = false;
24037 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24038 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
24042 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
24043 LDKChannelPublicKeys this_ptr_conv;
24044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24045 this_ptr_conv.is_owned = false;
24046 LDKPublicKey val_ref;
24047 CHECK(*((uint32_t*)val) == 33);
24048 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24049 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
24052 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
24053 LDKChannelPublicKeys this_ptr_conv;
24054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24055 this_ptr_conv.is_owned = false;
24056 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24057 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
24061 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
24062 LDKChannelPublicKeys this_ptr_conv;
24063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24064 this_ptr_conv.is_owned = false;
24065 LDKPublicKey val_ref;
24066 CHECK(*((uint32_t*)val) == 33);
24067 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24068 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
24071 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
24072 LDKChannelPublicKeys this_ptr_conv;
24073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24074 this_ptr_conv.is_owned = false;
24075 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24076 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
24080 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
24081 LDKChannelPublicKeys this_ptr_conv;
24082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24083 this_ptr_conv.is_owned = false;
24084 LDKPublicKey val_ref;
24085 CHECK(*((uint32_t*)val) == 33);
24086 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24087 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
24090 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) {
24091 LDKPublicKey funding_pubkey_arg_ref;
24092 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
24093 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
24094 LDKPublicKey revocation_basepoint_arg_ref;
24095 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
24096 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
24097 LDKPublicKey payment_point_arg_ref;
24098 CHECK(*((uint32_t*)payment_point_arg) == 33);
24099 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
24100 LDKPublicKey delayed_payment_basepoint_arg_ref;
24101 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
24102 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
24103 LDKPublicKey htlc_basepoint_arg_ref;
24104 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
24105 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
24106 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);
24107 uint64_t ret_ref = 0;
24108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24110 ret_ref = (uint64_t)ret_var.inner;
24111 if (ret_var.is_owned) {
24117 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
24118 LDKChannelPublicKeys orig_conv;
24119 orig_conv.inner = (void*)(orig & (~1));
24120 orig_conv.is_owned = false;
24121 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
24122 uint64_t ret_ref = 0;
24123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24125 ret_ref = (uint64_t)ret_var.inner;
24126 if (ret_var.is_owned) {
24132 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
24133 LDKChannelPublicKeys obj_conv;
24134 obj_conv.inner = (void*)(obj & (~1));
24135 obj_conv.is_owned = false;
24136 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
24137 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24138 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24139 CVec_u8Z_free(ret_var);
24143 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
24144 LDKu8slice ser_ref;
24145 ser_ref.datalen = *((uint32_t*)ser);
24146 ser_ref.data = (int8_t*)(ser + 4);
24147 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
24148 *ret_conv = ChannelPublicKeys_read(ser_ref);
24149 return (uint64_t)ret_conv;
24152 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) {
24153 LDKPublicKey per_commitment_point_ref;
24154 CHECK(*((uint32_t*)per_commitment_point) == 33);
24155 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
24156 LDKPublicKey broadcaster_delayed_payment_base_ref;
24157 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
24158 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
24159 LDKPublicKey broadcaster_htlc_base_ref;
24160 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
24161 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
24162 LDKPublicKey countersignatory_revocation_base_ref;
24163 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
24164 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
24165 LDKPublicKey countersignatory_htlc_base_ref;
24166 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
24167 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
24168 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24169 *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);
24170 return (uint64_t)ret_conv;
24173 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
24174 LDKPublicKey per_commitment_point_ref;
24175 CHECK(*((uint32_t*)per_commitment_point) == 33);
24176 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
24177 LDKChannelPublicKeys broadcaster_keys_conv;
24178 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24179 broadcaster_keys_conv.is_owned = false;
24180 LDKChannelPublicKeys countersignatory_keys_conv;
24181 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24182 countersignatory_keys_conv.is_owned = false;
24183 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24184 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
24185 return (uint64_t)ret_conv;
24188 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
24189 LDKPublicKey revocation_key_ref;
24190 CHECK(*((uint32_t*)revocation_key) == 33);
24191 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
24192 LDKPublicKey broadcaster_delayed_payment_key_ref;
24193 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
24194 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
24195 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
24196 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24197 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24198 CVec_u8Z_free(ret_var);
24202 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
24203 LDKHTLCOutputInCommitment this_obj_conv;
24204 this_obj_conv.inner = (void*)(this_obj & (~1));
24205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24206 HTLCOutputInCommitment_free(this_obj_conv);
24209 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
24210 LDKHTLCOutputInCommitment this_ptr_conv;
24211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24212 this_ptr_conv.is_owned = false;
24213 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
24217 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
24218 LDKHTLCOutputInCommitment this_ptr_conv;
24219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24220 this_ptr_conv.is_owned = false;
24221 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
24224 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
24225 LDKHTLCOutputInCommitment this_ptr_conv;
24226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24227 this_ptr_conv.is_owned = false;
24228 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
24232 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
24233 LDKHTLCOutputInCommitment this_ptr_conv;
24234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24235 this_ptr_conv.is_owned = false;
24236 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
24239 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
24240 LDKHTLCOutputInCommitment this_ptr_conv;
24241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24242 this_ptr_conv.is_owned = false;
24243 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
24247 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
24248 LDKHTLCOutputInCommitment this_ptr_conv;
24249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24250 this_ptr_conv.is_owned = false;
24251 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
24254 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
24255 LDKHTLCOutputInCommitment this_ptr_conv;
24256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24257 this_ptr_conv.is_owned = false;
24258 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24259 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
24263 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
24264 LDKHTLCOutputInCommitment this_ptr_conv;
24265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24266 this_ptr_conv.is_owned = false;
24267 LDKThirtyTwoBytes val_ref;
24268 CHECK(*((uint32_t*)val) == 32);
24269 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24270 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
24273 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
24274 LDKHTLCOutputInCommitment this_ptr_conv;
24275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24276 this_ptr_conv.is_owned = false;
24277 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24278 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
24279 uint64_t ret_ref = (uint64_t)ret_copy;
24283 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
24284 LDKHTLCOutputInCommitment this_ptr_conv;
24285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24286 this_ptr_conv.is_owned = false;
24287 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24288 CHECK_ACCESS(val_ptr);
24289 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
24290 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
24291 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
24294 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) {
24295 LDKThirtyTwoBytes payment_hash_arg_ref;
24296 CHECK(*((uint32_t*)payment_hash_arg) == 32);
24297 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
24298 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
24299 CHECK_ACCESS(transaction_output_index_arg_ptr);
24300 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
24301 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
24302 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
24303 uint64_t ret_ref = 0;
24304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24306 ret_ref = (uint64_t)ret_var.inner;
24307 if (ret_var.is_owned) {
24313 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
24314 LDKHTLCOutputInCommitment orig_conv;
24315 orig_conv.inner = (void*)(orig & (~1));
24316 orig_conv.is_owned = false;
24317 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
24318 uint64_t ret_ref = 0;
24319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24321 ret_ref = (uint64_t)ret_var.inner;
24322 if (ret_var.is_owned) {
24328 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
24329 LDKHTLCOutputInCommitment obj_conv;
24330 obj_conv.inner = (void*)(obj & (~1));
24331 obj_conv.is_owned = false;
24332 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
24333 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24334 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24335 CVec_u8Z_free(ret_var);
24339 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
24340 LDKu8slice ser_ref;
24341 ser_ref.datalen = *((uint32_t*)ser);
24342 ser_ref.data = (int8_t*)(ser + 4);
24343 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
24344 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
24345 return (uint64_t)ret_conv;
24348 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
24349 LDKHTLCOutputInCommitment htlc_conv;
24350 htlc_conv.inner = (void*)(htlc & (~1));
24351 htlc_conv.is_owned = false;
24352 LDKTxCreationKeys keys_conv;
24353 keys_conv.inner = (void*)(keys & (~1));
24354 keys_conv.is_owned = false;
24355 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
24356 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24357 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24358 CVec_u8Z_free(ret_var);
24362 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
24363 LDKPublicKey broadcaster_ref;
24364 CHECK(*((uint32_t*)broadcaster) == 33);
24365 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
24366 LDKPublicKey countersignatory_ref;
24367 CHECK(*((uint32_t*)countersignatory) == 33);
24368 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
24369 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
24370 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24371 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24372 CVec_u8Z_free(ret_var);
24376 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) {
24377 unsigned char commitment_txid_arr[32];
24378 CHECK(*((uint32_t*)commitment_txid) == 32);
24379 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
24380 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
24381 LDKHTLCOutputInCommitment htlc_conv;
24382 htlc_conv.inner = (void*)(htlc & (~1));
24383 htlc_conv.is_owned = false;
24384 LDKPublicKey broadcaster_delayed_payment_key_ref;
24385 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
24386 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
24387 LDKPublicKey revocation_key_ref;
24388 CHECK(*((uint32_t*)revocation_key) == 33);
24389 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
24390 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
24391 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24392 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24393 Transaction_free(ret_var);
24397 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
24398 LDKChannelTransactionParameters this_obj_conv;
24399 this_obj_conv.inner = (void*)(this_obj & (~1));
24400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24401 ChannelTransactionParameters_free(this_obj_conv);
24404 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
24405 LDKChannelTransactionParameters this_ptr_conv;
24406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24407 this_ptr_conv.is_owned = false;
24408 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
24409 uint64_t ret_ref = 0;
24410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24412 ret_ref = (uint64_t)ret_var.inner;
24413 if (ret_var.is_owned) {
24419 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
24420 LDKChannelTransactionParameters this_ptr_conv;
24421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24422 this_ptr_conv.is_owned = false;
24423 LDKChannelPublicKeys val_conv;
24424 val_conv.inner = (void*)(val & (~1));
24425 val_conv.is_owned = (val & 1) || (val == 0);
24426 val_conv = ChannelPublicKeys_clone(&val_conv);
24427 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
24430 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
24431 LDKChannelTransactionParameters this_ptr_conv;
24432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24433 this_ptr_conv.is_owned = false;
24434 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
24438 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
24439 LDKChannelTransactionParameters this_ptr_conv;
24440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24441 this_ptr_conv.is_owned = false;
24442 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
24445 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
24446 LDKChannelTransactionParameters this_ptr_conv;
24447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24448 this_ptr_conv.is_owned = false;
24449 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
24453 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
24454 LDKChannelTransactionParameters this_ptr_conv;
24455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24456 this_ptr_conv.is_owned = false;
24457 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
24460 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
24461 LDKChannelTransactionParameters this_ptr_conv;
24462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24463 this_ptr_conv.is_owned = false;
24464 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
24465 uint64_t ret_ref = 0;
24466 if ((uint64_t)ret_var.inner > 4096) {
24467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24469 ret_ref = (uint64_t)ret_var.inner;
24470 if (ret_var.is_owned) {
24477 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
24478 LDKChannelTransactionParameters this_ptr_conv;
24479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24480 this_ptr_conv.is_owned = false;
24481 LDKCounterpartyChannelTransactionParameters val_conv;
24482 val_conv.inner = (void*)(val & (~1));
24483 val_conv.is_owned = (val & 1) || (val == 0);
24484 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
24485 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
24488 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
24489 LDKChannelTransactionParameters this_ptr_conv;
24490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24491 this_ptr_conv.is_owned = false;
24492 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
24493 uint64_t ret_ref = 0;
24494 if ((uint64_t)ret_var.inner > 4096) {
24495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24497 ret_ref = (uint64_t)ret_var.inner;
24498 if (ret_var.is_owned) {
24505 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
24506 LDKChannelTransactionParameters this_ptr_conv;
24507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24508 this_ptr_conv.is_owned = false;
24509 LDKOutPoint val_conv;
24510 val_conv.inner = (void*)(val & (~1));
24511 val_conv.is_owned = (val & 1) || (val == 0);
24512 val_conv = OutPoint_clone(&val_conv);
24513 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
24516 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) {
24517 LDKChannelPublicKeys holder_pubkeys_arg_conv;
24518 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
24519 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
24520 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
24521 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
24522 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
24523 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
24524 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
24525 LDKOutPoint funding_outpoint_arg_conv;
24526 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
24527 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
24528 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
24529 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);
24530 uint64_t ret_ref = 0;
24531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24533 ret_ref = (uint64_t)ret_var.inner;
24534 if (ret_var.is_owned) {
24540 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
24541 LDKChannelTransactionParameters orig_conv;
24542 orig_conv.inner = (void*)(orig & (~1));
24543 orig_conv.is_owned = false;
24544 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
24545 uint64_t ret_ref = 0;
24546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24548 ret_ref = (uint64_t)ret_var.inner;
24549 if (ret_var.is_owned) {
24555 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
24556 LDKCounterpartyChannelTransactionParameters this_obj_conv;
24557 this_obj_conv.inner = (void*)(this_obj & (~1));
24558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24559 CounterpartyChannelTransactionParameters_free(this_obj_conv);
24562 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
24563 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
24564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24565 this_ptr_conv.is_owned = false;
24566 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
24567 uint64_t ret_ref = 0;
24568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24570 ret_ref = (uint64_t)ret_var.inner;
24571 if (ret_var.is_owned) {
24577 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
24578 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
24579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24580 this_ptr_conv.is_owned = false;
24581 LDKChannelPublicKeys val_conv;
24582 val_conv.inner = (void*)(val & (~1));
24583 val_conv.is_owned = (val & 1) || (val == 0);
24584 val_conv = ChannelPublicKeys_clone(&val_conv);
24585 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
24588 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
24589 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
24590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24591 this_ptr_conv.is_owned = false;
24592 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
24596 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
24597 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
24598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24599 this_ptr_conv.is_owned = false;
24600 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
24603 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
24604 LDKChannelPublicKeys pubkeys_arg_conv;
24605 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
24606 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
24607 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
24608 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
24609 uint64_t ret_ref = 0;
24610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24612 ret_ref = (uint64_t)ret_var.inner;
24613 if (ret_var.is_owned) {
24619 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
24620 LDKCounterpartyChannelTransactionParameters orig_conv;
24621 orig_conv.inner = (void*)(orig & (~1));
24622 orig_conv.is_owned = false;
24623 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
24624 uint64_t ret_ref = 0;
24625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24627 ret_ref = (uint64_t)ret_var.inner;
24628 if (ret_var.is_owned) {
24634 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
24635 LDKChannelTransactionParameters this_arg_conv;
24636 this_arg_conv.inner = (void*)(this_arg & (~1));
24637 this_arg_conv.is_owned = false;
24638 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
24642 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
24643 LDKChannelTransactionParameters this_arg_conv;
24644 this_arg_conv.inner = (void*)(this_arg & (~1));
24645 this_arg_conv.is_owned = false;
24646 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
24647 uint64_t ret_ref = 0;
24648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24650 ret_ref = (uint64_t)ret_var.inner;
24651 if (ret_var.is_owned) {
24657 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
24658 LDKChannelTransactionParameters this_arg_conv;
24659 this_arg_conv.inner = (void*)(this_arg & (~1));
24660 this_arg_conv.is_owned = false;
24661 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
24662 uint64_t ret_ref = 0;
24663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24665 ret_ref = (uint64_t)ret_var.inner;
24666 if (ret_var.is_owned) {
24672 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
24673 LDKCounterpartyChannelTransactionParameters obj_conv;
24674 obj_conv.inner = (void*)(obj & (~1));
24675 obj_conv.is_owned = false;
24676 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
24677 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24678 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24679 CVec_u8Z_free(ret_var);
24683 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
24684 LDKu8slice ser_ref;
24685 ser_ref.datalen = *((uint32_t*)ser);
24686 ser_ref.data = (int8_t*)(ser + 4);
24687 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
24688 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
24689 return (uint64_t)ret_conv;
24692 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
24693 LDKChannelTransactionParameters obj_conv;
24694 obj_conv.inner = (void*)(obj & (~1));
24695 obj_conv.is_owned = false;
24696 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
24697 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24698 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24699 CVec_u8Z_free(ret_var);
24703 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
24704 LDKu8slice ser_ref;
24705 ser_ref.datalen = *((uint32_t*)ser);
24706 ser_ref.data = (int8_t*)(ser + 4);
24707 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
24708 *ret_conv = ChannelTransactionParameters_read(ser_ref);
24709 return (uint64_t)ret_conv;
24712 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
24713 LDKDirectedChannelTransactionParameters this_obj_conv;
24714 this_obj_conv.inner = (void*)(this_obj & (~1));
24715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24716 DirectedChannelTransactionParameters_free(this_obj_conv);
24719 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
24720 LDKDirectedChannelTransactionParameters this_arg_conv;
24721 this_arg_conv.inner = (void*)(this_arg & (~1));
24722 this_arg_conv.is_owned = false;
24723 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
24724 uint64_t ret_ref = 0;
24725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24727 ret_ref = (uint64_t)ret_var.inner;
24728 if (ret_var.is_owned) {
24734 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
24735 LDKDirectedChannelTransactionParameters this_arg_conv;
24736 this_arg_conv.inner = (void*)(this_arg & (~1));
24737 this_arg_conv.is_owned = false;
24738 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
24739 uint64_t ret_ref = 0;
24740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24742 ret_ref = (uint64_t)ret_var.inner;
24743 if (ret_var.is_owned) {
24749 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
24750 LDKDirectedChannelTransactionParameters this_arg_conv;
24751 this_arg_conv.inner = (void*)(this_arg & (~1));
24752 this_arg_conv.is_owned = false;
24753 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
24757 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
24758 LDKDirectedChannelTransactionParameters this_arg_conv;
24759 this_arg_conv.inner = (void*)(this_arg & (~1));
24760 this_arg_conv.is_owned = false;
24761 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
24765 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
24766 LDKDirectedChannelTransactionParameters this_arg_conv;
24767 this_arg_conv.inner = (void*)(this_arg & (~1));
24768 this_arg_conv.is_owned = false;
24769 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
24770 uint64_t ret_ref = 0;
24771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24773 ret_ref = (uint64_t)ret_var.inner;
24774 if (ret_var.is_owned) {
24780 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
24781 LDKHolderCommitmentTransaction this_obj_conv;
24782 this_obj_conv.inner = (void*)(this_obj & (~1));
24783 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24784 HolderCommitmentTransaction_free(this_obj_conv);
24787 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
24788 LDKHolderCommitmentTransaction this_ptr_conv;
24789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24790 this_ptr_conv.is_owned = false;
24791 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
24792 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
24796 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
24797 LDKHolderCommitmentTransaction this_ptr_conv;
24798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24799 this_ptr_conv.is_owned = false;
24800 LDKSignature val_ref;
24801 CHECK(*((uint32_t*)val) == 64);
24802 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
24803 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
24806 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
24807 LDKHolderCommitmentTransaction this_ptr_conv;
24808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24809 this_ptr_conv.is_owned = false;
24810 LDKCVec_SignatureZ val_constr;
24811 val_constr.datalen = *((uint32_t*)val);
24812 if (val_constr.datalen > 0)
24813 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24815 val_constr.data = NULL;
24816 int8_tArray* val_vals = (int8_tArray*)(val + 4);
24817 for (size_t m = 0; m < val_constr.datalen; m++) {
24818 int8_tArray val_conv_12 = val_vals[m];
24819 LDKSignature val_conv_12_ref;
24820 CHECK(*((uint32_t*)val_conv_12) == 64);
24821 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
24822 val_constr.data[m] = val_conv_12_ref;
24824 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
24827 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
24828 LDKHolderCommitmentTransaction orig_conv;
24829 orig_conv.inner = (void*)(orig & (~1));
24830 orig_conv.is_owned = false;
24831 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
24832 uint64_t ret_ref = 0;
24833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24835 ret_ref = (uint64_t)ret_var.inner;
24836 if (ret_var.is_owned) {
24842 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
24843 LDKHolderCommitmentTransaction obj_conv;
24844 obj_conv.inner = (void*)(obj & (~1));
24845 obj_conv.is_owned = false;
24846 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
24847 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24848 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24849 CVec_u8Z_free(ret_var);
24853 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
24854 LDKu8slice ser_ref;
24855 ser_ref.datalen = *((uint32_t*)ser);
24856 ser_ref.data = (int8_t*)(ser + 4);
24857 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
24858 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
24859 return (uint64_t)ret_conv;
24862 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) {
24863 LDKCommitmentTransaction commitment_tx_conv;
24864 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
24865 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
24866 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
24867 LDKSignature counterparty_sig_ref;
24868 CHECK(*((uint32_t*)counterparty_sig) == 64);
24869 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
24870 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
24871 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
24872 if (counterparty_htlc_sigs_constr.datalen > 0)
24873 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24875 counterparty_htlc_sigs_constr.data = NULL;
24876 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
24877 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
24878 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
24879 LDKSignature counterparty_htlc_sigs_conv_12_ref;
24880 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
24881 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
24882 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
24884 LDKPublicKey holder_funding_key_ref;
24885 CHECK(*((uint32_t*)holder_funding_key) == 33);
24886 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
24887 LDKPublicKey counterparty_funding_key_ref;
24888 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
24889 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
24890 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
24891 uint64_t ret_ref = 0;
24892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24894 ret_ref = (uint64_t)ret_var.inner;
24895 if (ret_var.is_owned) {
24901 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
24902 LDKBuiltCommitmentTransaction this_obj_conv;
24903 this_obj_conv.inner = (void*)(this_obj & (~1));
24904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24905 BuiltCommitmentTransaction_free(this_obj_conv);
24908 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
24909 LDKBuiltCommitmentTransaction this_ptr_conv;
24910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24911 this_ptr_conv.is_owned = false;
24912 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
24913 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24914 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24915 Transaction_free(ret_var);
24919 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
24920 LDKBuiltCommitmentTransaction this_ptr_conv;
24921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24922 this_ptr_conv.is_owned = false;
24923 LDKTransaction val_ref;
24924 val_ref.datalen = *((uint32_t*)val);
24925 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
24926 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
24927 val_ref.data_is_owned = true;
24928 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
24931 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
24932 LDKBuiltCommitmentTransaction this_ptr_conv;
24933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24934 this_ptr_conv.is_owned = false;
24935 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24936 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
24940 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
24941 LDKBuiltCommitmentTransaction this_ptr_conv;
24942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24943 this_ptr_conv.is_owned = false;
24944 LDKThirtyTwoBytes val_ref;
24945 CHECK(*((uint32_t*)val) == 32);
24946 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24947 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
24950 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
24951 LDKTransaction transaction_arg_ref;
24952 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
24953 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
24954 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
24955 transaction_arg_ref.data_is_owned = true;
24956 LDKThirtyTwoBytes txid_arg_ref;
24957 CHECK(*((uint32_t*)txid_arg) == 32);
24958 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
24959 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
24960 uint64_t ret_ref = 0;
24961 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24962 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24963 ret_ref = (uint64_t)ret_var.inner;
24964 if (ret_var.is_owned) {
24970 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
24971 LDKBuiltCommitmentTransaction orig_conv;
24972 orig_conv.inner = (void*)(orig & (~1));
24973 orig_conv.is_owned = false;
24974 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
24975 uint64_t ret_ref = 0;
24976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24978 ret_ref = (uint64_t)ret_var.inner;
24979 if (ret_var.is_owned) {
24985 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
24986 LDKBuiltCommitmentTransaction obj_conv;
24987 obj_conv.inner = (void*)(obj & (~1));
24988 obj_conv.is_owned = false;
24989 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
24990 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24991 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24992 CVec_u8Z_free(ret_var);
24996 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
24997 LDKu8slice ser_ref;
24998 ser_ref.datalen = *((uint32_t*)ser);
24999 ser_ref.data = (int8_t*)(ser + 4);
25000 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
25001 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
25002 return (uint64_t)ret_conv;
25005 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25006 LDKBuiltCommitmentTransaction this_arg_conv;
25007 this_arg_conv.inner = (void*)(this_arg & (~1));
25008 this_arg_conv.is_owned = false;
25009 LDKu8slice funding_redeemscript_ref;
25010 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
25011 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
25012 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25013 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
25017 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) {
25018 LDKBuiltCommitmentTransaction this_arg_conv;
25019 this_arg_conv.inner = (void*)(this_arg & (~1));
25020 this_arg_conv.is_owned = false;
25021 unsigned char funding_key_arr[32];
25022 CHECK(*((uint32_t*)funding_key) == 32);
25023 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
25024 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25025 LDKu8slice funding_redeemscript_ref;
25026 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
25027 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
25028 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25029 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
25033 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
25034 LDKClosingTransaction this_obj_conv;
25035 this_obj_conv.inner = (void*)(this_obj & (~1));
25036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25037 ClosingTransaction_free(this_obj_conv);
25040 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
25041 LDKClosingTransaction orig_conv;
25042 orig_conv.inner = (void*)(orig & (~1));
25043 orig_conv.is_owned = false;
25044 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
25045 uint64_t ret_ref = 0;
25046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25048 ret_ref = (uint64_t)ret_var.inner;
25049 if (ret_var.is_owned) {
25055 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
25056 LDKClosingTransaction o_conv;
25057 o_conv.inner = (void*)(o & (~1));
25058 o_conv.is_owned = false;
25059 int64_t ret_val = ClosingTransaction_hash(&o_conv);
25063 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) {
25064 LDKCVec_u8Z to_holder_script_ref;
25065 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
25066 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25067 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
25068 LDKCVec_u8Z to_counterparty_script_ref;
25069 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
25070 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25071 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
25072 LDKOutPoint funding_outpoint_conv;
25073 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25074 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25075 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25076 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
25077 uint64_t ret_ref = 0;
25078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25080 ret_ref = (uint64_t)ret_var.inner;
25081 if (ret_var.is_owned) {
25087 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
25088 LDKClosingTransaction this_arg_conv;
25089 this_arg_conv.inner = (void*)(this_arg & (~1));
25090 this_arg_conv.is_owned = false;
25091 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
25092 uint64_t ret_ref = 0;
25093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25095 ret_ref = (uint64_t)ret_var.inner;
25096 if (ret_var.is_owned) {
25102 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
25103 LDKClosingTransaction this_arg_conv;
25104 this_arg_conv.inner = (void*)(this_arg & (~1));
25105 this_arg_conv.is_owned = false;
25106 LDKOutPoint funding_outpoint_conv;
25107 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25108 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25109 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25110 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
25111 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
25112 return (uint64_t)ret_conv;
25115 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
25116 LDKClosingTransaction this_arg_conv;
25117 this_arg_conv.inner = (void*)(this_arg & (~1));
25118 this_arg_conv.is_owned = false;
25119 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
25123 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
25124 LDKClosingTransaction this_arg_conv;
25125 this_arg_conv.inner = (void*)(this_arg & (~1));
25126 this_arg_conv.is_owned = false;
25127 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
25131 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
25132 LDKClosingTransaction this_arg_conv;
25133 this_arg_conv.inner = (void*)(this_arg & (~1));
25134 this_arg_conv.is_owned = false;
25135 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
25136 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25137 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25141 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
25142 LDKClosingTransaction this_arg_conv;
25143 this_arg_conv.inner = (void*)(this_arg & (~1));
25144 this_arg_conv.is_owned = false;
25145 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
25146 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25147 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25151 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
25152 LDKTrustedClosingTransaction this_obj_conv;
25153 this_obj_conv.inner = (void*)(this_obj & (~1));
25154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25155 TrustedClosingTransaction_free(this_obj_conv);
25158 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
25159 LDKTrustedClosingTransaction this_arg_conv;
25160 this_arg_conv.inner = (void*)(this_arg & (~1));
25161 this_arg_conv.is_owned = false;
25162 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
25163 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25164 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25165 Transaction_free(ret_var);
25169 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25170 LDKTrustedClosingTransaction this_arg_conv;
25171 this_arg_conv.inner = (void*)(this_arg & (~1));
25172 this_arg_conv.is_owned = false;
25173 LDKu8slice funding_redeemscript_ref;
25174 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
25175 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
25176 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25177 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
25181 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) {
25182 LDKTrustedClosingTransaction this_arg_conv;
25183 this_arg_conv.inner = (void*)(this_arg & (~1));
25184 this_arg_conv.is_owned = false;
25185 unsigned char funding_key_arr[32];
25186 CHECK(*((uint32_t*)funding_key) == 32);
25187 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
25188 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25189 LDKu8slice funding_redeemscript_ref;
25190 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
25191 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
25192 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
25193 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
25197 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
25198 LDKCommitmentTransaction this_obj_conv;
25199 this_obj_conv.inner = (void*)(this_obj & (~1));
25200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25201 CommitmentTransaction_free(this_obj_conv);
25204 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
25205 LDKCommitmentTransaction orig_conv;
25206 orig_conv.inner = (void*)(orig & (~1));
25207 orig_conv.is_owned = false;
25208 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
25209 uint64_t ret_ref = 0;
25210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25212 ret_ref = (uint64_t)ret_var.inner;
25213 if (ret_var.is_owned) {
25219 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
25220 LDKCommitmentTransaction obj_conv;
25221 obj_conv.inner = (void*)(obj & (~1));
25222 obj_conv.is_owned = false;
25223 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
25224 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25225 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25226 CVec_u8Z_free(ret_var);
25230 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
25231 LDKu8slice ser_ref;
25232 ser_ref.datalen = *((uint32_t*)ser);
25233 ser_ref.data = (int8_t*)(ser + 4);
25234 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
25235 *ret_conv = CommitmentTransaction_read(ser_ref);
25236 return (uint64_t)ret_conv;
25239 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
25240 LDKCommitmentTransaction this_arg_conv;
25241 this_arg_conv.inner = (void*)(this_arg & (~1));
25242 this_arg_conv.is_owned = false;
25243 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
25247 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
25248 LDKCommitmentTransaction this_arg_conv;
25249 this_arg_conv.inner = (void*)(this_arg & (~1));
25250 this_arg_conv.is_owned = false;
25251 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
25255 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
25256 LDKCommitmentTransaction this_arg_conv;
25257 this_arg_conv.inner = (void*)(this_arg & (~1));
25258 this_arg_conv.is_owned = false;
25259 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
25263 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
25264 LDKCommitmentTransaction this_arg_conv;
25265 this_arg_conv.inner = (void*)(this_arg & (~1));
25266 this_arg_conv.is_owned = false;
25267 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
25271 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
25272 LDKCommitmentTransaction this_arg_conv;
25273 this_arg_conv.inner = (void*)(this_arg & (~1));
25274 this_arg_conv.is_owned = false;
25275 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
25276 uint64_t ret_ref = 0;
25277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25279 ret_ref = (uint64_t)ret_var.inner;
25280 if (ret_var.is_owned) {
25286 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
25287 LDKCommitmentTransaction this_arg_conv;
25288 this_arg_conv.inner = (void*)(this_arg & (~1));
25289 this_arg_conv.is_owned = false;
25290 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25291 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25292 channel_parameters_conv.is_owned = false;
25293 LDKChannelPublicKeys broadcaster_keys_conv;
25294 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
25295 broadcaster_keys_conv.is_owned = false;
25296 LDKChannelPublicKeys countersignatory_keys_conv;
25297 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
25298 countersignatory_keys_conv.is_owned = false;
25299 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
25300 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
25301 return (uint64_t)ret_conv;
25304 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
25305 LDKTrustedCommitmentTransaction this_obj_conv;
25306 this_obj_conv.inner = (void*)(this_obj & (~1));
25307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25308 TrustedCommitmentTransaction_free(this_obj_conv);
25311 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
25312 LDKTrustedCommitmentTransaction this_arg_conv;
25313 this_arg_conv.inner = (void*)(this_arg & (~1));
25314 this_arg_conv.is_owned = false;
25315 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25316 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
25320 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
25321 LDKTrustedCommitmentTransaction this_arg_conv;
25322 this_arg_conv.inner = (void*)(this_arg & (~1));
25323 this_arg_conv.is_owned = false;
25324 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
25325 uint64_t ret_ref = 0;
25326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25328 ret_ref = (uint64_t)ret_var.inner;
25329 if (ret_var.is_owned) {
25335 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
25336 LDKTrustedCommitmentTransaction this_arg_conv;
25337 this_arg_conv.inner = (void*)(this_arg & (~1));
25338 this_arg_conv.is_owned = false;
25339 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
25340 uint64_t ret_ref = 0;
25341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25343 ret_ref = (uint64_t)ret_var.inner;
25344 if (ret_var.is_owned) {
25350 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
25351 LDKTrustedCommitmentTransaction this_arg_conv;
25352 this_arg_conv.inner = (void*)(this_arg & (~1));
25353 this_arg_conv.is_owned = false;
25354 unsigned char htlc_base_key_arr[32];
25355 CHECK(*((uint32_t*)htlc_base_key) == 32);
25356 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
25357 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
25358 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25359 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25360 channel_parameters_conv.is_owned = false;
25361 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
25362 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
25363 return (uint64_t)ret_conv;
25366 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) {
25367 LDKPublicKey broadcaster_payment_basepoint_ref;
25368 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
25369 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
25370 LDKPublicKey countersignatory_payment_basepoint_ref;
25371 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
25372 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
25373 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
25377 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
25378 LDKInitFeatures a_conv;
25379 a_conv.inner = (void*)(a & (~1));
25380 a_conv.is_owned = false;
25381 LDKInitFeatures b_conv;
25382 b_conv.inner = (void*)(b & (~1));
25383 b_conv.is_owned = false;
25384 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
25388 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
25389 LDKNodeFeatures a_conv;
25390 a_conv.inner = (void*)(a & (~1));
25391 a_conv.is_owned = false;
25392 LDKNodeFeatures b_conv;
25393 b_conv.inner = (void*)(b & (~1));
25394 b_conv.is_owned = false;
25395 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
25399 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
25400 LDKChannelFeatures a_conv;
25401 a_conv.inner = (void*)(a & (~1));
25402 a_conv.is_owned = false;
25403 LDKChannelFeatures b_conv;
25404 b_conv.inner = (void*)(b & (~1));
25405 b_conv.is_owned = false;
25406 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
25410 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
25411 LDKInvoiceFeatures a_conv;
25412 a_conv.inner = (void*)(a & (~1));
25413 a_conv.is_owned = false;
25414 LDKInvoiceFeatures b_conv;
25415 b_conv.inner = (void*)(b & (~1));
25416 b_conv.is_owned = false;
25417 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
25421 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
25422 LDKInitFeatures orig_conv;
25423 orig_conv.inner = (void*)(orig & (~1));
25424 orig_conv.is_owned = false;
25425 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
25426 uint64_t ret_ref = 0;
25427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25429 ret_ref = (uint64_t)ret_var.inner;
25430 if (ret_var.is_owned) {
25436 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
25437 LDKNodeFeatures orig_conv;
25438 orig_conv.inner = (void*)(orig & (~1));
25439 orig_conv.is_owned = false;
25440 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
25441 uint64_t ret_ref = 0;
25442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25444 ret_ref = (uint64_t)ret_var.inner;
25445 if (ret_var.is_owned) {
25451 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
25452 LDKChannelFeatures orig_conv;
25453 orig_conv.inner = (void*)(orig & (~1));
25454 orig_conv.is_owned = false;
25455 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
25456 uint64_t ret_ref = 0;
25457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25459 ret_ref = (uint64_t)ret_var.inner;
25460 if (ret_var.is_owned) {
25466 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
25467 LDKInvoiceFeatures orig_conv;
25468 orig_conv.inner = (void*)(orig & (~1));
25469 orig_conv.is_owned = false;
25470 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
25471 uint64_t ret_ref = 0;
25472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25474 ret_ref = (uint64_t)ret_var.inner;
25475 if (ret_var.is_owned) {
25481 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
25482 LDKInitFeatures this_obj_conv;
25483 this_obj_conv.inner = (void*)(this_obj & (~1));
25484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25485 InitFeatures_free(this_obj_conv);
25488 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
25489 LDKNodeFeatures this_obj_conv;
25490 this_obj_conv.inner = (void*)(this_obj & (~1));
25491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25492 NodeFeatures_free(this_obj_conv);
25495 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
25496 LDKChannelFeatures this_obj_conv;
25497 this_obj_conv.inner = (void*)(this_obj & (~1));
25498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25499 ChannelFeatures_free(this_obj_conv);
25502 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
25503 LDKInvoiceFeatures this_obj_conv;
25504 this_obj_conv.inner = (void*)(this_obj & (~1));
25505 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25506 InvoiceFeatures_free(this_obj_conv);
25509 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
25510 LDKInitFeatures ret_var = InitFeatures_empty();
25511 uint64_t ret_ref = 0;
25512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25514 ret_ref = (uint64_t)ret_var.inner;
25515 if (ret_var.is_owned) {
25521 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
25522 LDKInitFeatures ret_var = InitFeatures_known();
25523 uint64_t ret_ref = 0;
25524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25526 ret_ref = (uint64_t)ret_var.inner;
25527 if (ret_var.is_owned) {
25533 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
25534 LDKInitFeatures this_arg_conv;
25535 this_arg_conv.inner = (void*)(this_arg & (~1));
25536 this_arg_conv.is_owned = false;
25537 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
25541 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
25542 LDKNodeFeatures ret_var = NodeFeatures_empty();
25543 uint64_t ret_ref = 0;
25544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25546 ret_ref = (uint64_t)ret_var.inner;
25547 if (ret_var.is_owned) {
25553 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
25554 LDKNodeFeatures ret_var = NodeFeatures_known();
25555 uint64_t ret_ref = 0;
25556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25558 ret_ref = (uint64_t)ret_var.inner;
25559 if (ret_var.is_owned) {
25565 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
25566 LDKNodeFeatures this_arg_conv;
25567 this_arg_conv.inner = (void*)(this_arg & (~1));
25568 this_arg_conv.is_owned = false;
25569 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
25573 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
25574 LDKChannelFeatures ret_var = ChannelFeatures_empty();
25575 uint64_t ret_ref = 0;
25576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25578 ret_ref = (uint64_t)ret_var.inner;
25579 if (ret_var.is_owned) {
25585 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
25586 LDKChannelFeatures ret_var = ChannelFeatures_known();
25587 uint64_t ret_ref = 0;
25588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25590 ret_ref = (uint64_t)ret_var.inner;
25591 if (ret_var.is_owned) {
25597 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
25598 LDKChannelFeatures this_arg_conv;
25599 this_arg_conv.inner = (void*)(this_arg & (~1));
25600 this_arg_conv.is_owned = false;
25601 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
25605 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
25606 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
25607 uint64_t ret_ref = 0;
25608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25610 ret_ref = (uint64_t)ret_var.inner;
25611 if (ret_var.is_owned) {
25617 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
25618 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
25619 uint64_t ret_ref = 0;
25620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25622 ret_ref = (uint64_t)ret_var.inner;
25623 if (ret_var.is_owned) {
25629 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
25630 LDKInvoiceFeatures this_arg_conv;
25631 this_arg_conv.inner = (void*)(this_arg & (~1));
25632 this_arg_conv.is_owned = false;
25633 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
25637 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
25638 LDKInitFeatures this_arg_conv;
25639 this_arg_conv.inner = (void*)(this_arg & (~1));
25640 this_arg_conv.is_owned = false;
25641 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
25645 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
25646 LDKNodeFeatures this_arg_conv;
25647 this_arg_conv.inner = (void*)(this_arg & (~1));
25648 this_arg_conv.is_owned = false;
25649 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
25653 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
25654 LDKInvoiceFeatures this_arg_conv;
25655 this_arg_conv.inner = (void*)(this_arg & (~1));
25656 this_arg_conv.is_owned = false;
25657 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
25661 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
25662 LDKInitFeatures obj_conv;
25663 obj_conv.inner = (void*)(obj & (~1));
25664 obj_conv.is_owned = false;
25665 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
25666 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25667 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25668 CVec_u8Z_free(ret_var);
25672 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
25673 LDKNodeFeatures obj_conv;
25674 obj_conv.inner = (void*)(obj & (~1));
25675 obj_conv.is_owned = false;
25676 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
25677 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25678 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25679 CVec_u8Z_free(ret_var);
25683 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
25684 LDKChannelFeatures obj_conv;
25685 obj_conv.inner = (void*)(obj & (~1));
25686 obj_conv.is_owned = false;
25687 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
25688 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25689 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25690 CVec_u8Z_free(ret_var);
25694 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
25695 LDKInvoiceFeatures obj_conv;
25696 obj_conv.inner = (void*)(obj & (~1));
25697 obj_conv.is_owned = false;
25698 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
25699 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25700 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25701 CVec_u8Z_free(ret_var);
25705 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
25706 LDKu8slice ser_ref;
25707 ser_ref.datalen = *((uint32_t*)ser);
25708 ser_ref.data = (int8_t*)(ser + 4);
25709 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25710 *ret_conv = InitFeatures_read(ser_ref);
25711 return (uint64_t)ret_conv;
25714 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
25715 LDKu8slice ser_ref;
25716 ser_ref.datalen = *((uint32_t*)ser);
25717 ser_ref.data = (int8_t*)(ser + 4);
25718 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25719 *ret_conv = NodeFeatures_read(ser_ref);
25720 return (uint64_t)ret_conv;
25723 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
25724 LDKu8slice ser_ref;
25725 ser_ref.datalen = *((uint32_t*)ser);
25726 ser_ref.data = (int8_t*)(ser + 4);
25727 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25728 *ret_conv = ChannelFeatures_read(ser_ref);
25729 return (uint64_t)ret_conv;
25732 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
25733 LDKu8slice ser_ref;
25734 ser_ref.datalen = *((uint32_t*)ser);
25735 ser_ref.data = (int8_t*)(ser + 4);
25736 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
25737 *ret_conv = InvoiceFeatures_read(ser_ref);
25738 return (uint64_t)ret_conv;
25741 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
25742 LDKShutdownScript this_obj_conv;
25743 this_obj_conv.inner = (void*)(this_obj & (~1));
25744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25745 ShutdownScript_free(this_obj_conv);
25748 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
25749 LDKShutdownScript orig_conv;
25750 orig_conv.inner = (void*)(orig & (~1));
25751 orig_conv.is_owned = false;
25752 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
25753 uint64_t ret_ref = 0;
25754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25756 ret_ref = (uint64_t)ret_var.inner;
25757 if (ret_var.is_owned) {
25763 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
25764 LDKInvalidShutdownScript this_obj_conv;
25765 this_obj_conv.inner = (void*)(this_obj & (~1));
25766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25767 InvalidShutdownScript_free(this_obj_conv);
25770 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
25771 LDKInvalidShutdownScript this_ptr_conv;
25772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25773 this_ptr_conv.is_owned = false;
25774 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
25775 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25776 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25780 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
25781 LDKInvalidShutdownScript this_ptr_conv;
25782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25783 this_ptr_conv.is_owned = false;
25784 LDKCVec_u8Z val_ref;
25785 val_ref.datalen = *((uint32_t*)val);
25786 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25787 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
25788 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
25791 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
25792 LDKCVec_u8Z script_arg_ref;
25793 script_arg_ref.datalen = *((uint32_t*)script_arg);
25794 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25795 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
25796 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
25797 uint64_t ret_ref = 0;
25798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25800 ret_ref = (uint64_t)ret_var.inner;
25801 if (ret_var.is_owned) {
25807 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
25808 LDKInvalidShutdownScript orig_conv;
25809 orig_conv.inner = (void*)(orig & (~1));
25810 orig_conv.is_owned = false;
25811 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
25812 uint64_t ret_ref = 0;
25813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25815 ret_ref = (uint64_t)ret_var.inner;
25816 if (ret_var.is_owned) {
25822 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
25823 LDKShutdownScript obj_conv;
25824 obj_conv.inner = (void*)(obj & (~1));
25825 obj_conv.is_owned = false;
25826 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
25827 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25828 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25829 CVec_u8Z_free(ret_var);
25833 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
25834 LDKu8slice ser_ref;
25835 ser_ref.datalen = *((uint32_t*)ser);
25836 ser_ref.data = (int8_t*)(ser + 4);
25837 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
25838 *ret_conv = ShutdownScript_read(ser_ref);
25839 return (uint64_t)ret_conv;
25842 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
25843 unsigned char pubkey_hash_arr[20];
25844 CHECK(*((uint32_t*)pubkey_hash) == 20);
25845 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
25846 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
25847 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
25848 uint64_t ret_ref = 0;
25849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25851 ret_ref = (uint64_t)ret_var.inner;
25852 if (ret_var.is_owned) {
25858 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
25859 unsigned char script_hash_arr[32];
25860 CHECK(*((uint32_t*)script_hash) == 32);
25861 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
25862 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
25863 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
25864 uint64_t ret_ref = 0;
25865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25867 ret_ref = (uint64_t)ret_var.inner;
25868 if (ret_var.is_owned) {
25874 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
25875 LDKu8slice program_ref;
25876 program_ref.datalen = *((uint32_t*)program);
25877 program_ref.data = (int8_t*)(program + 4);
25878 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
25879 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
25880 return (uint64_t)ret_conv;
25883 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
25884 LDKShutdownScript this_arg_conv;
25885 this_arg_conv.inner = (void*)(this_arg & (~1));
25886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25887 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
25888 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
25889 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25890 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25891 CVec_u8Z_free(ret_var);
25895 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
25896 LDKShutdownScript this_arg_conv;
25897 this_arg_conv.inner = (void*)(this_arg & (~1));
25898 this_arg_conv.is_owned = false;
25899 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25900 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
25904 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
25905 LDKShutdownScript this_arg_conv;
25906 this_arg_conv.inner = (void*)(this_arg & (~1));
25907 this_arg_conv.is_owned = false;
25908 LDKInitFeatures features_conv;
25909 features_conv.inner = (void*)(features & (~1));
25910 features_conv.is_owned = false;
25911 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
25915 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
25916 if ((this_ptr & 1) != 0) return;
25917 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25918 CHECK_ACCESS(this_ptr_ptr);
25919 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
25920 FREE((void*)this_ptr);
25921 CustomMessageReader_free(this_ptr_conv);
25924 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
25925 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
25926 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
25927 LDKType* orig_conv = (LDKType*)orig_ptr;
25928 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
25929 *ret_ret = Type_clone(orig_conv);
25930 return (uint64_t)ret_ret;
25933 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
25934 if ((this_ptr & 1) != 0) return;
25935 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25936 CHECK_ACCESS(this_ptr_ptr);
25937 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
25938 FREE((void*)this_ptr);
25939 Type_free(this_ptr_conv);
25942 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
25943 if ((this_ptr & 1) != 0) return;
25944 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25945 CHECK_ACCESS(this_ptr_ptr);
25946 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
25947 FREE((void*)this_ptr);
25948 Score_free(this_ptr_conv);
25951 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_obj) {
25952 LDKLockableScore this_obj_conv;
25953 this_obj_conv.inner = (void*)(this_obj & (~1));
25954 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25955 LockableScore_free(this_obj_conv);
25958 uint32_t __attribute__((visibility("default"))) TS_LockableScore_new(uint32_t score) {
25959 void* score_ptr = (void*)(((uint64_t)score) & ~1);
25960 CHECK_ACCESS(score_ptr);
25961 LDKScore score_conv = *(LDKScore*)(score_ptr);
25962 LDKLockableScore ret_var = LockableScore_new(score_conv);
25963 uint64_t ret_ref = 0;
25964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25966 ret_ref = (uint64_t)ret_var.inner;
25967 if (ret_var.is_owned) {
25973 int8_tArray __attribute__((visibility("default"))) TS_LockableScore_write(uint32_t obj) {
25974 LDKLockableScore obj_conv;
25975 obj_conv.inner = (void*)(obj & (~1));
25976 obj_conv.is_owned = false;
25977 LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv);
25978 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25979 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25980 CVec_u8Z_free(ret_var);
25984 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
25985 LDKNodeId this_obj_conv;
25986 this_obj_conv.inner = (void*)(this_obj & (~1));
25987 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25988 NodeId_free(this_obj_conv);
25991 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
25992 LDKNodeId orig_conv;
25993 orig_conv.inner = (void*)(orig & (~1));
25994 orig_conv.is_owned = false;
25995 LDKNodeId ret_var = NodeId_clone(&orig_conv);
25996 uint64_t ret_ref = 0;
25997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25999 ret_ref = (uint64_t)ret_var.inner;
26000 if (ret_var.is_owned) {
26006 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
26007 LDKPublicKey pubkey_ref;
26008 CHECK(*((uint32_t*)pubkey) == 33);
26009 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
26010 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
26011 uint64_t ret_ref = 0;
26012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26014 ret_ref = (uint64_t)ret_var.inner;
26015 if (ret_var.is_owned) {
26021 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
26022 LDKNodeId this_arg_conv;
26023 this_arg_conv.inner = (void*)(this_arg & (~1));
26024 this_arg_conv.is_owned = false;
26025 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
26026 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26027 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26031 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
26033 o_conv.inner = (void*)(o & (~1));
26034 o_conv.is_owned = false;
26035 int64_t ret_val = NodeId_hash(&o_conv);
26039 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
26040 LDKNodeId obj_conv;
26041 obj_conv.inner = (void*)(obj & (~1));
26042 obj_conv.is_owned = false;
26043 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
26044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26046 CVec_u8Z_free(ret_var);
26050 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
26051 LDKu8slice ser_ref;
26052 ser_ref.datalen = *((uint32_t*)ser);
26053 ser_ref.data = (int8_t*)(ser + 4);
26054 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26055 *ret_conv = NodeId_read(ser_ref);
26056 return (uint64_t)ret_conv;
26059 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
26060 LDKNetworkGraph this_obj_conv;
26061 this_obj_conv.inner = (void*)(this_obj & (~1));
26062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26063 NetworkGraph_free(this_obj_conv);
26066 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
26067 LDKNetworkGraph orig_conv;
26068 orig_conv.inner = (void*)(orig & (~1));
26069 orig_conv.is_owned = false;
26070 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
26071 uint64_t ret_ref = 0;
26072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26074 ret_ref = (uint64_t)ret_var.inner;
26075 if (ret_var.is_owned) {
26081 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
26082 LDKReadOnlyNetworkGraph this_obj_conv;
26083 this_obj_conv.inner = (void*)(this_obj & (~1));
26084 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26085 ReadOnlyNetworkGraph_free(this_obj_conv);
26088 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
26089 if ((this_ptr & 1) != 0) return;
26090 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26091 CHECK_ACCESS(this_ptr_ptr);
26092 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
26093 FREE((void*)this_ptr);
26094 NetworkUpdate_free(this_ptr_conv);
26097 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
26098 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
26099 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
26100 *ret_copy = NetworkUpdate_clone(orig_conv);
26101 uint64_t ret_ref = (uint64_t)ret_copy;
26105 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
26106 LDKChannelUpdate msg_conv;
26107 msg_conv.inner = (void*)(msg & (~1));
26108 msg_conv.is_owned = (msg & 1) || (msg == 0);
26109 msg_conv = ChannelUpdate_clone(&msg_conv);
26110 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
26111 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
26112 uint64_t ret_ref = (uint64_t)ret_copy;
26116 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
26117 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
26118 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
26119 uint64_t ret_ref = (uint64_t)ret_copy;
26123 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
26124 LDKPublicKey node_id_ref;
26125 CHECK(*((uint32_t*)node_id) == 33);
26126 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
26127 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
26128 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
26129 uint64_t ret_ref = (uint64_t)ret_copy;
26133 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
26134 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
26135 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
26136 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26137 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26138 CVec_u8Z_free(ret_var);
26142 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
26143 LDKNetGraphMsgHandler this_arg_conv;
26144 this_arg_conv.inner = (void*)(this_arg & (~1));
26145 this_arg_conv.is_owned = false;
26146 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
26147 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
26148 return (uint64_t)ret_ret;
26151 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
26152 LDKNetGraphMsgHandler this_obj_conv;
26153 this_obj_conv.inner = (void*)(this_obj & (~1));
26154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26155 NetGraphMsgHandler_free(this_obj_conv);
26158 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
26159 LDKNetworkGraph network_graph_conv;
26160 network_graph_conv.inner = (void*)(network_graph & (~1));
26161 network_graph_conv.is_owned = false;
26162 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
26163 CHECK_ACCESS(chain_access_ptr);
26164 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
26165 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
26166 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
26167 // Manually implement clone for Java trait instances
26169 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
26170 CHECK_ACCESS(logger_ptr);
26171 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26172 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
26173 uint64_t ret_ref = 0;
26174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26176 ret_ref = (uint64_t)ret_var.inner;
26177 if (ret_var.is_owned) {
26183 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
26184 LDKNetGraphMsgHandler this_arg_conv;
26185 this_arg_conv.inner = (void*)(this_arg & (~1));
26186 this_arg_conv.is_owned = false;
26187 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
26188 CHECK_ACCESS(chain_access_ptr);
26189 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
26190 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
26191 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
26192 // Manually implement clone for Java trait instances
26194 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
26197 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
26198 LDKNetGraphMsgHandler this_arg_conv;
26199 this_arg_conv.inner = (void*)(this_arg & (~1));
26200 this_arg_conv.is_owned = false;
26201 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
26202 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
26203 return (uint64_t)ret_ret;
26206 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
26207 LDKNetGraphMsgHandler this_arg_conv;
26208 this_arg_conv.inner = (void*)(this_arg & (~1));
26209 this_arg_conv.is_owned = false;
26210 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26211 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
26212 return (uint64_t)ret_ret;
26215 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
26216 LDKDirectionalChannelInfo this_obj_conv;
26217 this_obj_conv.inner = (void*)(this_obj & (~1));
26218 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26219 DirectionalChannelInfo_free(this_obj_conv);
26222 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
26223 LDKDirectionalChannelInfo this_ptr_conv;
26224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26225 this_ptr_conv.is_owned = false;
26226 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
26230 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
26231 LDKDirectionalChannelInfo this_ptr_conv;
26232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26233 this_ptr_conv.is_owned = false;
26234 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
26237 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
26238 LDKDirectionalChannelInfo this_ptr_conv;
26239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26240 this_ptr_conv.is_owned = false;
26241 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
26245 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
26246 LDKDirectionalChannelInfo this_ptr_conv;
26247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26248 this_ptr_conv.is_owned = false;
26249 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
26252 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
26253 LDKDirectionalChannelInfo this_ptr_conv;
26254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26255 this_ptr_conv.is_owned = false;
26256 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
26260 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26261 LDKDirectionalChannelInfo this_ptr_conv;
26262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26263 this_ptr_conv.is_owned = false;
26264 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
26267 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
26268 LDKDirectionalChannelInfo this_ptr_conv;
26269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26270 this_ptr_conv.is_owned = false;
26271 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
26275 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26276 LDKDirectionalChannelInfo this_ptr_conv;
26277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26278 this_ptr_conv.is_owned = false;
26279 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
26282 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
26283 LDKDirectionalChannelInfo this_ptr_conv;
26284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26285 this_ptr_conv.is_owned = false;
26286 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26287 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
26288 uint64_t ret_ref = (uint64_t)ret_copy;
26292 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
26293 LDKDirectionalChannelInfo this_ptr_conv;
26294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26295 this_ptr_conv.is_owned = false;
26296 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26297 CHECK_ACCESS(val_ptr);
26298 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26299 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26300 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
26303 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
26304 LDKDirectionalChannelInfo this_ptr_conv;
26305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26306 this_ptr_conv.is_owned = false;
26307 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
26308 uint64_t ret_ref = 0;
26309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26311 ret_ref = (uint64_t)ret_var.inner;
26312 if (ret_var.is_owned) {
26318 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
26319 LDKDirectionalChannelInfo this_ptr_conv;
26320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26321 this_ptr_conv.is_owned = false;
26322 LDKRoutingFees val_conv;
26323 val_conv.inner = (void*)(val & (~1));
26324 val_conv.is_owned = (val & 1) || (val == 0);
26325 val_conv = RoutingFees_clone(&val_conv);
26326 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
26329 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
26330 LDKDirectionalChannelInfo this_ptr_conv;
26331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26332 this_ptr_conv.is_owned = false;
26333 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
26334 uint64_t ret_ref = 0;
26335 if ((uint64_t)ret_var.inner > 4096) {
26336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26338 ret_ref = (uint64_t)ret_var.inner;
26339 if (ret_var.is_owned) {
26346 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
26347 LDKDirectionalChannelInfo this_ptr_conv;
26348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26349 this_ptr_conv.is_owned = false;
26350 LDKChannelUpdate val_conv;
26351 val_conv.inner = (void*)(val & (~1));
26352 val_conv.is_owned = (val & 1) || (val == 0);
26353 val_conv = ChannelUpdate_clone(&val_conv);
26354 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
26357 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) {
26358 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
26359 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
26360 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
26361 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
26362 LDKRoutingFees fees_arg_conv;
26363 fees_arg_conv.inner = (void*)(fees_arg & (~1));
26364 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
26365 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
26366 LDKChannelUpdate last_update_message_arg_conv;
26367 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
26368 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
26369 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
26370 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);
26371 uint64_t ret_ref = 0;
26372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26374 ret_ref = (uint64_t)ret_var.inner;
26375 if (ret_var.is_owned) {
26381 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
26382 LDKDirectionalChannelInfo orig_conv;
26383 orig_conv.inner = (void*)(orig & (~1));
26384 orig_conv.is_owned = false;
26385 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
26386 uint64_t ret_ref = 0;
26387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26389 ret_ref = (uint64_t)ret_var.inner;
26390 if (ret_var.is_owned) {
26396 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
26397 LDKDirectionalChannelInfo obj_conv;
26398 obj_conv.inner = (void*)(obj & (~1));
26399 obj_conv.is_owned = false;
26400 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
26401 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26402 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26403 CVec_u8Z_free(ret_var);
26407 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
26408 LDKu8slice ser_ref;
26409 ser_ref.datalen = *((uint32_t*)ser);
26410 ser_ref.data = (int8_t*)(ser + 4);
26411 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
26412 *ret_conv = DirectionalChannelInfo_read(ser_ref);
26413 return (uint64_t)ret_conv;
26416 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
26417 LDKChannelInfo this_obj_conv;
26418 this_obj_conv.inner = (void*)(this_obj & (~1));
26419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26420 ChannelInfo_free(this_obj_conv);
26423 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
26424 LDKChannelInfo this_ptr_conv;
26425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26426 this_ptr_conv.is_owned = false;
26427 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
26428 uint64_t ret_ref = 0;
26429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26431 ret_ref = (uint64_t)ret_var.inner;
26432 if (ret_var.is_owned) {
26438 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
26439 LDKChannelInfo this_ptr_conv;
26440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26441 this_ptr_conv.is_owned = false;
26442 LDKChannelFeatures val_conv;
26443 val_conv.inner = (void*)(val & (~1));
26444 val_conv.is_owned = (val & 1) || (val == 0);
26445 val_conv = ChannelFeatures_clone(&val_conv);
26446 ChannelInfo_set_features(&this_ptr_conv, val_conv);
26449 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
26450 LDKChannelInfo this_ptr_conv;
26451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26452 this_ptr_conv.is_owned = false;
26453 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
26454 uint64_t ret_ref = 0;
26455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26457 ret_ref = (uint64_t)ret_var.inner;
26458 if (ret_var.is_owned) {
26464 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
26465 LDKChannelInfo this_ptr_conv;
26466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26467 this_ptr_conv.is_owned = false;
26468 LDKNodeId val_conv;
26469 val_conv.inner = (void*)(val & (~1));
26470 val_conv.is_owned = (val & 1) || (val == 0);
26471 val_conv = NodeId_clone(&val_conv);
26472 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
26475 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
26476 LDKChannelInfo this_ptr_conv;
26477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26478 this_ptr_conv.is_owned = false;
26479 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
26480 uint64_t ret_ref = 0;
26481 if ((uint64_t)ret_var.inner > 4096) {
26482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26484 ret_ref = (uint64_t)ret_var.inner;
26485 if (ret_var.is_owned) {
26492 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
26493 LDKChannelInfo this_ptr_conv;
26494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26495 this_ptr_conv.is_owned = false;
26496 LDKDirectionalChannelInfo val_conv;
26497 val_conv.inner = (void*)(val & (~1));
26498 val_conv.is_owned = (val & 1) || (val == 0);
26499 val_conv = DirectionalChannelInfo_clone(&val_conv);
26500 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
26503 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
26504 LDKChannelInfo this_ptr_conv;
26505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26506 this_ptr_conv.is_owned = false;
26507 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
26508 uint64_t ret_ref = 0;
26509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26511 ret_ref = (uint64_t)ret_var.inner;
26512 if (ret_var.is_owned) {
26518 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
26519 LDKChannelInfo this_ptr_conv;
26520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26521 this_ptr_conv.is_owned = false;
26522 LDKNodeId val_conv;
26523 val_conv.inner = (void*)(val & (~1));
26524 val_conv.is_owned = (val & 1) || (val == 0);
26525 val_conv = NodeId_clone(&val_conv);
26526 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
26529 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
26530 LDKChannelInfo this_ptr_conv;
26531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26532 this_ptr_conv.is_owned = false;
26533 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
26534 uint64_t ret_ref = 0;
26535 if ((uint64_t)ret_var.inner > 4096) {
26536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26538 ret_ref = (uint64_t)ret_var.inner;
26539 if (ret_var.is_owned) {
26546 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
26547 LDKChannelInfo this_ptr_conv;
26548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26549 this_ptr_conv.is_owned = false;
26550 LDKDirectionalChannelInfo val_conv;
26551 val_conv.inner = (void*)(val & (~1));
26552 val_conv.is_owned = (val & 1) || (val == 0);
26553 val_conv = DirectionalChannelInfo_clone(&val_conv);
26554 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
26557 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
26558 LDKChannelInfo this_ptr_conv;
26559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26560 this_ptr_conv.is_owned = false;
26561 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26562 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
26563 uint64_t ret_ref = (uint64_t)ret_copy;
26567 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
26568 LDKChannelInfo this_ptr_conv;
26569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26570 this_ptr_conv.is_owned = false;
26571 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26572 CHECK_ACCESS(val_ptr);
26573 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26574 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26575 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
26578 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
26579 LDKChannelInfo this_ptr_conv;
26580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26581 this_ptr_conv.is_owned = false;
26582 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
26583 uint64_t ret_ref = 0;
26584 if ((uint64_t)ret_var.inner > 4096) {
26585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26587 ret_ref = (uint64_t)ret_var.inner;
26588 if (ret_var.is_owned) {
26595 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
26596 LDKChannelInfo this_ptr_conv;
26597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26598 this_ptr_conv.is_owned = false;
26599 LDKChannelAnnouncement val_conv;
26600 val_conv.inner = (void*)(val & (~1));
26601 val_conv.is_owned = (val & 1) || (val == 0);
26602 val_conv = ChannelAnnouncement_clone(&val_conv);
26603 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
26606 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
26607 LDKChannelFeatures features_arg_conv;
26608 features_arg_conv.inner = (void*)(features_arg & (~1));
26609 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26610 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
26611 LDKNodeId node_one_arg_conv;
26612 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
26613 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
26614 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
26615 LDKDirectionalChannelInfo one_to_two_arg_conv;
26616 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
26617 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
26618 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
26619 LDKNodeId node_two_arg_conv;
26620 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
26621 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
26622 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
26623 LDKDirectionalChannelInfo two_to_one_arg_conv;
26624 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
26625 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
26626 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
26627 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
26628 CHECK_ACCESS(capacity_sats_arg_ptr);
26629 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
26630 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
26631 LDKChannelAnnouncement announcement_message_arg_conv;
26632 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
26633 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
26634 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
26635 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
26636 uint64_t ret_ref = 0;
26637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26639 ret_ref = (uint64_t)ret_var.inner;
26640 if (ret_var.is_owned) {
26646 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
26647 LDKChannelInfo orig_conv;
26648 orig_conv.inner = (void*)(orig & (~1));
26649 orig_conv.is_owned = false;
26650 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
26651 uint64_t ret_ref = 0;
26652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26654 ret_ref = (uint64_t)ret_var.inner;
26655 if (ret_var.is_owned) {
26661 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
26662 LDKChannelInfo obj_conv;
26663 obj_conv.inner = (void*)(obj & (~1));
26664 obj_conv.is_owned = false;
26665 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
26666 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26667 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26668 CVec_u8Z_free(ret_var);
26672 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
26673 LDKu8slice ser_ref;
26674 ser_ref.datalen = *((uint32_t*)ser);
26675 ser_ref.data = (int8_t*)(ser + 4);
26676 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26677 *ret_conv = ChannelInfo_read(ser_ref);
26678 return (uint64_t)ret_conv;
26681 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
26682 LDKRoutingFees this_obj_conv;
26683 this_obj_conv.inner = (void*)(this_obj & (~1));
26684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26685 RoutingFees_free(this_obj_conv);
26688 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
26689 LDKRoutingFees this_ptr_conv;
26690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26691 this_ptr_conv.is_owned = false;
26692 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
26696 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
26697 LDKRoutingFees this_ptr_conv;
26698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26699 this_ptr_conv.is_owned = false;
26700 RoutingFees_set_base_msat(&this_ptr_conv, val);
26703 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
26704 LDKRoutingFees this_ptr_conv;
26705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26706 this_ptr_conv.is_owned = false;
26707 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
26711 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
26712 LDKRoutingFees this_ptr_conv;
26713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26714 this_ptr_conv.is_owned = false;
26715 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
26718 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
26719 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
26720 uint64_t ret_ref = 0;
26721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26723 ret_ref = (uint64_t)ret_var.inner;
26724 if (ret_var.is_owned) {
26730 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
26731 LDKRoutingFees a_conv;
26732 a_conv.inner = (void*)(a & (~1));
26733 a_conv.is_owned = false;
26734 LDKRoutingFees b_conv;
26735 b_conv.inner = (void*)(b & (~1));
26736 b_conv.is_owned = false;
26737 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
26741 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
26742 LDKRoutingFees orig_conv;
26743 orig_conv.inner = (void*)(orig & (~1));
26744 orig_conv.is_owned = false;
26745 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
26746 uint64_t ret_ref = 0;
26747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26749 ret_ref = (uint64_t)ret_var.inner;
26750 if (ret_var.is_owned) {
26756 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
26757 LDKRoutingFees o_conv;
26758 o_conv.inner = (void*)(o & (~1));
26759 o_conv.is_owned = false;
26760 int64_t ret_val = RoutingFees_hash(&o_conv);
26764 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
26765 LDKRoutingFees obj_conv;
26766 obj_conv.inner = (void*)(obj & (~1));
26767 obj_conv.is_owned = false;
26768 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
26769 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26770 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26771 CVec_u8Z_free(ret_var);
26775 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
26776 LDKu8slice ser_ref;
26777 ser_ref.datalen = *((uint32_t*)ser);
26778 ser_ref.data = (int8_t*)(ser + 4);
26779 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26780 *ret_conv = RoutingFees_read(ser_ref);
26781 return (uint64_t)ret_conv;
26784 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
26785 LDKNodeAnnouncementInfo this_obj_conv;
26786 this_obj_conv.inner = (void*)(this_obj & (~1));
26787 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26788 NodeAnnouncementInfo_free(this_obj_conv);
26791 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
26792 LDKNodeAnnouncementInfo this_ptr_conv;
26793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26794 this_ptr_conv.is_owned = false;
26795 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
26796 uint64_t ret_ref = 0;
26797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26799 ret_ref = (uint64_t)ret_var.inner;
26800 if (ret_var.is_owned) {
26806 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
26807 LDKNodeAnnouncementInfo this_ptr_conv;
26808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26809 this_ptr_conv.is_owned = false;
26810 LDKNodeFeatures val_conv;
26811 val_conv.inner = (void*)(val & (~1));
26812 val_conv.is_owned = (val & 1) || (val == 0);
26813 val_conv = NodeFeatures_clone(&val_conv);
26814 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
26817 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
26818 LDKNodeAnnouncementInfo this_ptr_conv;
26819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26820 this_ptr_conv.is_owned = false;
26821 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
26825 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
26826 LDKNodeAnnouncementInfo this_ptr_conv;
26827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26828 this_ptr_conv.is_owned = false;
26829 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
26832 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
26833 LDKNodeAnnouncementInfo this_ptr_conv;
26834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26835 this_ptr_conv.is_owned = false;
26836 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
26837 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
26841 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
26842 LDKNodeAnnouncementInfo this_ptr_conv;
26843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26844 this_ptr_conv.is_owned = false;
26845 LDKThreeBytes val_ref;
26846 CHECK(*((uint32_t*)val) == 3);
26847 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
26848 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
26851 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
26852 LDKNodeAnnouncementInfo this_ptr_conv;
26853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26854 this_ptr_conv.is_owned = false;
26855 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26856 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
26860 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
26861 LDKNodeAnnouncementInfo this_ptr_conv;
26862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26863 this_ptr_conv.is_owned = false;
26864 LDKThirtyTwoBytes val_ref;
26865 CHECK(*((uint32_t*)val) == 32);
26866 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
26867 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
26870 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
26871 LDKNodeAnnouncementInfo this_ptr_conv;
26872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26873 this_ptr_conv.is_owned = false;
26874 LDKCVec_NetAddressZ val_constr;
26875 val_constr.datalen = *((uint32_t*)val);
26876 if (val_constr.datalen > 0)
26877 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26879 val_constr.data = NULL;
26880 uint32_t* val_vals = (uint32_t*)(val + 4);
26881 for (size_t m = 0; m < val_constr.datalen; m++) {
26882 uint32_t val_conv_12 = val_vals[m];
26883 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
26884 CHECK_ACCESS(val_conv_12_ptr);
26885 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
26886 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
26887 val_constr.data[m] = val_conv_12_conv;
26889 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
26892 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
26893 LDKNodeAnnouncementInfo this_ptr_conv;
26894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26895 this_ptr_conv.is_owned = false;
26896 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
26897 uint64_t ret_ref = 0;
26898 if ((uint64_t)ret_var.inner > 4096) {
26899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26901 ret_ref = (uint64_t)ret_var.inner;
26902 if (ret_var.is_owned) {
26909 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
26910 LDKNodeAnnouncementInfo this_ptr_conv;
26911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26912 this_ptr_conv.is_owned = false;
26913 LDKNodeAnnouncement val_conv;
26914 val_conv.inner = (void*)(val & (~1));
26915 val_conv.is_owned = (val & 1) || (val == 0);
26916 val_conv = NodeAnnouncement_clone(&val_conv);
26917 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
26920 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) {
26921 LDKNodeFeatures features_arg_conv;
26922 features_arg_conv.inner = (void*)(features_arg & (~1));
26923 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26924 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
26925 LDKThreeBytes rgb_arg_ref;
26926 CHECK(*((uint32_t*)rgb_arg) == 3);
26927 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
26928 LDKThirtyTwoBytes alias_arg_ref;
26929 CHECK(*((uint32_t*)alias_arg) == 32);
26930 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
26931 LDKCVec_NetAddressZ addresses_arg_constr;
26932 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
26933 if (addresses_arg_constr.datalen > 0)
26934 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26936 addresses_arg_constr.data = NULL;
26937 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
26938 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
26939 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
26940 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
26941 CHECK_ACCESS(addresses_arg_conv_12_ptr);
26942 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
26943 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
26945 LDKNodeAnnouncement announcement_message_arg_conv;
26946 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
26947 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
26948 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
26949 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
26950 uint64_t ret_ref = 0;
26951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26953 ret_ref = (uint64_t)ret_var.inner;
26954 if (ret_var.is_owned) {
26960 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
26961 LDKNodeAnnouncementInfo orig_conv;
26962 orig_conv.inner = (void*)(orig & (~1));
26963 orig_conv.is_owned = false;
26964 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
26965 uint64_t ret_ref = 0;
26966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26968 ret_ref = (uint64_t)ret_var.inner;
26969 if (ret_var.is_owned) {
26975 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
26976 LDKNodeAnnouncementInfo obj_conv;
26977 obj_conv.inner = (void*)(obj & (~1));
26978 obj_conv.is_owned = false;
26979 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
26980 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
26981 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
26982 CVec_u8Z_free(ret_var);
26986 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
26987 LDKu8slice ser_ref;
26988 ser_ref.datalen = *((uint32_t*)ser);
26989 ser_ref.data = (int8_t*)(ser + 4);
26990 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26991 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
26992 return (uint64_t)ret_conv;
26995 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
26996 LDKNodeInfo this_obj_conv;
26997 this_obj_conv.inner = (void*)(this_obj & (~1));
26998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26999 NodeInfo_free(this_obj_conv);
27002 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
27003 LDKNodeInfo this_ptr_conv;
27004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27005 this_ptr_conv.is_owned = false;
27006 LDKCVec_u64Z val_constr;
27007 val_constr.datalen = *((uint32_t*)val);
27008 if (val_constr.datalen > 0)
27009 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
27011 val_constr.data = NULL;
27012 int64_t* val_vals = (int64_t*)(val + 4);
27013 for (size_t i = 0; i < val_constr.datalen; i++) {
27014 int64_t val_conv_8 = val_vals[i];
27015 val_constr.data[i] = val_conv_8;
27017 NodeInfo_set_channels(&this_ptr_conv, val_constr);
27020 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
27021 LDKNodeInfo this_ptr_conv;
27022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27023 this_ptr_conv.is_owned = false;
27024 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
27025 uint64_t ret_ref = 0;
27026 if ((uint64_t)ret_var.inner > 4096) {
27027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27029 ret_ref = (uint64_t)ret_var.inner;
27030 if (ret_var.is_owned) {
27037 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
27038 LDKNodeInfo this_ptr_conv;
27039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27040 this_ptr_conv.is_owned = false;
27041 LDKRoutingFees val_conv;
27042 val_conv.inner = (void*)(val & (~1));
27043 val_conv.is_owned = (val & 1) || (val == 0);
27044 val_conv = RoutingFees_clone(&val_conv);
27045 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
27048 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
27049 LDKNodeInfo this_ptr_conv;
27050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27051 this_ptr_conv.is_owned = false;
27052 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
27053 uint64_t ret_ref = 0;
27054 if ((uint64_t)ret_var.inner > 4096) {
27055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27057 ret_ref = (uint64_t)ret_var.inner;
27058 if (ret_var.is_owned) {
27065 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
27066 LDKNodeInfo this_ptr_conv;
27067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27068 this_ptr_conv.is_owned = false;
27069 LDKNodeAnnouncementInfo val_conv;
27070 val_conv.inner = (void*)(val & (~1));
27071 val_conv.is_owned = (val & 1) || (val == 0);
27072 val_conv = NodeAnnouncementInfo_clone(&val_conv);
27073 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
27076 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
27077 LDKCVec_u64Z channels_arg_constr;
27078 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
27079 if (channels_arg_constr.datalen > 0)
27080 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
27082 channels_arg_constr.data = NULL;
27083 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
27084 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
27085 int64_t channels_arg_conv_8 = channels_arg_vals[i];
27086 channels_arg_constr.data[i] = channels_arg_conv_8;
27088 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
27089 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
27090 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
27091 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
27092 LDKNodeAnnouncementInfo announcement_info_arg_conv;
27093 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
27094 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
27095 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
27096 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
27097 uint64_t ret_ref = 0;
27098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27100 ret_ref = (uint64_t)ret_var.inner;
27101 if (ret_var.is_owned) {
27107 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
27108 LDKNodeInfo orig_conv;
27109 orig_conv.inner = (void*)(orig & (~1));
27110 orig_conv.is_owned = false;
27111 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
27112 uint64_t ret_ref = 0;
27113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27115 ret_ref = (uint64_t)ret_var.inner;
27116 if (ret_var.is_owned) {
27122 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
27123 LDKNodeInfo obj_conv;
27124 obj_conv.inner = (void*)(obj & (~1));
27125 obj_conv.is_owned = false;
27126 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
27127 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27128 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27129 CVec_u8Z_free(ret_var);
27133 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
27134 LDKu8slice ser_ref;
27135 ser_ref.datalen = *((uint32_t*)ser);
27136 ser_ref.data = (int8_t*)(ser + 4);
27137 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
27138 *ret_conv = NodeInfo_read(ser_ref);
27139 return (uint64_t)ret_conv;
27142 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
27143 LDKNetworkGraph obj_conv;
27144 obj_conv.inner = (void*)(obj & (~1));
27145 obj_conv.is_owned = false;
27146 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
27147 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27148 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27149 CVec_u8Z_free(ret_var);
27153 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
27154 LDKu8slice ser_ref;
27155 ser_ref.datalen = *((uint32_t*)ser);
27156 ser_ref.data = (int8_t*)(ser + 4);
27157 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
27158 *ret_conv = NetworkGraph_read(ser_ref);
27159 return (uint64_t)ret_conv;
27162 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
27163 LDKThirtyTwoBytes genesis_hash_ref;
27164 CHECK(*((uint32_t*)genesis_hash) == 32);
27165 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
27166 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
27167 uint64_t ret_ref = 0;
27168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27170 ret_ref = (uint64_t)ret_var.inner;
27171 if (ret_var.is_owned) {
27177 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
27178 LDKNetworkGraph this_arg_conv;
27179 this_arg_conv.inner = (void*)(this_arg & (~1));
27180 this_arg_conv.is_owned = false;
27181 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
27182 uint64_t ret_ref = 0;
27183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27185 ret_ref = (uint64_t)ret_var.inner;
27186 if (ret_var.is_owned) {
27192 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
27193 LDKNetworkGraph this_arg_conv;
27194 this_arg_conv.inner = (void*)(this_arg & (~1));
27195 this_arg_conv.is_owned = false;
27196 LDKNodeAnnouncement msg_conv;
27197 msg_conv.inner = (void*)(msg & (~1));
27198 msg_conv.is_owned = false;
27199 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27200 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
27201 return (uint64_t)ret_conv;
27204 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
27205 LDKNetworkGraph this_arg_conv;
27206 this_arg_conv.inner = (void*)(this_arg & (~1));
27207 this_arg_conv.is_owned = false;
27208 LDKUnsignedNodeAnnouncement msg_conv;
27209 msg_conv.inner = (void*)(msg & (~1));
27210 msg_conv.is_owned = false;
27211 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27212 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
27213 return (uint64_t)ret_conv;
27216 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
27217 LDKNetworkGraph this_arg_conv;
27218 this_arg_conv.inner = (void*)(this_arg & (~1));
27219 this_arg_conv.is_owned = false;
27220 LDKChannelAnnouncement msg_conv;
27221 msg_conv.inner = (void*)(msg & (~1));
27222 msg_conv.is_owned = false;
27223 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
27224 CHECK_ACCESS(chain_access_ptr);
27225 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
27226 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27227 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27228 // Manually implement clone for Java trait instances
27230 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27231 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
27232 return (uint64_t)ret_conv;
27235 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
27236 LDKNetworkGraph this_arg_conv;
27237 this_arg_conv.inner = (void*)(this_arg & (~1));
27238 this_arg_conv.is_owned = false;
27239 LDKUnsignedChannelAnnouncement msg_conv;
27240 msg_conv.inner = (void*)(msg & (~1));
27241 msg_conv.is_owned = false;
27242 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
27243 CHECK_ACCESS(chain_access_ptr);
27244 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
27245 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27246 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27247 // Manually implement clone for Java trait instances
27249 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27250 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
27251 return (uint64_t)ret_conv;
27254 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
27255 LDKNetworkGraph this_arg_conv;
27256 this_arg_conv.inner = (void*)(this_arg & (~1));
27257 this_arg_conv.is_owned = false;
27258 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
27261 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
27262 LDKNetworkGraph this_arg_conv;
27263 this_arg_conv.inner = (void*)(this_arg & (~1));
27264 this_arg_conv.is_owned = false;
27265 LDKPublicKey _node_id_ref;
27266 CHECK(*((uint32_t*)_node_id) == 33);
27267 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
27268 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
27271 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
27272 LDKNetworkGraph this_arg_conv;
27273 this_arg_conv.inner = (void*)(this_arg & (~1));
27274 this_arg_conv.is_owned = false;
27275 LDKChannelUpdate msg_conv;
27276 msg_conv.inner = (void*)(msg & (~1));
27277 msg_conv.is_owned = false;
27278 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27279 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
27280 return (uint64_t)ret_conv;
27283 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
27284 LDKNetworkGraph this_arg_conv;
27285 this_arg_conv.inner = (void*)(this_arg & (~1));
27286 this_arg_conv.is_owned = false;
27287 LDKUnsignedChannelUpdate msg_conv;
27288 msg_conv.inner = (void*)(msg & (~1));
27289 msg_conv.is_owned = false;
27290 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
27291 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
27292 return (uint64_t)ret_conv;
27295 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
27296 LDKReadOnlyNetworkGraph this_arg_conv;
27297 this_arg_conv.inner = (void*)(this_arg & (~1));
27298 this_arg_conv.is_owned = false;
27299 LDKPublicKey pubkey_ref;
27300 CHECK(*((uint32_t*)pubkey) == 33);
27301 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
27302 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
27303 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
27304 uint64_t ret_ref = (uint64_t)ret_copy;
27308 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
27309 LDKRouteHop this_obj_conv;
27310 this_obj_conv.inner = (void*)(this_obj & (~1));
27311 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27312 RouteHop_free(this_obj_conv);
27315 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
27316 LDKRouteHop this_ptr_conv;
27317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27318 this_ptr_conv.is_owned = false;
27319 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27320 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
27324 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
27325 LDKRouteHop this_ptr_conv;
27326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27327 this_ptr_conv.is_owned = false;
27328 LDKPublicKey val_ref;
27329 CHECK(*((uint32_t*)val) == 33);
27330 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
27331 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
27334 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
27335 LDKRouteHop this_ptr_conv;
27336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27337 this_ptr_conv.is_owned = false;
27338 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
27339 uint64_t ret_ref = 0;
27340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27342 ret_ref = (uint64_t)ret_var.inner;
27343 if (ret_var.is_owned) {
27349 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
27350 LDKRouteHop this_ptr_conv;
27351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27352 this_ptr_conv.is_owned = false;
27353 LDKNodeFeatures val_conv;
27354 val_conv.inner = (void*)(val & (~1));
27355 val_conv.is_owned = (val & 1) || (val == 0);
27356 val_conv = NodeFeatures_clone(&val_conv);
27357 RouteHop_set_node_features(&this_ptr_conv, val_conv);
27360 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
27361 LDKRouteHop this_ptr_conv;
27362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27363 this_ptr_conv.is_owned = false;
27364 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
27368 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
27369 LDKRouteHop this_ptr_conv;
27370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27371 this_ptr_conv.is_owned = false;
27372 RouteHop_set_short_channel_id(&this_ptr_conv, val);
27375 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
27376 LDKRouteHop this_ptr_conv;
27377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27378 this_ptr_conv.is_owned = false;
27379 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
27380 uint64_t ret_ref = 0;
27381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27383 ret_ref = (uint64_t)ret_var.inner;
27384 if (ret_var.is_owned) {
27390 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
27391 LDKRouteHop this_ptr_conv;
27392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27393 this_ptr_conv.is_owned = false;
27394 LDKChannelFeatures val_conv;
27395 val_conv.inner = (void*)(val & (~1));
27396 val_conv.is_owned = (val & 1) || (val == 0);
27397 val_conv = ChannelFeatures_clone(&val_conv);
27398 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
27401 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
27402 LDKRouteHop this_ptr_conv;
27403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27404 this_ptr_conv.is_owned = false;
27405 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
27409 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
27410 LDKRouteHop this_ptr_conv;
27411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27412 this_ptr_conv.is_owned = false;
27413 RouteHop_set_fee_msat(&this_ptr_conv, val);
27416 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
27417 LDKRouteHop this_ptr_conv;
27418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27419 this_ptr_conv.is_owned = false;
27420 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
27424 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
27425 LDKRouteHop this_ptr_conv;
27426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27427 this_ptr_conv.is_owned = false;
27428 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
27431 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) {
27432 LDKPublicKey pubkey_arg_ref;
27433 CHECK(*((uint32_t*)pubkey_arg) == 33);
27434 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
27435 LDKNodeFeatures node_features_arg_conv;
27436 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
27437 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
27438 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
27439 LDKChannelFeatures channel_features_arg_conv;
27440 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
27441 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
27442 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
27443 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);
27444 uint64_t ret_ref = 0;
27445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27447 ret_ref = (uint64_t)ret_var.inner;
27448 if (ret_var.is_owned) {
27454 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
27455 LDKRouteHop orig_conv;
27456 orig_conv.inner = (void*)(orig & (~1));
27457 orig_conv.is_owned = false;
27458 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
27459 uint64_t ret_ref = 0;
27460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27462 ret_ref = (uint64_t)ret_var.inner;
27463 if (ret_var.is_owned) {
27469 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
27470 LDKRouteHop o_conv;
27471 o_conv.inner = (void*)(o & (~1));
27472 o_conv.is_owned = false;
27473 int64_t ret_val = RouteHop_hash(&o_conv);
27477 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
27478 LDKRouteHop a_conv;
27479 a_conv.inner = (void*)(a & (~1));
27480 a_conv.is_owned = false;
27481 LDKRouteHop b_conv;
27482 b_conv.inner = (void*)(b & (~1));
27483 b_conv.is_owned = false;
27484 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
27488 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
27489 LDKRouteHop obj_conv;
27490 obj_conv.inner = (void*)(obj & (~1));
27491 obj_conv.is_owned = false;
27492 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
27493 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27494 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27495 CVec_u8Z_free(ret_var);
27499 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
27500 LDKu8slice ser_ref;
27501 ser_ref.datalen = *((uint32_t*)ser);
27502 ser_ref.data = (int8_t*)(ser + 4);
27503 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
27504 *ret_conv = RouteHop_read(ser_ref);
27505 return (uint64_t)ret_conv;
27508 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
27509 LDKRoute this_obj_conv;
27510 this_obj_conv.inner = (void*)(this_obj & (~1));
27511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27512 Route_free(this_obj_conv);
27515 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
27516 LDKRoute this_ptr_conv;
27517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27518 this_ptr_conv.is_owned = false;
27519 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
27520 ptrArray ret_arr = NULL;
27521 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
27522 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
27523 for (size_t m = 0; m < ret_var.datalen; m++) {
27524 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
27525 uint32_tArray ret_conv_12_arr = NULL;
27526 ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27527 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
27528 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
27529 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
27530 uint64_t ret_conv_12_conv_10_ref = 0;
27531 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27532 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27533 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
27534 if (ret_conv_12_conv_10_var.is_owned) {
27535 ret_conv_12_conv_10_ref |= 1;
27537 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
27540 FREE(ret_conv_12_var.data);
27541 ret_arr_ptr[m] = ret_conv_12_arr;
27544 FREE(ret_var.data);
27548 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
27549 LDKRoute this_ptr_conv;
27550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27551 this_ptr_conv.is_owned = false;
27552 LDKCVec_CVec_RouteHopZZ val_constr;
27553 val_constr.datalen = *((uint32_t*)val);
27554 if (val_constr.datalen > 0)
27555 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
27557 val_constr.data = NULL;
27558 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
27559 for (size_t m = 0; m < val_constr.datalen; m++) {
27560 uint32_tArray val_conv_12 = val_vals[m];
27561 LDKCVec_RouteHopZ val_conv_12_constr;
27562 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
27563 if (val_conv_12_constr.datalen > 0)
27564 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27566 val_conv_12_constr.data = NULL;
27567 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
27568 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
27569 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
27570 LDKRouteHop val_conv_12_conv_10_conv;
27571 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
27572 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
27573 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
27574 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
27576 val_constr.data[m] = val_conv_12_constr;
27578 Route_set_paths(&this_ptr_conv, val_constr);
27581 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
27582 LDKRoute this_ptr_conv;
27583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27584 this_ptr_conv.is_owned = false;
27585 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
27586 uint64_t ret_ref = 0;
27587 if ((uint64_t)ret_var.inner > 4096) {
27588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27590 ret_ref = (uint64_t)ret_var.inner;
27591 if (ret_var.is_owned) {
27598 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
27599 LDKRoute this_ptr_conv;
27600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27601 this_ptr_conv.is_owned = false;
27603 val_conv.inner = (void*)(val & (~1));
27604 val_conv.is_owned = (val & 1) || (val == 0);
27605 val_conv = Payee_clone(&val_conv);
27606 Route_set_payee(&this_ptr_conv, val_conv);
27609 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
27610 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
27611 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
27612 if (paths_arg_constr.datalen > 0)
27613 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
27615 paths_arg_constr.data = NULL;
27616 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
27617 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
27618 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
27619 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
27620 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
27621 if (paths_arg_conv_12_constr.datalen > 0)
27622 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27624 paths_arg_conv_12_constr.data = NULL;
27625 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
27626 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
27627 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
27628 LDKRouteHop paths_arg_conv_12_conv_10_conv;
27629 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
27630 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
27631 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
27632 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
27634 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
27636 LDKPayee payee_arg_conv;
27637 payee_arg_conv.inner = (void*)(payee_arg & (~1));
27638 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
27639 payee_arg_conv = Payee_clone(&payee_arg_conv);
27640 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
27641 uint64_t ret_ref = 0;
27642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27644 ret_ref = (uint64_t)ret_var.inner;
27645 if (ret_var.is_owned) {
27651 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
27652 LDKRoute orig_conv;
27653 orig_conv.inner = (void*)(orig & (~1));
27654 orig_conv.is_owned = false;
27655 LDKRoute ret_var = Route_clone(&orig_conv);
27656 uint64_t ret_ref = 0;
27657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27659 ret_ref = (uint64_t)ret_var.inner;
27660 if (ret_var.is_owned) {
27666 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
27668 o_conv.inner = (void*)(o & (~1));
27669 o_conv.is_owned = false;
27670 int64_t ret_val = Route_hash(&o_conv);
27674 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
27676 a_conv.inner = (void*)(a & (~1));
27677 a_conv.is_owned = false;
27679 b_conv.inner = (void*)(b & (~1));
27680 b_conv.is_owned = false;
27681 jboolean ret_val = Route_eq(&a_conv, &b_conv);
27685 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
27686 LDKRoute this_arg_conv;
27687 this_arg_conv.inner = (void*)(this_arg & (~1));
27688 this_arg_conv.is_owned = false;
27689 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
27693 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
27694 LDKRoute this_arg_conv;
27695 this_arg_conv.inner = (void*)(this_arg & (~1));
27696 this_arg_conv.is_owned = false;
27697 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
27701 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
27703 obj_conv.inner = (void*)(obj & (~1));
27704 obj_conv.is_owned = false;
27705 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
27706 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27707 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27708 CVec_u8Z_free(ret_var);
27712 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
27713 LDKu8slice ser_ref;
27714 ser_ref.datalen = *((uint32_t*)ser);
27715 ser_ref.data = (int8_t*)(ser + 4);
27716 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
27717 *ret_conv = Route_read(ser_ref);
27718 return (uint64_t)ret_conv;
27721 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
27722 LDKRouteParameters this_obj_conv;
27723 this_obj_conv.inner = (void*)(this_obj & (~1));
27724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27725 RouteParameters_free(this_obj_conv);
27728 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
27729 LDKRouteParameters this_ptr_conv;
27730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27731 this_ptr_conv.is_owned = false;
27732 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
27733 uint64_t ret_ref = 0;
27734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27736 ret_ref = (uint64_t)ret_var.inner;
27737 if (ret_var.is_owned) {
27743 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
27744 LDKRouteParameters this_ptr_conv;
27745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27746 this_ptr_conv.is_owned = false;
27748 val_conv.inner = (void*)(val & (~1));
27749 val_conv.is_owned = (val & 1) || (val == 0);
27750 val_conv = Payee_clone(&val_conv);
27751 RouteParameters_set_payee(&this_ptr_conv, val_conv);
27754 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
27755 LDKRouteParameters this_ptr_conv;
27756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27757 this_ptr_conv.is_owned = false;
27758 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
27762 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
27763 LDKRouteParameters this_ptr_conv;
27764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27765 this_ptr_conv.is_owned = false;
27766 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
27769 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
27770 LDKRouteParameters this_ptr_conv;
27771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27772 this_ptr_conv.is_owned = false;
27773 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
27777 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
27778 LDKRouteParameters this_ptr_conv;
27779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27780 this_ptr_conv.is_owned = false;
27781 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
27784 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_new(uint32_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
27785 LDKPayee payee_arg_conv;
27786 payee_arg_conv.inner = (void*)(payee_arg & (~1));
27787 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
27788 payee_arg_conv = Payee_clone(&payee_arg_conv);
27789 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
27790 uint64_t ret_ref = 0;
27791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27793 ret_ref = (uint64_t)ret_var.inner;
27794 if (ret_var.is_owned) {
27800 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
27801 LDKRouteParameters orig_conv;
27802 orig_conv.inner = (void*)(orig & (~1));
27803 orig_conv.is_owned = false;
27804 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
27805 uint64_t ret_ref = 0;
27806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27808 ret_ref = (uint64_t)ret_var.inner;
27809 if (ret_var.is_owned) {
27815 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
27816 LDKRouteParameters obj_conv;
27817 obj_conv.inner = (void*)(obj & (~1));
27818 obj_conv.is_owned = false;
27819 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
27820 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
27821 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
27822 CVec_u8Z_free(ret_var);
27826 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
27827 LDKu8slice ser_ref;
27828 ser_ref.datalen = *((uint32_t*)ser);
27829 ser_ref.data = (int8_t*)(ser + 4);
27830 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
27831 *ret_conv = RouteParameters_read(ser_ref);
27832 return (uint64_t)ret_conv;
27835 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
27836 LDKPayee this_obj_conv;
27837 this_obj_conv.inner = (void*)(this_obj & (~1));
27838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27839 Payee_free(this_obj_conv);
27842 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
27843 LDKPayee this_ptr_conv;
27844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27845 this_ptr_conv.is_owned = false;
27846 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27847 memcpy((uint8_t*)(ret_arr + 4), Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
27851 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
27852 LDKPayee this_ptr_conv;
27853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27854 this_ptr_conv.is_owned = false;
27855 LDKPublicKey val_ref;
27856 CHECK(*((uint32_t*)val) == 33);
27857 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
27858 Payee_set_pubkey(&this_ptr_conv, val_ref);
27861 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
27862 LDKPayee this_ptr_conv;
27863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27864 this_ptr_conv.is_owned = false;
27865 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
27866 uint64_t ret_ref = 0;
27867 if ((uint64_t)ret_var.inner > 4096) {
27868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27870 ret_ref = (uint64_t)ret_var.inner;
27871 if (ret_var.is_owned) {
27878 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
27879 LDKPayee this_ptr_conv;
27880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27881 this_ptr_conv.is_owned = false;
27882 LDKInvoiceFeatures val_conv;
27883 val_conv.inner = (void*)(val & (~1));
27884 val_conv.is_owned = (val & 1) || (val == 0);
27885 val_conv = InvoiceFeatures_clone(&val_conv);
27886 Payee_set_features(&this_ptr_conv, val_conv);
27889 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
27890 LDKPayee this_ptr_conv;
27891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27892 this_ptr_conv.is_owned = false;
27893 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
27894 uint32_tArray ret_arr = NULL;
27895 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27896 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27897 for (size_t l = 0; l < ret_var.datalen; l++) {
27898 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27899 uint64_t ret_conv_11_ref = 0;
27900 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27901 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27902 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27903 if (ret_conv_11_var.is_owned) {
27904 ret_conv_11_ref |= 1;
27906 ret_arr_ptr[l] = ret_conv_11_ref;
27909 FREE(ret_var.data);
27913 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
27914 LDKPayee this_ptr_conv;
27915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27916 this_ptr_conv.is_owned = false;
27917 LDKCVec_RouteHintZ val_constr;
27918 val_constr.datalen = *((uint32_t*)val);
27919 if (val_constr.datalen > 0)
27920 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27922 val_constr.data = NULL;
27923 uint32_t* val_vals = (uint32_t*)(val + 4);
27924 for (size_t l = 0; l < val_constr.datalen; l++) {
27925 uint32_t val_conv_11 = val_vals[l];
27926 LDKRouteHint val_conv_11_conv;
27927 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
27928 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
27929 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
27930 val_constr.data[l] = val_conv_11_conv;
27932 Payee_set_route_hints(&this_ptr_conv, val_constr);
27935 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
27936 LDKPayee this_ptr_conv;
27937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27938 this_ptr_conv.is_owned = false;
27939 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27940 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
27941 uint64_t ret_ref = (uint64_t)ret_copy;
27945 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
27946 LDKPayee this_ptr_conv;
27947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27948 this_ptr_conv.is_owned = false;
27949 void* val_ptr = (void*)(((uint64_t)val) & ~1);
27950 CHECK_ACCESS(val_ptr);
27951 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27952 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27953 Payee_set_expiry_time(&this_ptr_conv, val_conv);
27956 uint32_t __attribute__((visibility("default"))) TS_Payee_new(int8_tArray pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg) {
27957 LDKPublicKey pubkey_arg_ref;
27958 CHECK(*((uint32_t*)pubkey_arg) == 33);
27959 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
27960 LDKInvoiceFeatures features_arg_conv;
27961 features_arg_conv.inner = (void*)(features_arg & (~1));
27962 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27963 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
27964 LDKCVec_RouteHintZ route_hints_arg_constr;
27965 route_hints_arg_constr.datalen = *((uint32_t*)route_hints_arg);
27966 if (route_hints_arg_constr.datalen > 0)
27967 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27969 route_hints_arg_constr.data = NULL;
27970 uint32_t* route_hints_arg_vals = (uint32_t*)(route_hints_arg + 4);
27971 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
27972 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
27973 LDKRouteHint route_hints_arg_conv_11_conv;
27974 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
27975 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
27976 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
27977 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
27979 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
27980 CHECK_ACCESS(expiry_time_arg_ptr);
27981 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
27982 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
27983 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
27984 uint64_t ret_ref = 0;
27985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27987 ret_ref = (uint64_t)ret_var.inner;
27988 if (ret_var.is_owned) {
27994 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
27995 LDKPayee orig_conv;
27996 orig_conv.inner = (void*)(orig & (~1));
27997 orig_conv.is_owned = false;
27998 LDKPayee ret_var = Payee_clone(&orig_conv);
27999 uint64_t ret_ref = 0;
28000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28002 ret_ref = (uint64_t)ret_var.inner;
28003 if (ret_var.is_owned) {
28009 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
28011 o_conv.inner = (void*)(o & (~1));
28012 o_conv.is_owned = false;
28013 int64_t ret_val = Payee_hash(&o_conv);
28017 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
28019 a_conv.inner = (void*)(a & (~1));
28020 a_conv.is_owned = false;
28022 b_conv.inner = (void*)(b & (~1));
28023 b_conv.is_owned = false;
28024 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
28028 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
28030 obj_conv.inner = (void*)(obj & (~1));
28031 obj_conv.is_owned = false;
28032 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
28033 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28034 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28035 CVec_u8Z_free(ret_var);
28039 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
28040 LDKu8slice ser_ref;
28041 ser_ref.datalen = *((uint32_t*)ser);
28042 ser_ref.data = (int8_t*)(ser + 4);
28043 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
28044 *ret_conv = Payee_read(ser_ref);
28045 return (uint64_t)ret_conv;
28048 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
28049 LDKPublicKey pubkey_ref;
28050 CHECK(*((uint32_t*)pubkey) == 33);
28051 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
28052 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
28053 uint64_t ret_ref = 0;
28054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28056 ret_ref = (uint64_t)ret_var.inner;
28057 if (ret_var.is_owned) {
28063 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
28064 LDKPublicKey pubkey_ref;
28065 CHECK(*((uint32_t*)pubkey) == 33);
28066 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
28067 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
28068 uint64_t ret_ref = 0;
28069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28071 ret_ref = (uint64_t)ret_var.inner;
28072 if (ret_var.is_owned) {
28078 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
28079 LDKRouteHint this_obj_conv;
28080 this_obj_conv.inner = (void*)(this_obj & (~1));
28081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28082 RouteHint_free(this_obj_conv);
28085 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
28086 LDKRouteHint this_ptr_conv;
28087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28088 this_ptr_conv.is_owned = false;
28089 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
28090 uint32_tArray ret_arr = NULL;
28091 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
28092 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
28093 for (size_t o = 0; o < ret_var.datalen; o++) {
28094 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
28095 uint64_t ret_conv_14_ref = 0;
28096 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28097 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28098 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
28099 if (ret_conv_14_var.is_owned) {
28100 ret_conv_14_ref |= 1;
28102 ret_arr_ptr[o] = ret_conv_14_ref;
28105 FREE(ret_var.data);
28109 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
28110 LDKRouteHint this_ptr_conv;
28111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28112 this_ptr_conv.is_owned = false;
28113 LDKCVec_RouteHintHopZ val_constr;
28114 val_constr.datalen = *((uint32_t*)val);
28115 if (val_constr.datalen > 0)
28116 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
28118 val_constr.data = NULL;
28119 uint32_t* val_vals = (uint32_t*)(val + 4);
28120 for (size_t o = 0; o < val_constr.datalen; o++) {
28121 uint32_t val_conv_14 = val_vals[o];
28122 LDKRouteHintHop val_conv_14_conv;
28123 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
28124 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
28125 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
28126 val_constr.data[o] = val_conv_14_conv;
28128 RouteHint_set_a(&this_ptr_conv, val_constr);
28131 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
28132 LDKCVec_RouteHintHopZ a_arg_constr;
28133 a_arg_constr.datalen = *((uint32_t*)a_arg);
28134 if (a_arg_constr.datalen > 0)
28135 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
28137 a_arg_constr.data = NULL;
28138 uint32_t* a_arg_vals = (uint32_t*)(a_arg + 4);
28139 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
28140 uint32_t a_arg_conv_14 = a_arg_vals[o];
28141 LDKRouteHintHop a_arg_conv_14_conv;
28142 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
28143 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
28144 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
28145 a_arg_constr.data[o] = a_arg_conv_14_conv;
28147 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
28148 uint64_t ret_ref = 0;
28149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28151 ret_ref = (uint64_t)ret_var.inner;
28152 if (ret_var.is_owned) {
28158 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
28159 LDKRouteHint orig_conv;
28160 orig_conv.inner = (void*)(orig & (~1));
28161 orig_conv.is_owned = false;
28162 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
28163 uint64_t ret_ref = 0;
28164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28166 ret_ref = (uint64_t)ret_var.inner;
28167 if (ret_var.is_owned) {
28173 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
28174 LDKRouteHint o_conv;
28175 o_conv.inner = (void*)(o & (~1));
28176 o_conv.is_owned = false;
28177 int64_t ret_val = RouteHint_hash(&o_conv);
28181 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
28182 LDKRouteHint a_conv;
28183 a_conv.inner = (void*)(a & (~1));
28184 a_conv.is_owned = false;
28185 LDKRouteHint b_conv;
28186 b_conv.inner = (void*)(b & (~1));
28187 b_conv.is_owned = false;
28188 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
28192 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
28193 LDKRouteHint obj_conv;
28194 obj_conv.inner = (void*)(obj & (~1));
28195 obj_conv.is_owned = false;
28196 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
28197 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28198 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28199 CVec_u8Z_free(ret_var);
28203 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
28204 LDKu8slice ser_ref;
28205 ser_ref.datalen = *((uint32_t*)ser);
28206 ser_ref.data = (int8_t*)(ser + 4);
28207 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
28208 *ret_conv = RouteHint_read(ser_ref);
28209 return (uint64_t)ret_conv;
28212 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
28213 LDKRouteHintHop this_obj_conv;
28214 this_obj_conv.inner = (void*)(this_obj & (~1));
28215 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28216 RouteHintHop_free(this_obj_conv);
28219 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
28220 LDKRouteHintHop this_ptr_conv;
28221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28222 this_ptr_conv.is_owned = false;
28223 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
28224 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
28228 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
28229 LDKRouteHintHop this_ptr_conv;
28230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28231 this_ptr_conv.is_owned = false;
28232 LDKPublicKey val_ref;
28233 CHECK(*((uint32_t*)val) == 33);
28234 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
28235 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
28238 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
28239 LDKRouteHintHop this_ptr_conv;
28240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28241 this_ptr_conv.is_owned = false;
28242 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
28246 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
28247 LDKRouteHintHop this_ptr_conv;
28248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28249 this_ptr_conv.is_owned = false;
28250 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
28253 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
28254 LDKRouteHintHop this_ptr_conv;
28255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28256 this_ptr_conv.is_owned = false;
28257 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
28258 uint64_t ret_ref = 0;
28259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28261 ret_ref = (uint64_t)ret_var.inner;
28262 if (ret_var.is_owned) {
28268 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
28269 LDKRouteHintHop this_ptr_conv;
28270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28271 this_ptr_conv.is_owned = false;
28272 LDKRoutingFees val_conv;
28273 val_conv.inner = (void*)(val & (~1));
28274 val_conv.is_owned = (val & 1) || (val == 0);
28275 val_conv = RoutingFees_clone(&val_conv);
28276 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
28279 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
28280 LDKRouteHintHop this_ptr_conv;
28281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28282 this_ptr_conv.is_owned = false;
28283 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
28287 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
28288 LDKRouteHintHop this_ptr_conv;
28289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28290 this_ptr_conv.is_owned = false;
28291 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
28294 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
28295 LDKRouteHintHop this_ptr_conv;
28296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28297 this_ptr_conv.is_owned = false;
28298 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28299 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
28300 uint64_t ret_ref = (uint64_t)ret_copy;
28304 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
28305 LDKRouteHintHop this_ptr_conv;
28306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28307 this_ptr_conv.is_owned = false;
28308 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28309 CHECK_ACCESS(val_ptr);
28310 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28311 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
28312 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
28315 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
28316 LDKRouteHintHop this_ptr_conv;
28317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28318 this_ptr_conv.is_owned = false;
28319 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28320 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
28321 uint64_t ret_ref = (uint64_t)ret_copy;
28325 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
28326 LDKRouteHintHop this_ptr_conv;
28327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28328 this_ptr_conv.is_owned = false;
28329 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28330 CHECK_ACCESS(val_ptr);
28331 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28332 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
28333 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
28336 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) {
28337 LDKPublicKey src_node_id_arg_ref;
28338 CHECK(*((uint32_t*)src_node_id_arg) == 33);
28339 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
28340 LDKRoutingFees fees_arg_conv;
28341 fees_arg_conv.inner = (void*)(fees_arg & (~1));
28342 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
28343 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
28344 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
28345 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
28346 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
28347 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
28348 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
28349 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
28350 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
28351 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
28352 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);
28353 uint64_t ret_ref = 0;
28354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28356 ret_ref = (uint64_t)ret_var.inner;
28357 if (ret_var.is_owned) {
28363 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
28364 LDKRouteHintHop orig_conv;
28365 orig_conv.inner = (void*)(orig & (~1));
28366 orig_conv.is_owned = false;
28367 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
28368 uint64_t ret_ref = 0;
28369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28371 ret_ref = (uint64_t)ret_var.inner;
28372 if (ret_var.is_owned) {
28378 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
28379 LDKRouteHintHop o_conv;
28380 o_conv.inner = (void*)(o & (~1));
28381 o_conv.is_owned = false;
28382 int64_t ret_val = RouteHintHop_hash(&o_conv);
28386 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
28387 LDKRouteHintHop a_conv;
28388 a_conv.inner = (void*)(a & (~1));
28389 a_conv.is_owned = false;
28390 LDKRouteHintHop b_conv;
28391 b_conv.inner = (void*)(b & (~1));
28392 b_conv.is_owned = false;
28393 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
28397 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
28398 LDKRouteHintHop obj_conv;
28399 obj_conv.inner = (void*)(obj & (~1));
28400 obj_conv.is_owned = false;
28401 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
28402 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28403 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28404 CVec_u8Z_free(ret_var);
28408 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
28409 LDKu8slice ser_ref;
28410 ser_ref.datalen = *((uint32_t*)ser);
28411 ser_ref.data = (int8_t*)(ser + 4);
28412 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
28413 *ret_conv = RouteHintHop_read(ser_ref);
28414 return (uint64_t)ret_conv;
28417 uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
28418 LDKPublicKey our_node_pubkey_ref;
28419 CHECK(*((uint32_t*)our_node_pubkey) == 33);
28420 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
28421 LDKRouteParameters params_conv;
28422 params_conv.inner = (void*)(params & (~1));
28423 params_conv.is_owned = false;
28424 LDKNetworkGraph network_conv;
28425 network_conv.inner = (void*)(network & (~1));
28426 network_conv.is_owned = false;
28427 LDKCVec_ChannelDetailsZ first_hops_constr;
28428 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
28429 if (first_hops != 0) {
28430 first_hops_constr.datalen = *((uint32_t*)first_hops);
28431 if (first_hops_constr.datalen > 0)
28432 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28434 first_hops_constr.data = NULL;
28435 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
28436 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
28437 uint32_t first_hops_conv_16 = first_hops_vals[q];
28438 LDKChannelDetails first_hops_conv_16_conv;
28439 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
28440 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
28441 first_hops_constr.data[q] = first_hops_conv_16_conv;
28443 first_hops_ptr = &first_hops_constr;
28445 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28446 CHECK_ACCESS(logger_ptr);
28447 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28448 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
28449 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
28450 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
28451 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
28452 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
28453 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
28454 return (uint64_t)ret_conv;
28457 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
28458 LDKScorer this_obj_conv;
28459 this_obj_conv.inner = (void*)(this_obj & (~1));
28460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28461 Scorer_free(this_obj_conv);
28464 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
28465 LDKScoringParameters this_obj_conv;
28466 this_obj_conv.inner = (void*)(this_obj & (~1));
28467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28468 ScoringParameters_free(this_obj_conv);
28471 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
28472 LDKScoringParameters this_ptr_conv;
28473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28474 this_ptr_conv.is_owned = false;
28475 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
28479 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
28480 LDKScoringParameters this_ptr_conv;
28481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28482 this_ptr_conv.is_owned = false;
28483 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
28486 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
28487 LDKScoringParameters this_ptr_conv;
28488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28489 this_ptr_conv.is_owned = false;
28490 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
28494 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
28495 LDKScoringParameters this_ptr_conv;
28496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28497 this_ptr_conv.is_owned = false;
28498 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
28501 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
28502 LDKScoringParameters this_ptr_conv;
28503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28504 this_ptr_conv.is_owned = false;
28505 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
28509 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
28510 LDKScoringParameters this_ptr_conv;
28511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28512 this_ptr_conv.is_owned = false;
28513 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
28516 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) {
28517 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
28518 uint64_t ret_ref = 0;
28519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28521 ret_ref = (uint64_t)ret_var.inner;
28522 if (ret_var.is_owned) {
28528 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
28529 LDKScoringParameters obj_conv;
28530 obj_conv.inner = (void*)(obj & (~1));
28531 obj_conv.is_owned = false;
28532 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
28533 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28534 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28535 CVec_u8Z_free(ret_var);
28539 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
28540 LDKu8slice ser_ref;
28541 ser_ref.datalen = *((uint32_t*)ser);
28542 ser_ref.data = (int8_t*)(ser + 4);
28543 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
28544 *ret_conv = ScoringParameters_read(ser_ref);
28545 return (uint64_t)ret_conv;
28548 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(uint32_t params) {
28549 LDKScoringParameters params_conv;
28550 params_conv.inner = (void*)(params & (~1));
28551 params_conv.is_owned = (params & 1) || (params == 0);
28552 // Warning: we need a move here but no clone is available for LDKScoringParameters
28553 LDKScorer ret_var = Scorer_new(params_conv);
28554 uint64_t ret_ref = 0;
28555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28557 ret_ref = (uint64_t)ret_var.inner;
28558 if (ret_var.is_owned) {
28564 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
28565 LDKScorer ret_var = Scorer_default();
28566 uint64_t ret_ref = 0;
28567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28569 ret_ref = (uint64_t)ret_var.inner;
28570 if (ret_var.is_owned) {
28576 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
28577 LDKScoringParameters ret_var = ScoringParameters_default();
28578 uint64_t ret_ref = 0;
28579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28581 ret_ref = (uint64_t)ret_var.inner;
28582 if (ret_var.is_owned) {
28588 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
28589 LDKScorer this_arg_conv;
28590 this_arg_conv.inner = (void*)(this_arg & (~1));
28591 this_arg_conv.is_owned = false;
28592 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
28593 *ret_ret = Scorer_as_Score(&this_arg_conv);
28594 return (uint64_t)ret_ret;
28597 int8_tArray __attribute__((visibility("default"))) TS_Scorer_write(uint32_t obj) {
28598 LDKScorer obj_conv;
28599 obj_conv.inner = (void*)(obj & (~1));
28600 obj_conv.is_owned = false;
28601 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
28602 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
28603 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
28604 CVec_u8Z_free(ret_var);
28608 uint32_t __attribute__((visibility("default"))) TS_Scorer_read(int8_tArray ser) {
28609 LDKu8slice ser_ref;
28610 ser_ref.datalen = *((uint32_t*)ser);
28611 ser_ref.data = (int8_t*)(ser + 4);
28612 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
28613 *ret_conv = Scorer_read(ser_ref);
28614 return (uint64_t)ret_conv;
28617 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
28618 LDKFilesystemPersister this_obj_conv;
28619 this_obj_conv.inner = (void*)(this_obj & (~1));
28620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28621 FilesystemPersister_free(this_obj_conv);
28624 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
28625 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
28626 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
28627 uint64_t ret_ref = 0;
28628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28630 ret_ref = (uint64_t)ret_var.inner;
28631 if (ret_var.is_owned) {
28637 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
28638 LDKFilesystemPersister this_arg_conv;
28639 this_arg_conv.inner = (void*)(this_arg & (~1));
28640 this_arg_conv.is_owned = false;
28641 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
28642 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28647 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
28648 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
28649 LDKChannelManager manager_conv;
28650 manager_conv.inner = (void*)(manager & (~1));
28651 manager_conv.is_owned = false;
28652 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28653 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
28654 return (uint64_t)ret_conv;
28657 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
28658 LDKFilesystemPersister this_arg_conv;
28659 this_arg_conv.inner = (void*)(this_arg & (~1));
28660 this_arg_conv.is_owned = false;
28661 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
28662 CHECK_ACCESS(keys_manager_ptr);
28663 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28664 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
28665 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
28666 return (uint64_t)ret_conv;
28669 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
28670 LDKFilesystemPersister this_arg_conv;
28671 this_arg_conv.inner = (void*)(this_arg & (~1));
28672 this_arg_conv.is_owned = false;
28673 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
28674 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
28675 return (uint64_t)ret_ret;
28678 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
28679 LDKBackgroundProcessor this_obj_conv;
28680 this_obj_conv.inner = (void*)(this_obj & (~1));
28681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28682 BackgroundProcessor_free(this_obj_conv);
28685 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
28686 if ((this_ptr & 1) != 0) return;
28687 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28688 CHECK_ACCESS(this_ptr_ptr);
28689 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
28690 FREE((void*)this_ptr);
28691 ChannelManagerPersister_free(this_ptr_conv);
28694 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) {
28695 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
28696 CHECK_ACCESS(persister_ptr);
28697 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
28698 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
28699 CHECK_ACCESS(event_handler_ptr);
28700 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
28701 LDKChainMonitor chain_monitor_conv;
28702 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
28703 chain_monitor_conv.is_owned = false;
28704 LDKChannelManager channel_manager_conv;
28705 channel_manager_conv.inner = (void*)(channel_manager & (~1));
28706 channel_manager_conv.is_owned = false;
28707 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
28708 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
28709 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
28710 LDKPeerManager peer_manager_conv;
28711 peer_manager_conv.inner = (void*)(peer_manager & (~1));
28712 peer_manager_conv.is_owned = false;
28713 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28714 CHECK_ACCESS(logger_ptr);
28715 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28716 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);
28717 uint64_t ret_ref = 0;
28718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28720 ret_ref = (uint64_t)ret_var.inner;
28721 if (ret_var.is_owned) {
28727 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
28728 LDKBackgroundProcessor this_arg_conv;
28729 this_arg_conv.inner = (void*)(this_arg & (~1));
28730 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28731 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28732 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28733 *ret_conv = BackgroundProcessor_join(this_arg_conv);
28734 return (uint64_t)ret_conv;
28737 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
28738 LDKBackgroundProcessor this_arg_conv;
28739 this_arg_conv.inner = (void*)(this_arg & (~1));
28740 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28741 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28742 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28743 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
28744 return (uint64_t)ret_conv;
28747 void __attribute__((visibility("default"))) TS_check_platform() {
28751 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
28752 LDKInvoice this_obj_conv;
28753 this_obj_conv.inner = (void*)(this_obj & (~1));
28754 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28755 Invoice_free(this_obj_conv);
28758 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
28760 a_conv.inner = (void*)(a & (~1));
28761 a_conv.is_owned = false;
28763 b_conv.inner = (void*)(b & (~1));
28764 b_conv.is_owned = false;
28765 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
28769 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
28770 LDKInvoice orig_conv;
28771 orig_conv.inner = (void*)(orig & (~1));
28772 orig_conv.is_owned = false;
28773 LDKInvoice ret_var = Invoice_clone(&orig_conv);
28774 uint64_t ret_ref = 0;
28775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28777 ret_ref = (uint64_t)ret_var.inner;
28778 if (ret_var.is_owned) {
28784 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
28785 LDKSignedRawInvoice this_obj_conv;
28786 this_obj_conv.inner = (void*)(this_obj & (~1));
28787 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28788 SignedRawInvoice_free(this_obj_conv);
28791 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
28792 LDKSignedRawInvoice a_conv;
28793 a_conv.inner = (void*)(a & (~1));
28794 a_conv.is_owned = false;
28795 LDKSignedRawInvoice b_conv;
28796 b_conv.inner = (void*)(b & (~1));
28797 b_conv.is_owned = false;
28798 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
28802 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
28803 LDKSignedRawInvoice orig_conv;
28804 orig_conv.inner = (void*)(orig & (~1));
28805 orig_conv.is_owned = false;
28806 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
28807 uint64_t ret_ref = 0;
28808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28810 ret_ref = (uint64_t)ret_var.inner;
28811 if (ret_var.is_owned) {
28817 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
28818 LDKRawInvoice this_obj_conv;
28819 this_obj_conv.inner = (void*)(this_obj & (~1));
28820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28821 RawInvoice_free(this_obj_conv);
28824 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
28825 LDKRawInvoice this_ptr_conv;
28826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28827 this_ptr_conv.is_owned = false;
28828 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
28829 uint64_t ret_ref = 0;
28830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28832 ret_ref = (uint64_t)ret_var.inner;
28833 if (ret_var.is_owned) {
28839 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
28840 LDKRawInvoice this_ptr_conv;
28841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28842 this_ptr_conv.is_owned = false;
28843 LDKRawDataPart val_conv;
28844 val_conv.inner = (void*)(val & (~1));
28845 val_conv.is_owned = (val & 1) || (val == 0);
28846 val_conv = RawDataPart_clone(&val_conv);
28847 RawInvoice_set_data(&this_ptr_conv, val_conv);
28850 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
28851 LDKRawInvoice a_conv;
28852 a_conv.inner = (void*)(a & (~1));
28853 a_conv.is_owned = false;
28854 LDKRawInvoice b_conv;
28855 b_conv.inner = (void*)(b & (~1));
28856 b_conv.is_owned = false;
28857 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
28861 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
28862 LDKRawInvoice orig_conv;
28863 orig_conv.inner = (void*)(orig & (~1));
28864 orig_conv.is_owned = false;
28865 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
28866 uint64_t ret_ref = 0;
28867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28869 ret_ref = (uint64_t)ret_var.inner;
28870 if (ret_var.is_owned) {
28876 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
28877 LDKRawDataPart this_obj_conv;
28878 this_obj_conv.inner = (void*)(this_obj & (~1));
28879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28880 RawDataPart_free(this_obj_conv);
28883 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
28884 LDKRawDataPart this_ptr_conv;
28885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28886 this_ptr_conv.is_owned = false;
28887 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
28888 uint64_t ret_ref = 0;
28889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28891 ret_ref = (uint64_t)ret_var.inner;
28892 if (ret_var.is_owned) {
28898 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
28899 LDKRawDataPart this_ptr_conv;
28900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28901 this_ptr_conv.is_owned = false;
28902 LDKPositiveTimestamp val_conv;
28903 val_conv.inner = (void*)(val & (~1));
28904 val_conv.is_owned = (val & 1) || (val == 0);
28905 val_conv = PositiveTimestamp_clone(&val_conv);
28906 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
28909 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
28910 LDKRawDataPart a_conv;
28911 a_conv.inner = (void*)(a & (~1));
28912 a_conv.is_owned = false;
28913 LDKRawDataPart b_conv;
28914 b_conv.inner = (void*)(b & (~1));
28915 b_conv.is_owned = false;
28916 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
28920 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
28921 LDKRawDataPart orig_conv;
28922 orig_conv.inner = (void*)(orig & (~1));
28923 orig_conv.is_owned = false;
28924 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
28925 uint64_t ret_ref = 0;
28926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28928 ret_ref = (uint64_t)ret_var.inner;
28929 if (ret_var.is_owned) {
28935 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
28936 LDKPositiveTimestamp this_obj_conv;
28937 this_obj_conv.inner = (void*)(this_obj & (~1));
28938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28939 PositiveTimestamp_free(this_obj_conv);
28942 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
28943 LDKPositiveTimestamp a_conv;
28944 a_conv.inner = (void*)(a & (~1));
28945 a_conv.is_owned = false;
28946 LDKPositiveTimestamp b_conv;
28947 b_conv.inner = (void*)(b & (~1));
28948 b_conv.is_owned = false;
28949 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
28953 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
28954 LDKPositiveTimestamp orig_conv;
28955 orig_conv.inner = (void*)(orig & (~1));
28956 orig_conv.is_owned = false;
28957 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
28958 uint64_t ret_ref = 0;
28959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28961 ret_ref = (uint64_t)ret_var.inner;
28962 if (ret_var.is_owned) {
28968 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
28969 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
28970 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
28974 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
28975 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
28979 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
28980 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
28984 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
28985 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
28989 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
28990 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
28994 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
28995 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
28996 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
28997 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
29001 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
29002 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
29003 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
29007 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
29008 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
29009 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
29013 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
29014 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
29018 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
29019 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
29023 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
29024 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
29028 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
29029 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
29033 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
29034 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
29038 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
29039 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
29040 int64_t ret_val = Currency_hash(o_conv);
29044 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
29045 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
29046 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
29047 jboolean ret_val = Currency_eq(a_conv, b_conv);
29051 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
29052 LDKSha256 this_obj_conv;
29053 this_obj_conv.inner = (void*)(this_obj & (~1));
29054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29055 Sha256_free(this_obj_conv);
29058 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
29059 LDKSha256 orig_conv;
29060 orig_conv.inner = (void*)(orig & (~1));
29061 orig_conv.is_owned = false;
29062 LDKSha256 ret_var = Sha256_clone(&orig_conv);
29063 uint64_t ret_ref = 0;
29064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29066 ret_ref = (uint64_t)ret_var.inner;
29067 if (ret_var.is_owned) {
29073 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
29075 o_conv.inner = (void*)(o & (~1));
29076 o_conv.is_owned = false;
29077 int64_t ret_val = Sha256_hash(&o_conv);
29081 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
29083 a_conv.inner = (void*)(a & (~1));
29084 a_conv.is_owned = false;
29086 b_conv.inner = (void*)(b & (~1));
29087 b_conv.is_owned = false;
29088 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
29092 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
29093 LDKDescription this_obj_conv;
29094 this_obj_conv.inner = (void*)(this_obj & (~1));
29095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29096 Description_free(this_obj_conv);
29099 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
29100 LDKDescription orig_conv;
29101 orig_conv.inner = (void*)(orig & (~1));
29102 orig_conv.is_owned = false;
29103 LDKDescription ret_var = Description_clone(&orig_conv);
29104 uint64_t ret_ref = 0;
29105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29107 ret_ref = (uint64_t)ret_var.inner;
29108 if (ret_var.is_owned) {
29114 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
29115 LDKDescription o_conv;
29116 o_conv.inner = (void*)(o & (~1));
29117 o_conv.is_owned = false;
29118 int64_t ret_val = Description_hash(&o_conv);
29122 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
29123 LDKDescription a_conv;
29124 a_conv.inner = (void*)(a & (~1));
29125 a_conv.is_owned = false;
29126 LDKDescription b_conv;
29127 b_conv.inner = (void*)(b & (~1));
29128 b_conv.is_owned = false;
29129 jboolean ret_val = Description_eq(&a_conv, &b_conv);
29133 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
29134 LDKPayeePubKey this_obj_conv;
29135 this_obj_conv.inner = (void*)(this_obj & (~1));
29136 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29137 PayeePubKey_free(this_obj_conv);
29140 int8_tArray __attribute__((visibility("default"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
29141 LDKPayeePubKey this_ptr_conv;
29142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29143 this_ptr_conv.is_owned = false;
29144 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29145 memcpy((uint8_t*)(ret_arr + 4), PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
29149 void __attribute__((visibility("default"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
29150 LDKPayeePubKey this_ptr_conv;
29151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29152 this_ptr_conv.is_owned = false;
29153 LDKPublicKey val_ref;
29154 CHECK(*((uint32_t*)val) == 33);
29155 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
29156 PayeePubKey_set_a(&this_ptr_conv, val_ref);
29159 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_new(int8_tArray a_arg) {
29160 LDKPublicKey a_arg_ref;
29161 CHECK(*((uint32_t*)a_arg) == 33);
29162 memcpy(a_arg_ref.compressed_form, (uint8_t*)(a_arg + 4), 33);
29163 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
29164 uint64_t ret_ref = 0;
29165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29167 ret_ref = (uint64_t)ret_var.inner;
29168 if (ret_var.is_owned) {
29174 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
29175 LDKPayeePubKey orig_conv;
29176 orig_conv.inner = (void*)(orig & (~1));
29177 orig_conv.is_owned = false;
29178 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
29179 uint64_t ret_ref = 0;
29180 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29181 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29182 ret_ref = (uint64_t)ret_var.inner;
29183 if (ret_var.is_owned) {
29189 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
29190 LDKPayeePubKey o_conv;
29191 o_conv.inner = (void*)(o & (~1));
29192 o_conv.is_owned = false;
29193 int64_t ret_val = PayeePubKey_hash(&o_conv);
29197 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
29198 LDKPayeePubKey a_conv;
29199 a_conv.inner = (void*)(a & (~1));
29200 a_conv.is_owned = false;
29201 LDKPayeePubKey b_conv;
29202 b_conv.inner = (void*)(b & (~1));
29203 b_conv.is_owned = false;
29204 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
29208 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
29209 LDKExpiryTime this_obj_conv;
29210 this_obj_conv.inner = (void*)(this_obj & (~1));
29211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29212 ExpiryTime_free(this_obj_conv);
29215 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
29216 LDKExpiryTime orig_conv;
29217 orig_conv.inner = (void*)(orig & (~1));
29218 orig_conv.is_owned = false;
29219 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
29220 uint64_t ret_ref = 0;
29221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29223 ret_ref = (uint64_t)ret_var.inner;
29224 if (ret_var.is_owned) {
29230 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
29231 LDKExpiryTime o_conv;
29232 o_conv.inner = (void*)(o & (~1));
29233 o_conv.is_owned = false;
29234 int64_t ret_val = ExpiryTime_hash(&o_conv);
29238 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
29239 LDKExpiryTime a_conv;
29240 a_conv.inner = (void*)(a & (~1));
29241 a_conv.is_owned = false;
29242 LDKExpiryTime b_conv;
29243 b_conv.inner = (void*)(b & (~1));
29244 b_conv.is_owned = false;
29245 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
29249 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
29250 LDKMinFinalCltvExpiry this_obj_conv;
29251 this_obj_conv.inner = (void*)(this_obj & (~1));
29252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29253 MinFinalCltvExpiry_free(this_obj_conv);
29256 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
29257 LDKMinFinalCltvExpiry this_ptr_conv;
29258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29259 this_ptr_conv.is_owned = false;
29260 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
29264 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
29265 LDKMinFinalCltvExpiry this_ptr_conv;
29266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29267 this_ptr_conv.is_owned = false;
29268 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
29271 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
29272 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
29273 uint64_t ret_ref = 0;
29274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29276 ret_ref = (uint64_t)ret_var.inner;
29277 if (ret_var.is_owned) {
29283 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
29284 LDKMinFinalCltvExpiry orig_conv;
29285 orig_conv.inner = (void*)(orig & (~1));
29286 orig_conv.is_owned = false;
29287 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
29288 uint64_t ret_ref = 0;
29289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29291 ret_ref = (uint64_t)ret_var.inner;
29292 if (ret_var.is_owned) {
29298 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
29299 LDKMinFinalCltvExpiry o_conv;
29300 o_conv.inner = (void*)(o & (~1));
29301 o_conv.is_owned = false;
29302 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
29306 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
29307 LDKMinFinalCltvExpiry a_conv;
29308 a_conv.inner = (void*)(a & (~1));
29309 a_conv.is_owned = false;
29310 LDKMinFinalCltvExpiry b_conv;
29311 b_conv.inner = (void*)(b & (~1));
29312 b_conv.is_owned = false;
29313 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
29317 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
29318 if ((this_ptr & 1) != 0) return;
29319 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29320 CHECK_ACCESS(this_ptr_ptr);
29321 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
29322 FREE((void*)this_ptr);
29323 Fallback_free(this_ptr_conv);
29326 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
29327 LDKFallback* orig_conv = (LDKFallback*)orig;
29328 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29329 *ret_copy = Fallback_clone(orig_conv);
29330 uint64_t ret_ref = (uint64_t)ret_copy;
29334 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
29336 LDKCVec_u8Z program_ref;
29337 program_ref.datalen = *((uint32_t*)program);
29338 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
29339 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
29340 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29341 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
29342 uint64_t ret_ref = (uint64_t)ret_copy;
29346 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
29347 LDKTwentyBytes a_ref;
29348 CHECK(*((uint32_t*)a) == 20);
29349 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
29350 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29351 *ret_copy = Fallback_pub_key_hash(a_ref);
29352 uint64_t ret_ref = (uint64_t)ret_copy;
29356 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
29357 LDKTwentyBytes a_ref;
29358 CHECK(*((uint32_t*)a) == 20);
29359 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
29360 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29361 *ret_copy = Fallback_script_hash(a_ref);
29362 uint64_t ret_ref = (uint64_t)ret_copy;
29366 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
29367 LDKFallback* o_conv = (LDKFallback*)o;
29368 int64_t ret_val = Fallback_hash(o_conv);
29372 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
29373 LDKFallback* a_conv = (LDKFallback*)a;
29374 LDKFallback* b_conv = (LDKFallback*)b;
29375 jboolean ret_val = Fallback_eq(a_conv, b_conv);
29379 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
29380 LDKInvoiceSignature this_obj_conv;
29381 this_obj_conv.inner = (void*)(this_obj & (~1));
29382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29383 InvoiceSignature_free(this_obj_conv);
29386 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
29387 LDKInvoiceSignature orig_conv;
29388 orig_conv.inner = (void*)(orig & (~1));
29389 orig_conv.is_owned = false;
29390 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
29391 uint64_t ret_ref = 0;
29392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29394 ret_ref = (uint64_t)ret_var.inner;
29395 if (ret_var.is_owned) {
29401 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
29402 LDKInvoiceSignature a_conv;
29403 a_conv.inner = (void*)(a & (~1));
29404 a_conv.is_owned = false;
29405 LDKInvoiceSignature b_conv;
29406 b_conv.inner = (void*)(b & (~1));
29407 b_conv.is_owned = false;
29408 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
29412 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
29413 LDKPrivateRoute this_obj_conv;
29414 this_obj_conv.inner = (void*)(this_obj & (~1));
29415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29416 PrivateRoute_free(this_obj_conv);
29419 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
29420 LDKPrivateRoute orig_conv;
29421 orig_conv.inner = (void*)(orig & (~1));
29422 orig_conv.is_owned = false;
29423 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
29424 uint64_t ret_ref = 0;
29425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29427 ret_ref = (uint64_t)ret_var.inner;
29428 if (ret_var.is_owned) {
29434 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
29435 LDKPrivateRoute o_conv;
29436 o_conv.inner = (void*)(o & (~1));
29437 o_conv.is_owned = false;
29438 int64_t ret_val = PrivateRoute_hash(&o_conv);
29442 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
29443 LDKPrivateRoute a_conv;
29444 a_conv.inner = (void*)(a & (~1));
29445 a_conv.is_owned = false;
29446 LDKPrivateRoute b_conv;
29447 b_conv.inner = (void*)(b & (~1));
29448 b_conv.is_owned = false;
29449 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
29453 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
29454 LDKSignedRawInvoice this_arg_conv;
29455 this_arg_conv.inner = (void*)(this_arg & (~1));
29456 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29457 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
29458 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
29459 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
29460 return ((uint64_t)ret_conv);
29463 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
29464 LDKSignedRawInvoice this_arg_conv;
29465 this_arg_conv.inner = (void*)(this_arg & (~1));
29466 this_arg_conv.is_owned = false;
29467 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
29468 uint64_t ret_ref = 0;
29469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29471 ret_ref = (uint64_t)ret_var.inner;
29472 if (ret_var.is_owned) {
29478 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
29479 LDKSignedRawInvoice this_arg_conv;
29480 this_arg_conv.inner = (void*)(this_arg & (~1));
29481 this_arg_conv.is_owned = false;
29482 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29483 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
29487 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
29488 LDKSignedRawInvoice this_arg_conv;
29489 this_arg_conv.inner = (void*)(this_arg & (~1));
29490 this_arg_conv.is_owned = false;
29491 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
29492 uint64_t ret_ref = 0;
29493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29495 ret_ref = (uint64_t)ret_var.inner;
29496 if (ret_var.is_owned) {
29502 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
29503 LDKSignedRawInvoice this_arg_conv;
29504 this_arg_conv.inner = (void*)(this_arg & (~1));
29505 this_arg_conv.is_owned = false;
29506 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
29507 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
29508 return (uint64_t)ret_conv;
29511 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
29512 LDKSignedRawInvoice this_arg_conv;
29513 this_arg_conv.inner = (void*)(this_arg & (~1));
29514 this_arg_conv.is_owned = false;
29515 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
29519 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
29520 LDKRawInvoice this_arg_conv;
29521 this_arg_conv.inner = (void*)(this_arg & (~1));
29522 this_arg_conv.is_owned = false;
29523 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29524 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
29528 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
29529 LDKRawInvoice this_arg_conv;
29530 this_arg_conv.inner = (void*)(this_arg & (~1));
29531 this_arg_conv.is_owned = false;
29532 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
29533 uint64_t ret_ref = 0;
29534 if ((uint64_t)ret_var.inner > 4096) {
29535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29537 ret_ref = (uint64_t)ret_var.inner;
29538 if (ret_var.is_owned) {
29545 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
29546 LDKRawInvoice this_arg_conv;
29547 this_arg_conv.inner = (void*)(this_arg & (~1));
29548 this_arg_conv.is_owned = false;
29549 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
29550 uint64_t ret_ref = 0;
29551 if ((uint64_t)ret_var.inner > 4096) {
29552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29554 ret_ref = (uint64_t)ret_var.inner;
29555 if (ret_var.is_owned) {
29562 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
29563 LDKRawInvoice this_arg_conv;
29564 this_arg_conv.inner = (void*)(this_arg & (~1));
29565 this_arg_conv.is_owned = false;
29566 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
29567 uint64_t ret_ref = 0;
29568 if ((uint64_t)ret_var.inner > 4096) {
29569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29571 ret_ref = (uint64_t)ret_var.inner;
29572 if (ret_var.is_owned) {
29579 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
29580 LDKRawInvoice this_arg_conv;
29581 this_arg_conv.inner = (void*)(this_arg & (~1));
29582 this_arg_conv.is_owned = false;
29583 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
29584 uint64_t ret_ref = 0;
29585 if ((uint64_t)ret_var.inner > 4096) {
29586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29588 ret_ref = (uint64_t)ret_var.inner;
29589 if (ret_var.is_owned) {
29596 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
29597 LDKRawInvoice this_arg_conv;
29598 this_arg_conv.inner = (void*)(this_arg & (~1));
29599 this_arg_conv.is_owned = false;
29600 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
29601 uint64_t ret_ref = 0;
29602 if ((uint64_t)ret_var.inner > 4096) {
29603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29605 ret_ref = (uint64_t)ret_var.inner;
29606 if (ret_var.is_owned) {
29613 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
29614 LDKRawInvoice this_arg_conv;
29615 this_arg_conv.inner = (void*)(this_arg & (~1));
29616 this_arg_conv.is_owned = false;
29617 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
29618 uint64_t ret_ref = 0;
29619 if ((uint64_t)ret_var.inner > 4096) {
29620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29622 ret_ref = (uint64_t)ret_var.inner;
29623 if (ret_var.is_owned) {
29630 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
29631 LDKRawInvoice this_arg_conv;
29632 this_arg_conv.inner = (void*)(this_arg & (~1));
29633 this_arg_conv.is_owned = false;
29634 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29635 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
29639 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
29640 LDKRawInvoice this_arg_conv;
29641 this_arg_conv.inner = (void*)(this_arg & (~1));
29642 this_arg_conv.is_owned = false;
29643 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
29644 uint64_t ret_ref = 0;
29645 if ((uint64_t)ret_var.inner > 4096) {
29646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29648 ret_ref = (uint64_t)ret_var.inner;
29649 if (ret_var.is_owned) {
29656 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
29657 LDKRawInvoice this_arg_conv;
29658 this_arg_conv.inner = (void*)(this_arg & (~1));
29659 this_arg_conv.is_owned = false;
29660 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
29661 uint32_tArray ret_arr = NULL;
29662 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
29663 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
29664 for (size_t o = 0; o < ret_var.datalen; o++) {
29665 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29666 uint64_t ret_conv_14_ref = 0;
29667 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29668 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29669 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29670 if (ret_conv_14_var.is_owned) {
29671 ret_conv_14_ref |= 1;
29673 ret_arr_ptr[o] = ret_conv_14_ref;
29676 FREE(ret_var.data);
29680 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
29681 LDKRawInvoice this_arg_conv;
29682 this_arg_conv.inner = (void*)(this_arg & (~1));
29683 this_arg_conv.is_owned = false;
29684 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29685 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
29686 uint64_t ret_ref = (uint64_t)ret_copy;
29690 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
29691 LDKRawInvoice this_arg_conv;
29692 this_arg_conv.inner = (void*)(this_arg & (~1));
29693 this_arg_conv.is_owned = false;
29694 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
29698 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
29699 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29700 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
29701 return (uint64_t)ret_conv;
29704 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
29705 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29706 *ret_conv = PositiveTimestamp_from_system_time(time);
29707 return (uint64_t)ret_conv;
29710 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
29711 LDKPositiveTimestamp this_arg_conv;
29712 this_arg_conv.inner = (void*)(this_arg & (~1));
29713 this_arg_conv.is_owned = false;
29714 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
29718 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
29719 LDKPositiveTimestamp this_arg_conv;
29720 this_arg_conv.inner = (void*)(this_arg & (~1));
29721 this_arg_conv.is_owned = false;
29722 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
29726 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
29727 LDKInvoice this_arg_conv;
29728 this_arg_conv.inner = (void*)(this_arg & (~1));
29729 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29730 this_arg_conv = Invoice_clone(&this_arg_conv);
29731 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
29732 uint64_t ret_ref = 0;
29733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29735 ret_ref = (uint64_t)ret_var.inner;
29736 if (ret_var.is_owned) {
29742 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
29743 LDKInvoice this_arg_conv;
29744 this_arg_conv.inner = (void*)(this_arg & (~1));
29745 this_arg_conv.is_owned = false;
29746 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
29747 *ret_conv = Invoice_check_signature(&this_arg_conv);
29748 return (uint64_t)ret_conv;
29751 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
29752 LDKSignedRawInvoice signed_invoice_conv;
29753 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
29754 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
29755 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
29756 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
29757 *ret_conv = Invoice_from_signed(signed_invoice_conv);
29758 return (uint64_t)ret_conv;
29761 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
29762 LDKInvoice this_arg_conv;
29763 this_arg_conv.inner = (void*)(this_arg & (~1));
29764 this_arg_conv.is_owned = false;
29765 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
29769 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
29770 LDKInvoice this_arg_conv;
29771 this_arg_conv.inner = (void*)(this_arg & (~1));
29772 this_arg_conv.is_owned = false;
29773 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29774 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
29778 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
29779 LDKInvoice this_arg_conv;
29780 this_arg_conv.inner = (void*)(this_arg & (~1));
29781 this_arg_conv.is_owned = false;
29782 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29783 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
29787 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
29788 LDKInvoice this_arg_conv;
29789 this_arg_conv.inner = (void*)(this_arg & (~1));
29790 this_arg_conv.is_owned = false;
29791 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
29792 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_secret(&this_arg_conv), 32);
29796 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
29797 LDKInvoice this_arg_conv;
29798 this_arg_conv.inner = (void*)(this_arg & (~1));
29799 this_arg_conv.is_owned = false;
29800 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
29801 uint64_t ret_ref = 0;
29802 if ((uint64_t)ret_var.inner > 4096) {
29803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29805 ret_ref = (uint64_t)ret_var.inner;
29806 if (ret_var.is_owned) {
29813 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
29814 LDKInvoice this_arg_conv;
29815 this_arg_conv.inner = (void*)(this_arg & (~1));
29816 this_arg_conv.is_owned = false;
29817 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
29818 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
29822 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
29823 LDKInvoice this_arg_conv;
29824 this_arg_conv.inner = (void*)(this_arg & (~1));
29825 this_arg_conv.is_owned = false;
29826 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
29830 jboolean __attribute__((visibility("default"))) TS_Invoice_is_expired(uint32_t this_arg) {
29831 LDKInvoice this_arg_conv;
29832 this_arg_conv.inner = (void*)(this_arg & (~1));
29833 this_arg_conv.is_owned = false;
29834 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
29838 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
29839 LDKInvoice this_arg_conv;
29840 this_arg_conv.inner = (void*)(this_arg & (~1));
29841 this_arg_conv.is_owned = false;
29842 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
29846 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
29847 LDKInvoice this_arg_conv;
29848 this_arg_conv.inner = (void*)(this_arg & (~1));
29849 this_arg_conv.is_owned = false;
29850 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
29851 uint32_tArray ret_arr = NULL;
29852 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
29853 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
29854 for (size_t o = 0; o < ret_var.datalen; o++) {
29855 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29856 uint64_t ret_conv_14_ref = 0;
29857 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29858 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29859 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29860 if (ret_conv_14_var.is_owned) {
29861 ret_conv_14_ref |= 1;
29863 ret_arr_ptr[o] = ret_conv_14_ref;
29866 FREE(ret_var.data);
29870 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
29871 LDKInvoice this_arg_conv;
29872 this_arg_conv.inner = (void*)(this_arg & (~1));
29873 this_arg_conv.is_owned = false;
29874 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
29875 uint32_tArray ret_arr = NULL;
29876 ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
29877 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
29878 for (size_t l = 0; l < ret_var.datalen; l++) {
29879 LDKRouteHint ret_conv_11_var = ret_var.data[l];
29880 uint64_t ret_conv_11_ref = 0;
29881 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29882 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29883 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
29884 if (ret_conv_11_var.is_owned) {
29885 ret_conv_11_ref |= 1;
29887 ret_arr_ptr[l] = ret_conv_11_ref;
29890 FREE(ret_var.data);
29894 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
29895 LDKInvoice this_arg_conv;
29896 this_arg_conv.inner = (void*)(this_arg & (~1));
29897 this_arg_conv.is_owned = false;
29898 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
29902 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
29903 LDKInvoice this_arg_conv;
29904 this_arg_conv.inner = (void*)(this_arg & (~1));
29905 this_arg_conv.is_owned = false;
29906 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29907 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
29908 uint64_t ret_ref = (uint64_t)ret_copy;
29912 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
29913 LDKStr description_conv = str_ref_to_owned_c(description);
29914 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
29915 *ret_conv = Description_new(description_conv);
29916 return (uint64_t)ret_conv;
29919 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
29920 LDKDescription this_arg_conv;
29921 this_arg_conv.inner = (void*)(this_arg & (~1));
29922 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29923 this_arg_conv = Description_clone(&this_arg_conv);
29924 LDKStr ret_str = Description_into_inner(this_arg_conv);
29925 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29930 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
29931 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29932 *ret_conv = ExpiryTime_from_seconds(seconds);
29933 return (uint64_t)ret_conv;
29936 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
29937 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29938 *ret_conv = ExpiryTime_from_duration(duration);
29939 return (uint64_t)ret_conv;
29942 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
29943 LDKExpiryTime this_arg_conv;
29944 this_arg_conv.inner = (void*)(this_arg & (~1));
29945 this_arg_conv.is_owned = false;
29946 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
29950 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
29951 LDKExpiryTime this_arg_conv;
29952 this_arg_conv.inner = (void*)(this_arg & (~1));
29953 this_arg_conv.is_owned = false;
29954 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
29958 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
29959 LDKRouteHint hops_conv;
29960 hops_conv.inner = (void*)(hops & (~1));
29961 hops_conv.is_owned = (hops & 1) || (hops == 0);
29962 hops_conv = RouteHint_clone(&hops_conv);
29963 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
29964 *ret_conv = PrivateRoute_new(hops_conv);
29965 return (uint64_t)ret_conv;
29968 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
29969 LDKPrivateRoute this_arg_conv;
29970 this_arg_conv.inner = (void*)(this_arg & (~1));
29971 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29972 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
29973 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
29974 uint64_t ret_ref = 0;
29975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29977 ret_ref = (uint64_t)ret_var.inner;
29978 if (ret_var.is_owned) {
29984 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
29985 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
29986 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
29990 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
29991 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
29995 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
29996 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
30000 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
30001 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
30005 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
30006 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
30010 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
30011 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
30012 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
30013 jboolean ret_val = CreationError_eq(a_conv, b_conv);
30017 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
30018 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
30019 LDKStr ret_str = CreationError_to_str(o_conv);
30020 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30025 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
30026 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
30027 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
30031 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
30032 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
30036 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
30037 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
30041 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
30042 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
30046 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
30047 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
30051 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
30052 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
30056 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
30057 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
30061 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
30062 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
30066 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
30067 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
30071 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
30072 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
30076 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
30077 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
30081 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
30082 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
30083 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
30084 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
30088 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
30089 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
30090 LDKStr ret_str = SemanticError_to_str(o_conv);
30091 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30096 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
30097 if ((this_ptr & 1) != 0) return;
30098 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30099 CHECK_ACCESS(this_ptr_ptr);
30100 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
30101 FREE((void*)this_ptr);
30102 SignOrCreationError_free(this_ptr_conv);
30105 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
30106 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
30107 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30108 *ret_copy = SignOrCreationError_clone(orig_conv);
30109 uint64_t ret_ref = (uint64_t)ret_copy;
30113 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
30114 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30115 *ret_copy = SignOrCreationError_sign_error();
30116 uint64_t ret_ref = (uint64_t)ret_copy;
30120 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
30121 LDKCreationError a_conv = LDKCreationError_from_js(a);
30122 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30123 *ret_copy = SignOrCreationError_creation_error(a_conv);
30124 uint64_t ret_ref = (uint64_t)ret_copy;
30128 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
30129 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
30130 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
30131 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
30135 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
30136 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
30137 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
30138 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30143 void __attribute__((visibility("default"))) TS_InvoicePayer_free(uint32_t this_obj) {
30144 LDKInvoicePayer this_obj_conv;
30145 this_obj_conv.inner = (void*)(this_obj & (~1));
30146 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30147 InvoicePayer_free(this_obj_conv);
30150 void __attribute__((visibility("default"))) TS_Payer_free(uint32_t this_ptr) {
30151 if ((this_ptr & 1) != 0) return;
30152 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30153 CHECK_ACCESS(this_ptr_ptr);
30154 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
30155 FREE((void*)this_ptr);
30156 Payer_free(this_ptr_conv);
30159 void __attribute__((visibility("default"))) TS_Router_free(uint32_t this_ptr) {
30160 if ((this_ptr & 1) != 0) return;
30161 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30162 CHECK_ACCESS(this_ptr_ptr);
30163 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
30164 FREE((void*)this_ptr);
30165 Router_free(this_ptr_conv);
30168 void __attribute__((visibility("default"))) TS_RetryAttempts_free(uint32_t this_obj) {
30169 LDKRetryAttempts this_obj_conv;
30170 this_obj_conv.inner = (void*)(this_obj & (~1));
30171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30172 RetryAttempts_free(this_obj_conv);
30175 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
30176 LDKRetryAttempts this_ptr_conv;
30177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30178 this_ptr_conv.is_owned = false;
30179 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
30183 void __attribute__((visibility("default"))) TS_RetryAttempts_set_a(uint32_t this_ptr, int64_t val) {
30184 LDKRetryAttempts this_ptr_conv;
30185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30186 this_ptr_conv.is_owned = false;
30187 RetryAttempts_set_a(&this_ptr_conv, val);
30190 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_new(int64_t a_arg) {
30191 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
30192 uint64_t ret_ref = 0;
30193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30195 ret_ref = (uint64_t)ret_var.inner;
30196 if (ret_var.is_owned) {
30202 uint32_t __attribute__((visibility("default"))) TS_RetryAttempts_clone(uint32_t orig) {
30203 LDKRetryAttempts orig_conv;
30204 orig_conv.inner = (void*)(orig & (~1));
30205 orig_conv.is_owned = false;
30206 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
30207 uint64_t ret_ref = 0;
30208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30210 ret_ref = (uint64_t)ret_var.inner;
30211 if (ret_var.is_owned) {
30217 jboolean __attribute__((visibility("default"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
30218 LDKRetryAttempts a_conv;
30219 a_conv.inner = (void*)(a & (~1));
30220 a_conv.is_owned = false;
30221 LDKRetryAttempts b_conv;
30222 b_conv.inner = (void*)(b & (~1));
30223 b_conv.is_owned = false;
30224 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
30228 int64_t __attribute__((visibility("default"))) TS_RetryAttempts_hash(uint32_t o) {
30229 LDKRetryAttempts o_conv;
30230 o_conv.inner = (void*)(o & (~1));
30231 o_conv.is_owned = false;
30232 int64_t ret_val = RetryAttempts_hash(&o_conv);
30236 void __attribute__((visibility("default"))) TS_PaymentError_free(uint32_t this_ptr) {
30237 if ((this_ptr & 1) != 0) return;
30238 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30239 CHECK_ACCESS(this_ptr_ptr);
30240 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
30241 FREE((void*)this_ptr);
30242 PaymentError_free(this_ptr_conv);
30245 uint32_t __attribute__((visibility("default"))) TS_PaymentError_clone(uint32_t orig) {
30246 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
30247 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
30248 *ret_copy = PaymentError_clone(orig_conv);
30249 uint64_t ret_ref = (uint64_t)ret_copy;
30253 uint32_t __attribute__((visibility("default"))) TS_PaymentError_invoice(jstring a) {
30254 LDKStr a_conv = str_ref_to_owned_c(a);
30255 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
30256 *ret_copy = PaymentError_invoice(a_conv);
30257 uint64_t ret_ref = (uint64_t)ret_copy;
30261 uint32_t __attribute__((visibility("default"))) TS_PaymentError_routing(uint32_t a) {
30262 LDKLightningError a_conv;
30263 a_conv.inner = (void*)(a & (~1));
30264 a_conv.is_owned = (a & 1) || (a == 0);
30265 a_conv = LightningError_clone(&a_conv);
30266 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
30267 *ret_copy = PaymentError_routing(a_conv);
30268 uint64_t ret_ref = (uint64_t)ret_copy;
30272 uint32_t __attribute__((visibility("default"))) TS_PaymentError_sending(uint32_t a) {
30273 void* a_ptr = (void*)(((uint64_t)a) & ~1);
30274 CHECK_ACCESS(a_ptr);
30275 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
30276 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
30277 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
30278 *ret_copy = PaymentError_sending(a_conv);
30279 uint64_t ret_ref = (uint64_t)ret_copy;
30283 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_new(uint32_t payer, uint32_t router, uint32_t scorer, uint32_t logger, uint32_t event_handler, uint32_t retry_attempts) {
30284 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
30285 CHECK_ACCESS(payer_ptr);
30286 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
30287 void* router_ptr = (void*)(((uint64_t)router) & ~1);
30288 CHECK_ACCESS(router_ptr);
30289 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
30290 LDKLockableScore scorer_conv;
30291 scorer_conv.inner = (void*)(scorer & (~1));
30292 scorer_conv.is_owned = false;
30293 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
30294 CHECK_ACCESS(logger_ptr);
30295 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30296 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
30297 CHECK_ACCESS(event_handler_ptr);
30298 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
30299 LDKRetryAttempts retry_attempts_conv;
30300 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
30301 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
30302 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
30303 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
30304 uint64_t ret_ref = 0;
30305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30307 ret_ref = (uint64_t)ret_var.inner;
30308 if (ret_var.is_owned) {
30314 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
30315 LDKInvoicePayer this_arg_conv;
30316 this_arg_conv.inner = (void*)(this_arg & (~1));
30317 this_arg_conv.is_owned = false;
30318 LDKInvoice invoice_conv;
30319 invoice_conv.inner = (void*)(invoice & (~1));
30320 invoice_conv.is_owned = false;
30321 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
30322 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
30323 return (uint64_t)ret_conv;
30326 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_invoice(uint32_t this_arg, uint32_t invoice, int64_t amount_msats) {
30327 LDKInvoicePayer this_arg_conv;
30328 this_arg_conv.inner = (void*)(this_arg & (~1));
30329 this_arg_conv.is_owned = false;
30330 LDKInvoice invoice_conv;
30331 invoice_conv.inner = (void*)(invoice & (~1));
30332 invoice_conv.is_owned = false;
30333 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
30334 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
30335 return (uint64_t)ret_conv;
30338 void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
30339 LDKInvoicePayer this_arg_conv;
30340 this_arg_conv.inner = (void*)(this_arg & (~1));
30341 this_arg_conv.is_owned = false;
30342 unsigned char payment_hash_arr[32];
30343 CHECK(*((uint32_t*)payment_hash) == 32);
30344 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
30345 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
30346 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
30349 uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
30350 LDKInvoicePayer this_arg_conv;
30351 this_arg_conv.inner = (void*)(this_arg & (~1));
30352 this_arg_conv.is_owned = false;
30353 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
30354 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
30355 return (uint64_t)ret_ret;
30358 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) {
30359 LDKChannelManager channelmanager_conv;
30360 channelmanager_conv.inner = (void*)(channelmanager & (~1));
30361 channelmanager_conv.is_owned = false;
30362 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
30363 CHECK_ACCESS(keys_manager_ptr);
30364 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30365 LDKCurrency network_conv = LDKCurrency_from_js(network);
30366 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
30367 CHECK_ACCESS(amt_msat_ptr);
30368 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
30369 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
30370 LDKStr description_conv = str_ref_to_owned_c(description);
30371 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
30372 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
30373 return (uint64_t)ret_conv;
30376 void __attribute__((visibility("default"))) TS_DefaultRouter_free(uint32_t this_obj) {
30377 LDKDefaultRouter this_obj_conv;
30378 this_obj_conv.inner = (void*)(this_obj & (~1));
30379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30380 DefaultRouter_free(this_obj_conv);
30383 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
30384 LDKNetworkGraph network_graph_conv;
30385 network_graph_conv.inner = (void*)(network_graph & (~1));
30386 network_graph_conv.is_owned = false;
30387 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
30388 CHECK_ACCESS(logger_ptr);
30389 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30390 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
30391 uint64_t ret_ref = 0;
30392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30394 ret_ref = (uint64_t)ret_var.inner;
30395 if (ret_var.is_owned) {
30401 uint32_t __attribute__((visibility("default"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
30402 LDKDefaultRouter this_arg_conv;
30403 this_arg_conv.inner = (void*)(this_arg & (~1));
30404 this_arg_conv.is_owned = false;
30405 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
30406 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
30407 return (uint64_t)ret_ret;
30410 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
30411 LDKChannelManager this_arg_conv;
30412 this_arg_conv.inner = (void*)(this_arg & (~1));
30413 this_arg_conv.is_owned = false;
30414 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
30415 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
30416 return (uint64_t)ret_ret;
30419 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
30420 LDKStr s_conv = str_ref_to_owned_c(s);
30421 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
30422 *ret_conv = SiPrefix_from_str(s_conv);
30423 return (uint64_t)ret_conv;
30426 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
30427 LDKStr s_conv = str_ref_to_owned_c(s);
30428 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
30429 *ret_conv = Invoice_from_str(s_conv);
30430 return (uint64_t)ret_conv;
30433 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
30434 LDKStr s_conv = str_ref_to_owned_c(s);
30435 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
30436 *ret_conv = SignedRawInvoice_from_str(s_conv);
30437 return (uint64_t)ret_conv;
30440 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
30442 o_conv.inner = (void*)(o & (~1));
30443 o_conv.is_owned = false;
30444 LDKStr ret_str = Invoice_to_str(&o_conv);
30445 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30450 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
30451 LDKSignedRawInvoice o_conv;
30452 o_conv.inner = (void*)(o & (~1));
30453 o_conv.is_owned = false;
30454 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
30455 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30460 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
30461 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
30462 LDKStr ret_str = Currency_to_str(o_conv);
30463 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30468 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
30469 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
30470 LDKStr ret_str = SiPrefix_to_str(o_conv);
30471 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);