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 ((long)(p) > 1024) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
23 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
24 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
25 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
30 typedef uint32_t int64_tArray;
31 typedef uint32_t int8_tArray;
32 typedef uint32_t uint32_tArray;
33 typedef uint32_t ptrArray;
34 typedef uint32_t jstring;
36 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
37 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
39 return (uint32_t)elems;
42 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
43 char* err_buf = MALLOC(len + 4, "str conv buf");
44 *((uint32_t*)err_buf) = len;
45 memcpy(err_buf + 4, chars, len);
46 return (uint32_t) err_buf;
48 static inline LDKStr str_ref_to_owned_c(jstring str) {
49 uint32_t *str_len = (uint32_t*)str;
50 char* newchars = MALLOC(*str_len + 1, "String chars");
51 memcpy(newchars, (const char*)(str + 4), *str_len);
52 newchars[*str_len] = 0;
56 .chars_is_owned = true
61 typedef bool jboolean;
63 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
64 return (uint32_t)MALLOC(size, "JS-Called malloc");
66 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
69 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
70 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
72 case 0: return LDKAccessError_UnknownChain;
73 case 1: return LDKAccessError_UnknownTx;
77 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
79 case LDKAccessError_UnknownChain: return 0;
80 case LDKAccessError_UnknownTx: return 1;
84 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
86 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
87 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
91 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
93 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
94 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
98 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
100 case 0: return LDKConfirmationTarget_Background;
101 case 1: return LDKConfirmationTarget_Normal;
102 case 2: return LDKConfirmationTarget_HighPriority;
106 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
108 case LDKConfirmationTarget_Background: return 0;
109 case LDKConfirmationTarget_Normal: return 1;
110 case LDKConfirmationTarget_HighPriority: return 2;
114 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
116 case 0: return LDKCreationError_DescriptionTooLong;
117 case 1: return LDKCreationError_RouteTooLong;
118 case 2: return LDKCreationError_TimestampOutOfBounds;
119 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
123 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
125 case LDKCreationError_DescriptionTooLong: return 0;
126 case LDKCreationError_RouteTooLong: return 1;
127 case LDKCreationError_TimestampOutOfBounds: return 2;
128 case LDKCreationError_ExpiryTimeOutOfBounds: return 3;
132 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
134 case 0: return LDKCurrency_Bitcoin;
135 case 1: return LDKCurrency_BitcoinTestnet;
136 case 2: return LDKCurrency_Regtest;
137 case 3: return LDKCurrency_Simnet;
138 case 4: return LDKCurrency_Signet;
142 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
144 case LDKCurrency_Bitcoin: return 0;
145 case LDKCurrency_BitcoinTestnet: return 1;
146 case LDKCurrency_Regtest: return 2;
147 case LDKCurrency_Simnet: return 3;
148 case LDKCurrency_Signet: return 4;
152 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
154 case 0: return LDKIOError_NotFound;
155 case 1: return LDKIOError_PermissionDenied;
156 case 2: return LDKIOError_ConnectionRefused;
157 case 3: return LDKIOError_ConnectionReset;
158 case 4: return LDKIOError_ConnectionAborted;
159 case 5: return LDKIOError_NotConnected;
160 case 6: return LDKIOError_AddrInUse;
161 case 7: return LDKIOError_AddrNotAvailable;
162 case 8: return LDKIOError_BrokenPipe;
163 case 9: return LDKIOError_AlreadyExists;
164 case 10: return LDKIOError_WouldBlock;
165 case 11: return LDKIOError_InvalidInput;
166 case 12: return LDKIOError_InvalidData;
167 case 13: return LDKIOError_TimedOut;
168 case 14: return LDKIOError_WriteZero;
169 case 15: return LDKIOError_Interrupted;
170 case 16: return LDKIOError_Other;
171 case 17: return LDKIOError_UnexpectedEof;
175 static inline int32_t LDKIOError_to_js(LDKIOError val) {
177 case LDKIOError_NotFound: return 0;
178 case LDKIOError_PermissionDenied: return 1;
179 case LDKIOError_ConnectionRefused: return 2;
180 case LDKIOError_ConnectionReset: return 3;
181 case LDKIOError_ConnectionAborted: return 4;
182 case LDKIOError_NotConnected: return 5;
183 case LDKIOError_AddrInUse: return 6;
184 case LDKIOError_AddrNotAvailable: return 7;
185 case LDKIOError_BrokenPipe: return 8;
186 case LDKIOError_AlreadyExists: return 9;
187 case LDKIOError_WouldBlock: return 10;
188 case LDKIOError_InvalidInput: return 11;
189 case LDKIOError_InvalidData: return 12;
190 case LDKIOError_TimedOut: return 13;
191 case LDKIOError_WriteZero: return 14;
192 case LDKIOError_Interrupted: return 15;
193 case LDKIOError_Other: return 16;
194 case LDKIOError_UnexpectedEof: return 17;
198 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
200 case 0: return LDKLevel_Trace;
201 case 1: return LDKLevel_Debug;
202 case 2: return LDKLevel_Info;
203 case 3: return LDKLevel_Warn;
204 case 4: return LDKLevel_Error;
208 static inline int32_t LDKLevel_to_js(LDKLevel val) {
210 case LDKLevel_Trace: return 0;
211 case LDKLevel_Debug: return 1;
212 case LDKLevel_Info: return 2;
213 case LDKLevel_Warn: return 3;
214 case LDKLevel_Error: return 4;
218 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
220 case 0: return LDKNetwork_Bitcoin;
221 case 1: return LDKNetwork_Testnet;
222 case 2: return LDKNetwork_Regtest;
223 case 3: return LDKNetwork_Signet;
227 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
229 case LDKNetwork_Bitcoin: return 0;
230 case LDKNetwork_Testnet: return 1;
231 case LDKNetwork_Regtest: return 2;
232 case LDKNetwork_Signet: return 3;
236 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
238 case 0: return LDKSecp256k1Error_IncorrectSignature;
239 case 1: return LDKSecp256k1Error_InvalidMessage;
240 case 2: return LDKSecp256k1Error_InvalidPublicKey;
241 case 3: return LDKSecp256k1Error_InvalidSignature;
242 case 4: return LDKSecp256k1Error_InvalidSecretKey;
243 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
244 case 6: return LDKSecp256k1Error_InvalidTweak;
245 case 7: return LDKSecp256k1Error_TweakCheckFailed;
246 case 8: return LDKSecp256k1Error_NotEnoughMemory;
250 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
252 case LDKSecp256k1Error_IncorrectSignature: return 0;
253 case LDKSecp256k1Error_InvalidMessage: return 1;
254 case LDKSecp256k1Error_InvalidPublicKey: return 2;
255 case LDKSecp256k1Error_InvalidSignature: return 3;
256 case LDKSecp256k1Error_InvalidSecretKey: return 4;
257 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
258 case LDKSecp256k1Error_InvalidTweak: return 6;
259 case LDKSecp256k1Error_TweakCheckFailed: return 7;
260 case LDKSecp256k1Error_NotEnoughMemory: return 8;
264 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
266 case 0: return LDKSemanticError_NoPaymentHash;
267 case 1: return LDKSemanticError_MultiplePaymentHashes;
268 case 2: return LDKSemanticError_NoDescription;
269 case 3: return LDKSemanticError_MultipleDescriptions;
270 case 4: return LDKSemanticError_MultiplePaymentSecrets;
271 case 5: return LDKSemanticError_InvalidFeatures;
272 case 6: return LDKSemanticError_InvalidRecoveryId;
273 case 7: return LDKSemanticError_InvalidSignature;
277 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
279 case LDKSemanticError_NoPaymentHash: return 0;
280 case LDKSemanticError_MultiplePaymentHashes: return 1;
281 case LDKSemanticError_NoDescription: return 2;
282 case LDKSemanticError_MultipleDescriptions: return 3;
283 case LDKSemanticError_MultiplePaymentSecrets: return 4;
284 case LDKSemanticError_InvalidFeatures: return 5;
285 case LDKSemanticError_InvalidRecoveryId: return 6;
286 case LDKSemanticError_InvalidSignature: return 7;
290 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
292 case 0: return LDKSiPrefix_Milli;
293 case 1: return LDKSiPrefix_Micro;
294 case 2: return LDKSiPrefix_Nano;
295 case 3: return LDKSiPrefix_Pico;
299 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
301 case LDKSiPrefix_Milli: return 0;
302 case LDKSiPrefix_Micro: return 1;
303 case LDKSiPrefix_Nano: return 2;
304 case LDKSiPrefix_Pico: return 3;
308 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
309 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
310 ret->datalen = *((uint32_t*)elems);
311 if (ret->datalen == 0) {
314 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
315 int8_t *java_elems = (int8_t*)(elems + 4);
316 for (size_t i = 0; i < ret->datalen; i++) {
317 ret->data[i] = java_elems[i];
320 return (uint64_t)ret;
322 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
323 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
324 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
327 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) {
328 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
329 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
330 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
331 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
332 CVec_u8Z_free(ret_var);
336 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
337 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
338 int64_t ret_val = TxOut_get_value(thing_conv);
342 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
343 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
345 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
346 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
347 CHECK(val->result_ok);
348 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
349 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
353 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
354 CHECK(!val->result_ok);
355 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
358 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
359 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
361 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
362 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
363 CHECK(val->result_ok);
364 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
365 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
368 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
369 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
370 CHECK(!val->result_ok);
371 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
374 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
375 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
377 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
378 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
379 CHECK(val->result_ok);
380 LDKTxCreationKeys res_var = (*val->contents.result);
381 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
382 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
383 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
387 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
388 CHECK(!val->result_ok);
389 LDKDecodeError err_var = (*val->contents.err);
390 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
391 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
392 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
395 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
396 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
398 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
399 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
400 CHECK(val->result_ok);
401 LDKChannelPublicKeys res_var = (*val->contents.result);
402 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
403 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
404 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
408 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
409 CHECK(!val->result_ok);
410 LDKDecodeError err_var = (*val->contents.err);
411 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
412 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
413 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
416 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
417 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
419 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
420 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
421 CHECK(val->result_ok);
422 LDKTxCreationKeys res_var = (*val->contents.result);
423 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
424 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
425 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
428 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
429 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
430 CHECK(!val->result_ok);
431 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
434 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
435 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
437 case LDKCOption_u32Z_Some: {
438 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
440 case LDKCOption_u32Z_None: {
441 return 0 /* LDKCOption_u32Z - None */;
446 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
447 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
449 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
450 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
451 CHECK(val->result_ok);
452 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
453 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
454 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
455 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
458 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
459 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
460 CHECK(!val->result_ok);
461 LDKDecodeError err_var = (*val->contents.err);
462 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
463 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
464 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
467 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
468 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
470 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
471 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
472 CHECK(val->result_ok);
473 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
474 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
475 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
476 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
479 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
480 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
481 CHECK(!val->result_ok);
482 LDKDecodeError err_var = (*val->contents.err);
483 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
484 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
485 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
488 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
489 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
491 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
492 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
493 CHECK(val->result_ok);
494 LDKChannelTransactionParameters res_var = (*val->contents.result);
495 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
496 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
497 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
500 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
501 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
502 CHECK(!val->result_ok);
503 LDKDecodeError err_var = (*val->contents.err);
504 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
505 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
506 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
509 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
510 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
512 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
513 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
514 CHECK(val->result_ok);
515 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
516 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
517 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
518 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
521 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
522 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
523 CHECK(!val->result_ok);
524 LDKDecodeError err_var = (*val->contents.err);
525 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
526 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
527 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
530 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
531 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
533 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
534 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
535 CHECK(val->result_ok);
536 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
537 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
538 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
539 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
542 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
543 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
544 CHECK(!val->result_ok);
545 LDKDecodeError err_var = (*val->contents.err);
546 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
547 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
548 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
551 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
552 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
554 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
555 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
556 CHECK(val->result_ok);
557 LDKCommitmentTransaction res_var = (*val->contents.result);
558 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
559 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
560 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
563 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
564 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
565 CHECK(!val->result_ok);
566 LDKDecodeError err_var = (*val->contents.err);
567 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
568 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
569 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
572 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
573 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
576 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
577 CHECK(val->result_ok);
578 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
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 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
584 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
585 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
586 CHECK(!val->result_ok);
587 return *val->contents.err;
589 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
590 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
592 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
593 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
594 CHECK(val->result_ok);
595 LDKCVec_SignatureZ res_var = (*val->contents.result);
596 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
597 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
598 for (size_t m = 0; m < res_var.datalen; m++) {
599 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
600 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
601 res_arr_ptr[m] = res_conv_12_arr;
605 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
606 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
607 CHECK(!val->result_ok);
608 return *val->contents.err;
610 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
611 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
613 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
614 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
615 CHECK(val->result_ok);
616 return *val->contents.result;
618 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
619 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
620 CHECK(!val->result_ok);
621 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
624 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
625 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
627 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
628 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
629 CHECK(val->result_ok);
630 LDKRouteHop res_var = (*val->contents.result);
631 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
632 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
633 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
636 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
637 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
638 CHECK(!val->result_ok);
639 LDKDecodeError err_var = (*val->contents.err);
640 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
641 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
642 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
645 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
646 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
647 ret->datalen = *((uint32_t*)elems);
648 if (ret->datalen == 0) {
651 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
652 uint32_t *java_elems = (uint32_t*)(elems + 4);
653 for (size_t i = 0; i < ret->datalen; i++) {
654 uint32_t arr_elem = java_elems[i];
655 LDKRouteHop arr_elem_conv;
656 arr_elem_conv.inner = (void*)(arr_elem & (~1));
657 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
658 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
659 ret->data[i] = arr_elem_conv;
662 return (uint64_t)ret;
664 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
665 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
666 for (size_t i = 0; i < ret.datalen; i++) {
667 ret.data[i] = RouteHop_clone(&orig->data[i]);
671 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
672 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
673 for (size_t i = 0; i < ret.datalen; i++) {
674 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
678 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
679 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
682 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
683 CHECK(val->result_ok);
684 LDKRoute res_var = (*val->contents.result);
685 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
686 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
687 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
691 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
692 CHECK(!val->result_ok);
693 LDKDecodeError err_var = (*val->contents.err);
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 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
699 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
700 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
702 case LDKCOption_u64Z_Some: {
703 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
705 case LDKCOption_u64Z_None: {
706 return 0 /* LDKCOption_u64Z - None */;
711 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
712 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
713 ret->datalen = *((uint32_t*)elems);
714 if (ret->datalen == 0) {
717 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
718 uint32_t *java_elems = (uint32_t*)(elems + 4);
719 for (size_t i = 0; i < ret->datalen; i++) {
720 uint32_t arr_elem = java_elems[i];
721 LDKChannelDetails arr_elem_conv;
722 arr_elem_conv.inner = (void*)(arr_elem & (~1));
723 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
724 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
725 ret->data[i] = arr_elem_conv;
728 return (uint64_t)ret;
730 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
731 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
732 for (size_t i = 0; i < ret.datalen; i++) {
733 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
737 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
738 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
739 ret->datalen = *((uint32_t*)elems);
740 if (ret->datalen == 0) {
743 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
744 uint32_t *java_elems = (uint32_t*)(elems + 4);
745 for (size_t i = 0; i < ret->datalen; i++) {
746 uint32_t arr_elem = java_elems[i];
747 LDKRouteHint arr_elem_conv;
748 arr_elem_conv.inner = (void*)(arr_elem & (~1));
749 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
750 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
751 ret->data[i] = arr_elem_conv;
754 return (uint64_t)ret;
756 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
757 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
758 for (size_t i = 0; i < ret.datalen; i++) {
759 ret.data[i] = RouteHint_clone(&orig->data[i]);
763 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
764 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
766 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
767 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
768 CHECK(val->result_ok);
769 LDKRoute res_var = (*val->contents.result);
770 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
771 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
772 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
776 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
777 CHECK(!val->result_ok);
778 LDKLightningError err_var = (*val->contents.err);
779 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
780 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
781 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
784 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
785 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
787 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
788 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
789 CHECK(val->result_ok);
790 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
791 return (uint64_t)res_ref;
793 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
794 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
795 CHECK(!val->result_ok);
796 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
799 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
800 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
802 LDKTransaction b_ref;
803 b_ref.datalen = *((uint32_t*)b);
804 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
805 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
806 b_ref.data_is_owned = false;
808 return (uint64_t)ret;
810 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
811 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
814 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
815 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
816 LDKTransaction b_var = tuple->b;
817 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
818 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
821 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
822 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
823 ret->datalen = *((uint32_t*)elems);
824 if (ret->datalen == 0) {
827 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
828 uint32_t *java_elems = (uint32_t*)(elems + 4);
829 for (size_t i = 0; i < ret->datalen; i++) {
830 uint32_t arr_elem = java_elems[i];
831 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
832 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
833 ret->data[i] = arr_elem_conv;
836 return (uint64_t)ret;
838 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
839 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
840 for (size_t i = 0; i < ret.datalen; i++) {
841 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
845 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
846 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
847 for (size_t i = 0; i < ret.datalen; i++) {
848 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
852 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
853 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
855 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
856 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
857 CHECK(val->result_ok);
858 return *val->contents.result;
860 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
861 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
862 CHECK(!val->result_ok);
863 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
866 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
867 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
869 case LDKMonitorEvent_HTLCEvent: {
870 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
871 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
872 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
873 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
874 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
876 case LDKMonitorEvent_CommitmentTxBroadcasted: {
877 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
878 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
879 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
880 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
881 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
886 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
887 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
888 ret->datalen = *((uint32_t*)elems);
889 if (ret->datalen == 0) {
892 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
893 uint32_t *java_elems = (uint32_t*)(elems + 4);
894 for (size_t i = 0; i < ret->datalen; i++) {
895 uint32_t arr_elem = java_elems[i];
896 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
897 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
898 ret->data[i] = arr_elem_conv;
901 return (uint64_t)ret;
903 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
904 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
905 for (size_t i = 0; i < ret.datalen; i++) {
906 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
910 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
911 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
913 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
914 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
915 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
917 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
918 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
923 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
924 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
926 case LDKSpendableOutputDescriptor_StaticOutput: {
927 LDKOutPoint outpoint_var = obj->static_output.outpoint;
928 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
931 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
932 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
934 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
935 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
936 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
939 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
941 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
942 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
943 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
946 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
951 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
952 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
953 ret->datalen = *((uint32_t*)elems);
954 if (ret->datalen == 0) {
957 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
958 uint32_t *java_elems = (uint32_t*)(elems + 4);
959 for (size_t i = 0; i < ret->datalen; i++) {
960 uint32_t arr_elem = java_elems[i];
961 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
962 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
963 ret->data[i] = arr_elem_conv;
966 return (uint64_t)ret;
968 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
969 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
970 for (size_t i = 0; i < ret.datalen; i++) {
971 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
975 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
976 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
978 case LDKErrorAction_DisconnectPeer: {
979 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
980 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
983 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
985 case LDKErrorAction_IgnoreError: {
986 return 0 /* LDKErrorAction - IgnoreError */;
988 case LDKErrorAction_IgnoreAndLog: {
989 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
990 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
992 case LDKErrorAction_SendErrorMessage: {
993 LDKErrorMessage msg_var = obj->send_error_message.msg;
994 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
997 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1002 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
1003 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1005 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1006 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1007 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1008 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1009 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1010 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
1012 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1013 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1015 case LDKHTLCFailChannelUpdate_NodeFailure: {
1016 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1017 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1018 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1023 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1024 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1026 case LDKMessageSendEvent_SendAcceptChannel: {
1027 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1028 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1029 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1030 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1031 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1032 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1033 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1035 case LDKMessageSendEvent_SendOpenChannel: {
1036 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1037 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1038 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1039 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1040 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1041 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1042 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1044 case LDKMessageSendEvent_SendFundingCreated: {
1045 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1046 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1047 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1048 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1049 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1050 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1051 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1053 case LDKMessageSendEvent_SendFundingSigned: {
1054 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1055 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1056 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1057 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1058 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1059 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1060 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1062 case LDKMessageSendEvent_SendFundingLocked: {
1063 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1064 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1065 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1066 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1069 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1071 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1072 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1073 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1074 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1075 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1076 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1077 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1078 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1080 case LDKMessageSendEvent_UpdateHTLCs: {
1081 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1082 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1083 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1084 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1085 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1086 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1087 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1089 case LDKMessageSendEvent_SendRevokeAndACK: {
1090 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1091 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1092 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1093 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1094 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1095 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1096 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1098 case LDKMessageSendEvent_SendClosingSigned: {
1099 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1100 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1101 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1102 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1103 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1104 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1105 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1107 case LDKMessageSendEvent_SendShutdown: {
1108 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1109 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1110 LDKShutdown msg_var = obj->send_shutdown.msg;
1111 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1112 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1113 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1114 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1116 case LDKMessageSendEvent_SendChannelReestablish: {
1117 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1118 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1119 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1120 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1121 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1122 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1123 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1125 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1126 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1127 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1128 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1129 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1130 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1131 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1132 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1133 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1134 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1136 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1137 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1138 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1139 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1140 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1141 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1143 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1144 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1145 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1146 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1148 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1150 case LDKMessageSendEvent_SendChannelUpdate: {
1151 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1152 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1153 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1154 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1155 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1156 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1157 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1159 case LDKMessageSendEvent_HandleError: {
1160 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1161 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1162 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1163 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1165 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1166 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1167 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
1169 case LDKMessageSendEvent_SendChannelRangeQuery: {
1170 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1171 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1172 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1173 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1174 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1175 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1176 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1178 case LDKMessageSendEvent_SendShortIdsQuery: {
1179 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1180 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1181 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1184 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1185 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1187 case LDKMessageSendEvent_SendReplyChannelRange: {
1188 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1189 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1190 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1191 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1192 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1193 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1194 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1199 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1200 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1201 ret->datalen = *((uint32_t*)elems);
1202 if (ret->datalen == 0) {
1205 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1206 uint32_t *java_elems = (uint32_t*)(elems + 4);
1207 for (size_t i = 0; i < ret->datalen; i++) {
1208 uint32_t arr_elem = java_elems[i];
1209 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1210 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1211 ret->data[i] = arr_elem_conv;
1214 return (uint64_t)ret;
1216 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1217 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1218 for (size_t i = 0; i < ret.datalen; i++) {
1219 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1223 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1224 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1226 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1227 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1228 CHECK(val->result_ok);
1229 LDKInitFeatures res_var = (*val->contents.result);
1230 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1231 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1232 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1235 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1236 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1237 CHECK(!val->result_ok);
1238 LDKDecodeError err_var = (*val->contents.err);
1239 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1240 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1241 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1244 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1245 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1247 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1248 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1249 CHECK(val->result_ok);
1250 LDKNodeFeatures res_var = (*val->contents.result);
1251 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1252 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1253 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1256 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1257 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1258 CHECK(!val->result_ok);
1259 LDKDecodeError err_var = (*val->contents.err);
1260 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1261 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1262 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1265 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1266 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1268 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1269 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1270 CHECK(val->result_ok);
1271 LDKChannelFeatures res_var = (*val->contents.result);
1272 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1273 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1274 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1277 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1278 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1279 CHECK(!val->result_ok);
1280 LDKDecodeError err_var = (*val->contents.err);
1281 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1282 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1283 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1286 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1287 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1289 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1290 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1291 CHECK(val->result_ok);
1292 LDKInvoiceFeatures res_var = (*val->contents.result);
1293 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1294 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1295 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1298 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1299 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1300 CHECK(!val->result_ok);
1301 LDKDecodeError err_var = (*val->contents.err);
1302 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1303 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1304 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1307 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1308 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1311 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1312 CHECK(val->result_ok);
1313 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1314 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1315 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1316 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1319 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1320 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1321 CHECK(!val->result_ok);
1322 LDKDecodeError err_var = (*val->contents.err);
1323 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1328 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1329 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1331 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1332 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1333 CHECK(val->result_ok);
1334 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1335 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1336 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1337 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1340 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1341 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1342 CHECK(!val->result_ok);
1343 LDKDecodeError err_var = (*val->contents.err);
1344 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1350 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1353 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1354 CHECK(val->result_ok);
1355 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1358 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1359 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1360 CHECK(!val->result_ok);
1361 LDKDecodeError err_var = (*val->contents.err);
1362 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1363 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1364 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1367 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1368 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1370 CHECK(*((uint32_t*)a) == 64);
1371 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1373 LDKCVec_SignatureZ b_constr;
1374 b_constr.datalen = *((uint32_t*)b);
1375 if (b_constr.datalen > 0)
1376 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1378 b_constr.data = NULL;
1379 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1380 for (size_t m = 0; m < b_constr.datalen; m++) {
1381 int8_tArray b_conv_12 = b_vals[m];
1382 LDKSignature b_conv_12_ref;
1383 CHECK(*((uint32_t*)b_conv_12) == 64);
1384 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1385 b_constr.data[m] = b_conv_12_ref;
1388 return (uint64_t)ret;
1390 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1391 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1392 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1393 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1396 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1397 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1398 LDKCVec_SignatureZ b_var = tuple->b;
1399 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1400 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1401 for (size_t m = 0; m < b_var.datalen; m++) {
1402 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1403 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1404 b_arr_ptr[m] = b_conv_12_arr;
1408 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1409 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1412 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1413 CHECK(val->result_ok);
1414 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
1417 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1418 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1419 CHECK(!val->result_ok);
1420 return *val->contents.err;
1422 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1423 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1425 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1426 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1427 CHECK(val->result_ok);
1428 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1429 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1432 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1433 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1434 CHECK(!val->result_ok);
1435 return *val->contents.err;
1437 typedef struct LDKBaseSign_JCalls {
1438 atomic_size_t refcnt;
1439 uint32_t get_per_commitment_point_meth;
1440 uint32_t release_commitment_secret_meth;
1441 uint32_t channel_keys_id_meth;
1442 uint32_t sign_counterparty_commitment_meth;
1443 uint32_t sign_holder_commitment_and_htlcs_meth;
1444 uint32_t sign_justice_revoked_output_meth;
1445 uint32_t sign_justice_revoked_htlc_meth;
1446 uint32_t sign_counterparty_htlc_transaction_meth;
1447 uint32_t sign_closing_transaction_meth;
1448 uint32_t sign_channel_announcement_meth;
1449 uint32_t ready_channel_meth;
1450 } LDKBaseSign_JCalls;
1451 static void LDKBaseSign_JCalls_free(void* this_arg) {
1452 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1453 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1454 js_free(j_calls->get_per_commitment_point_meth);
1455 js_free(j_calls->release_commitment_secret_meth);
1456 js_free(j_calls->channel_keys_id_meth);
1457 js_free(j_calls->sign_counterparty_commitment_meth);
1458 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1459 js_free(j_calls->sign_justice_revoked_output_meth);
1460 js_free(j_calls->sign_justice_revoked_htlc_meth);
1461 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1462 js_free(j_calls->sign_closing_transaction_meth);
1463 js_free(j_calls->sign_channel_announcement_meth);
1464 js_free(j_calls->ready_channel_meth);
1468 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1469 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1470 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1471 LDKPublicKey ret_ref;
1472 CHECK(*((uint32_t*)ret) == 33);
1473 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1476 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1477 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1478 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1479 LDKThirtyTwoBytes ret_ref;
1480 CHECK(*((uint32_t*)ret) == 32);
1481 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1484 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1485 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1486 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1487 LDKThirtyTwoBytes ret_ref;
1488 CHECK(*((uint32_t*)ret) == 32);
1489 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1492 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1493 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1494 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1495 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1496 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1497 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1498 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1499 if (commitment_tx_var.is_owned) {
1500 commitment_tx_ref |= 1;
1502 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1503 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1504 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1507 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1508 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1509 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1510 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1511 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1512 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1513 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1514 if (commitment_tx_var.is_owned) {
1515 commitment_tx_ref |= 1;
1517 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1518 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1519 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1522 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]) {
1523 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1524 LDKTransaction justice_tx_var = justice_tx;
1525 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1526 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1527 Transaction_free(justice_tx_var);
1528 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1529 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1530 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1531 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1532 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1535 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) {
1536 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1537 LDKTransaction justice_tx_var = justice_tx;
1538 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1539 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1540 Transaction_free(justice_tx_var);
1541 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1542 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1543 LDKHTLCOutputInCommitment htlc_var = *htlc;
1544 htlc_var = HTLCOutputInCommitment_clone(htlc);
1545 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1546 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1547 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1548 if (htlc_var.is_owned) {
1551 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1552 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1553 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1556 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) {
1557 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1558 LDKTransaction htlc_tx_var = htlc_tx;
1559 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1560 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1561 Transaction_free(htlc_tx_var);
1562 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1563 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1564 LDKHTLCOutputInCommitment htlc_var = *htlc;
1565 htlc_var = HTLCOutputInCommitment_clone(htlc);
1566 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1567 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1568 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1569 if (htlc_var.is_owned) {
1572 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1573 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1574 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1577 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1578 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1579 LDKTransaction closing_tx_var = closing_tx;
1580 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1581 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1582 Transaction_free(closing_tx_var);
1583 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1584 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1585 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1588 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1589 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1590 LDKUnsignedChannelAnnouncement msg_var = *msg;
1591 msg_var = UnsignedChannelAnnouncement_clone(msg);
1592 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1593 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1594 uint64_t msg_ref = (uint64_t)msg_var.inner;
1595 if (msg_var.is_owned) {
1598 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1599 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1600 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1603 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1604 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1605 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1606 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1607 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1608 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1609 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1610 if (channel_parameters_var.is_owned) {
1611 channel_parameters_ref |= 1;
1613 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1615 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1616 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1617 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1619 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1620 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1621 atomic_init(&calls->refcnt, 1);
1622 //TODO: Assign calls->o from o
1624 LDKChannelPublicKeys pubkeys_conv;
1625 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1626 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1627 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1630 .this_arg = (void*) calls,
1631 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1632 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1633 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1634 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1635 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1636 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1637 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1638 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1639 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1640 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1641 .ready_channel = ready_channel_LDKBaseSign_jcall,
1642 .free = LDKBaseSign_JCalls_free,
1643 .pubkeys = pubkeys_conv,
1644 .set_pubkeys = NULL,
1648 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1649 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1650 *res_ptr = LDKBaseSign_init(o, pubkeys);
1651 return (long)res_ptr;
1653 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1654 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1655 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1656 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1660 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1661 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1662 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1663 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1667 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1668 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1669 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1670 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1674 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1675 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1676 LDKCommitmentTransaction commitment_tx_conv;
1677 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1678 commitment_tx_conv.is_owned = false;
1679 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1680 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1681 return (uint64_t)ret_conv;
1684 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1685 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1686 LDKHolderCommitmentTransaction commitment_tx_conv;
1687 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1688 commitment_tx_conv.is_owned = false;
1689 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1690 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1691 return (uint64_t)ret_conv;
1694 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) {
1695 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1696 LDKTransaction justice_tx_ref;
1697 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1698 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1699 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1700 justice_tx_ref.data_is_owned = true;
1701 unsigned char per_commitment_key_arr[32];
1702 CHECK(*((uint32_t*)per_commitment_key) == 32);
1703 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1704 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1705 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1706 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1707 return (uint64_t)ret_conv;
1710 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) {
1711 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1712 LDKTransaction justice_tx_ref;
1713 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1714 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1715 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1716 justice_tx_ref.data_is_owned = true;
1717 unsigned char per_commitment_key_arr[32];
1718 CHECK(*((uint32_t*)per_commitment_key) == 32);
1719 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1720 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1721 LDKHTLCOutputInCommitment htlc_conv;
1722 htlc_conv.inner = (void*)(htlc & (~1));
1723 htlc_conv.is_owned = false;
1724 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1725 *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);
1726 return (uint64_t)ret_conv;
1729 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) {
1730 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1731 LDKTransaction htlc_tx_ref;
1732 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1733 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1734 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1735 htlc_tx_ref.data_is_owned = true;
1736 LDKPublicKey per_commitment_point_ref;
1737 CHECK(*((uint32_t*)per_commitment_point) == 33);
1738 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1739 LDKHTLCOutputInCommitment htlc_conv;
1740 htlc_conv.inner = (void*)(htlc & (~1));
1741 htlc_conv.is_owned = false;
1742 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1743 *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);
1744 return (uint64_t)ret_conv;
1747 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1748 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1749 LDKTransaction closing_tx_ref;
1750 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1751 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1752 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1753 closing_tx_ref.data_is_owned = true;
1754 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1755 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1756 return (uint64_t)ret_conv;
1759 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1760 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1761 LDKUnsignedChannelAnnouncement msg_conv;
1762 msg_conv.inner = (void*)(msg & (~1));
1763 msg_conv.is_owned = false;
1764 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1765 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1766 return (uint64_t)ret_conv;
1769 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1770 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1771 LDKChannelTransactionParameters channel_parameters_conv;
1772 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1773 channel_parameters_conv.is_owned = false;
1774 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1777 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1778 if (this_arg->set_pubkeys != NULL)
1779 this_arg->set_pubkeys(this_arg);
1780 return this_arg->pubkeys;
1782 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1783 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1784 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1787 uint64_t ret_ref = (uint64_t)ret_var.inner;
1788 if (ret_var.is_owned) {
1794 typedef struct LDKSign_JCalls {
1795 atomic_size_t refcnt;
1796 LDKBaseSign_JCalls* BaseSign;
1797 uint32_t write_meth;
1799 static void LDKSign_JCalls_free(void* this_arg) {
1800 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1801 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1802 js_free(j_calls->write_meth);
1806 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1807 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1808 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1809 LDKCVec_u8Z ret_ref;
1810 ret_ref.datalen = *((uint32_t*)ret);
1811 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1812 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1815 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1816 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1817 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1818 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1820 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1821 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1822 atomic_init(&calls->refcnt, 1);
1823 //TODO: Assign calls->o from o
1825 LDKChannelPublicKeys pubkeys_conv;
1826 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1827 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1828 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1831 .this_arg = (void*) calls,
1832 .write = write_LDKSign_jcall,
1833 .cloned = LDKSign_JCalls_cloned,
1834 .free = LDKSign_JCalls_free,
1835 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1837 calls->BaseSign = ret.BaseSign.this_arg;
1840 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1841 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1842 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1843 return (long)res_ptr;
1845 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1846 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1847 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1848 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1849 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1850 CVec_u8Z_free(ret_var);
1854 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
1855 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
1857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
1858 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1859 CHECK(val->result_ok);
1860 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
1861 *ret = Sign_clone(&(*val->contents.result));
1862 return (uint64_t)ret;
1864 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
1865 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1866 CHECK(!val->result_ok);
1867 LDKDecodeError err_var = (*val->contents.err);
1868 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1869 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1870 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1873 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
1874 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
1876 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
1877 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1878 CHECK(val->result_ok);
1879 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
1880 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
1883 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
1884 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1885 CHECK(!val->result_ok);
1886 return *val->contents.err;
1888 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
1889 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
1890 for (size_t i = 0; i < ret.datalen; i++) {
1891 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
1895 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
1896 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
1898 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
1899 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1900 CHECK(val->result_ok);
1901 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
1902 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1903 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
1904 for (size_t m = 0; m < res_var.datalen; m++) {
1905 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
1906 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1907 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
1908 res_arr_ptr[m] = res_conv_12_arr;
1912 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
1913 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1914 CHECK(!val->result_ok);
1915 return *val->contents.err;
1917 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
1918 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
1920 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
1921 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1922 CHECK(val->result_ok);
1923 LDKInMemorySigner res_var = (*val->contents.result);
1924 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1925 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1926 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1929 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
1930 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1931 CHECK(!val->result_ok);
1932 LDKDecodeError err_var = (*val->contents.err);
1933 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1934 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1935 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1938 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
1939 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
1940 ret->datalen = *((uint32_t*)elems);
1941 if (ret->datalen == 0) {
1944 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
1945 uint32_t *java_elems = (uint32_t*)(elems + 4);
1946 for (size_t i = 0; i < ret->datalen; i++) {
1947 uint32_t arr_elem = java_elems[i];
1948 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
1949 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
1950 ret->data[i] = arr_elem_conv;
1953 return (uint64_t)ret;
1955 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1956 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1957 for (size_t i = 0; i < ret.datalen; i++) {
1958 ret.data[i] = TxOut_clone(&orig->data[i]);
1962 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
1963 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
1965 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
1966 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
1967 CHECK(val->result_ok);
1968 LDKTransaction res_var = (*val->contents.result);
1969 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1970 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
1973 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
1974 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
1975 CHECK(!val->result_ok);
1976 return *val->contents.err;
1978 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
1979 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1980 LDKThirtyTwoBytes a_ref;
1981 CHECK(*((uint32_t*)a) == 32);
1982 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1984 LDKChannelMonitor b_conv;
1985 b_conv.inner = (void*)(b & (~1));
1986 b_conv.is_owned = (b & 1) || (b == 0);
1987 b_conv = ChannelMonitor_clone(&b_conv);
1989 return (uint64_t)ret;
1991 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
1992 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1993 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1994 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1997 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
1998 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1999 LDKChannelMonitor b_var = tuple->b;
2000 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2001 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2002 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2005 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2006 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2007 ret->datalen = *((uint32_t*)elems);
2008 if (ret->datalen == 0) {
2011 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2012 uint32_t *java_elems = (uint32_t*)(elems + 4);
2013 for (size_t i = 0; i < ret->datalen; i++) {
2014 uint32_t arr_elem = java_elems[i];
2015 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2016 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2017 ret->data[i] = arr_elem_conv;
2020 return (uint64_t)ret;
2022 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2023 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2025 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2026 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2027 CHECK(val->result_ok);
2028 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2029 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2030 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2031 for (size_t m = 0; m < res_var.datalen; m++) {
2032 uint64_t res_conv_38_ref = (uint64_t)(&res_var.data[m]) | 1;
2033 res_arr_ptr[m] = res_conv_38_ref;
2037 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2038 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2039 CHECK(!val->result_ok);
2040 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2043 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2044 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2046 case LDKCOption_u16Z_Some: {
2047 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2049 case LDKCOption_u16Z_None: {
2050 return 0 /* LDKCOption_u16Z - None */;
2055 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2056 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2058 case LDKAPIError_APIMisuseError: {
2059 LDKStr err_str = obj->api_misuse_error.err;
2060 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2061 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2063 case LDKAPIError_FeeRateTooHigh: {
2064 LDKStr err_str = obj->fee_rate_too_high.err;
2065 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2066 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2068 case LDKAPIError_RouteError: {
2069 LDKStr err_str = obj->route_error.err;
2070 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2071 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2073 case LDKAPIError_ChannelUnavailable: {
2074 LDKStr err_str = obj->channel_unavailable.err;
2075 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2076 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2078 case LDKAPIError_MonitorUpdateFailed: {
2079 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2084 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2085 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2087 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2088 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2089 CHECK(val->result_ok);
2090 return *val->contents.result;
2092 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2093 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2094 CHECK(!val->result_ok);
2095 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2098 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2099 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2100 ret->datalen = *((uint32_t*)elems);
2101 if (ret->datalen == 0) {
2104 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2105 uint32_t *java_elems = (uint32_t*)(elems + 4);
2106 for (size_t i = 0; i < ret->datalen; i++) {
2107 uint32_t arr_elem = java_elems[i];
2108 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2109 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2110 ret->data[i] = arr_elem_conv;
2113 return (uint64_t)ret;
2115 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2116 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2117 for (size_t i = 0; i < ret.datalen; i++) {
2118 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2122 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2123 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2124 ret->datalen = *((uint32_t*)elems);
2125 if (ret->datalen == 0) {
2128 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2129 uint32_t *java_elems = (uint32_t*)(elems + 4);
2130 for (size_t i = 0; i < ret->datalen; i++) {
2131 uint32_t arr_elem = java_elems[i];
2132 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2133 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2134 ret->data[i] = arr_elem_conv;
2137 return (uint64_t)ret;
2139 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2140 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2141 for (size_t i = 0; i < ret.datalen; i++) {
2142 ret.data[i] = APIError_clone(&orig->data[i]);
2146 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2147 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2149 case LDKPaymentSendFailure_ParameterError: {
2150 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2151 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2153 case LDKPaymentSendFailure_PathParameterError: {
2154 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2155 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2156 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2157 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2158 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2159 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2160 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2161 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2163 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2165 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2166 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2167 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2168 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2169 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2170 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2171 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2173 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2175 case LDKPaymentSendFailure_PartialFailure: {
2176 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2177 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2178 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2179 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2180 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2181 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2182 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2183 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2185 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2190 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2191 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2193 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2194 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2195 CHECK(val->result_ok);
2196 return *val->contents.result;
2198 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2199 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2200 CHECK(!val->result_ok);
2201 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2204 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2205 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2207 case LDKNetAddress_IPv4: {
2208 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2209 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2210 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2212 case LDKNetAddress_IPv6: {
2213 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2214 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2215 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2217 case LDKNetAddress_OnionV2: {
2218 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2219 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2220 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2222 case LDKNetAddress_OnionV3: {
2223 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2224 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2225 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2230 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2231 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2232 ret->datalen = *((uint32_t*)elems);
2233 if (ret->datalen == 0) {
2236 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2237 uint32_t *java_elems = (uint32_t*)(elems + 4);
2238 for (size_t i = 0; i < ret->datalen; i++) {
2239 uint32_t arr_elem = java_elems[i];
2240 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2241 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2242 ret->data[i] = arr_elem_conv;
2245 return (uint64_t)ret;
2247 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2248 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2249 for (size_t i = 0; i < ret.datalen; i++) {
2250 ret.data[i] = NetAddress_clone(&orig->data[i]);
2254 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2255 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2256 LDKThirtyTwoBytes a_ref;
2257 CHECK(*((uint32_t*)a) == 32);
2258 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2260 LDKThirtyTwoBytes b_ref;
2261 CHECK(*((uint32_t*)b) == 32);
2262 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2264 return (uint64_t)ret;
2266 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t ptr) {
2267 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2268 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2269 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2272 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t ptr) {
2273 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2274 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2275 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2278 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2279 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2281 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2282 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2283 CHECK(val->result_ok);
2284 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2285 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2288 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2289 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2290 CHECK(!val->result_ok);
2291 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2294 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2295 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2296 ret->datalen = *((uint32_t*)elems);
2297 if (ret->datalen == 0) {
2300 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2301 uint32_t *java_elems = (uint32_t*)(elems + 4);
2302 for (size_t i = 0; i < ret->datalen; i++) {
2303 uint32_t arr_elem = java_elems[i];
2304 LDKChannelMonitor arr_elem_conv;
2305 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2306 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2307 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2308 ret->data[i] = arr_elem_conv;
2311 return (uint64_t)ret;
2313 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2314 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2315 for (size_t i = 0; i < ret.datalen; i++) {
2316 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2320 typedef struct LDKWatch_JCalls {
2321 atomic_size_t refcnt;
2322 uint32_t watch_channel_meth;
2323 uint32_t update_channel_meth;
2324 uint32_t release_pending_monitor_events_meth;
2326 static void LDKWatch_JCalls_free(void* this_arg) {
2327 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2328 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2329 js_free(j_calls->watch_channel_meth);
2330 js_free(j_calls->update_channel_meth);
2331 js_free(j_calls->release_pending_monitor_events_meth);
2335 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2336 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2337 LDKOutPoint funding_txo_var = funding_txo;
2338 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2339 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2340 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2341 if (funding_txo_var.is_owned) {
2342 funding_txo_ref |= 1;
2344 LDKChannelMonitor monitor_var = monitor;
2345 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2346 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2347 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2348 if (monitor_var.is_owned) {
2351 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2352 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2353 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2356 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2357 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2358 LDKOutPoint funding_txo_var = funding_txo;
2359 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2360 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2361 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2362 if (funding_txo_var.is_owned) {
2363 funding_txo_ref |= 1;
2365 LDKChannelMonitorUpdate update_var = update;
2366 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2367 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2368 uint64_t update_ref = (uint64_t)update_var.inner;
2369 if (update_var.is_owned) {
2372 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2373 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2374 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2377 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2378 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2379 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2380 LDKCVec_MonitorEventZ ret_constr;
2381 ret_constr.datalen = *((uint32_t*)ret);
2382 if (ret_constr.datalen > 0)
2383 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2385 ret_constr.data = NULL;
2386 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2387 for (size_t o = 0; o < ret_constr.datalen; o++) {
2388 uint32_t ret_conv_14 = ret_vals[o];
2389 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2390 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2391 ret_constr.data[o] = ret_conv_14_conv;
2395 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2396 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2397 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2399 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2400 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2401 atomic_init(&calls->refcnt, 1);
2402 //TODO: Assign calls->o from o
2405 .this_arg = (void*) calls,
2406 .watch_channel = watch_channel_LDKWatch_jcall,
2407 .update_channel = update_channel_LDKWatch_jcall,
2408 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2409 .free = LDKWatch_JCalls_free,
2413 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2414 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2415 *res_ptr = LDKWatch_init(o);
2416 return (long)res_ptr;
2418 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2419 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2420 LDKOutPoint funding_txo_conv;
2421 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2422 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2423 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2424 LDKChannelMonitor monitor_conv;
2425 monitor_conv.inner = (void*)(monitor & (~1));
2426 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2427 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2428 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2429 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2430 return (uint64_t)ret_conv;
2433 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2434 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2435 LDKOutPoint funding_txo_conv;
2436 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2437 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2438 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2439 LDKChannelMonitorUpdate update_conv;
2440 update_conv.inner = (void*)(update & (~1));
2441 update_conv.is_owned = (update & 1) || (update == 0);
2442 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2443 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2444 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2445 return (uint64_t)ret_conv;
2448 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2449 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2450 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2451 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2452 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2453 for (size_t o = 0; o < ret_var.datalen; o++) {
2454 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2455 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2456 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2457 ret_arr_ptr[o] = ret_conv_14_ref;
2463 typedef struct LDKBroadcasterInterface_JCalls {
2464 atomic_size_t refcnt;
2465 uint32_t broadcast_transaction_meth;
2466 } LDKBroadcasterInterface_JCalls;
2467 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2468 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2469 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2470 js_free(j_calls->broadcast_transaction_meth);
2474 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2475 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2476 LDKTransaction tx_var = tx;
2477 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2478 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2479 Transaction_free(tx_var);
2480 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2482 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2483 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2484 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2486 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2487 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2488 atomic_init(&calls->refcnt, 1);
2489 //TODO: Assign calls->o from o
2491 LDKBroadcasterInterface ret = {
2492 .this_arg = (void*) calls,
2493 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2494 .free = LDKBroadcasterInterface_JCalls_free,
2498 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2499 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2500 *res_ptr = LDKBroadcasterInterface_init(o);
2501 return (long)res_ptr;
2503 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2504 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2505 LDKTransaction tx_ref;
2506 tx_ref.datalen = *((uint32_t*)tx);
2507 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2508 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2509 tx_ref.data_is_owned = true;
2510 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2513 typedef struct LDKKeysInterface_JCalls {
2514 atomic_size_t refcnt;
2515 uint32_t get_node_secret_meth;
2516 uint32_t get_destination_script_meth;
2517 uint32_t get_shutdown_pubkey_meth;
2518 uint32_t get_channel_signer_meth;
2519 uint32_t get_secure_random_bytes_meth;
2520 uint32_t read_chan_signer_meth;
2521 uint32_t sign_invoice_meth;
2522 } LDKKeysInterface_JCalls;
2523 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2524 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2525 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2526 js_free(j_calls->get_node_secret_meth);
2527 js_free(j_calls->get_destination_script_meth);
2528 js_free(j_calls->get_shutdown_pubkey_meth);
2529 js_free(j_calls->get_channel_signer_meth);
2530 js_free(j_calls->get_secure_random_bytes_meth);
2531 js_free(j_calls->read_chan_signer_meth);
2532 js_free(j_calls->sign_invoice_meth);
2536 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2537 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2538 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2539 LDKSecretKey ret_ref;
2540 CHECK(*((uint32_t*)ret) == 32);
2541 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2544 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2545 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2546 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2547 LDKCVec_u8Z ret_ref;
2548 ret_ref.datalen = *((uint32_t*)ret);
2549 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2550 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2553 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
2554 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2555 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2556 LDKPublicKey ret_ref;
2557 CHECK(*((uint32_t*)ret) == 33);
2558 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2561 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2562 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2563 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2564 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2565 ret_conv = Sign_clone(ret);
2568 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2569 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2570 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2571 LDKThirtyTwoBytes ret_ref;
2572 CHECK(*((uint32_t*)ret) == 32);
2573 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2576 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2577 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2578 LDKu8slice reader_var = reader;
2579 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2580 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2581 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2582 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2583 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2586 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2587 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2588 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2589 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2590 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2591 CVec_u8Z_free(invoice_preimage_var);
2592 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2593 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2594 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2597 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2598 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2599 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2601 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2602 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2603 atomic_init(&calls->refcnt, 1);
2604 //TODO: Assign calls->o from o
2606 LDKKeysInterface ret = {
2607 .this_arg = (void*) calls,
2608 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2609 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2610 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
2611 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2612 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2613 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2614 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2615 .free = LDKKeysInterface_JCalls_free,
2619 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2620 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2621 *res_ptr = LDKKeysInterface_init(o);
2622 return (long)res_ptr;
2624 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2625 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2626 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2627 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2631 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2632 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2633 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2634 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2635 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2636 CVec_u8Z_free(ret_var);
2640 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2641 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2642 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2643 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2647 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2648 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2649 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2650 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2651 return (uint64_t)ret;
2654 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2655 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2656 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2657 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2661 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2662 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2663 LDKu8slice reader_ref;
2664 reader_ref.datalen = *((uint32_t*)reader);
2665 reader_ref.data = (int8_t*)(reader + 4);
2666 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2667 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2668 return (uint64_t)ret_conv;
2671 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2672 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2673 LDKCVec_u8Z invoice_preimage_ref;
2674 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2675 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2676 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2677 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2678 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2679 return (uint64_t)ret_conv;
2682 typedef struct LDKFeeEstimator_JCalls {
2683 atomic_size_t refcnt;
2684 uint32_t get_est_sat_per_1000_weight_meth;
2685 } LDKFeeEstimator_JCalls;
2686 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2687 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2688 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2689 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2693 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2694 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2695 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2696 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2698 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2699 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2700 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2702 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2703 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2704 atomic_init(&calls->refcnt, 1);
2705 //TODO: Assign calls->o from o
2707 LDKFeeEstimator ret = {
2708 .this_arg = (void*) calls,
2709 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2710 .free = LDKFeeEstimator_JCalls_free,
2714 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2715 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2716 *res_ptr = LDKFeeEstimator_init(o);
2717 return (long)res_ptr;
2719 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2720 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2721 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2722 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2726 typedef struct LDKLogger_JCalls {
2727 atomic_size_t refcnt;
2730 static void LDKLogger_JCalls_free(void* this_arg) {
2731 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2732 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2733 js_free(j_calls->log_meth);
2737 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2738 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2739 const char* record_str = record;
2740 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2741 js_invoke_function_1(j_calls->log_meth, record_conv);
2743 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2744 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2745 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2747 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2748 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2749 atomic_init(&calls->refcnt, 1);
2750 //TODO: Assign calls->o from o
2753 .this_arg = (void*) calls,
2754 .log = log_LDKLogger_jcall,
2755 .free = LDKLogger_JCalls_free,
2759 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2760 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2761 *res_ptr = LDKLogger_init(o);
2762 return (long)res_ptr;
2764 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2765 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2766 LDKThirtyTwoBytes a_ref;
2767 CHECK(*((uint32_t*)a) == 32);
2768 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2770 LDKChannelManager b_conv;
2771 b_conv.inner = (void*)(b & (~1));
2772 b_conv.is_owned = (b & 1) || (b == 0);
2773 // Warning: we need a move here but no clone is available for LDKChannelManager
2775 return (uint64_t)ret;
2777 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2778 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2779 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2780 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2783 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2784 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2785 LDKChannelManager b_var = tuple->b;
2786 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2787 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2788 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2791 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2792 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2794 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2795 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2796 CHECK(val->result_ok);
2797 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2800 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2801 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2802 CHECK(!val->result_ok);
2803 LDKDecodeError err_var = (*val->contents.err);
2804 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2805 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2806 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2809 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
2810 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
2812 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
2813 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2814 CHECK(val->result_ok);
2815 LDKChannelConfig res_var = (*val->contents.result);
2816 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2817 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2818 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2821 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
2822 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2823 CHECK(!val->result_ok);
2824 LDKDecodeError err_var = (*val->contents.err);
2825 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2826 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2827 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2830 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
2831 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
2833 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
2834 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2835 CHECK(val->result_ok);
2836 LDKOutPoint res_var = (*val->contents.result);
2837 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2838 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2839 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2842 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
2843 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2844 CHECK(!val->result_ok);
2845 LDKDecodeError err_var = (*val->contents.err);
2846 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2847 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2848 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2851 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
2852 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
2854 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
2855 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2856 CHECK(val->result_ok);
2857 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
2860 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
2861 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2862 CHECK(!val->result_ok);
2863 return *val->contents.err;
2865 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
2866 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
2868 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
2869 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2870 CHECK(val->result_ok);
2871 LDKInvoice res_var = (*val->contents.result);
2872 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2873 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2874 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2877 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
2878 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2879 CHECK(!val->result_ok);
2880 return *val->contents.err;
2882 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
2883 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
2885 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
2886 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2887 CHECK(val->result_ok);
2888 LDKSignedRawInvoice res_var = (*val->contents.result);
2889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2894 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
2895 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2896 CHECK(!val->result_ok);
2897 return *val->contents.err;
2899 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
2900 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
2901 LDKRawInvoice a_conv;
2902 a_conv.inner = (void*)(a & (~1));
2903 a_conv.is_owned = (a & 1) || (a == 0);
2904 a_conv = RawInvoice_clone(&a_conv);
2906 LDKThirtyTwoBytes b_ref;
2907 CHECK(*((uint32_t*)b) == 32);
2908 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2910 LDKInvoiceSignature c_conv;
2911 c_conv.inner = (void*)(c & (~1));
2912 c_conv.is_owned = (c & 1) || (c == 0);
2913 c_conv = InvoiceSignature_clone(&c_conv);
2915 return (uint64_t)ret;
2917 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t ptr) {
2918 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2919 LDKRawInvoice a_var = tuple->a;
2920 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2921 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2922 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
2925 int8_tArray __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t ptr) {
2926 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2927 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2928 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2931 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t ptr) {
2932 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2933 LDKInvoiceSignature c_var = tuple->c;
2934 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2935 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2936 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
2939 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
2940 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
2942 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
2943 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
2944 CHECK(val->result_ok);
2945 LDKPayeePubKey res_var = (*val->contents.result);
2946 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2947 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2948 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2951 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
2952 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
2953 CHECK(!val->result_ok);
2954 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2957 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
2958 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
2959 ret->datalen = *((uint32_t*)elems);
2960 if (ret->datalen == 0) {
2963 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
2964 uint32_t *java_elems = (uint32_t*)(elems + 4);
2965 for (size_t i = 0; i < ret->datalen; i++) {
2966 uint32_t arr_elem = java_elems[i];
2967 LDKPrivateRoute arr_elem_conv;
2968 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2969 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2970 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
2971 ret->data[i] = arr_elem_conv;
2974 return (uint64_t)ret;
2976 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
2977 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
2978 for (size_t i = 0; i < ret.datalen; i++) {
2979 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
2983 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
2984 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
2986 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
2987 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
2988 CHECK(val->result_ok);
2989 LDKPositiveTimestamp res_var = (*val->contents.result);
2990 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2991 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2992 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2995 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
2996 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
2997 CHECK(!val->result_ok);
2998 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3001 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3002 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3004 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3005 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3006 CHECK(val->result_ok);
3007 return *val->contents.result;
3009 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3010 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3011 CHECK(!val->result_ok);
3012 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3015 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3016 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3019 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3020 CHECK(val->result_ok);
3021 LDKInvoice res_var = (*val->contents.result);
3022 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3023 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3024 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3027 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3028 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3029 CHECK(!val->result_ok);
3030 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3033 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3034 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3036 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3037 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3038 CHECK(val->result_ok);
3039 LDKDescription res_var = (*val->contents.result);
3040 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3041 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3042 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3046 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3047 CHECK(!val->result_ok);
3048 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3051 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3052 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3054 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3055 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3056 CHECK(val->result_ok);
3057 LDKExpiryTime res_var = (*val->contents.result);
3058 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3059 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3060 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3063 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3064 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3065 CHECK(!val->result_ok);
3066 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3069 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3070 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3072 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3073 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3074 CHECK(val->result_ok);
3075 LDKPrivateRoute res_var = (*val->contents.result);
3076 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3077 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3078 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3081 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3082 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3083 CHECK(!val->result_ok);
3084 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3087 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3088 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3090 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3091 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3092 CHECK(val->result_ok);
3093 LDKStr res_str = (*val->contents.result);
3094 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3097 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3098 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3099 CHECK(!val->result_ok);
3100 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3103 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3104 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3106 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3107 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3108 CHECK(val->result_ok);
3109 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3115 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3116 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3117 CHECK(!val->result_ok);
3118 LDKDecodeError err_var = (*val->contents.err);
3119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3124 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3125 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3127 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3128 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3129 CHECK(val->result_ok);
3130 LDKHTLCUpdate res_var = (*val->contents.result);
3131 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3132 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3133 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3136 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3137 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3138 CHECK(!val->result_ok);
3139 LDKDecodeError err_var = (*val->contents.err);
3140 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3141 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3142 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3145 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3146 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3148 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3149 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3150 CHECK(val->result_ok);
3151 return *val->contents.result;
3153 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3154 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3155 CHECK(!val->result_ok);
3156 LDKMonitorUpdateError err_var = (*val->contents.err);
3157 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3158 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3159 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3162 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3163 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3165 a_conv.inner = (void*)(a & (~1));
3166 a_conv.is_owned = (a & 1) || (a == 0);
3167 a_conv = OutPoint_clone(&a_conv);
3170 b_ref.datalen = *((uint32_t*)b);
3171 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3172 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3174 return (uint64_t)ret;
3176 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
3177 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3178 LDKOutPoint a_var = tuple->a;
3179 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3180 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3181 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3184 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
3185 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3186 LDKCVec_u8Z b_var = tuple->b;
3187 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3188 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3191 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3192 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3195 b_ref.datalen = *((uint32_t*)b);
3196 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3197 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3199 return (uint64_t)ret;
3201 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
3202 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3205 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
3206 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3207 LDKCVec_u8Z b_var = tuple->b;
3208 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3209 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3212 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3213 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3214 ret->datalen = *((uint32_t*)elems);
3215 if (ret->datalen == 0) {
3218 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3219 uint32_t *java_elems = (uint32_t*)(elems + 4);
3220 for (size_t i = 0; i < ret->datalen; i++) {
3221 uint32_t arr_elem = java_elems[i];
3222 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3223 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3224 ret->data[i] = arr_elem_conv;
3227 return (uint64_t)ret;
3229 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3230 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3231 for (size_t i = 0; i < ret.datalen; i++) {
3232 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3236 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3237 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3238 LDKThirtyTwoBytes a_ref;
3239 CHECK(*((uint32_t*)a) == 32);
3240 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3242 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3243 b_constr.datalen = *((uint32_t*)b);
3244 if (b_constr.datalen > 0)
3245 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3247 b_constr.data = NULL;
3248 uint32_t* b_vals = (uint32_t*)(b + 4);
3249 for (size_t e = 0; e < b_constr.datalen; e++) {
3250 uint32_t b_conv_30 = b_vals[e];
3251 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
3252 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
3253 b_constr.data[e] = b_conv_30_conv;
3256 return (uint64_t)ret;
3258 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
3259 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3260 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3261 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3264 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
3265 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3266 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
3267 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3268 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3269 for (size_t e = 0; e < b_var.datalen; e++) {
3270 uint64_t b_conv_30_ref = (uint64_t)(&b_var.data[e]) | 1;
3271 b_arr_ptr[e] = b_conv_30_ref;
3275 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3276 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3277 ret->datalen = *((uint32_t*)elems);
3278 if (ret->datalen == 0) {
3281 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3282 uint32_t *java_elems = (uint32_t*)(elems + 4);
3283 for (size_t i = 0; i < ret->datalen; i++) {
3284 uint32_t arr_elem = java_elems[i];
3285 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3286 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3287 ret->data[i] = arr_elem_conv;
3290 return (uint64_t)ret;
3292 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3293 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 };
3294 for (size_t i = 0; i < ret.datalen; i++) {
3295 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3299 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3300 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3302 case LDKEvent_FundingGenerationReady: {
3303 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3304 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3305 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3306 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3307 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3308 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;
3310 case LDKEvent_PaymentReceived: {
3311 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3312 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3313 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3314 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_received.payment_preimage.data, 32);
3315 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3316 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
3317 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->payment_received.amt; (void) obj->payment_received.user_payment_id;
3319 case LDKEvent_PaymentSent: {
3320 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3321 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3322 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3324 case LDKEvent_PaymentFailed: {
3325 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3326 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
3327 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
3329 case LDKEvent_PendingHTLCsForwardable: {
3330 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3332 case LDKEvent_SpendableOutputs: {
3333 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3334 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3335 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3336 for (size_t b = 0; b < outputs_var.datalen; b++) {
3337 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3338 outputs_arr_ptr[b] = outputs_conv_27_ref;
3340 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3345 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3346 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3347 ret->datalen = *((uint32_t*)elems);
3348 if (ret->datalen == 0) {
3351 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3352 uint32_t *java_elems = (uint32_t*)(elems + 4);
3353 for (size_t i = 0; i < ret->datalen; i++) {
3354 uint32_t arr_elem = java_elems[i];
3355 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3356 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3357 ret->data[i] = arr_elem_conv;
3360 return (uint64_t)ret;
3362 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3363 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3364 for (size_t i = 0; i < ret.datalen; i++) {
3365 ret.data[i] = Event_clone(&orig->data[i]);
3369 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3370 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3372 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3373 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3375 return (uint64_t)ret;
3377 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
3378 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3381 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
3382 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3383 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
3384 return (uint64_t)b_ref;
3386 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3387 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3388 ret->datalen = *((uint32_t*)elems);
3389 if (ret->datalen == 0) {
3392 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3393 uint32_t *java_elems = (uint32_t*)(elems + 4);
3394 for (size_t i = 0; i < ret->datalen; i++) {
3395 uint32_t arr_elem = java_elems[i];
3396 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3397 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3398 ret->data[i] = arr_elem_conv;
3401 return (uint64_t)ret;
3403 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3404 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3405 for (size_t i = 0; i < ret.datalen; i++) {
3406 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3410 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3411 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3412 LDKThirtyTwoBytes a_ref;
3413 CHECK(*((uint32_t*)a) == 32);
3414 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3416 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3417 b_constr.datalen = *((uint32_t*)b);
3418 if (b_constr.datalen > 0)
3419 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3421 b_constr.data = NULL;
3422 uint32_t* b_vals = (uint32_t*)(b + 4);
3423 for (size_t z = 0; z < b_constr.datalen; z++) {
3424 uint32_t b_conv_25 = b_vals[z];
3425 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
3426 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
3427 b_constr.data[z] = b_conv_25_conv;
3430 return (uint64_t)ret;
3432 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
3433 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3434 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3435 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3438 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
3439 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3440 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
3441 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3442 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3443 for (size_t z = 0; z < b_var.datalen; z++) {
3444 uint64_t b_conv_25_ref = (uint64_t)(&b_var.data[z]) | 1;
3445 b_arr_ptr[z] = b_conv_25_ref;
3449 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3450 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3451 ret->datalen = *((uint32_t*)elems);
3452 if (ret->datalen == 0) {
3455 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3456 uint32_t *java_elems = (uint32_t*)(elems + 4);
3457 for (size_t i = 0; i < ret->datalen; i++) {
3458 uint32_t arr_elem = java_elems[i];
3459 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3460 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3461 ret->data[i] = arr_elem_conv;
3464 return (uint64_t)ret;
3466 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3467 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 };
3468 for (size_t i = 0; i < ret.datalen; i++) {
3469 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3473 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3474 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3476 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3477 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3478 CHECK(val->result_ok);
3479 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3482 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
3483 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3484 CHECK(!val->result_ok);
3485 LDKDecodeError err_var = (*val->contents.err);
3486 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3487 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3488 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3491 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
3492 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3494 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
3495 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3496 CHECK(val->result_ok);
3497 return *val->contents.result;
3499 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
3500 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3501 CHECK(!val->result_ok);
3502 LDKLightningError err_var = (*val->contents.err);
3503 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3504 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3505 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3508 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
3509 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3510 LDKChannelAnnouncement a_conv;
3511 a_conv.inner = (void*)(a & (~1));
3512 a_conv.is_owned = (a & 1) || (a == 0);
3513 a_conv = ChannelAnnouncement_clone(&a_conv);
3515 LDKChannelUpdate b_conv;
3516 b_conv.inner = (void*)(b & (~1));
3517 b_conv.is_owned = (b & 1) || (b == 0);
3518 b_conv = ChannelUpdate_clone(&b_conv);
3520 LDKChannelUpdate c_conv;
3521 c_conv.inner = (void*)(c & (~1));
3522 c_conv.is_owned = (c & 1) || (c == 0);
3523 c_conv = ChannelUpdate_clone(&c_conv);
3525 return (uint64_t)ret;
3527 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
3528 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3529 LDKChannelAnnouncement a_var = tuple->a;
3530 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3531 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3532 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3535 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
3536 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3537 LDKChannelUpdate b_var = tuple->b;
3538 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3539 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3540 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3543 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
3544 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3545 LDKChannelUpdate c_var = tuple->c;
3546 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3547 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3548 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3551 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
3552 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3553 ret->datalen = *((uint32_t*)elems);
3554 if (ret->datalen == 0) {
3557 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3558 uint32_t *java_elems = (uint32_t*)(elems + 4);
3559 for (size_t i = 0; i < ret->datalen; i++) {
3560 uint32_t arr_elem = java_elems[i];
3561 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
3562 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
3563 ret->data[i] = arr_elem_conv;
3566 return (uint64_t)ret;
3568 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3569 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3570 for (size_t i = 0; i < ret.datalen; i++) {
3571 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3575 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
3576 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3577 ret->datalen = *((uint32_t*)elems);
3578 if (ret->datalen == 0) {
3581 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3582 uint32_t *java_elems = (uint32_t*)(elems + 4);
3583 for (size_t i = 0; i < ret->datalen; i++) {
3584 uint32_t arr_elem = java_elems[i];
3585 LDKNodeAnnouncement arr_elem_conv;
3586 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3587 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3588 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3589 ret->data[i] = arr_elem_conv;
3592 return (uint64_t)ret;
3594 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3595 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3596 for (size_t i = 0; i < ret.datalen; i++) {
3597 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3601 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
3602 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3604 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
3605 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3606 CHECK(val->result_ok);
3607 return *val->contents.result;
3609 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
3610 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3611 CHECK(!val->result_ok);
3612 LDKLightningError err_var = (*val->contents.err);
3613 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3614 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3615 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3618 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
3619 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3621 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
3622 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3623 CHECK(val->result_ok);
3624 LDKCVec_u8Z res_var = (*val->contents.result);
3625 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3626 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3629 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
3630 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3631 CHECK(!val->result_ok);
3632 LDKPeerHandleError err_var = (*val->contents.err);
3633 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3634 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3635 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3638 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
3639 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3641 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
3642 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3643 CHECK(val->result_ok);
3644 return *val->contents.result;
3646 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
3647 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3648 CHECK(!val->result_ok);
3649 LDKPeerHandleError err_var = (*val->contents.err);
3650 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3651 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3652 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3655 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
3656 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3658 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
3659 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3660 CHECK(val->result_ok);
3661 return *val->contents.result;
3663 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
3664 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3665 CHECK(!val->result_ok);
3666 LDKPeerHandleError err_var = (*val->contents.err);
3667 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3668 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3669 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3672 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3673 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
3675 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3676 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3677 CHECK(val->result_ok);
3678 LDKDirectionalChannelInfo res_var = (*val->contents.result);
3679 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3680 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3681 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3685 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3686 CHECK(!val->result_ok);
3687 LDKDecodeError err_var = (*val->contents.err);
3688 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3689 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3690 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3693 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3694 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
3696 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3697 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3698 CHECK(val->result_ok);
3699 LDKChannelInfo res_var = (*val->contents.result);
3700 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3701 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3702 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3705 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3706 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3707 CHECK(!val->result_ok);
3708 LDKDecodeError err_var = (*val->contents.err);
3709 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3710 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3711 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3714 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
3715 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3717 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
3718 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3719 CHECK(val->result_ok);
3720 LDKRoutingFees res_var = (*val->contents.result);
3721 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3722 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3723 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
3727 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3728 CHECK(!val->result_ok);
3729 LDKDecodeError err_var = (*val->contents.err);
3730 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3731 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3732 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3735 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
3736 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3738 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
3739 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3740 CHECK(val->result_ok);
3741 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3742 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3743 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3744 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3747 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
3748 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3749 CHECK(!val->result_ok);
3750 LDKDecodeError err_var = (*val->contents.err);
3751 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3756 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
3757 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
3758 ret->datalen = *((uint32_t*)elems);
3759 if (ret->datalen == 0) {
3762 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
3763 int64_t *java_elems = (int64_t*)(elems + 4);
3764 for (size_t i = 0; i < ret->datalen; i++) {
3765 ret->data[i] = java_elems[i];
3768 return (uint64_t)ret;
3770 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3771 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3772 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3775 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
3776 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3778 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
3779 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3780 CHECK(val->result_ok);
3781 LDKNodeInfo res_var = (*val->contents.result);
3782 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3783 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3784 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3787 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
3788 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3789 CHECK(!val->result_ok);
3790 LDKDecodeError err_var = (*val->contents.err);
3791 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3792 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3793 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3796 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
3797 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3799 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
3800 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3801 CHECK(val->result_ok);
3802 LDKNetworkGraph res_var = (*val->contents.result);
3803 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3804 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3805 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3808 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
3809 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3810 CHECK(!val->result_ok);
3811 LDKDecodeError err_var = (*val->contents.err);
3812 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3813 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3814 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3817 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
3818 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3820 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
3821 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3822 CHECK(val->result_ok);
3823 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3826 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
3827 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3828 CHECK(!val->result_ok);
3829 return *val->contents.err;
3831 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
3832 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3834 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
3835 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3836 CHECK(val->result_ok);
3837 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3838 *res_conv = (*val->contents.result);
3839 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3840 return (uint64_t)res_conv;
3842 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3843 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3844 CHECK(!val->result_ok);
3845 LDKDecodeError err_var = (*val->contents.err);
3846 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3847 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3848 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3851 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
3852 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
3854 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
3855 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3856 CHECK(val->result_ok);
3857 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3860 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
3861 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3862 CHECK(!val->result_ok);
3863 LDKDecodeError err_var = (*val->contents.err);
3864 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3865 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3866 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3869 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3870 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3871 ret->datalen = *((uint32_t*)elems);
3872 if (ret->datalen == 0) {
3875 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3876 uint32_t *java_elems = (uint32_t*)(elems + 4);
3877 for (size_t i = 0; i < ret->datalen; i++) {
3878 uint32_t arr_elem = java_elems[i];
3879 LDKUpdateAddHTLC arr_elem_conv;
3880 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3881 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3882 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3883 ret->data[i] = arr_elem_conv;
3886 return (uint64_t)ret;
3888 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3889 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3890 for (size_t i = 0; i < ret.datalen; i++) {
3891 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3895 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3896 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3897 ret->datalen = *((uint32_t*)elems);
3898 if (ret->datalen == 0) {
3901 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3902 uint32_t *java_elems = (uint32_t*)(elems + 4);
3903 for (size_t i = 0; i < ret->datalen; i++) {
3904 uint32_t arr_elem = java_elems[i];
3905 LDKUpdateFulfillHTLC arr_elem_conv;
3906 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3907 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3908 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3909 ret->data[i] = arr_elem_conv;
3912 return (uint64_t)ret;
3914 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3915 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3916 for (size_t i = 0; i < ret.datalen; i++) {
3917 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3921 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
3922 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3923 ret->datalen = *((uint32_t*)elems);
3924 if (ret->datalen == 0) {
3927 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3928 uint32_t *java_elems = (uint32_t*)(elems + 4);
3929 for (size_t i = 0; i < ret->datalen; i++) {
3930 uint32_t arr_elem = java_elems[i];
3931 LDKUpdateFailHTLC arr_elem_conv;
3932 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3933 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3934 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3935 ret->data[i] = arr_elem_conv;
3938 return (uint64_t)ret;
3940 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3941 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3942 for (size_t i = 0; i < ret.datalen; i++) {
3943 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3947 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3948 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3949 ret->datalen = *((uint32_t*)elems);
3950 if (ret->datalen == 0) {
3953 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3954 uint32_t *java_elems = (uint32_t*)(elems + 4);
3955 for (size_t i = 0; i < ret->datalen; i++) {
3956 uint32_t arr_elem = java_elems[i];
3957 LDKUpdateFailMalformedHTLC arr_elem_conv;
3958 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3959 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3960 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3961 ret->data[i] = arr_elem_conv;
3964 return (uint64_t)ret;
3966 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3967 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3968 for (size_t i = 0; i < ret.datalen; i++) {
3969 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3973 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3974 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3976 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3977 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3978 CHECK(val->result_ok);
3979 LDKAcceptChannel res_var = (*val->contents.result);
3980 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3981 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3982 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3985 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3986 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3987 CHECK(!val->result_ok);
3988 LDKDecodeError err_var = (*val->contents.err);
3989 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3990 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3991 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3994 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3995 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3997 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
3998 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3999 CHECK(val->result_ok);
4000 LDKAnnouncementSignatures res_var = (*val->contents.result);
4001 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4002 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4003 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4006 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4007 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4008 CHECK(!val->result_ok);
4009 LDKDecodeError err_var = (*val->contents.err);
4010 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4011 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4012 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4015 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4016 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4019 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4020 CHECK(val->result_ok);
4021 LDKChannelReestablish res_var = (*val->contents.result);
4022 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4023 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4024 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4027 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4028 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4029 CHECK(!val->result_ok);
4030 LDKDecodeError err_var = (*val->contents.err);
4031 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4032 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4033 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4036 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4037 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4039 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4040 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4041 CHECK(val->result_ok);
4042 LDKClosingSigned res_var = (*val->contents.result);
4043 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4048 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4049 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4050 CHECK(!val->result_ok);
4051 LDKDecodeError err_var = (*val->contents.err);
4052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4057 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4058 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4061 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4062 CHECK(val->result_ok);
4063 LDKCommitmentSigned res_var = (*val->contents.result);
4064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4070 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4071 CHECK(!val->result_ok);
4072 LDKDecodeError err_var = (*val->contents.err);
4073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4078 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4079 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4081 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4082 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4083 CHECK(val->result_ok);
4084 LDKFundingCreated res_var = (*val->contents.result);
4085 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4086 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4087 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4091 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4092 CHECK(!val->result_ok);
4093 LDKDecodeError err_var = (*val->contents.err);
4094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4099 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4100 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4102 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4103 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4104 CHECK(val->result_ok);
4105 LDKFundingSigned res_var = (*val->contents.result);
4106 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4107 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4108 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4111 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4112 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4113 CHECK(!val->result_ok);
4114 LDKDecodeError err_var = (*val->contents.err);
4115 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4116 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4117 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4120 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4121 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4123 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4124 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4125 CHECK(val->result_ok);
4126 LDKFundingLocked res_var = (*val->contents.result);
4127 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4128 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4129 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4132 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4133 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4134 CHECK(!val->result_ok);
4135 LDKDecodeError err_var = (*val->contents.err);
4136 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4137 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4138 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4141 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4142 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4144 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4145 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4146 CHECK(val->result_ok);
4147 LDKInit res_var = (*val->contents.result);
4148 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4149 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4150 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4153 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4154 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4155 CHECK(!val->result_ok);
4156 LDKDecodeError err_var = (*val->contents.err);
4157 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4158 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4159 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4163 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4165 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4166 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4167 CHECK(val->result_ok);
4168 LDKOpenChannel res_var = (*val->contents.result);
4169 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4174 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4175 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4176 CHECK(!val->result_ok);
4177 LDKDecodeError err_var = (*val->contents.err);
4178 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4179 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4180 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4183 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4184 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4186 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4187 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4188 CHECK(val->result_ok);
4189 LDKRevokeAndACK res_var = (*val->contents.result);
4190 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4191 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4192 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4195 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4196 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4197 CHECK(!val->result_ok);
4198 LDKDecodeError err_var = (*val->contents.err);
4199 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4200 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4201 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4204 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4205 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4207 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4208 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4209 CHECK(val->result_ok);
4210 LDKShutdown res_var = (*val->contents.result);
4211 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4212 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4213 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4216 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4217 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4218 CHECK(!val->result_ok);
4219 LDKDecodeError err_var = (*val->contents.err);
4220 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4221 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4222 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4225 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4226 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4228 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4229 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4230 CHECK(val->result_ok);
4231 LDKUpdateFailHTLC res_var = (*val->contents.result);
4232 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4237 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4238 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4239 CHECK(!val->result_ok);
4240 LDKDecodeError err_var = (*val->contents.err);
4241 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4242 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4243 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4246 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4247 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4249 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4250 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4251 CHECK(val->result_ok);
4252 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4253 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4254 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4255 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4258 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4259 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4260 CHECK(!val->result_ok);
4261 LDKDecodeError err_var = (*val->contents.err);
4262 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4263 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4264 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4267 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4268 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4270 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4271 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4272 CHECK(val->result_ok);
4273 LDKUpdateFee res_var = (*val->contents.result);
4274 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4275 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4276 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4279 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4280 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4281 CHECK(!val->result_ok);
4282 LDKDecodeError err_var = (*val->contents.err);
4283 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4284 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4285 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4288 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4289 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4291 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4292 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4293 CHECK(val->result_ok);
4294 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4295 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4296 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4297 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4300 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4301 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4302 CHECK(!val->result_ok);
4303 LDKDecodeError err_var = (*val->contents.err);
4304 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4305 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4306 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4309 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4310 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4312 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4313 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4314 CHECK(val->result_ok);
4315 LDKUpdateAddHTLC res_var = (*val->contents.result);
4316 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4317 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4318 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4321 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4322 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4323 CHECK(!val->result_ok);
4324 LDKDecodeError err_var = (*val->contents.err);
4325 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4326 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4327 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4330 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
4331 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4334 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4335 CHECK(val->result_ok);
4336 LDKPing res_var = (*val->contents.result);
4337 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4338 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4339 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4342 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4343 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4344 CHECK(!val->result_ok);
4345 LDKDecodeError err_var = (*val->contents.err);
4346 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4347 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4348 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4351 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
4352 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4355 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4356 CHECK(val->result_ok);
4357 LDKPong res_var = (*val->contents.result);
4358 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4364 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4365 CHECK(!val->result_ok);
4366 LDKDecodeError err_var = (*val->contents.err);
4367 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4368 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4369 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4372 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4373 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4375 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4376 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4377 CHECK(val->result_ok);
4378 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4379 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4380 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4381 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4385 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4386 CHECK(!val->result_ok);
4387 LDKDecodeError err_var = (*val->contents.err);
4388 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4389 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4390 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4393 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4394 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4396 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4397 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4398 CHECK(val->result_ok);
4399 LDKChannelAnnouncement res_var = (*val->contents.result);
4400 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4405 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4406 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4407 CHECK(!val->result_ok);
4408 LDKDecodeError err_var = (*val->contents.err);
4409 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4410 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4411 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4414 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4415 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4417 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4418 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4419 CHECK(val->result_ok);
4420 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4421 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4426 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4427 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4428 CHECK(!val->result_ok);
4429 LDKDecodeError err_var = (*val->contents.err);
4430 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4431 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4432 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4435 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4436 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4438 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4439 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4440 CHECK(val->result_ok);
4441 LDKChannelUpdate res_var = (*val->contents.result);
4442 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4443 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4444 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4447 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4448 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4449 CHECK(!val->result_ok);
4450 LDKDecodeError err_var = (*val->contents.err);
4451 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4452 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4453 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4456 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
4457 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4459 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
4460 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4461 CHECK(val->result_ok);
4462 LDKErrorMessage res_var = (*val->contents.result);
4463 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4468 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
4469 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4470 CHECK(!val->result_ok);
4471 LDKDecodeError err_var = (*val->contents.err);
4472 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4473 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4474 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4477 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4478 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4480 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4482 CHECK(val->result_ok);
4483 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4484 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4485 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4486 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4489 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4490 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4491 CHECK(!val->result_ok);
4492 LDKDecodeError err_var = (*val->contents.err);
4493 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4494 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4495 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4498 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4499 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4501 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4502 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4503 CHECK(val->result_ok);
4504 LDKNodeAnnouncement res_var = (*val->contents.result);
4505 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4506 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4507 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4510 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4511 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4512 CHECK(!val->result_ok);
4513 LDKDecodeError err_var = (*val->contents.err);
4514 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4515 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4516 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4519 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
4520 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4522 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
4523 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4524 CHECK(val->result_ok);
4525 LDKQueryShortChannelIds res_var = (*val->contents.result);
4526 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4527 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4528 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4531 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
4532 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4533 CHECK(!val->result_ok);
4534 LDKDecodeError err_var = (*val->contents.err);
4535 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4536 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4537 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4540 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
4541 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4543 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
4544 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4545 CHECK(val->result_ok);
4546 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4547 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4548 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4549 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4552 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
4553 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4554 CHECK(!val->result_ok);
4555 LDKDecodeError err_var = (*val->contents.err);
4556 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4557 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4558 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4561 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4562 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4564 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4565 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4566 CHECK(val->result_ok);
4567 LDKQueryChannelRange res_var = (*val->contents.result);
4568 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4569 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4570 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4573 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4574 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4575 CHECK(!val->result_ok);
4576 LDKDecodeError err_var = (*val->contents.err);
4577 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4578 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4579 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4582 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4583 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4585 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4586 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4587 CHECK(val->result_ok);
4588 LDKReplyChannelRange res_var = (*val->contents.result);
4589 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4590 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4591 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4594 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4595 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4596 CHECK(!val->result_ok);
4597 LDKDecodeError err_var = (*val->contents.err);
4598 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4599 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4600 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4603 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
4604 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4606 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
4607 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4608 CHECK(val->result_ok);
4609 LDKGossipTimestampFilter res_var = (*val->contents.result);
4610 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4611 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4612 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4615 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
4616 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4617 CHECK(!val->result_ok);
4618 LDKDecodeError err_var = (*val->contents.err);
4619 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4620 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4621 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4624 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
4625 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
4627 case LDKSignOrCreationError_SignError: {
4628 return 0 /* LDKSignOrCreationError - SignError */;
4630 case LDKSignOrCreationError_CreationError: {
4631 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
4632 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
4637 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
4638 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
4640 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
4641 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4642 CHECK(val->result_ok);
4643 LDKInvoice res_var = (*val->contents.result);
4644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4646 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4649 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
4650 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4651 CHECK(!val->result_ok);
4652 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4655 typedef struct LDKMessageSendEventsProvider_JCalls {
4656 atomic_size_t refcnt;
4657 uint32_t get_and_clear_pending_msg_events_meth;
4658 } LDKMessageSendEventsProvider_JCalls;
4659 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4660 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4661 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4662 js_free(j_calls->get_and_clear_pending_msg_events_meth);
4666 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4667 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4668 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
4669 LDKCVec_MessageSendEventZ ret_constr;
4670 ret_constr.datalen = *((uint32_t*)ret);
4671 if (ret_constr.datalen > 0)
4672 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4674 ret_constr.data = NULL;
4675 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4676 for (size_t s = 0; s < ret_constr.datalen; s++) {
4677 uint32_t ret_conv_18 = ret_vals[s];
4678 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4679 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
4680 ret_constr.data[s] = ret_conv_18_conv;
4684 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
4685 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
4686 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4688 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4689 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4690 atomic_init(&calls->refcnt, 1);
4691 //TODO: Assign calls->o from o
4693 LDKMessageSendEventsProvider ret = {
4694 .this_arg = (void*) calls,
4695 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4696 .free = LDKMessageSendEventsProvider_JCalls_free,
4700 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4701 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4702 *res_ptr = LDKMessageSendEventsProvider_init(o);
4703 return (long)res_ptr;
4705 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
4706 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4707 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4708 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4709 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4710 for (size_t s = 0; s < ret_var.datalen; s++) {
4711 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4712 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4713 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
4714 ret_arr_ptr[s] = ret_conv_18_ref;
4720 typedef struct LDKEventHandler_JCalls {
4721 atomic_size_t refcnt;
4722 uint32_t handle_event_meth;
4723 } LDKEventHandler_JCalls;
4724 static void LDKEventHandler_JCalls_free(void* this_arg) {
4725 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4726 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4727 js_free(j_calls->handle_event_meth);
4731 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
4732 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4733 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4734 *event_copy = event;
4735 uint64_t event_ref = (uint64_t)event_copy;
4736 js_invoke_function_1(j_calls->handle_event_meth, event_ref);
4738 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
4739 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
4740 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4742 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
4743 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
4744 atomic_init(&calls->refcnt, 1);
4745 //TODO: Assign calls->o from o
4747 LDKEventHandler ret = {
4748 .this_arg = (void*) calls,
4749 .handle_event = handle_event_LDKEventHandler_jcall,
4750 .free = LDKEventHandler_JCalls_free,
4754 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
4755 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4756 *res_ptr = LDKEventHandler_init(o);
4757 return (long)res_ptr;
4759 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
4760 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
4761 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
4762 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
4765 typedef struct LDKEventsProvider_JCalls {
4766 atomic_size_t refcnt;
4767 uint32_t process_pending_events_meth;
4768 } LDKEventsProvider_JCalls;
4769 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4770 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4771 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4772 js_free(j_calls->process_pending_events_meth);
4776 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
4777 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4778 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4780 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)ret);
4782 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
4783 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
4784 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4786 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4787 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4788 atomic_init(&calls->refcnt, 1);
4789 //TODO: Assign calls->o from o
4791 LDKEventsProvider ret = {
4792 .this_arg = (void*) calls,
4793 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
4794 .free = LDKEventsProvider_JCalls_free,
4798 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4799 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4800 *res_ptr = LDKEventsProvider_init(o);
4801 return (long)res_ptr;
4803 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
4804 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4805 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
4806 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
4809 typedef struct LDKAccess_JCalls {
4810 atomic_size_t refcnt;
4811 uint32_t get_utxo_meth;
4813 static void LDKAccess_JCalls_free(void* this_arg) {
4814 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4815 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4816 js_free(j_calls->get_utxo_meth);
4820 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4821 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4822 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4823 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4824 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4825 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4826 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4829 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4830 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4831 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4833 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4834 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4835 atomic_init(&calls->refcnt, 1);
4836 //TODO: Assign calls->o from o
4839 .this_arg = (void*) calls,
4840 .get_utxo = get_utxo_LDKAccess_jcall,
4841 .free = LDKAccess_JCalls_free,
4845 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4846 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4847 *res_ptr = LDKAccess_init(o);
4848 return (long)res_ptr;
4850 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4851 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4852 unsigned char genesis_hash_arr[32];
4853 CHECK(*((uint32_t*)genesis_hash) == 32);
4854 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4855 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4856 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4857 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4858 return (uint64_t)ret_conv;
4861 typedef struct LDKListen_JCalls {
4862 atomic_size_t refcnt;
4863 uint32_t block_connected_meth;
4864 uint32_t block_disconnected_meth;
4866 static void LDKListen_JCalls_free(void* this_arg) {
4867 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4868 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4869 js_free(j_calls->block_connected_meth);
4870 js_free(j_calls->block_disconnected_meth);
4874 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4875 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4876 LDKu8slice block_var = block;
4877 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4878 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4879 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4881 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4882 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4883 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4884 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4885 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4887 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
4888 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
4889 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4891 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4892 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4893 atomic_init(&calls->refcnt, 1);
4894 //TODO: Assign calls->o from o
4897 .this_arg = (void*) calls,
4898 .block_connected = block_connected_LDKListen_jcall,
4899 .block_disconnected = block_disconnected_LDKListen_jcall,
4900 .free = LDKListen_JCalls_free,
4904 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4905 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4906 *res_ptr = LDKListen_init(o);
4907 return (long)res_ptr;
4909 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4910 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4911 LDKu8slice block_ref;
4912 block_ref.datalen = *((uint32_t*)block);
4913 block_ref.data = (int8_t*)(block + 4);
4914 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4917 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4918 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4919 unsigned char header_arr[80];
4920 CHECK(*((uint32_t*)header) == 80);
4921 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4922 unsigned char (*header_ref)[80] = &header_arr;
4923 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4926 typedef struct LDKConfirm_JCalls {
4927 atomic_size_t refcnt;
4928 uint32_t transactions_confirmed_meth;
4929 uint32_t transaction_unconfirmed_meth;
4930 uint32_t best_block_updated_meth;
4931 uint32_t get_relevant_txids_meth;
4932 } LDKConfirm_JCalls;
4933 static void LDKConfirm_JCalls_free(void* this_arg) {
4934 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4935 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4936 js_free(j_calls->transactions_confirmed_meth);
4937 js_free(j_calls->transaction_unconfirmed_meth);
4938 js_free(j_calls->best_block_updated_meth);
4939 js_free(j_calls->get_relevant_txids_meth);
4943 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
4944 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4945 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4946 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4947 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
4948 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4949 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
4950 for (size_t e = 0; e < txdata_var.datalen; e++) {
4951 LDKC2Tuple_usizeTransactionZ* txdata_conv_30_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4952 *txdata_conv_30_ref = txdata_var.data[e];
4953 txdata_arr_ptr[e] = (uint64_t)txdata_conv_30_ref;
4955 FREE(txdata_var.data);
4956 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
4958 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
4959 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4960 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4961 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4962 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
4964 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4965 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4966 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4967 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4968 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
4970 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
4971 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
4972 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
4973 LDKCVec_TxidZ ret_constr;
4974 ret_constr.datalen = *((uint32_t*)ret);
4975 if (ret_constr.datalen > 0)
4976 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
4978 ret_constr.data = NULL;
4979 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
4980 for (size_t m = 0; m < ret_constr.datalen; m++) {
4981 int8_tArray ret_conv_12 = ret_vals[m];
4982 LDKThirtyTwoBytes ret_conv_12_ref;
4983 CHECK(*((uint32_t*)ret_conv_12) == 32);
4984 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
4985 ret_constr.data[m] = ret_conv_12_ref;
4989 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
4990 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
4991 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4993 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
4994 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
4995 atomic_init(&calls->refcnt, 1);
4996 //TODO: Assign calls->o from o
4999 .this_arg = (void*) calls,
5000 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5001 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5002 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5003 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5004 .free = LDKConfirm_JCalls_free,
5008 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5009 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5010 *res_ptr = LDKConfirm_init(o);
5011 return (long)res_ptr;
5013 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5014 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5015 unsigned char header_arr[80];
5016 CHECK(*((uint32_t*)header) == 80);
5017 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5018 unsigned char (*header_ref)[80] = &header_arr;
5019 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5020 txdata_constr.datalen = *((uint32_t*)txdata);
5021 if (txdata_constr.datalen > 0)
5022 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5024 txdata_constr.data = NULL;
5025 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5026 for (size_t e = 0; e < txdata_constr.datalen; e++) {
5027 uint32_t txdata_conv_30 = txdata_vals[e];
5028 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
5029 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
5030 txdata_constr.data[e] = txdata_conv_30_conv;
5032 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5035 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5036 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5037 unsigned char txid_arr[32];
5038 CHECK(*((uint32_t*)txid) == 32);
5039 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5040 unsigned char (*txid_ref)[32] = &txid_arr;
5041 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5044 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5045 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5046 unsigned char header_arr[80];
5047 CHECK(*((uint32_t*)header) == 80);
5048 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5049 unsigned char (*header_ref)[80] = &header_arr;
5050 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5053 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5054 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5055 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5056 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5057 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5058 for (size_t m = 0; m < ret_var.datalen; m++) {
5059 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5060 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5061 ret_arr_ptr[m] = ret_conv_12_arr;
5067 typedef struct LDKFilter_JCalls {
5068 atomic_size_t refcnt;
5069 uint32_t register_tx_meth;
5070 uint32_t register_output_meth;
5072 static void LDKFilter_JCalls_free(void* this_arg) {
5073 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5074 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5075 js_free(j_calls->register_tx_meth);
5076 js_free(j_calls->register_output_meth);
5080 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5081 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5082 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5083 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5084 LDKu8slice script_pubkey_var = script_pubkey;
5085 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5086 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5087 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5089 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5090 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5091 LDKWatchedOutput output_var = output;
5092 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5093 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5094 uint64_t output_ref = (uint64_t)output_var.inner;
5095 if (output_var.is_owned) {
5098 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
5099 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5100 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5103 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5104 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5105 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5107 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5108 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5109 atomic_init(&calls->refcnt, 1);
5110 //TODO: Assign calls->o from o
5113 .this_arg = (void*) calls,
5114 .register_tx = register_tx_LDKFilter_jcall,
5115 .register_output = register_output_LDKFilter_jcall,
5116 .free = LDKFilter_JCalls_free,
5120 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5121 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5122 *res_ptr = LDKFilter_init(o);
5123 return (long)res_ptr;
5125 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5126 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5127 unsigned char txid_arr[32];
5128 CHECK(*((uint32_t*)txid) == 32);
5129 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5130 unsigned char (*txid_ref)[32] = &txid_arr;
5131 LDKu8slice script_pubkey_ref;
5132 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5133 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5134 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5137 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5138 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5139 LDKWatchedOutput output_conv;
5140 output_conv.inner = (void*)(output & (~1));
5141 output_conv.is_owned = (output & 1) || (output == 0);
5142 output_conv = WatchedOutput_clone(&output_conv);
5143 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5144 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5145 uint64_t ret_ref = (uint64_t)ret_copy;
5149 typedef struct LDKPersist_JCalls {
5150 atomic_size_t refcnt;
5151 uint32_t persist_new_channel_meth;
5152 uint32_t update_persisted_channel_meth;
5153 } LDKPersist_JCalls;
5154 static void LDKPersist_JCalls_free(void* this_arg) {
5155 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5156 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5157 js_free(j_calls->persist_new_channel_meth);
5158 js_free(j_calls->update_persisted_channel_meth);
5162 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5163 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5164 LDKOutPoint id_var = id;
5165 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5166 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5167 uint64_t id_ref = (uint64_t)id_var.inner;
5168 if (id_var.is_owned) {
5171 LDKChannelMonitor data_var = *data;
5172 data_var = ChannelMonitor_clone(data);
5173 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5174 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5175 uint64_t data_ref = (uint64_t)data_var.inner;
5176 if (data_var.is_owned) {
5179 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5180 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5181 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5184 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5185 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5186 LDKOutPoint id_var = id;
5187 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5188 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5189 uint64_t id_ref = (uint64_t)id_var.inner;
5190 if (id_var.is_owned) {
5193 LDKChannelMonitorUpdate update_var = *update;
5194 update_var = ChannelMonitorUpdate_clone(update);
5195 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5196 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5197 uint64_t update_ref = (uint64_t)update_var.inner;
5198 if (update_var.is_owned) {
5201 LDKChannelMonitor data_var = *data;
5202 data_var = ChannelMonitor_clone(data);
5203 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5204 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5205 uint64_t data_ref = (uint64_t)data_var.inner;
5206 if (data_var.is_owned) {
5209 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5210 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5211 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5214 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5215 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5216 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5218 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5219 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5220 atomic_init(&calls->refcnt, 1);
5221 //TODO: Assign calls->o from o
5224 .this_arg = (void*) calls,
5225 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5226 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5227 .free = LDKPersist_JCalls_free,
5231 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5232 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5233 *res_ptr = LDKPersist_init(o);
5234 return (long)res_ptr;
5236 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5237 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5238 LDKOutPoint id_conv;
5239 id_conv.inner = (void*)(id & (~1));
5240 id_conv.is_owned = (id & 1) || (id == 0);
5241 id_conv = OutPoint_clone(&id_conv);
5242 LDKChannelMonitor data_conv;
5243 data_conv.inner = (void*)(data & (~1));
5244 data_conv.is_owned = false;
5245 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5246 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5247 return (uint64_t)ret_conv;
5250 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5251 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5252 LDKOutPoint id_conv;
5253 id_conv.inner = (void*)(id & (~1));
5254 id_conv.is_owned = (id & 1) || (id == 0);
5255 id_conv = OutPoint_clone(&id_conv);
5256 LDKChannelMonitorUpdate update_conv;
5257 update_conv.inner = (void*)(update & (~1));
5258 update_conv.is_owned = false;
5259 LDKChannelMonitor data_conv;
5260 data_conv.inner = (void*)(data & (~1));
5261 data_conv.is_owned = false;
5262 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5263 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5264 return (uint64_t)ret_conv;
5267 typedef struct LDKChannelMessageHandler_JCalls {
5268 atomic_size_t refcnt;
5269 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5270 uint32_t handle_open_channel_meth;
5271 uint32_t handle_accept_channel_meth;
5272 uint32_t handle_funding_created_meth;
5273 uint32_t handle_funding_signed_meth;
5274 uint32_t handle_funding_locked_meth;
5275 uint32_t handle_shutdown_meth;
5276 uint32_t handle_closing_signed_meth;
5277 uint32_t handle_update_add_htlc_meth;
5278 uint32_t handle_update_fulfill_htlc_meth;
5279 uint32_t handle_update_fail_htlc_meth;
5280 uint32_t handle_update_fail_malformed_htlc_meth;
5281 uint32_t handle_commitment_signed_meth;
5282 uint32_t handle_revoke_and_ack_meth;
5283 uint32_t handle_update_fee_meth;
5284 uint32_t handle_announcement_signatures_meth;
5285 uint32_t peer_disconnected_meth;
5286 uint32_t peer_connected_meth;
5287 uint32_t handle_channel_reestablish_meth;
5288 uint32_t handle_channel_update_meth;
5289 uint32_t handle_error_meth;
5290 } LDKChannelMessageHandler_JCalls;
5291 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5292 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5293 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5294 js_free(j_calls->handle_open_channel_meth);
5295 js_free(j_calls->handle_accept_channel_meth);
5296 js_free(j_calls->handle_funding_created_meth);
5297 js_free(j_calls->handle_funding_signed_meth);
5298 js_free(j_calls->handle_funding_locked_meth);
5299 js_free(j_calls->handle_shutdown_meth);
5300 js_free(j_calls->handle_closing_signed_meth);
5301 js_free(j_calls->handle_update_add_htlc_meth);
5302 js_free(j_calls->handle_update_fulfill_htlc_meth);
5303 js_free(j_calls->handle_update_fail_htlc_meth);
5304 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5305 js_free(j_calls->handle_commitment_signed_meth);
5306 js_free(j_calls->handle_revoke_and_ack_meth);
5307 js_free(j_calls->handle_update_fee_meth);
5308 js_free(j_calls->handle_announcement_signatures_meth);
5309 js_free(j_calls->peer_disconnected_meth);
5310 js_free(j_calls->peer_connected_meth);
5311 js_free(j_calls->handle_channel_reestablish_meth);
5312 js_free(j_calls->handle_channel_update_meth);
5313 js_free(j_calls->handle_error_meth);
5317 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5318 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5319 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5320 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5321 LDKInitFeatures their_features_var = their_features;
5322 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5323 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5324 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5325 if (their_features_var.is_owned) {
5326 their_features_ref |= 1;
5328 LDKOpenChannel msg_var = *msg;
5329 msg_var = OpenChannel_clone(msg);
5330 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5331 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5332 uint64_t msg_ref = (uint64_t)msg_var.inner;
5333 if (msg_var.is_owned) {
5336 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5338 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5339 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5340 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5341 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5342 LDKInitFeatures their_features_var = their_features;
5343 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5344 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5345 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5346 if (their_features_var.is_owned) {
5347 their_features_ref |= 1;
5349 LDKAcceptChannel msg_var = *msg;
5350 msg_var = AcceptChannel_clone(msg);
5351 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5352 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5353 uint64_t msg_ref = (uint64_t)msg_var.inner;
5354 if (msg_var.is_owned) {
5357 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5359 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5360 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5361 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5362 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5363 LDKFundingCreated msg_var = *msg;
5364 msg_var = FundingCreated_clone(msg);
5365 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5366 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5367 uint64_t msg_ref = (uint64_t)msg_var.inner;
5368 if (msg_var.is_owned) {
5371 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5373 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5374 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5375 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5376 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5377 LDKFundingSigned msg_var = *msg;
5378 msg_var = FundingSigned_clone(msg);
5379 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5380 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5381 uint64_t msg_ref = (uint64_t)msg_var.inner;
5382 if (msg_var.is_owned) {
5385 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5387 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5388 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5389 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5390 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5391 LDKFundingLocked msg_var = *msg;
5392 msg_var = FundingLocked_clone(msg);
5393 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5394 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5395 uint64_t msg_ref = (uint64_t)msg_var.inner;
5396 if (msg_var.is_owned) {
5399 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5401 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5403 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5404 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5405 LDKInitFeatures their_features_var = *their_features;
5406 their_features_var = InitFeatures_clone(their_features);
5407 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5408 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5409 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5410 if (their_features_var.is_owned) {
5411 their_features_ref |= 1;
5413 LDKShutdown msg_var = *msg;
5414 msg_var = Shutdown_clone(msg);
5415 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5416 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5417 uint64_t msg_ref = (uint64_t)msg_var.inner;
5418 if (msg_var.is_owned) {
5421 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5423 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5424 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5425 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5426 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5427 LDKClosingSigned msg_var = *msg;
5428 msg_var = ClosingSigned_clone(msg);
5429 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5430 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5431 uint64_t msg_ref = (uint64_t)msg_var.inner;
5432 if (msg_var.is_owned) {
5435 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5437 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5438 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5439 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5440 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5441 LDKUpdateAddHTLC msg_var = *msg;
5442 msg_var = UpdateAddHTLC_clone(msg);
5443 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5444 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5445 uint64_t msg_ref = (uint64_t)msg_var.inner;
5446 if (msg_var.is_owned) {
5449 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5451 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5452 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5453 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5454 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5455 LDKUpdateFulfillHTLC msg_var = *msg;
5456 msg_var = UpdateFulfillHTLC_clone(msg);
5457 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5458 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5459 uint64_t msg_ref = (uint64_t)msg_var.inner;
5460 if (msg_var.is_owned) {
5463 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5465 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5466 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5467 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5468 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5469 LDKUpdateFailHTLC msg_var = *msg;
5470 msg_var = UpdateFailHTLC_clone(msg);
5471 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5472 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5473 uint64_t msg_ref = (uint64_t)msg_var.inner;
5474 if (msg_var.is_owned) {
5477 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5479 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5480 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5481 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5482 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5483 LDKUpdateFailMalformedHTLC msg_var = *msg;
5484 msg_var = UpdateFailMalformedHTLC_clone(msg);
5485 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5486 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5487 uint64_t msg_ref = (uint64_t)msg_var.inner;
5488 if (msg_var.is_owned) {
5491 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5493 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5494 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5495 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5496 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5497 LDKCommitmentSigned msg_var = *msg;
5498 msg_var = CommitmentSigned_clone(msg);
5499 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5500 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5501 uint64_t msg_ref = (uint64_t)msg_var.inner;
5502 if (msg_var.is_owned) {
5505 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5507 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5509 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5510 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5511 LDKRevokeAndACK msg_var = *msg;
5512 msg_var = RevokeAndACK_clone(msg);
5513 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5514 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5515 uint64_t msg_ref = (uint64_t)msg_var.inner;
5516 if (msg_var.is_owned) {
5519 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5521 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5522 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5523 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5524 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5525 LDKUpdateFee msg_var = *msg;
5526 msg_var = UpdateFee_clone(msg);
5527 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5528 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5529 uint64_t msg_ref = (uint64_t)msg_var.inner;
5530 if (msg_var.is_owned) {
5533 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5535 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5536 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5537 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5538 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5539 LDKAnnouncementSignatures msg_var = *msg;
5540 msg_var = AnnouncementSignatures_clone(msg);
5541 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5542 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5543 uint64_t msg_ref = (uint64_t)msg_var.inner;
5544 if (msg_var.is_owned) {
5547 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5549 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5550 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5551 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5552 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5553 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5555 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5556 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5557 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5558 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5559 LDKInit msg_var = *msg;
5560 msg_var = Init_clone(msg);
5561 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5562 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5563 uint64_t msg_ref = (uint64_t)msg_var.inner;
5564 if (msg_var.is_owned) {
5567 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5569 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5570 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5571 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5572 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5573 LDKChannelReestablish msg_var = *msg;
5574 msg_var = ChannelReestablish_clone(msg);
5575 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5576 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5577 uint64_t msg_ref = (uint64_t)msg_var.inner;
5578 if (msg_var.is_owned) {
5581 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5583 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
5584 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5585 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5586 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5587 LDKChannelUpdate msg_var = *msg;
5588 msg_var = ChannelUpdate_clone(msg);
5589 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5590 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5591 uint64_t msg_ref = (uint64_t)msg_var.inner;
5592 if (msg_var.is_owned) {
5595 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
5597 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5598 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5599 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5600 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5601 LDKErrorMessage msg_var = *msg;
5602 msg_var = ErrorMessage_clone(msg);
5603 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5604 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5605 uint64_t msg_ref = (uint64_t)msg_var.inner;
5606 if (msg_var.is_owned) {
5609 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5611 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
5612 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
5613 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5614 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5616 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5617 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5618 atomic_init(&calls->refcnt, 1);
5619 //TODO: Assign calls->o from o
5621 LDKChannelMessageHandler ret = {
5622 .this_arg = (void*) calls,
5623 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
5624 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
5625 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
5626 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
5627 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
5628 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
5629 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
5630 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
5631 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
5632 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
5633 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
5634 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
5635 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
5636 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
5637 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
5638 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
5639 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
5640 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
5641 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
5642 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
5643 .free = LDKChannelMessageHandler_JCalls_free,
5644 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5646 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5649 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5650 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5651 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
5652 return (long)res_ptr;
5654 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) {
5655 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5656 LDKPublicKey their_node_id_ref;
5657 CHECK(*((uint32_t*)their_node_id) == 33);
5658 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5659 LDKInitFeatures their_features_conv;
5660 their_features_conv.inner = (void*)(their_features & (~1));
5661 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5662 their_features_conv = InitFeatures_clone(&their_features_conv);
5663 LDKOpenChannel msg_conv;
5664 msg_conv.inner = (void*)(msg & (~1));
5665 msg_conv.is_owned = false;
5666 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5669 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) {
5670 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5671 LDKPublicKey their_node_id_ref;
5672 CHECK(*((uint32_t*)their_node_id) == 33);
5673 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5674 LDKInitFeatures their_features_conv;
5675 their_features_conv.inner = (void*)(their_features & (~1));
5676 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5677 their_features_conv = InitFeatures_clone(&their_features_conv);
5678 LDKAcceptChannel msg_conv;
5679 msg_conv.inner = (void*)(msg & (~1));
5680 msg_conv.is_owned = false;
5681 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5684 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5685 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5686 LDKPublicKey their_node_id_ref;
5687 CHECK(*((uint32_t*)their_node_id) == 33);
5688 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5689 LDKFundingCreated msg_conv;
5690 msg_conv.inner = (void*)(msg & (~1));
5691 msg_conv.is_owned = false;
5692 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5695 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5696 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5697 LDKPublicKey their_node_id_ref;
5698 CHECK(*((uint32_t*)their_node_id) == 33);
5699 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5700 LDKFundingSigned msg_conv;
5701 msg_conv.inner = (void*)(msg & (~1));
5702 msg_conv.is_owned = false;
5703 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5706 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5707 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5708 LDKPublicKey their_node_id_ref;
5709 CHECK(*((uint32_t*)their_node_id) == 33);
5710 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5711 LDKFundingLocked msg_conv;
5712 msg_conv.inner = (void*)(msg & (~1));
5713 msg_conv.is_owned = false;
5714 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5717 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
5718 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5719 LDKPublicKey their_node_id_ref;
5720 CHECK(*((uint32_t*)their_node_id) == 33);
5721 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5722 LDKInitFeatures their_features_conv;
5723 their_features_conv.inner = (void*)(their_features & (~1));
5724 their_features_conv.is_owned = false;
5725 LDKShutdown msg_conv;
5726 msg_conv.inner = (void*)(msg & (~1));
5727 msg_conv.is_owned = false;
5728 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5731 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5732 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5733 LDKPublicKey their_node_id_ref;
5734 CHECK(*((uint32_t*)their_node_id) == 33);
5735 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5736 LDKClosingSigned msg_conv;
5737 msg_conv.inner = (void*)(msg & (~1));
5738 msg_conv.is_owned = false;
5739 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5742 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5743 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5744 LDKPublicKey their_node_id_ref;
5745 CHECK(*((uint32_t*)their_node_id) == 33);
5746 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5747 LDKUpdateAddHTLC msg_conv;
5748 msg_conv.inner = (void*)(msg & (~1));
5749 msg_conv.is_owned = false;
5750 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5753 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5754 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5755 LDKPublicKey their_node_id_ref;
5756 CHECK(*((uint32_t*)their_node_id) == 33);
5757 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5758 LDKUpdateFulfillHTLC msg_conv;
5759 msg_conv.inner = (void*)(msg & (~1));
5760 msg_conv.is_owned = false;
5761 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5764 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5765 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5766 LDKPublicKey their_node_id_ref;
5767 CHECK(*((uint32_t*)their_node_id) == 33);
5768 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5769 LDKUpdateFailHTLC msg_conv;
5770 msg_conv.inner = (void*)(msg & (~1));
5771 msg_conv.is_owned = false;
5772 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5775 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5776 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5777 LDKPublicKey their_node_id_ref;
5778 CHECK(*((uint32_t*)their_node_id) == 33);
5779 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5780 LDKUpdateFailMalformedHTLC msg_conv;
5781 msg_conv.inner = (void*)(msg & (~1));
5782 msg_conv.is_owned = false;
5783 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5786 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5787 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5788 LDKPublicKey their_node_id_ref;
5789 CHECK(*((uint32_t*)their_node_id) == 33);
5790 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5791 LDKCommitmentSigned msg_conv;
5792 msg_conv.inner = (void*)(msg & (~1));
5793 msg_conv.is_owned = false;
5794 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5797 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5798 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5799 LDKPublicKey their_node_id_ref;
5800 CHECK(*((uint32_t*)their_node_id) == 33);
5801 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5802 LDKRevokeAndACK msg_conv;
5803 msg_conv.inner = (void*)(msg & (~1));
5804 msg_conv.is_owned = false;
5805 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5808 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5809 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5810 LDKPublicKey their_node_id_ref;
5811 CHECK(*((uint32_t*)their_node_id) == 33);
5812 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5813 LDKUpdateFee msg_conv;
5814 msg_conv.inner = (void*)(msg & (~1));
5815 msg_conv.is_owned = false;
5816 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5819 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5820 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5821 LDKPublicKey their_node_id_ref;
5822 CHECK(*((uint32_t*)their_node_id) == 33);
5823 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5824 LDKAnnouncementSignatures msg_conv;
5825 msg_conv.inner = (void*)(msg & (~1));
5826 msg_conv.is_owned = false;
5827 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5830 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5831 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5832 LDKPublicKey their_node_id_ref;
5833 CHECK(*((uint32_t*)their_node_id) == 33);
5834 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5835 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5838 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5839 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5840 LDKPublicKey their_node_id_ref;
5841 CHECK(*((uint32_t*)their_node_id) == 33);
5842 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5844 msg_conv.inner = (void*)(msg & (~1));
5845 msg_conv.is_owned = false;
5846 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5849 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5850 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5851 LDKPublicKey their_node_id_ref;
5852 CHECK(*((uint32_t*)their_node_id) == 33);
5853 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5854 LDKChannelReestablish msg_conv;
5855 msg_conv.inner = (void*)(msg & (~1));
5856 msg_conv.is_owned = false;
5857 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5860 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5861 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5862 LDKPublicKey their_node_id_ref;
5863 CHECK(*((uint32_t*)their_node_id) == 33);
5864 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5865 LDKChannelUpdate msg_conv;
5866 msg_conv.inner = (void*)(msg & (~1));
5867 msg_conv.is_owned = false;
5868 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5871 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5873 LDKPublicKey their_node_id_ref;
5874 CHECK(*((uint32_t*)their_node_id) == 33);
5875 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5876 LDKErrorMessage msg_conv;
5877 msg_conv.inner = (void*)(msg & (~1));
5878 msg_conv.is_owned = false;
5879 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5882 typedef struct LDKRoutingMessageHandler_JCalls {
5883 atomic_size_t refcnt;
5884 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5885 uint32_t handle_node_announcement_meth;
5886 uint32_t handle_channel_announcement_meth;
5887 uint32_t handle_channel_update_meth;
5888 uint32_t handle_htlc_fail_channel_update_meth;
5889 uint32_t get_next_channel_announcements_meth;
5890 uint32_t get_next_node_announcements_meth;
5891 uint32_t sync_routing_table_meth;
5892 uint32_t handle_reply_channel_range_meth;
5893 uint32_t handle_reply_short_channel_ids_end_meth;
5894 uint32_t handle_query_channel_range_meth;
5895 uint32_t handle_query_short_channel_ids_meth;
5896 } LDKRoutingMessageHandler_JCalls;
5897 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5898 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5899 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5900 js_free(j_calls->handle_node_announcement_meth);
5901 js_free(j_calls->handle_channel_announcement_meth);
5902 js_free(j_calls->handle_channel_update_meth);
5903 js_free(j_calls->handle_htlc_fail_channel_update_meth);
5904 js_free(j_calls->get_next_channel_announcements_meth);
5905 js_free(j_calls->get_next_node_announcements_meth);
5906 js_free(j_calls->sync_routing_table_meth);
5907 js_free(j_calls->handle_reply_channel_range_meth);
5908 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
5909 js_free(j_calls->handle_query_channel_range_meth);
5910 js_free(j_calls->handle_query_short_channel_ids_meth);
5914 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5915 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5916 LDKNodeAnnouncement msg_var = *msg;
5917 msg_var = NodeAnnouncement_clone(msg);
5918 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5919 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5920 uint64_t msg_ref = (uint64_t)msg_var.inner;
5921 if (msg_var.is_owned) {
5924 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
5925 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5926 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5929 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5930 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5931 LDKChannelAnnouncement msg_var = *msg;
5932 msg_var = ChannelAnnouncement_clone(msg);
5933 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5934 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5935 uint64_t msg_ref = (uint64_t)msg_var.inner;
5936 if (msg_var.is_owned) {
5939 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
5940 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5941 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5944 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5945 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5946 LDKChannelUpdate msg_var = *msg;
5947 msg_var = ChannelUpdate_clone(msg);
5948 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5949 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5950 uint64_t msg_ref = (uint64_t)msg_var.inner;
5951 if (msg_var.is_owned) {
5954 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
5955 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5956 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
5959 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5960 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5961 uint64_t ret_update = (uint64_t)update;
5962 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5964 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5965 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5966 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5967 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5968 ret_constr.datalen = *((uint32_t*)ret);
5969 if (ret_constr.datalen > 0)
5970 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5972 ret_constr.data = NULL;
5973 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5974 for (size_t l = 0; l < ret_constr.datalen; l++) {
5975 uint32_t ret_conv_63 = ret_vals[l];
5976 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5977 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
5978 ret_constr.data[l] = ret_conv_63_conv;
5982 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5983 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5984 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5985 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
5986 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5987 LDKCVec_NodeAnnouncementZ ret_constr;
5988 ret_constr.datalen = *((uint32_t*)ret);
5989 if (ret_constr.datalen > 0)
5990 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5992 ret_constr.data = NULL;
5993 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5994 for (size_t s = 0; s < ret_constr.datalen; s++) {
5995 uint32_t ret_conv_18 = ret_vals[s];
5996 LDKNodeAnnouncement ret_conv_18_conv;
5997 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5998 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5999 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6000 ret_constr.data[s] = ret_conv_18_conv;
6004 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6005 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6006 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6007 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6008 LDKInit init_var = *init;
6009 init_var = Init_clone(init);
6010 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6011 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6012 uint64_t init_ref = (uint64_t)init_var.inner;
6013 if (init_var.is_owned) {
6016 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6018 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6019 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6020 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6021 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6022 LDKReplyChannelRange msg_var = msg;
6023 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 uint64_t msg_ref = (uint64_t)msg_var.inner;
6026 if (msg_var.is_owned) {
6029 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6030 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6031 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6034 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6035 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6036 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6037 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6038 LDKReplyShortChannelIdsEnd msg_var = msg;
6039 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6040 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6041 uint64_t msg_ref = (uint64_t)msg_var.inner;
6042 if (msg_var.is_owned) {
6045 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6046 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6047 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6050 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6051 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6052 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6053 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6054 LDKQueryChannelRange msg_var = msg;
6055 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6056 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6057 uint64_t msg_ref = (uint64_t)msg_var.inner;
6058 if (msg_var.is_owned) {
6061 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6062 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6063 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6066 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6067 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6068 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6069 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6070 LDKQueryShortChannelIds msg_var = msg;
6071 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6072 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6073 uint64_t msg_ref = (uint64_t)msg_var.inner;
6074 if (msg_var.is_owned) {
6077 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6078 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6079 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6082 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6083 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6084 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6085 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6087 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6088 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6089 atomic_init(&calls->refcnt, 1);
6090 //TODO: Assign calls->o from o
6092 LDKRoutingMessageHandler ret = {
6093 .this_arg = (void*) calls,
6094 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6095 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6096 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6097 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
6098 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6099 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6100 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6101 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6102 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6103 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6104 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6105 .free = LDKRoutingMessageHandler_JCalls_free,
6106 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6108 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6111 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6112 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6113 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6114 return (long)res_ptr;
6116 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6117 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6118 LDKNodeAnnouncement msg_conv;
6119 msg_conv.inner = (void*)(msg & (~1));
6120 msg_conv.is_owned = false;
6121 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6122 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6123 return (uint64_t)ret_conv;
6126 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6127 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6128 LDKChannelAnnouncement msg_conv;
6129 msg_conv.inner = (void*)(msg & (~1));
6130 msg_conv.is_owned = false;
6131 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6132 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6133 return (uint64_t)ret_conv;
6136 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6137 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6138 LDKChannelUpdate msg_conv;
6139 msg_conv.inner = (void*)(msg & (~1));
6140 msg_conv.is_owned = false;
6141 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6142 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6143 return (uint64_t)ret_conv;
6146 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
6147 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6148 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6149 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6152 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6153 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6154 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6155 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6156 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6157 for (size_t l = 0; l < ret_var.datalen; l++) {
6158 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6159 *ret_conv_63_ref = ret_var.data[l];
6160 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
6166 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6167 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6168 LDKPublicKey starting_point_ref;
6169 CHECK(*((uint32_t*)starting_point) == 33);
6170 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6171 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6172 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6173 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6174 for (size_t s = 0; s < ret_var.datalen; s++) {
6175 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6176 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6177 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6178 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6179 if (ret_conv_18_var.is_owned) {
6180 ret_conv_18_ref |= 1;
6182 ret_arr_ptr[s] = ret_conv_18_ref;
6188 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6189 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6190 LDKPublicKey their_node_id_ref;
6191 CHECK(*((uint32_t*)their_node_id) == 33);
6192 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6194 init_conv.inner = (void*)(init & (~1));
6195 init_conv.is_owned = false;
6196 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6199 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6200 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6201 LDKPublicKey their_node_id_ref;
6202 CHECK(*((uint32_t*)their_node_id) == 33);
6203 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6204 LDKReplyChannelRange msg_conv;
6205 msg_conv.inner = (void*)(msg & (~1));
6206 msg_conv.is_owned = (msg & 1) || (msg == 0);
6207 msg_conv = ReplyChannelRange_clone(&msg_conv);
6208 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6209 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6210 return (uint64_t)ret_conv;
6213 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) {
6214 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6215 LDKPublicKey their_node_id_ref;
6216 CHECK(*((uint32_t*)their_node_id) == 33);
6217 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6218 LDKReplyShortChannelIdsEnd msg_conv;
6219 msg_conv.inner = (void*)(msg & (~1));
6220 msg_conv.is_owned = (msg & 1) || (msg == 0);
6221 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6222 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6223 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6224 return (uint64_t)ret_conv;
6227 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6228 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6229 LDKPublicKey their_node_id_ref;
6230 CHECK(*((uint32_t*)their_node_id) == 33);
6231 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6232 LDKQueryChannelRange msg_conv;
6233 msg_conv.inner = (void*)(msg & (~1));
6234 msg_conv.is_owned = (msg & 1) || (msg == 0);
6235 msg_conv = QueryChannelRange_clone(&msg_conv);
6236 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6237 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6238 return (uint64_t)ret_conv;
6241 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6242 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6243 LDKPublicKey their_node_id_ref;
6244 CHECK(*((uint32_t*)their_node_id) == 33);
6245 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6246 LDKQueryShortChannelIds msg_conv;
6247 msg_conv.inner = (void*)(msg & (~1));
6248 msg_conv.is_owned = (msg & 1) || (msg == 0);
6249 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6250 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6251 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6252 return (uint64_t)ret_conv;
6255 typedef struct LDKSocketDescriptor_JCalls {
6256 atomic_size_t refcnt;
6257 uint32_t send_data_meth;
6258 uint32_t disconnect_socket_meth;
6261 } LDKSocketDescriptor_JCalls;
6262 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6263 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6264 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6265 js_free(j_calls->send_data_meth);
6266 js_free(j_calls->disconnect_socket_meth);
6267 js_free(j_calls->eq_meth);
6268 js_free(j_calls->hash_meth);
6272 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6273 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6274 LDKu8slice data_var = data;
6275 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6276 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
6277 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
6279 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6280 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6281 js_invoke_function_0(j_calls->disconnect_socket_meth);
6283 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6284 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6285 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6286 *other_arg_clone = SocketDescriptor_clone(other_arg);
6287 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
6289 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6290 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6291 return js_invoke_function_0(j_calls->hash_meth);
6293 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
6294 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
6295 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6297 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
6298 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6299 atomic_init(&calls->refcnt, 1);
6300 //TODO: Assign calls->o from o
6302 LDKSocketDescriptor ret = {
6303 .this_arg = (void*) calls,
6304 .send_data = send_data_LDKSocketDescriptor_jcall,
6305 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6306 .eq = eq_LDKSocketDescriptor_jcall,
6307 .hash = hash_LDKSocketDescriptor_jcall,
6308 .cloned = LDKSocketDescriptor_JCalls_cloned,
6309 .free = LDKSocketDescriptor_JCalls_free,
6313 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
6314 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6315 *res_ptr = LDKSocketDescriptor_init(o);
6316 return (long)res_ptr;
6318 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
6319 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6320 LDKu8slice data_ref;
6321 data_ref.datalen = *((uint32_t*)data);
6322 data_ref.data = (int8_t*)(data + 4);
6323 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6327 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
6328 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6329 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6332 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
6333 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6334 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6338 typedef struct LDKChannelManagerPersister_JCalls {
6339 atomic_size_t refcnt;
6340 uint32_t persist_manager_meth;
6341 } LDKChannelManagerPersister_JCalls;
6342 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
6343 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6344 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6345 js_free(j_calls->persist_manager_meth);
6349 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
6350 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6351 LDKChannelManager channel_manager_var = *channel_manager;
6352 // Warning: we may need a move here but no clone is available for LDKChannelManager
6353 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6354 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6355 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
6356 if (channel_manager_var.is_owned) {
6357 channel_manager_ref |= 1;
6359 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
6360 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
6361 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
6364 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
6365 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
6366 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6368 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
6369 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
6370 atomic_init(&calls->refcnt, 1);
6371 //TODO: Assign calls->o from o
6373 LDKChannelManagerPersister ret = {
6374 .this_arg = (void*) calls,
6375 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
6376 .free = LDKChannelManagerPersister_JCalls_free,
6380 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
6381 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
6382 *res_ptr = LDKChannelManagerPersister_init(o);
6383 return (long)res_ptr;
6385 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
6386 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
6387 LDKChannelManager channel_manager_conv;
6388 channel_manager_conv.inner = (void*)(channel_manager & (~1));
6389 channel_manager_conv.is_owned = false;
6390 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6391 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
6392 return (uint64_t)ret_conv;
6395 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
6396 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
6398 case LDKFallback_SegWitProgram: {
6399 uint8_t version_val = obj->seg_wit_program.version._0;
6400 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
6401 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6402 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
6403 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
6405 case LDKFallback_PubKeyHash: {
6406 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6407 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
6408 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
6410 case LDKFallback_ScriptHash: {
6411 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6412 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
6413 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
6418 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
6419 LDKStr ret_str = _ldk_get_compiled_version();
6420 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6425 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
6426 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
6427 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6432 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
6433 LDKTransaction _res_ref;
6434 _res_ref.datalen = *((uint32_t*)_res);
6435 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6436 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6437 _res_ref.data_is_owned = true;
6438 Transaction_free(_res_ref);
6441 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
6442 LDKCVec_u8Z script_pubkey_ref;
6443 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
6444 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
6445 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
6446 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6447 *ret_ref = TxOut_new(script_pubkey_ref, value);
6448 return (uint64_t)ret_ref;
6451 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
6452 if ((_res & 1) != 0) return;
6453 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6455 TxOut_free(_res_conv);
6458 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
6459 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6460 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6461 *ret_ref = TxOut_clone(orig_conv);
6462 return (uint64_t)ret_ref;
6465 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
6466 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
6470 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
6472 CHECK(*((uint32_t*)o) == 32);
6473 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
6474 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6475 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6476 return (uint64_t)ret_conv;
6479 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
6480 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6481 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6482 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6483 return (uint64_t)ret_conv;
6486 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
6487 if ((_res & 1) != 0) return;
6488 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6490 CResult_SecretKeyErrorZ_free(_res_conv);
6493 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
6495 CHECK(*((uint32_t*)o) == 33);
6496 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
6497 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6498 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6499 return (uint64_t)ret_conv;
6502 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
6503 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6504 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6505 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6506 return (uint64_t)ret_conv;
6509 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
6510 if ((_res & 1) != 0) return;
6511 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6513 CResult_PublicKeyErrorZ_free(_res_conv);
6516 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
6517 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
6518 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6519 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
6520 return (uint64_t)ret_conv;
6523 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
6524 LDKTxCreationKeys o_conv;
6525 o_conv.inner = (void*)(o & (~1));
6526 o_conv.is_owned = (o & 1) || (o == 0);
6527 o_conv = TxCreationKeys_clone(&o_conv);
6528 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6529 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6530 return (uint64_t)ret_conv;
6533 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
6534 LDKDecodeError e_conv;
6535 e_conv.inner = (void*)(e & (~1));
6536 e_conv.is_owned = (e & 1) || (e == 0);
6537 e_conv = DecodeError_clone(&e_conv);
6538 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6539 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6540 return (uint64_t)ret_conv;
6543 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
6544 if ((_res & 1) != 0) return;
6545 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6547 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6550 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
6551 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6552 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6553 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6554 return (uint64_t)ret_conv;
6557 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
6558 LDKChannelPublicKeys o_conv;
6559 o_conv.inner = (void*)(o & (~1));
6560 o_conv.is_owned = (o & 1) || (o == 0);
6561 o_conv = ChannelPublicKeys_clone(&o_conv);
6562 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6563 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6564 return (uint64_t)ret_conv;
6567 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
6568 LDKDecodeError e_conv;
6569 e_conv.inner = (void*)(e & (~1));
6570 e_conv.is_owned = (e & 1) || (e == 0);
6571 e_conv = DecodeError_clone(&e_conv);
6572 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6573 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6574 return (uint64_t)ret_conv;
6577 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
6578 if ((_res & 1) != 0) return;
6579 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6581 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6584 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
6585 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6586 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6587 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6588 return (uint64_t)ret_conv;
6591 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
6592 LDKTxCreationKeys o_conv;
6593 o_conv.inner = (void*)(o & (~1));
6594 o_conv.is_owned = (o & 1) || (o == 0);
6595 o_conv = TxCreationKeys_clone(&o_conv);
6596 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6597 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6598 return (uint64_t)ret_conv;
6601 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
6602 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6603 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6604 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6605 return (uint64_t)ret_conv;
6608 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
6609 if ((_res & 1) != 0) return;
6610 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6612 CResult_TxCreationKeysErrorZ_free(_res_conv);
6615 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
6616 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
6617 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6618 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
6619 return (uint64_t)ret_conv;
6622 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
6623 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6624 *ret_copy = COption_u32Z_some(o);
6625 uint64_t ret_ref = (uint64_t)ret_copy;
6629 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
6630 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6631 *ret_copy = COption_u32Z_none();
6632 uint64_t ret_ref = (uint64_t)ret_copy;
6636 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
6637 if ((_res & 1) != 0) return;
6638 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
6640 COption_u32Z_free(_res_conv);
6643 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
6644 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
6645 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6646 *ret_copy = COption_u32Z_clone(orig_conv);
6647 uint64_t ret_ref = (uint64_t)ret_copy;
6651 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
6652 LDKHTLCOutputInCommitment o_conv;
6653 o_conv.inner = (void*)(o & (~1));
6654 o_conv.is_owned = (o & 1) || (o == 0);
6655 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6656 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6657 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6658 return (uint64_t)ret_conv;
6661 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
6662 LDKDecodeError e_conv;
6663 e_conv.inner = (void*)(e & (~1));
6664 e_conv.is_owned = (e & 1) || (e == 0);
6665 e_conv = DecodeError_clone(&e_conv);
6666 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6667 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6668 return (uint64_t)ret_conv;
6671 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
6672 if ((_res & 1) != 0) return;
6673 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6675 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6678 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
6679 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6680 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6681 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6682 return (uint64_t)ret_conv;
6685 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6686 LDKCounterpartyChannelTransactionParameters o_conv;
6687 o_conv.inner = (void*)(o & (~1));
6688 o_conv.is_owned = (o & 1) || (o == 0);
6689 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6690 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6691 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6692 return (uint64_t)ret_conv;
6695 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6696 LDKDecodeError e_conv;
6697 e_conv.inner = (void*)(e & (~1));
6698 e_conv.is_owned = (e & 1) || (e == 0);
6699 e_conv = DecodeError_clone(&e_conv);
6700 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6701 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6702 return (uint64_t)ret_conv;
6705 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6706 if ((_res & 1) != 0) return;
6707 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6709 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6712 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6713 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6714 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6715 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6716 return (uint64_t)ret_conv;
6719 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6720 LDKChannelTransactionParameters o_conv;
6721 o_conv.inner = (void*)(o & (~1));
6722 o_conv.is_owned = (o & 1) || (o == 0);
6723 o_conv = ChannelTransactionParameters_clone(&o_conv);
6724 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6725 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6726 return (uint64_t)ret_conv;
6729 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6730 LDKDecodeError e_conv;
6731 e_conv.inner = (void*)(e & (~1));
6732 e_conv.is_owned = (e & 1) || (e == 0);
6733 e_conv = DecodeError_clone(&e_conv);
6734 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6735 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6736 return (uint64_t)ret_conv;
6739 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6740 if ((_res & 1) != 0) return;
6741 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6743 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6746 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6747 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6748 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6749 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6750 return (uint64_t)ret_conv;
6753 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
6754 LDKCVec_SignatureZ _res_constr;
6755 _res_constr.datalen = *((uint32_t*)_res);
6756 if (_res_constr.datalen > 0)
6757 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6759 _res_constr.data = NULL;
6760 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6761 for (size_t m = 0; m < _res_constr.datalen; m++) {
6762 int8_tArray _res_conv_12 = _res_vals[m];
6763 LDKSignature _res_conv_12_ref;
6764 CHECK(*((uint32_t*)_res_conv_12) == 64);
6765 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
6766 _res_constr.data[m] = _res_conv_12_ref;
6768 CVec_SignatureZ_free(_res_constr);
6771 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6772 LDKHolderCommitmentTransaction o_conv;
6773 o_conv.inner = (void*)(o & (~1));
6774 o_conv.is_owned = (o & 1) || (o == 0);
6775 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6776 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6777 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6778 return (uint64_t)ret_conv;
6781 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6782 LDKDecodeError e_conv;
6783 e_conv.inner = (void*)(e & (~1));
6784 e_conv.is_owned = (e & 1) || (e == 0);
6785 e_conv = DecodeError_clone(&e_conv);
6786 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6787 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6788 return (uint64_t)ret_conv;
6791 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6792 if ((_res & 1) != 0) return;
6793 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6795 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6798 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6799 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6800 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6801 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6802 return (uint64_t)ret_conv;
6805 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6806 LDKBuiltCommitmentTransaction o_conv;
6807 o_conv.inner = (void*)(o & (~1));
6808 o_conv.is_owned = (o & 1) || (o == 0);
6809 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6810 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6811 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6812 return (uint64_t)ret_conv;
6815 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6816 LDKDecodeError e_conv;
6817 e_conv.inner = (void*)(e & (~1));
6818 e_conv.is_owned = (e & 1) || (e == 0);
6819 e_conv = DecodeError_clone(&e_conv);
6820 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6821 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6822 return (uint64_t)ret_conv;
6825 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6826 if ((_res & 1) != 0) return;
6827 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6829 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6832 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6833 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6834 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6835 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6836 return (uint64_t)ret_conv;
6839 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6840 LDKCommitmentTransaction o_conv;
6841 o_conv.inner = (void*)(o & (~1));
6842 o_conv.is_owned = (o & 1) || (o == 0);
6843 o_conv = CommitmentTransaction_clone(&o_conv);
6844 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6845 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6846 return (uint64_t)ret_conv;
6849 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6850 LDKDecodeError e_conv;
6851 e_conv.inner = (void*)(e & (~1));
6852 e_conv.is_owned = (e & 1) || (e == 0);
6853 e_conv = DecodeError_clone(&e_conv);
6854 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6855 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6856 return (uint64_t)ret_conv;
6859 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6860 if ((_res & 1) != 0) return;
6861 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6863 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6866 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6867 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6868 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6869 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6870 return (uint64_t)ret_conv;
6873 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
6874 LDKTrustedCommitmentTransaction o_conv;
6875 o_conv.inner = (void*)(o & (~1));
6876 o_conv.is_owned = (o & 1) || (o == 0);
6877 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6878 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6879 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6880 return (uint64_t)ret_conv;
6883 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
6884 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6885 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6886 return (uint64_t)ret_conv;
6889 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
6890 if ((_res & 1) != 0) return;
6891 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6893 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6896 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
6897 LDKCVec_SignatureZ o_constr;
6898 o_constr.datalen = *((uint32_t*)o);
6899 if (o_constr.datalen > 0)
6900 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6902 o_constr.data = NULL;
6903 int8_tArray* o_vals = (int8_tArray*)(o + 4);
6904 for (size_t m = 0; m < o_constr.datalen; m++) {
6905 int8_tArray o_conv_12 = o_vals[m];
6906 LDKSignature o_conv_12_ref;
6907 CHECK(*((uint32_t*)o_conv_12) == 64);
6908 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
6909 o_constr.data[m] = o_conv_12_ref;
6911 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6912 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6913 return (uint64_t)ret_conv;
6916 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
6917 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6918 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6919 return (uint64_t)ret_conv;
6922 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
6923 if ((_res & 1) != 0) return;
6924 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6926 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6929 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
6930 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6931 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6932 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6933 return (uint64_t)ret_conv;
6936 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
6937 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6938 *ret_conv = CResult_NoneErrorZ_ok();
6939 return (uint64_t)ret_conv;
6942 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
6943 LDKIOError e_conv = LDKIOError_from_js(e);
6944 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6945 *ret_conv = CResult_NoneErrorZ_err(e_conv);
6946 return (uint64_t)ret_conv;
6949 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
6950 if ((_res & 1) != 0) return;
6951 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
6953 CResult_NoneErrorZ_free(_res_conv);
6956 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
6957 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
6958 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6959 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
6960 return (uint64_t)ret_conv;
6963 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
6965 o_conv.inner = (void*)(o & (~1));
6966 o_conv.is_owned = (o & 1) || (o == 0);
6967 o_conv = RouteHop_clone(&o_conv);
6968 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6969 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
6970 return (uint64_t)ret_conv;
6973 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
6974 LDKDecodeError e_conv;
6975 e_conv.inner = (void*)(e & (~1));
6976 e_conv.is_owned = (e & 1) || (e == 0);
6977 e_conv = DecodeError_clone(&e_conv);
6978 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6979 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
6980 return (uint64_t)ret_conv;
6983 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
6984 if ((_res & 1) != 0) return;
6985 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
6987 CResult_RouteHopDecodeErrorZ_free(_res_conv);
6990 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
6991 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
6992 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
6993 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
6994 return (uint64_t)ret_conv;
6997 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
6998 LDKCVec_RouteHopZ _res_constr;
6999 _res_constr.datalen = *((uint32_t*)_res);
7000 if (_res_constr.datalen > 0)
7001 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7003 _res_constr.data = NULL;
7004 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7005 for (size_t k = 0; k < _res_constr.datalen; k++) {
7006 uint32_t _res_conv_10 = _res_vals[k];
7007 LDKRouteHop _res_conv_10_conv;
7008 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7009 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7010 _res_constr.data[k] = _res_conv_10_conv;
7012 CVec_RouteHopZ_free(_res_constr);
7015 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7016 LDKCVec_CVec_RouteHopZZ _res_constr;
7017 _res_constr.datalen = *((uint32_t*)_res);
7018 if (_res_constr.datalen > 0)
7019 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7021 _res_constr.data = NULL;
7022 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7023 for (size_t m = 0; m < _res_constr.datalen; m++) {
7024 uint32_tArray _res_conv_12 = _res_vals[m];
7025 LDKCVec_RouteHopZ _res_conv_12_constr;
7026 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7027 if (_res_conv_12_constr.datalen > 0)
7028 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7030 _res_conv_12_constr.data = NULL;
7031 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7032 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7033 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7034 LDKRouteHop _res_conv_12_conv_10_conv;
7035 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7036 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7037 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7039 _res_constr.data[m] = _res_conv_12_constr;
7041 CVec_CVec_RouteHopZZ_free(_res_constr);
7044 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7046 o_conv.inner = (void*)(o & (~1));
7047 o_conv.is_owned = (o & 1) || (o == 0);
7048 o_conv = Route_clone(&o_conv);
7049 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7050 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7051 return (uint64_t)ret_conv;
7054 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7055 LDKDecodeError e_conv;
7056 e_conv.inner = (void*)(e & (~1));
7057 e_conv.is_owned = (e & 1) || (e == 0);
7058 e_conv = DecodeError_clone(&e_conv);
7059 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7060 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7061 return (uint64_t)ret_conv;
7064 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7065 if ((_res & 1) != 0) return;
7066 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7068 CResult_RouteDecodeErrorZ_free(_res_conv);
7071 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7072 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7073 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7074 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7075 return (uint64_t)ret_conv;
7078 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7079 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7080 *ret_copy = COption_u64Z_some(o);
7081 uint64_t ret_ref = (uint64_t)ret_copy;
7085 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7086 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7087 *ret_copy = COption_u64Z_none();
7088 uint64_t ret_ref = (uint64_t)ret_copy;
7092 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7093 if ((_res & 1) != 0) return;
7094 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7096 COption_u64Z_free(_res_conv);
7099 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7100 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7101 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7102 *ret_copy = COption_u64Z_clone(orig_conv);
7103 uint64_t ret_ref = (uint64_t)ret_copy;
7107 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7108 LDKCVec_ChannelDetailsZ _res_constr;
7109 _res_constr.datalen = *((uint32_t*)_res);
7110 if (_res_constr.datalen > 0)
7111 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7113 _res_constr.data = NULL;
7114 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7115 for (size_t q = 0; q < _res_constr.datalen; q++) {
7116 uint32_t _res_conv_16 = _res_vals[q];
7117 LDKChannelDetails _res_conv_16_conv;
7118 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7119 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7120 _res_constr.data[q] = _res_conv_16_conv;
7122 CVec_ChannelDetailsZ_free(_res_constr);
7125 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7126 LDKCVec_RouteHintZ _res_constr;
7127 _res_constr.datalen = *((uint32_t*)_res);
7128 if (_res_constr.datalen > 0)
7129 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7131 _res_constr.data = NULL;
7132 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7133 for (size_t l = 0; l < _res_constr.datalen; l++) {
7134 uint32_t _res_conv_11 = _res_vals[l];
7135 LDKRouteHint _res_conv_11_conv;
7136 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7137 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7138 _res_constr.data[l] = _res_conv_11_conv;
7140 CVec_RouteHintZ_free(_res_constr);
7143 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7145 o_conv.inner = (void*)(o & (~1));
7146 o_conv.is_owned = (o & 1) || (o == 0);
7147 o_conv = Route_clone(&o_conv);
7148 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7149 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7150 return (uint64_t)ret_conv;
7153 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7154 LDKLightningError e_conv;
7155 e_conv.inner = (void*)(e & (~1));
7156 e_conv.is_owned = (e & 1) || (e == 0);
7157 e_conv = LightningError_clone(&e_conv);
7158 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7159 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7160 return (uint64_t)ret_conv;
7163 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7164 if ((_res & 1) != 0) return;
7165 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7167 CResult_RouteLightningErrorZ_free(_res_conv);
7170 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7171 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7172 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7173 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7174 return (uint64_t)ret_conv;
7177 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7178 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7179 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7180 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7181 return (uint64_t)ret_conv;
7184 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7185 LDKAccessError e_conv = LDKAccessError_from_js(e);
7186 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7187 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7188 return (uint64_t)ret_conv;
7191 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7192 if ((_res & 1) != 0) return;
7193 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7195 CResult_TxOutAccessErrorZ_free(_res_conv);
7198 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7199 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7200 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7201 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7202 return (uint64_t)ret_conv;
7205 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
7206 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
7207 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7208 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
7209 return (uint64_t)ret_ref;
7212 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
7213 LDKTransaction b_ref;
7214 b_ref.datalen = *((uint32_t*)b);
7215 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7216 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
7217 b_ref.data_is_owned = true;
7218 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7219 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7220 return (uint64_t)ret_ref;
7223 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
7224 if ((_res & 1) != 0) return;
7225 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7227 C2Tuple_usizeTransactionZ_free(_res_conv);
7230 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
7231 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7232 _res_constr.datalen = *((uint32_t*)_res);
7233 if (_res_constr.datalen > 0)
7234 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7236 _res_constr.data = NULL;
7237 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7238 for (size_t e = 0; e < _res_constr.datalen; e++) {
7239 uint32_t _res_conv_30 = _res_vals[e];
7240 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
7241 FREE((void*)_res_conv_30);
7242 _res_constr.data[e] = _res_conv_30_conv;
7244 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7247 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
7248 LDKCVec_TxidZ _res_constr;
7249 _res_constr.datalen = *((uint32_t*)_res);
7250 if (_res_constr.datalen > 0)
7251 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7253 _res_constr.data = NULL;
7254 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7255 for (size_t m = 0; m < _res_constr.datalen; m++) {
7256 int8_tArray _res_conv_12 = _res_vals[m];
7257 LDKThirtyTwoBytes _res_conv_12_ref;
7258 CHECK(*((uint32_t*)_res_conv_12) == 32);
7259 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
7260 _res_constr.data[m] = _res_conv_12_ref;
7262 CVec_TxidZ_free(_res_constr);
7265 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
7266 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7267 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7268 return (uint64_t)ret_conv;
7271 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
7272 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
7273 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7274 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7275 return (uint64_t)ret_conv;
7278 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
7279 if ((_res & 1) != 0) return;
7280 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7282 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7285 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
7286 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7287 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7288 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7289 return (uint64_t)ret_conv;
7292 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
7293 LDKCVec_MonitorEventZ _res_constr;
7294 _res_constr.datalen = *((uint32_t*)_res);
7295 if (_res_constr.datalen > 0)
7296 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7298 _res_constr.data = NULL;
7299 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7300 for (size_t o = 0; o < _res_constr.datalen; o++) {
7301 uint32_t _res_conv_14 = _res_vals[o];
7302 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7303 FREE((void*)_res_conv_14);
7304 _res_constr.data[o] = _res_conv_14_conv;
7306 CVec_MonitorEventZ_free(_res_constr);
7309 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7310 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7311 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7312 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7313 uint64_t ret_ref = (uint64_t)ret_copy;
7317 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7318 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7319 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7320 uint64_t ret_ref = (uint64_t)ret_copy;
7324 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7325 if ((_res & 1) != 0) return;
7326 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7328 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7331 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
7332 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
7333 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7334 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
7335 uint64_t ret_ref = (uint64_t)ret_copy;
7339 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7340 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7341 _res_constr.datalen = *((uint32_t*)_res);
7342 if (_res_constr.datalen > 0)
7343 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7345 _res_constr.data = NULL;
7346 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7347 for (size_t b = 0; b < _res_constr.datalen; b++) {
7348 uint32_t _res_conv_27 = _res_vals[b];
7349 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7350 FREE((void*)_res_conv_27);
7351 _res_constr.data[b] = _res_conv_27_conv;
7353 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7356 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
7357 LDKCVec_MessageSendEventZ _res_constr;
7358 _res_constr.datalen = *((uint32_t*)_res);
7359 if (_res_constr.datalen > 0)
7360 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7362 _res_constr.data = NULL;
7363 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7364 for (size_t s = 0; s < _res_constr.datalen; s++) {
7365 uint32_t _res_conv_18 = _res_vals[s];
7366 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
7367 FREE((void*)_res_conv_18);
7368 _res_constr.data[s] = _res_conv_18_conv;
7370 CVec_MessageSendEventZ_free(_res_constr);
7373 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
7374 LDKInitFeatures o_conv;
7375 o_conv.inner = (void*)(o & (~1));
7376 o_conv.is_owned = (o & 1) || (o == 0);
7377 o_conv = InitFeatures_clone(&o_conv);
7378 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7379 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7380 return (uint64_t)ret_conv;
7383 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
7384 LDKDecodeError e_conv;
7385 e_conv.inner = (void*)(e & (~1));
7386 e_conv.is_owned = (e & 1) || (e == 0);
7387 e_conv = DecodeError_clone(&e_conv);
7388 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7389 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7390 return (uint64_t)ret_conv;
7393 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
7394 if ((_res & 1) != 0) return;
7395 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7397 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7400 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
7401 LDKNodeFeatures o_conv;
7402 o_conv.inner = (void*)(o & (~1));
7403 o_conv.is_owned = (o & 1) || (o == 0);
7404 o_conv = NodeFeatures_clone(&o_conv);
7405 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7406 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7407 return (uint64_t)ret_conv;
7410 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
7411 LDKDecodeError e_conv;
7412 e_conv.inner = (void*)(e & (~1));
7413 e_conv.is_owned = (e & 1) || (e == 0);
7414 e_conv = DecodeError_clone(&e_conv);
7415 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7416 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7417 return (uint64_t)ret_conv;
7420 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
7421 if ((_res & 1) != 0) return;
7422 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7424 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7427 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
7428 LDKChannelFeatures o_conv;
7429 o_conv.inner = (void*)(o & (~1));
7430 o_conv.is_owned = (o & 1) || (o == 0);
7431 o_conv = ChannelFeatures_clone(&o_conv);
7432 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7433 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7434 return (uint64_t)ret_conv;
7437 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
7438 LDKDecodeError e_conv;
7439 e_conv.inner = (void*)(e & (~1));
7440 e_conv.is_owned = (e & 1) || (e == 0);
7441 e_conv = DecodeError_clone(&e_conv);
7442 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7443 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7444 return (uint64_t)ret_conv;
7447 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
7448 if ((_res & 1) != 0) return;
7449 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7451 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7454 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
7455 LDKInvoiceFeatures o_conv;
7456 o_conv.inner = (void*)(o & (~1));
7457 o_conv.is_owned = (o & 1) || (o == 0);
7458 o_conv = InvoiceFeatures_clone(&o_conv);
7459 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7460 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7461 return (uint64_t)ret_conv;
7464 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
7465 LDKDecodeError e_conv;
7466 e_conv.inner = (void*)(e & (~1));
7467 e_conv.is_owned = (e & 1) || (e == 0);
7468 e_conv = DecodeError_clone(&e_conv);
7469 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7470 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7471 return (uint64_t)ret_conv;
7474 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
7475 if ((_res & 1) != 0) return;
7476 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7478 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7481 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7482 LDKDelayedPaymentOutputDescriptor o_conv;
7483 o_conv.inner = (void*)(o & (~1));
7484 o_conv.is_owned = (o & 1) || (o == 0);
7485 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
7486 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7487 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7488 return (uint64_t)ret_conv;
7491 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7492 LDKDecodeError e_conv;
7493 e_conv.inner = (void*)(e & (~1));
7494 e_conv.is_owned = (e & 1) || (e == 0);
7495 e_conv = DecodeError_clone(&e_conv);
7496 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7497 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7498 return (uint64_t)ret_conv;
7501 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7502 if ((_res & 1) != 0) return;
7503 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7505 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7508 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7509 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7510 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7511 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7512 return (uint64_t)ret_conv;
7515 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7516 LDKStaticPaymentOutputDescriptor o_conv;
7517 o_conv.inner = (void*)(o & (~1));
7518 o_conv.is_owned = (o & 1) || (o == 0);
7519 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
7520 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7521 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7522 return (uint64_t)ret_conv;
7525 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7526 LDKDecodeError e_conv;
7527 e_conv.inner = (void*)(e & (~1));
7528 e_conv.is_owned = (e & 1) || (e == 0);
7529 e_conv = DecodeError_clone(&e_conv);
7530 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7531 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7532 return (uint64_t)ret_conv;
7535 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7536 if ((_res & 1) != 0) return;
7537 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7539 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7542 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7543 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7544 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7545 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7546 return (uint64_t)ret_conv;
7549 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7550 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7551 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7552 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7553 return (uint64_t)ret_conv;
7556 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7557 LDKDecodeError e_conv;
7558 e_conv.inner = (void*)(e & (~1));
7559 e_conv.is_owned = (e & 1) || (e == 0);
7560 e_conv = DecodeError_clone(&e_conv);
7561 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7562 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7563 return (uint64_t)ret_conv;
7566 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7567 if ((_res & 1) != 0) return;
7568 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7570 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7573 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7574 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7575 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7576 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7577 return (uint64_t)ret_conv;
7580 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
7581 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7582 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7583 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7584 return (uint64_t)ret_ref;
7587 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
7589 CHECK(*((uint32_t*)a) == 64);
7590 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
7591 LDKCVec_SignatureZ b_constr;
7592 b_constr.datalen = *((uint32_t*)b);
7593 if (b_constr.datalen > 0)
7594 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7596 b_constr.data = NULL;
7597 int8_tArray* b_vals = (int8_tArray*)(b + 4);
7598 for (size_t m = 0; m < b_constr.datalen; m++) {
7599 int8_tArray b_conv_12 = b_vals[m];
7600 LDKSignature b_conv_12_ref;
7601 CHECK(*((uint32_t*)b_conv_12) == 64);
7602 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7603 b_constr.data[m] = b_conv_12_ref;
7605 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7606 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7607 return (uint64_t)ret_ref;
7610 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7611 if ((_res & 1) != 0) return;
7612 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7614 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7617 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7618 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7619 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7620 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7621 return (uint64_t)ret_conv;
7624 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7625 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7626 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7627 return (uint64_t)ret_conv;
7630 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7631 if ((_res & 1) != 0) return;
7632 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7634 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7637 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7638 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7639 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7640 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7641 return (uint64_t)ret_conv;
7644 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7646 CHECK(*((uint32_t*)o) == 64);
7647 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7648 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7649 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7650 return (uint64_t)ret_conv;
7653 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7654 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7655 *ret_conv = CResult_SignatureNoneZ_err();
7656 return (uint64_t)ret_conv;
7659 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7660 if ((_res & 1) != 0) return;
7661 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7663 CResult_SignatureNoneZ_free(_res_conv);
7666 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7667 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7668 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7669 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7670 return (uint64_t)ret_conv;
7673 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7674 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7675 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7676 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7677 return (uint64_t)ret_conv;
7680 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7681 LDKDecodeError e_conv;
7682 e_conv.inner = (void*)(e & (~1));
7683 e_conv.is_owned = (e & 1) || (e == 0);
7684 e_conv = DecodeError_clone(&e_conv);
7685 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7686 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7687 return (uint64_t)ret_conv;
7690 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7691 if ((_res & 1) != 0) return;
7692 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7694 CResult_SignDecodeErrorZ_free(_res_conv);
7697 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7698 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7699 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7700 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7701 return (uint64_t)ret_conv;
7704 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
7705 LDKCVec_u8Z _res_ref;
7706 _res_ref.datalen = *((uint32_t*)_res);
7707 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
7708 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7709 CVec_u8Z_free(_res_ref);
7712 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
7713 LDKRecoverableSignature arg_ref;
7714 CHECK(*((uint32_t*)arg) == 68);
7715 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
7716 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7717 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
7718 return (uint64_t)ret_conv;
7721 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
7722 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7723 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
7724 return (uint64_t)ret_conv;
7727 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
7728 if ((_res & 1) != 0) return;
7729 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
7731 CResult_RecoverableSignatureNoneZ_free(_res_conv);
7734 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
7735 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
7736 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7737 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
7738 return (uint64_t)ret_conv;
7741 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7742 LDKCVec_CVec_u8ZZ _res_constr;
7743 _res_constr.datalen = *((uint32_t*)_res);
7744 if (_res_constr.datalen > 0)
7745 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7747 _res_constr.data = NULL;
7748 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7749 for (size_t m = 0; m < _res_constr.datalen; m++) {
7750 int8_tArray _res_conv_12 = _res_vals[m];
7751 LDKCVec_u8Z _res_conv_12_ref;
7752 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7753 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7754 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7755 _res_constr.data[m] = _res_conv_12_ref;
7757 CVec_CVec_u8ZZ_free(_res_constr);
7760 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7761 LDKCVec_CVec_u8ZZ o_constr;
7762 o_constr.datalen = *((uint32_t*)o);
7763 if (o_constr.datalen > 0)
7764 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7766 o_constr.data = NULL;
7767 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7768 for (size_t m = 0; m < o_constr.datalen; m++) {
7769 int8_tArray o_conv_12 = o_vals[m];
7770 LDKCVec_u8Z o_conv_12_ref;
7771 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7772 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7773 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7774 o_constr.data[m] = o_conv_12_ref;
7776 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7777 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7778 return (uint64_t)ret_conv;
7781 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7782 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7783 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7784 return (uint64_t)ret_conv;
7787 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7788 if ((_res & 1) != 0) return;
7789 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7791 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7794 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7795 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7796 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7797 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7798 return (uint64_t)ret_conv;
7801 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7802 LDKInMemorySigner o_conv;
7803 o_conv.inner = (void*)(o & (~1));
7804 o_conv.is_owned = (o & 1) || (o == 0);
7805 o_conv = InMemorySigner_clone(&o_conv);
7806 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7807 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7808 return (uint64_t)ret_conv;
7811 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7812 LDKDecodeError e_conv;
7813 e_conv.inner = (void*)(e & (~1));
7814 e_conv.is_owned = (e & 1) || (e == 0);
7815 e_conv = DecodeError_clone(&e_conv);
7816 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7817 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7818 return (uint64_t)ret_conv;
7821 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7822 if ((_res & 1) != 0) return;
7823 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7825 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7828 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7829 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7830 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7831 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7832 return (uint64_t)ret_conv;
7835 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7836 LDKCVec_TxOutZ _res_constr;
7837 _res_constr.datalen = *((uint32_t*)_res);
7838 if (_res_constr.datalen > 0)
7839 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7841 _res_constr.data = NULL;
7842 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7843 for (size_t h = 0; h < _res_constr.datalen; h++) {
7844 uint32_t _res_conv_7 = _res_vals[h];
7845 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7846 FREE((void*)_res_conv_7);
7847 _res_constr.data[h] = _res_conv_7_conv;
7849 CVec_TxOutZ_free(_res_constr);
7852 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7853 LDKTransaction o_ref;
7854 o_ref.datalen = *((uint32_t*)o);
7855 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7856 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7857 o_ref.data_is_owned = true;
7858 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7859 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7860 return (uint64_t)ret_conv;
7863 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7864 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7865 *ret_conv = CResult_TransactionNoneZ_err();
7866 return (uint64_t)ret_conv;
7869 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7870 if ((_res & 1) != 0) return;
7871 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7873 CResult_TransactionNoneZ_free(_res_conv);
7876 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
7877 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
7878 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7879 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
7880 return (uint64_t)ret_conv;
7883 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
7884 LDKThirtyTwoBytes a_ref;
7885 CHECK(*((uint32_t*)a) == 32);
7886 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
7887 LDKChannelMonitor b_conv;
7888 b_conv.inner = (void*)(b & (~1));
7889 b_conv.is_owned = (b & 1) || (b == 0);
7890 b_conv = ChannelMonitor_clone(&b_conv);
7891 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7892 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7893 return (uint64_t)ret_ref;
7896 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
7897 if ((_res & 1) != 0) return;
7898 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7900 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7903 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
7904 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
7905 _res_constr.datalen = *((uint32_t*)_res);
7906 if (_res_constr.datalen > 0)
7907 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
7909 _res_constr.data = NULL;
7910 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7911 for (size_t m = 0; m < _res_constr.datalen; m++) {
7912 uint32_t _res_conv_38 = _res_vals[m];
7913 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
7914 FREE((void*)_res_conv_38);
7915 _res_constr.data[m] = _res_conv_38_conv;
7917 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
7920 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
7921 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
7922 o_constr.datalen = *((uint32_t*)o);
7923 if (o_constr.datalen > 0)
7924 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
7926 o_constr.data = NULL;
7927 uint32_t* o_vals = (uint32_t*)(o + 4);
7928 for (size_t m = 0; m < o_constr.datalen; m++) {
7929 uint32_t o_conv_38 = o_vals[m];
7930 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
7931 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
7932 o_constr.data[m] = o_conv_38_conv;
7934 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
7935 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
7936 return (uint64_t)ret_conv;
7939 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
7940 LDKIOError e_conv = LDKIOError_from_js(e);
7941 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
7942 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
7943 return (uint64_t)ret_conv;
7946 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
7947 if ((_res & 1) != 0) return;
7948 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
7950 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
7953 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
7954 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7955 *ret_copy = COption_u16Z_some(o);
7956 uint64_t ret_ref = (uint64_t)ret_copy;
7960 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
7961 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7962 *ret_copy = COption_u16Z_none();
7963 uint64_t ret_ref = (uint64_t)ret_copy;
7967 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
7968 if ((_res & 1) != 0) return;
7969 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
7971 COption_u16Z_free(_res_conv);
7974 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
7975 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
7976 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
7977 *ret_copy = COption_u16Z_clone(orig_conv);
7978 uint64_t ret_ref = (uint64_t)ret_copy;
7982 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
7983 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7984 *ret_conv = CResult_NoneAPIErrorZ_ok();
7985 return (uint64_t)ret_conv;
7988 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
7989 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
7990 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7991 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
7992 return (uint64_t)ret_conv;
7995 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
7996 if ((_res & 1) != 0) return;
7997 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
7999 CResult_NoneAPIErrorZ_free(_res_conv);
8002 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8003 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8004 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8005 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8006 return (uint64_t)ret_conv;
8009 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8010 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8011 _res_constr.datalen = *((uint32_t*)_res);
8012 if (_res_constr.datalen > 0)
8013 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8015 _res_constr.data = NULL;
8016 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8017 for (size_t w = 0; w < _res_constr.datalen; w++) {
8018 uint32_t _res_conv_22 = _res_vals[w];
8019 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8020 FREE((void*)_res_conv_22);
8021 _res_constr.data[w] = _res_conv_22_conv;
8023 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8026 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8027 LDKCVec_APIErrorZ _res_constr;
8028 _res_constr.datalen = *((uint32_t*)_res);
8029 if (_res_constr.datalen > 0)
8030 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8032 _res_constr.data = NULL;
8033 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8034 for (size_t k = 0; k < _res_constr.datalen; k++) {
8035 uint32_t _res_conv_10 = _res_vals[k];
8036 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8037 FREE((void*)_res_conv_10);
8038 _res_constr.data[k] = _res_conv_10_conv;
8040 CVec_APIErrorZ_free(_res_constr);
8043 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8044 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8045 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8046 return (uint64_t)ret_conv;
8049 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8050 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8051 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8052 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8053 return (uint64_t)ret_conv;
8056 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8057 if ((_res & 1) != 0) return;
8058 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8060 CResult_NonePaymentSendFailureZ_free(_res_conv);
8063 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
8064 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8065 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8066 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8067 return (uint64_t)ret_conv;
8070 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
8071 LDKCVec_NetAddressZ _res_constr;
8072 _res_constr.datalen = *((uint32_t*)_res);
8073 if (_res_constr.datalen > 0)
8074 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8076 _res_constr.data = NULL;
8077 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8078 for (size_t m = 0; m < _res_constr.datalen; m++) {
8079 uint32_t _res_conv_12 = _res_vals[m];
8080 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
8081 FREE((void*)_res_conv_12);
8082 _res_constr.data[m] = _res_conv_12_conv;
8084 CVec_NetAddressZ_free(_res_constr);
8087 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
8088 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
8089 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8090 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
8091 return (uint64_t)ret_ref;
8094 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
8095 LDKThirtyTwoBytes a_ref;
8096 CHECK(*((uint32_t*)a) == 32);
8097 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8098 LDKThirtyTwoBytes b_ref;
8099 CHECK(*((uint32_t*)b) == 32);
8100 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8101 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8102 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
8103 return (uint64_t)ret_ref;
8106 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
8107 if ((_res & 1) != 0) return;
8108 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
8110 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
8113 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
8114 LDKThirtyTwoBytes o_ref;
8115 CHECK(*((uint32_t*)o) == 32);
8116 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8117 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8118 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
8119 return (uint64_t)ret_conv;
8122 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
8123 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8124 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8125 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
8126 return (uint64_t)ret_conv;
8129 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
8130 if ((_res & 1) != 0) return;
8131 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
8133 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
8136 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
8137 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
8138 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8139 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
8140 return (uint64_t)ret_conv;
8143 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
8144 LDKCVec_ChannelMonitorZ _res_constr;
8145 _res_constr.datalen = *((uint32_t*)_res);
8146 if (_res_constr.datalen > 0)
8147 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8149 _res_constr.data = NULL;
8150 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8151 for (size_t q = 0; q < _res_constr.datalen; q++) {
8152 uint32_t _res_conv_16 = _res_vals[q];
8153 LDKChannelMonitor _res_conv_16_conv;
8154 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8155 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8156 _res_constr.data[q] = _res_conv_16_conv;
8158 CVec_ChannelMonitorZ_free(_res_constr);
8161 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
8162 LDKThirtyTwoBytes a_ref;
8163 CHECK(*((uint32_t*)a) == 32);
8164 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8165 LDKChannelManager b_conv;
8166 b_conv.inner = (void*)(b & (~1));
8167 b_conv.is_owned = (b & 1) || (b == 0);
8168 // Warning: we need a move here but no clone is available for LDKChannelManager
8169 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8170 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8171 return (uint64_t)ret_ref;
8174 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
8175 if ((_res & 1) != 0) return;
8176 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8178 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8181 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
8182 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8183 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8184 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8185 return (uint64_t)ret_conv;
8188 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
8189 LDKDecodeError e_conv;
8190 e_conv.inner = (void*)(e & (~1));
8191 e_conv.is_owned = (e & 1) || (e == 0);
8192 e_conv = DecodeError_clone(&e_conv);
8193 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8194 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8195 return (uint64_t)ret_conv;
8198 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
8199 if ((_res & 1) != 0) return;
8200 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8202 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8205 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8206 LDKChannelConfig o_conv;
8207 o_conv.inner = (void*)(o & (~1));
8208 o_conv.is_owned = (o & 1) || (o == 0);
8209 o_conv = ChannelConfig_clone(&o_conv);
8210 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8211 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8212 return (uint64_t)ret_conv;
8215 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8216 LDKDecodeError e_conv;
8217 e_conv.inner = (void*)(e & (~1));
8218 e_conv.is_owned = (e & 1) || (e == 0);
8219 e_conv = DecodeError_clone(&e_conv);
8220 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8221 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8222 return (uint64_t)ret_conv;
8225 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
8226 if ((_res & 1) != 0) return;
8227 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
8229 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
8232 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
8233 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
8234 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8235 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
8236 return (uint64_t)ret_conv;
8239 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
8241 o_conv.inner = (void*)(o & (~1));
8242 o_conv.is_owned = (o & 1) || (o == 0);
8243 o_conv = OutPoint_clone(&o_conv);
8244 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8245 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
8246 return (uint64_t)ret_conv;
8249 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
8250 LDKDecodeError e_conv;
8251 e_conv.inner = (void*)(e & (~1));
8252 e_conv.is_owned = (e & 1) || (e == 0);
8253 e_conv = DecodeError_clone(&e_conv);
8254 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8255 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
8256 return (uint64_t)ret_conv;
8259 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
8260 if ((_res & 1) != 0) return;
8261 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
8263 CResult_OutPointDecodeErrorZ_free(_res_conv);
8266 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
8267 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
8268 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8269 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
8270 return (uint64_t)ret_conv;
8273 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
8274 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
8275 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8276 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
8277 return (uint64_t)ret_conv;
8280 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
8281 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8282 *ret_conv = CResult_SiPrefixNoneZ_err();
8283 return (uint64_t)ret_conv;
8286 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
8287 if ((_res & 1) != 0) return;
8288 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
8290 CResult_SiPrefixNoneZ_free(_res_conv);
8293 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
8294 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
8295 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8296 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
8297 return (uint64_t)ret_conv;
8300 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
8302 o_conv.inner = (void*)(o & (~1));
8303 o_conv.is_owned = (o & 1) || (o == 0);
8304 o_conv = Invoice_clone(&o_conv);
8305 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8306 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
8307 return (uint64_t)ret_conv;
8310 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
8311 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8312 *ret_conv = CResult_InvoiceNoneZ_err();
8313 return (uint64_t)ret_conv;
8316 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
8317 if ((_res & 1) != 0) return;
8318 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
8320 CResult_InvoiceNoneZ_free(_res_conv);
8323 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
8324 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
8325 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8326 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
8327 return (uint64_t)ret_conv;
8330 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
8331 LDKSignedRawInvoice o_conv;
8332 o_conv.inner = (void*)(o & (~1));
8333 o_conv.is_owned = (o & 1) || (o == 0);
8334 o_conv = SignedRawInvoice_clone(&o_conv);
8335 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8336 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
8337 return (uint64_t)ret_conv;
8340 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
8341 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8342 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
8343 return (uint64_t)ret_conv;
8346 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
8347 if ((_res & 1) != 0) return;
8348 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
8350 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
8353 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
8354 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
8355 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8356 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
8357 return (uint64_t)ret_conv;
8360 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
8361 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
8362 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8363 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
8364 return (uint64_t)ret_ref;
8367 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
8368 LDKRawInvoice a_conv;
8369 a_conv.inner = (void*)(a & (~1));
8370 a_conv.is_owned = (a & 1) || (a == 0);
8371 a_conv = RawInvoice_clone(&a_conv);
8372 LDKThirtyTwoBytes b_ref;
8373 CHECK(*((uint32_t*)b) == 32);
8374 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8375 LDKInvoiceSignature c_conv;
8376 c_conv.inner = (void*)(c & (~1));
8377 c_conv.is_owned = (c & 1) || (c == 0);
8378 c_conv = InvoiceSignature_clone(&c_conv);
8379 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8380 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
8381 return (uint64_t)ret_ref;
8384 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
8385 if ((_res & 1) != 0) return;
8386 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
8388 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
8391 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
8392 LDKPayeePubKey o_conv;
8393 o_conv.inner = (void*)(o & (~1));
8394 o_conv.is_owned = (o & 1) || (o == 0);
8395 o_conv = PayeePubKey_clone(&o_conv);
8396 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8397 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
8398 return (uint64_t)ret_conv;
8401 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
8402 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8403 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8404 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
8405 return (uint64_t)ret_conv;
8408 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
8409 if ((_res & 1) != 0) return;
8410 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
8412 CResult_PayeePubKeyErrorZ_free(_res_conv);
8415 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
8416 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
8417 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8418 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
8419 return (uint64_t)ret_conv;
8422 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
8423 LDKCVec_PrivateRouteZ _res_constr;
8424 _res_constr.datalen = *((uint32_t*)_res);
8425 if (_res_constr.datalen > 0)
8426 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
8428 _res_constr.data = NULL;
8429 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8430 for (size_t o = 0; o < _res_constr.datalen; o++) {
8431 uint32_t _res_conv_14 = _res_vals[o];
8432 LDKPrivateRoute _res_conv_14_conv;
8433 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
8434 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
8435 _res_constr.data[o] = _res_conv_14_conv;
8437 CVec_PrivateRouteZ_free(_res_constr);
8440 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
8441 LDKPositiveTimestamp o_conv;
8442 o_conv.inner = (void*)(o & (~1));
8443 o_conv.is_owned = (o & 1) || (o == 0);
8444 o_conv = PositiveTimestamp_clone(&o_conv);
8445 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8446 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
8447 return (uint64_t)ret_conv;
8450 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
8451 LDKCreationError e_conv = LDKCreationError_from_js(e);
8452 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8453 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
8454 return (uint64_t)ret_conv;
8457 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
8458 if ((_res & 1) != 0) return;
8459 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
8461 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
8464 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
8465 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
8466 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8467 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
8468 return (uint64_t)ret_conv;
8471 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
8472 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8473 *ret_conv = CResult_NoneSemanticErrorZ_ok();
8474 return (uint64_t)ret_conv;
8477 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
8478 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8479 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8480 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
8481 return (uint64_t)ret_conv;
8484 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
8485 if ((_res & 1) != 0) return;
8486 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
8488 CResult_NoneSemanticErrorZ_free(_res_conv);
8491 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
8492 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
8493 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8494 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
8495 return (uint64_t)ret_conv;
8498 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
8500 o_conv.inner = (void*)(o & (~1));
8501 o_conv.is_owned = (o & 1) || (o == 0);
8502 o_conv = Invoice_clone(&o_conv);
8503 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8504 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
8505 return (uint64_t)ret_conv;
8508 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
8509 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8510 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8511 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
8512 return (uint64_t)ret_conv;
8515 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
8516 if ((_res & 1) != 0) return;
8517 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
8519 CResult_InvoiceSemanticErrorZ_free(_res_conv);
8522 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
8523 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
8524 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8525 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
8526 return (uint64_t)ret_conv;
8529 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
8530 LDKDescription o_conv;
8531 o_conv.inner = (void*)(o & (~1));
8532 o_conv.is_owned = (o & 1) || (o == 0);
8533 o_conv = Description_clone(&o_conv);
8534 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8535 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
8536 return (uint64_t)ret_conv;
8539 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
8540 LDKCreationError e_conv = LDKCreationError_from_js(e);
8541 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8542 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
8543 return (uint64_t)ret_conv;
8546 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
8547 if ((_res & 1) != 0) return;
8548 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
8550 CResult_DescriptionCreationErrorZ_free(_res_conv);
8553 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
8554 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
8555 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8556 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
8557 return (uint64_t)ret_conv;
8560 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
8561 LDKExpiryTime o_conv;
8562 o_conv.inner = (void*)(o & (~1));
8563 o_conv.is_owned = (o & 1) || (o == 0);
8564 o_conv = ExpiryTime_clone(&o_conv);
8565 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8566 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
8567 return (uint64_t)ret_conv;
8570 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
8571 LDKCreationError e_conv = LDKCreationError_from_js(e);
8572 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8573 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
8574 return (uint64_t)ret_conv;
8577 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
8578 if ((_res & 1) != 0) return;
8579 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
8581 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
8584 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
8585 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
8586 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8587 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
8588 return (uint64_t)ret_conv;
8591 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
8592 LDKPrivateRoute o_conv;
8593 o_conv.inner = (void*)(o & (~1));
8594 o_conv.is_owned = (o & 1) || (o == 0);
8595 o_conv = PrivateRoute_clone(&o_conv);
8596 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8597 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
8598 return (uint64_t)ret_conv;
8601 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
8602 LDKCreationError e_conv = LDKCreationError_from_js(e);
8603 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8604 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
8605 return (uint64_t)ret_conv;
8608 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
8609 if ((_res & 1) != 0) return;
8610 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
8612 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
8615 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
8616 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
8617 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8618 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
8619 return (uint64_t)ret_conv;
8622 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
8623 LDKStr o_conv = str_ref_to_owned_c(o);
8624 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8625 *ret_conv = CResult_StringErrorZ_ok(o_conv);
8626 return (uint64_t)ret_conv;
8629 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
8630 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8631 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8632 *ret_conv = CResult_StringErrorZ_err(e_conv);
8633 return (uint64_t)ret_conv;
8636 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
8637 if ((_res & 1) != 0) return;
8638 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
8640 CResult_StringErrorZ_free(_res_conv);
8643 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
8644 LDKChannelMonitorUpdate o_conv;
8645 o_conv.inner = (void*)(o & (~1));
8646 o_conv.is_owned = (o & 1) || (o == 0);
8647 o_conv = ChannelMonitorUpdate_clone(&o_conv);
8648 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8649 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
8650 return (uint64_t)ret_conv;
8653 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
8654 LDKDecodeError e_conv;
8655 e_conv.inner = (void*)(e & (~1));
8656 e_conv.is_owned = (e & 1) || (e == 0);
8657 e_conv = DecodeError_clone(&e_conv);
8658 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8659 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
8660 return (uint64_t)ret_conv;
8663 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
8664 if ((_res & 1) != 0) return;
8665 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8667 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
8670 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
8671 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
8672 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8673 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
8674 return (uint64_t)ret_conv;
8677 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
8678 LDKHTLCUpdate o_conv;
8679 o_conv.inner = (void*)(o & (~1));
8680 o_conv.is_owned = (o & 1) || (o == 0);
8681 o_conv = HTLCUpdate_clone(&o_conv);
8682 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8683 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
8684 return (uint64_t)ret_conv;
8687 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
8688 LDKDecodeError e_conv;
8689 e_conv.inner = (void*)(e & (~1));
8690 e_conv.is_owned = (e & 1) || (e == 0);
8691 e_conv = DecodeError_clone(&e_conv);
8692 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8693 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
8694 return (uint64_t)ret_conv;
8697 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
8698 if ((_res & 1) != 0) return;
8699 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8701 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
8704 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
8705 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
8706 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8707 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
8708 return (uint64_t)ret_conv;
8711 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
8712 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8713 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
8714 return (uint64_t)ret_conv;
8717 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
8718 LDKMonitorUpdateError e_conv;
8719 e_conv.inner = (void*)(e & (~1));
8720 e_conv.is_owned = (e & 1) || (e == 0);
8721 e_conv = MonitorUpdateError_clone(&e_conv);
8722 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8723 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
8724 return (uint64_t)ret_conv;
8727 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
8728 if ((_res & 1) != 0) return;
8729 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
8731 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
8734 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
8735 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
8736 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8737 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
8738 return (uint64_t)ret_conv;
8741 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
8742 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
8743 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8744 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
8745 return (uint64_t)ret_ref;
8748 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
8750 a_conv.inner = (void*)(a & (~1));
8751 a_conv.is_owned = (a & 1) || (a == 0);
8752 a_conv = OutPoint_clone(&a_conv);
8754 b_ref.datalen = *((uint32_t*)b);
8755 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8756 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8757 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8758 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
8759 return (uint64_t)ret_ref;
8762 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
8763 if ((_res & 1) != 0) return;
8764 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
8766 C2Tuple_OutPointScriptZ_free(_res_conv);
8769 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
8770 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
8771 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8772 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
8773 return (uint64_t)ret_ref;
8776 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
8778 b_ref.datalen = *((uint32_t*)b);
8779 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8780 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8781 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8782 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
8783 return (uint64_t)ret_ref;
8786 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
8787 if ((_res & 1) != 0) return;
8788 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
8790 C2Tuple_u32ScriptZ_free(_res_conv);
8793 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
8794 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
8795 _res_constr.datalen = *((uint32_t*)_res);
8796 if (_res_constr.datalen > 0)
8797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
8799 _res_constr.data = NULL;
8800 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8801 for (size_t e = 0; e < _res_constr.datalen; e++) {
8802 uint32_t _res_conv_30 = _res_vals[e];
8803 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
8804 FREE((void*)_res_conv_30);
8805 _res_constr.data[e] = _res_conv_30_conv;
8807 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
8810 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
8811 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
8812 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
8813 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
8814 return (uint64_t)ret_ref;
8817 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
8818 LDKThirtyTwoBytes a_ref;
8819 CHECK(*((uint32_t*)a) == 32);
8820 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8821 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
8822 b_constr.datalen = *((uint32_t*)b);
8823 if (b_constr.datalen > 0)
8824 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
8826 b_constr.data = NULL;
8827 uint32_t* b_vals = (uint32_t*)(b + 4);
8828 for (size_t e = 0; e < b_constr.datalen; e++) {
8829 uint32_t b_conv_30 = b_vals[e];
8830 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
8831 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
8832 b_constr.data[e] = b_conv_30_conv;
8834 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
8835 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
8836 return (uint64_t)ret_ref;
8839 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
8840 if ((_res & 1) != 0) return;
8841 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
8843 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
8846 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
8847 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
8848 _res_constr.datalen = *((uint32_t*)_res);
8849 if (_res_constr.datalen > 0)
8850 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
8852 _res_constr.data = NULL;
8853 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8854 for (size_t c = 0; c < _res_constr.datalen; c++) {
8855 uint32_t _res_conv_54 = _res_vals[c];
8856 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
8857 FREE((void*)_res_conv_54);
8858 _res_constr.data[c] = _res_conv_54_conv;
8860 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
8863 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
8864 LDKCVec_EventZ _res_constr;
8865 _res_constr.datalen = *((uint32_t*)_res);
8866 if (_res_constr.datalen > 0)
8867 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
8869 _res_constr.data = NULL;
8870 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8871 for (size_t h = 0; h < _res_constr.datalen; h++) {
8872 uint32_t _res_conv_7 = _res_vals[h];
8873 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
8874 FREE((void*)_res_conv_7);
8875 _res_constr.data[h] = _res_conv_7_conv;
8877 CVec_EventZ_free(_res_constr);
8880 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
8881 LDKCVec_TransactionZ _res_constr;
8882 _res_constr.datalen = *((uint32_t*)_res);
8883 if (_res_constr.datalen > 0)
8884 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8886 _res_constr.data = NULL;
8887 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8888 for (size_t m = 0; m < _res_constr.datalen; m++) {
8889 int8_tArray _res_conv_12 = _res_vals[m];
8890 LDKTransaction _res_conv_12_ref;
8891 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8892 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
8893 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8894 _res_conv_12_ref.data_is_owned = true;
8895 _res_constr.data[m] = _res_conv_12_ref;
8897 CVec_TransactionZ_free(_res_constr);
8900 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
8901 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
8902 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8903 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
8904 return (uint64_t)ret_ref;
8907 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
8908 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
8909 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8910 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
8911 return (uint64_t)ret_ref;
8914 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
8915 if ((_res & 1) != 0) return;
8916 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
8918 C2Tuple_u32TxOutZ_free(_res_conv);
8921 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
8922 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
8923 _res_constr.datalen = *((uint32_t*)_res);
8924 if (_res_constr.datalen > 0)
8925 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8927 _res_constr.data = NULL;
8928 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8929 for (size_t z = 0; z < _res_constr.datalen; z++) {
8930 uint32_t _res_conv_25 = _res_vals[z];
8931 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
8932 FREE((void*)_res_conv_25);
8933 _res_constr.data[z] = _res_conv_25_conv;
8935 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
8938 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
8939 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
8940 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8941 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
8942 return (uint64_t)ret_ref;
8945 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
8946 LDKThirtyTwoBytes a_ref;
8947 CHECK(*((uint32_t*)a) == 32);
8948 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8949 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
8950 b_constr.datalen = *((uint32_t*)b);
8951 if (b_constr.datalen > 0)
8952 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8954 b_constr.data = NULL;
8955 uint32_t* b_vals = (uint32_t*)(b + 4);
8956 for (size_t z = 0; z < b_constr.datalen; z++) {
8957 uint32_t b_conv_25 = b_vals[z];
8958 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
8959 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
8960 b_constr.data[z] = b_conv_25_conv;
8962 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8963 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
8964 return (uint64_t)ret_ref;
8967 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
8968 if ((_res & 1) != 0) return;
8969 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
8971 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
8974 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
8975 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
8976 _res_constr.datalen = *((uint32_t*)_res);
8977 if (_res_constr.datalen > 0)
8978 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
8980 _res_constr.data = NULL;
8981 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8982 for (size_t x = 0; x < _res_constr.datalen; x++) {
8983 uint32_t _res_conv_49 = _res_vals[x];
8984 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
8985 FREE((void*)_res_conv_49);
8986 _res_constr.data[x] = _res_conv_49_conv;
8988 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
8991 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
8992 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
8993 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8994 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
8995 return (uint64_t)ret_conv;
8998 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
8999 LDKDecodeError e_conv;
9000 e_conv.inner = (void*)(e & (~1));
9001 e_conv.is_owned = (e & 1) || (e == 0);
9002 e_conv = DecodeError_clone(&e_conv);
9003 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9004 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
9005 return (uint64_t)ret_conv;
9008 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
9009 if ((_res & 1) != 0) return;
9010 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9012 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
9015 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
9016 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9017 *ret_conv = CResult_boolLightningErrorZ_ok(o);
9018 return (uint64_t)ret_conv;
9021 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
9022 LDKLightningError e_conv;
9023 e_conv.inner = (void*)(e & (~1));
9024 e_conv.is_owned = (e & 1) || (e == 0);
9025 e_conv = LightningError_clone(&e_conv);
9026 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9027 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
9028 return (uint64_t)ret_conv;
9031 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
9032 if ((_res & 1) != 0) return;
9033 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
9035 CResult_boolLightningErrorZ_free(_res_conv);
9038 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
9039 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
9040 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9041 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
9042 return (uint64_t)ret_conv;
9045 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
9046 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
9047 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9048 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
9049 return (uint64_t)ret_ref;
9052 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
9053 LDKChannelAnnouncement a_conv;
9054 a_conv.inner = (void*)(a & (~1));
9055 a_conv.is_owned = (a & 1) || (a == 0);
9056 a_conv = ChannelAnnouncement_clone(&a_conv);
9057 LDKChannelUpdate b_conv;
9058 b_conv.inner = (void*)(b & (~1));
9059 b_conv.is_owned = (b & 1) || (b == 0);
9060 b_conv = ChannelUpdate_clone(&b_conv);
9061 LDKChannelUpdate c_conv;
9062 c_conv.inner = (void*)(c & (~1));
9063 c_conv.is_owned = (c & 1) || (c == 0);
9064 c_conv = ChannelUpdate_clone(&c_conv);
9065 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9066 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
9067 return (uint64_t)ret_ref;
9070 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
9071 if ((_res & 1) != 0) return;
9072 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
9074 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
9077 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
9078 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
9079 _res_constr.datalen = *((uint32_t*)_res);
9080 if (_res_constr.datalen > 0)
9081 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9083 _res_constr.data = NULL;
9084 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9085 for (size_t l = 0; l < _res_constr.datalen; l++) {
9086 uint32_t _res_conv_63 = _res_vals[l];
9087 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
9088 FREE((void*)_res_conv_63);
9089 _res_constr.data[l] = _res_conv_63_conv;
9091 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
9094 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
9095 LDKCVec_NodeAnnouncementZ _res_constr;
9096 _res_constr.datalen = *((uint32_t*)_res);
9097 if (_res_constr.datalen > 0)
9098 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9100 _res_constr.data = NULL;
9101 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9102 for (size_t s = 0; s < _res_constr.datalen; s++) {
9103 uint32_t _res_conv_18 = _res_vals[s];
9104 LDKNodeAnnouncement _res_conv_18_conv;
9105 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
9106 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
9107 _res_constr.data[s] = _res_conv_18_conv;
9109 CVec_NodeAnnouncementZ_free(_res_constr);
9112 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
9113 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9114 *ret_conv = CResult_NoneLightningErrorZ_ok();
9115 return (uint64_t)ret_conv;
9118 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
9119 LDKLightningError e_conv;
9120 e_conv.inner = (void*)(e & (~1));
9121 e_conv.is_owned = (e & 1) || (e == 0);
9122 e_conv = LightningError_clone(&e_conv);
9123 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9124 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
9125 return (uint64_t)ret_conv;
9128 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
9129 if ((_res & 1) != 0) return;
9130 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
9132 CResult_NoneLightningErrorZ_free(_res_conv);
9135 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
9136 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
9137 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9138 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
9139 return (uint64_t)ret_conv;
9142 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
9143 LDKCVec_PublicKeyZ _res_constr;
9144 _res_constr.datalen = *((uint32_t*)_res);
9145 if (_res_constr.datalen > 0)
9146 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9148 _res_constr.data = NULL;
9149 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9150 for (size_t m = 0; m < _res_constr.datalen; m++) {
9151 int8_tArray _res_conv_12 = _res_vals[m];
9152 LDKPublicKey _res_conv_12_ref;
9153 CHECK(*((uint32_t*)_res_conv_12) == 33);
9154 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
9155 _res_constr.data[m] = _res_conv_12_ref;
9157 CVec_PublicKeyZ_free(_res_constr);
9160 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
9162 o_ref.datalen = *((uint32_t*)o);
9163 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
9164 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9165 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9166 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
9167 return (uint64_t)ret_conv;
9170 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
9171 LDKPeerHandleError e_conv;
9172 e_conv.inner = (void*)(e & (~1));
9173 e_conv.is_owned = (e & 1) || (e == 0);
9174 e_conv = PeerHandleError_clone(&e_conv);
9175 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9176 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
9177 return (uint64_t)ret_conv;
9180 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
9181 if ((_res & 1) != 0) return;
9182 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9184 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
9187 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
9188 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
9189 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9190 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
9191 return (uint64_t)ret_conv;
9194 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
9195 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9196 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
9197 return (uint64_t)ret_conv;
9200 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
9201 LDKPeerHandleError e_conv;
9202 e_conv.inner = (void*)(e & (~1));
9203 e_conv.is_owned = (e & 1) || (e == 0);
9204 e_conv = PeerHandleError_clone(&e_conv);
9205 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9206 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
9207 return (uint64_t)ret_conv;
9210 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
9211 if ((_res & 1) != 0) return;
9212 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9214 CResult_NonePeerHandleErrorZ_free(_res_conv);
9217 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
9218 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
9219 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9220 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
9221 return (uint64_t)ret_conv;
9224 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
9225 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9226 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
9227 return (uint64_t)ret_conv;
9230 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
9231 LDKPeerHandleError e_conv;
9232 e_conv.inner = (void*)(e & (~1));
9233 e_conv.is_owned = (e & 1) || (e == 0);
9234 e_conv = PeerHandleError_clone(&e_conv);
9235 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9236 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
9237 return (uint64_t)ret_conv;
9240 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
9241 if ((_res & 1) != 0) return;
9242 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9244 CResult_boolPeerHandleErrorZ_free(_res_conv);
9247 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
9248 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
9249 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9250 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
9251 return (uint64_t)ret_conv;
9254 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
9255 LDKDirectionalChannelInfo o_conv;
9256 o_conv.inner = (void*)(o & (~1));
9257 o_conv.is_owned = (o & 1) || (o == 0);
9258 o_conv = DirectionalChannelInfo_clone(&o_conv);
9259 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9260 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
9261 return (uint64_t)ret_conv;
9264 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
9265 LDKDecodeError e_conv;
9266 e_conv.inner = (void*)(e & (~1));
9267 e_conv.is_owned = (e & 1) || (e == 0);
9268 e_conv = DecodeError_clone(&e_conv);
9269 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9270 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
9271 return (uint64_t)ret_conv;
9274 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
9275 if ((_res & 1) != 0) return;
9276 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9278 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
9281 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9282 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
9283 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9284 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
9285 return (uint64_t)ret_conv;
9288 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
9289 LDKChannelInfo o_conv;
9290 o_conv.inner = (void*)(o & (~1));
9291 o_conv.is_owned = (o & 1) || (o == 0);
9292 o_conv = ChannelInfo_clone(&o_conv);
9293 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9294 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
9295 return (uint64_t)ret_conv;
9298 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
9299 LDKDecodeError e_conv;
9300 e_conv.inner = (void*)(e & (~1));
9301 e_conv.is_owned = (e & 1) || (e == 0);
9302 e_conv = DecodeError_clone(&e_conv);
9303 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9304 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
9305 return (uint64_t)ret_conv;
9308 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
9309 if ((_res & 1) != 0) return;
9310 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9312 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
9315 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9316 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
9317 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9318 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
9319 return (uint64_t)ret_conv;
9322 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
9323 LDKRoutingFees o_conv;
9324 o_conv.inner = (void*)(o & (~1));
9325 o_conv.is_owned = (o & 1) || (o == 0);
9326 o_conv = RoutingFees_clone(&o_conv);
9327 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9328 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
9329 return (uint64_t)ret_conv;
9332 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
9333 LDKDecodeError e_conv;
9334 e_conv.inner = (void*)(e & (~1));
9335 e_conv.is_owned = (e & 1) || (e == 0);
9336 e_conv = DecodeError_clone(&e_conv);
9337 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9338 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
9339 return (uint64_t)ret_conv;
9342 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
9343 if ((_res & 1) != 0) return;
9344 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9346 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
9349 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
9350 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
9351 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9352 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
9353 return (uint64_t)ret_conv;
9356 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
9357 LDKNodeAnnouncementInfo o_conv;
9358 o_conv.inner = (void*)(o & (~1));
9359 o_conv.is_owned = (o & 1) || (o == 0);
9360 o_conv = NodeAnnouncementInfo_clone(&o_conv);
9361 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9362 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
9363 return (uint64_t)ret_conv;
9366 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
9367 LDKDecodeError e_conv;
9368 e_conv.inner = (void*)(e & (~1));
9369 e_conv.is_owned = (e & 1) || (e == 0);
9370 e_conv = DecodeError_clone(&e_conv);
9371 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9372 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
9373 return (uint64_t)ret_conv;
9376 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
9377 if ((_res & 1) != 0) return;
9378 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9380 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
9383 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
9384 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
9385 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9386 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
9387 return (uint64_t)ret_conv;
9390 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
9391 LDKCVec_u64Z _res_constr;
9392 _res_constr.datalen = *((uint32_t*)_res);
9393 if (_res_constr.datalen > 0)
9394 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
9396 _res_constr.data = NULL;
9397 int64_t* _res_vals = (int64_t*)(_res + 4);
9398 for (size_t i = 0; i < _res_constr.datalen; i++) {
9399 int64_t _res_conv_8 = _res_vals[i];
9400 _res_constr.data[i] = _res_conv_8;
9402 CVec_u64Z_free(_res_constr);
9405 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
9407 o_conv.inner = (void*)(o & (~1));
9408 o_conv.is_owned = (o & 1) || (o == 0);
9409 o_conv = NodeInfo_clone(&o_conv);
9410 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9411 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
9412 return (uint64_t)ret_conv;
9415 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
9416 LDKDecodeError e_conv;
9417 e_conv.inner = (void*)(e & (~1));
9418 e_conv.is_owned = (e & 1) || (e == 0);
9419 e_conv = DecodeError_clone(&e_conv);
9420 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9421 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
9422 return (uint64_t)ret_conv;
9425 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
9426 if ((_res & 1) != 0) return;
9427 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9429 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
9432 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
9433 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
9434 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9435 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
9436 return (uint64_t)ret_conv;
9439 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
9440 LDKNetworkGraph o_conv;
9441 o_conv.inner = (void*)(o & (~1));
9442 o_conv.is_owned = (o & 1) || (o == 0);
9443 o_conv = NetworkGraph_clone(&o_conv);
9444 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9445 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
9446 return (uint64_t)ret_conv;
9449 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
9450 LDKDecodeError e_conv;
9451 e_conv.inner = (void*)(e & (~1));
9452 e_conv.is_owned = (e & 1) || (e == 0);
9453 e_conv = DecodeError_clone(&e_conv);
9454 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9455 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
9456 return (uint64_t)ret_conv;
9459 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
9460 if ((_res & 1) != 0) return;
9461 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
9463 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
9466 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
9467 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
9468 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9469 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
9470 return (uint64_t)ret_conv;
9473 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
9474 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9475 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9476 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
9477 return (uint64_t)ret_conv;
9480 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
9481 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9482 *ret_conv = CResult_NetAddressu8Z_err(e);
9483 return (uint64_t)ret_conv;
9486 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
9487 if ((_res & 1) != 0) return;
9488 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
9490 CResult_NetAddressu8Z_free(_res_conv);
9493 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
9494 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
9495 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9496 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
9497 return (uint64_t)ret_conv;
9500 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
9501 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
9502 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9503 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
9504 return (uint64_t)ret_conv;
9507 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
9508 LDKDecodeError e_conv;
9509 e_conv.inner = (void*)(e & (~1));
9510 e_conv.is_owned = (e & 1) || (e == 0);
9511 e_conv = DecodeError_clone(&e_conv);
9512 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9513 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
9514 return (uint64_t)ret_conv;
9517 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
9518 if ((_res & 1) != 0) return;
9519 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9521 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
9524 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
9525 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
9526 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9527 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
9528 return (uint64_t)ret_conv;
9531 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
9532 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9533 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9534 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
9535 return (uint64_t)ret_conv;
9538 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
9539 LDKDecodeError e_conv;
9540 e_conv.inner = (void*)(e & (~1));
9541 e_conv.is_owned = (e & 1) || (e == 0);
9542 e_conv = DecodeError_clone(&e_conv);
9543 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9544 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
9545 return (uint64_t)ret_conv;
9548 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
9549 if ((_res & 1) != 0) return;
9550 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
9552 CResult_NetAddressDecodeErrorZ_free(_res_conv);
9555 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
9556 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
9557 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9558 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
9559 return (uint64_t)ret_conv;
9562 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
9563 LDKCVec_UpdateAddHTLCZ _res_constr;
9564 _res_constr.datalen = *((uint32_t*)_res);
9565 if (_res_constr.datalen > 0)
9566 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
9568 _res_constr.data = NULL;
9569 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9570 for (size_t p = 0; p < _res_constr.datalen; p++) {
9571 uint32_t _res_conv_15 = _res_vals[p];
9572 LDKUpdateAddHTLC _res_conv_15_conv;
9573 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
9574 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
9575 _res_constr.data[p] = _res_conv_15_conv;
9577 CVec_UpdateAddHTLCZ_free(_res_constr);
9580 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
9581 LDKCVec_UpdateFulfillHTLCZ _res_constr;
9582 _res_constr.datalen = *((uint32_t*)_res);
9583 if (_res_constr.datalen > 0)
9584 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
9586 _res_constr.data = NULL;
9587 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9588 for (size_t t = 0; t < _res_constr.datalen; t++) {
9589 uint32_t _res_conv_19 = _res_vals[t];
9590 LDKUpdateFulfillHTLC _res_conv_19_conv;
9591 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
9592 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
9593 _res_constr.data[t] = _res_conv_19_conv;
9595 CVec_UpdateFulfillHTLCZ_free(_res_constr);
9598 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
9599 LDKCVec_UpdateFailHTLCZ _res_constr;
9600 _res_constr.datalen = *((uint32_t*)_res);
9601 if (_res_constr.datalen > 0)
9602 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
9604 _res_constr.data = NULL;
9605 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9606 for (size_t q = 0; q < _res_constr.datalen; q++) {
9607 uint32_t _res_conv_16 = _res_vals[q];
9608 LDKUpdateFailHTLC _res_conv_16_conv;
9609 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9610 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9611 _res_constr.data[q] = _res_conv_16_conv;
9613 CVec_UpdateFailHTLCZ_free(_res_constr);
9616 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
9617 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
9618 _res_constr.datalen = *((uint32_t*)_res);
9619 if (_res_constr.datalen > 0)
9620 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
9622 _res_constr.data = NULL;
9623 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9624 for (size_t z = 0; z < _res_constr.datalen; z++) {
9625 uint32_t _res_conv_25 = _res_vals[z];
9626 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
9627 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
9628 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
9629 _res_constr.data[z] = _res_conv_25_conv;
9631 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
9634 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
9635 LDKAcceptChannel o_conv;
9636 o_conv.inner = (void*)(o & (~1));
9637 o_conv.is_owned = (o & 1) || (o == 0);
9638 o_conv = AcceptChannel_clone(&o_conv);
9639 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9640 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
9641 return (uint64_t)ret_conv;
9644 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
9645 LDKDecodeError e_conv;
9646 e_conv.inner = (void*)(e & (~1));
9647 e_conv.is_owned = (e & 1) || (e == 0);
9648 e_conv = DecodeError_clone(&e_conv);
9649 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9650 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
9651 return (uint64_t)ret_conv;
9654 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
9655 if ((_res & 1) != 0) return;
9656 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9658 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
9661 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
9662 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
9663 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9664 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
9665 return (uint64_t)ret_conv;
9668 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
9669 LDKAnnouncementSignatures o_conv;
9670 o_conv.inner = (void*)(o & (~1));
9671 o_conv.is_owned = (o & 1) || (o == 0);
9672 o_conv = AnnouncementSignatures_clone(&o_conv);
9673 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9674 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
9675 return (uint64_t)ret_conv;
9678 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
9679 LDKDecodeError e_conv;
9680 e_conv.inner = (void*)(e & (~1));
9681 e_conv.is_owned = (e & 1) || (e == 0);
9682 e_conv = DecodeError_clone(&e_conv);
9683 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9684 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
9685 return (uint64_t)ret_conv;
9688 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
9689 if ((_res & 1) != 0) return;
9690 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9692 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
9695 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
9696 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
9697 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9698 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
9699 return (uint64_t)ret_conv;
9702 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
9703 LDKChannelReestablish o_conv;
9704 o_conv.inner = (void*)(o & (~1));
9705 o_conv.is_owned = (o & 1) || (o == 0);
9706 o_conv = ChannelReestablish_clone(&o_conv);
9707 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9708 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
9709 return (uint64_t)ret_conv;
9712 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
9713 LDKDecodeError e_conv;
9714 e_conv.inner = (void*)(e & (~1));
9715 e_conv.is_owned = (e & 1) || (e == 0);
9716 e_conv = DecodeError_clone(&e_conv);
9717 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9718 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
9719 return (uint64_t)ret_conv;
9722 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
9723 if ((_res & 1) != 0) return;
9724 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
9726 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
9729 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
9730 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
9731 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9732 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
9733 return (uint64_t)ret_conv;
9736 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
9737 LDKClosingSigned o_conv;
9738 o_conv.inner = (void*)(o & (~1));
9739 o_conv.is_owned = (o & 1) || (o == 0);
9740 o_conv = ClosingSigned_clone(&o_conv);
9741 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9742 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
9743 return (uint64_t)ret_conv;
9746 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
9747 LDKDecodeError e_conv;
9748 e_conv.inner = (void*)(e & (~1));
9749 e_conv.is_owned = (e & 1) || (e == 0);
9750 e_conv = DecodeError_clone(&e_conv);
9751 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9752 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
9753 return (uint64_t)ret_conv;
9756 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
9757 if ((_res & 1) != 0) return;
9758 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9760 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
9763 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
9764 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
9765 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9766 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
9767 return (uint64_t)ret_conv;
9770 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
9771 LDKCommitmentSigned o_conv;
9772 o_conv.inner = (void*)(o & (~1));
9773 o_conv.is_owned = (o & 1) || (o == 0);
9774 o_conv = CommitmentSigned_clone(&o_conv);
9775 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9776 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
9777 return (uint64_t)ret_conv;
9780 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
9781 LDKDecodeError e_conv;
9782 e_conv.inner = (void*)(e & (~1));
9783 e_conv.is_owned = (e & 1) || (e == 0);
9784 e_conv = DecodeError_clone(&e_conv);
9785 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9786 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
9787 return (uint64_t)ret_conv;
9790 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
9791 if ((_res & 1) != 0) return;
9792 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9794 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
9797 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
9798 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
9799 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9800 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
9801 return (uint64_t)ret_conv;
9804 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
9805 LDKFundingCreated o_conv;
9806 o_conv.inner = (void*)(o & (~1));
9807 o_conv.is_owned = (o & 1) || (o == 0);
9808 o_conv = FundingCreated_clone(&o_conv);
9809 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9810 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
9811 return (uint64_t)ret_conv;
9814 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
9815 LDKDecodeError e_conv;
9816 e_conv.inner = (void*)(e & (~1));
9817 e_conv.is_owned = (e & 1) || (e == 0);
9818 e_conv = DecodeError_clone(&e_conv);
9819 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9820 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
9821 return (uint64_t)ret_conv;
9824 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
9825 if ((_res & 1) != 0) return;
9826 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9828 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
9831 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
9832 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
9833 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9834 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
9835 return (uint64_t)ret_conv;
9838 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
9839 LDKFundingSigned o_conv;
9840 o_conv.inner = (void*)(o & (~1));
9841 o_conv.is_owned = (o & 1) || (o == 0);
9842 o_conv = FundingSigned_clone(&o_conv);
9843 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9844 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
9845 return (uint64_t)ret_conv;
9848 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
9849 LDKDecodeError e_conv;
9850 e_conv.inner = (void*)(e & (~1));
9851 e_conv.is_owned = (e & 1) || (e == 0);
9852 e_conv = DecodeError_clone(&e_conv);
9853 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9854 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
9855 return (uint64_t)ret_conv;
9858 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
9859 if ((_res & 1) != 0) return;
9860 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9862 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
9865 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
9866 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
9867 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9868 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
9869 return (uint64_t)ret_conv;
9872 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
9873 LDKFundingLocked o_conv;
9874 o_conv.inner = (void*)(o & (~1));
9875 o_conv.is_owned = (o & 1) || (o == 0);
9876 o_conv = FundingLocked_clone(&o_conv);
9877 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9878 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
9879 return (uint64_t)ret_conv;
9882 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
9883 LDKDecodeError e_conv;
9884 e_conv.inner = (void*)(e & (~1));
9885 e_conv.is_owned = (e & 1) || (e == 0);
9886 e_conv = DecodeError_clone(&e_conv);
9887 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9888 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
9889 return (uint64_t)ret_conv;
9892 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
9893 if ((_res & 1) != 0) return;
9894 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9896 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
9899 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
9900 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
9901 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9902 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
9903 return (uint64_t)ret_conv;
9906 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
9908 o_conv.inner = (void*)(o & (~1));
9909 o_conv.is_owned = (o & 1) || (o == 0);
9910 o_conv = Init_clone(&o_conv);
9911 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9912 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
9913 return (uint64_t)ret_conv;
9916 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
9917 LDKDecodeError e_conv;
9918 e_conv.inner = (void*)(e & (~1));
9919 e_conv.is_owned = (e & 1) || (e == 0);
9920 e_conv = DecodeError_clone(&e_conv);
9921 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9922 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
9923 return (uint64_t)ret_conv;
9926 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
9927 if ((_res & 1) != 0) return;
9928 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
9930 CResult_InitDecodeErrorZ_free(_res_conv);
9933 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
9934 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
9935 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9936 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
9937 return (uint64_t)ret_conv;
9940 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
9941 LDKOpenChannel o_conv;
9942 o_conv.inner = (void*)(o & (~1));
9943 o_conv.is_owned = (o & 1) || (o == 0);
9944 o_conv = OpenChannel_clone(&o_conv);
9945 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9946 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
9947 return (uint64_t)ret_conv;
9950 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
9951 LDKDecodeError e_conv;
9952 e_conv.inner = (void*)(e & (~1));
9953 e_conv.is_owned = (e & 1) || (e == 0);
9954 e_conv = DecodeError_clone(&e_conv);
9955 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9956 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
9957 return (uint64_t)ret_conv;
9960 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
9961 if ((_res & 1) != 0) return;
9962 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9964 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
9967 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
9968 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
9969 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9970 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
9971 return (uint64_t)ret_conv;
9974 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
9975 LDKRevokeAndACK o_conv;
9976 o_conv.inner = (void*)(o & (~1));
9977 o_conv.is_owned = (o & 1) || (o == 0);
9978 o_conv = RevokeAndACK_clone(&o_conv);
9979 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9980 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
9981 return (uint64_t)ret_conv;
9984 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
9985 LDKDecodeError e_conv;
9986 e_conv.inner = (void*)(e & (~1));
9987 e_conv.is_owned = (e & 1) || (e == 0);
9988 e_conv = DecodeError_clone(&e_conv);
9989 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9990 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
9991 return (uint64_t)ret_conv;
9994 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
9995 if ((_res & 1) != 0) return;
9996 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
9998 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
10001 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
10002 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
10003 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10004 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
10005 return (uint64_t)ret_conv;
10008 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
10009 LDKShutdown o_conv;
10010 o_conv.inner = (void*)(o & (~1));
10011 o_conv.is_owned = (o & 1) || (o == 0);
10012 o_conv = Shutdown_clone(&o_conv);
10013 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10014 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
10015 return (uint64_t)ret_conv;
10018 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
10019 LDKDecodeError e_conv;
10020 e_conv.inner = (void*)(e & (~1));
10021 e_conv.is_owned = (e & 1) || (e == 0);
10022 e_conv = DecodeError_clone(&e_conv);
10023 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10024 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
10025 return (uint64_t)ret_conv;
10028 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
10029 if ((_res & 1) != 0) return;
10030 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
10032 CResult_ShutdownDecodeErrorZ_free(_res_conv);
10035 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
10036 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
10037 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10038 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
10039 return (uint64_t)ret_conv;
10042 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
10043 LDKUpdateFailHTLC o_conv;
10044 o_conv.inner = (void*)(o & (~1));
10045 o_conv.is_owned = (o & 1) || (o == 0);
10046 o_conv = UpdateFailHTLC_clone(&o_conv);
10047 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10048 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
10049 return (uint64_t)ret_conv;
10052 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
10053 LDKDecodeError e_conv;
10054 e_conv.inner = (void*)(e & (~1));
10055 e_conv.is_owned = (e & 1) || (e == 0);
10056 e_conv = DecodeError_clone(&e_conv);
10057 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10058 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
10059 return (uint64_t)ret_conv;
10062 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
10063 if ((_res & 1) != 0) return;
10064 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10066 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
10069 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
10070 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
10071 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10072 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
10073 return (uint64_t)ret_conv;
10076 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
10077 LDKUpdateFailMalformedHTLC o_conv;
10078 o_conv.inner = (void*)(o & (~1));
10079 o_conv.is_owned = (o & 1) || (o == 0);
10080 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
10081 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10082 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
10083 return (uint64_t)ret_conv;
10086 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
10087 LDKDecodeError e_conv;
10088 e_conv.inner = (void*)(e & (~1));
10089 e_conv.is_owned = (e & 1) || (e == 0);
10090 e_conv = DecodeError_clone(&e_conv);
10091 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10092 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
10093 return (uint64_t)ret_conv;
10096 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
10097 if ((_res & 1) != 0) return;
10098 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10100 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
10103 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
10104 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
10105 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10106 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
10107 return (uint64_t)ret_conv;
10110 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
10111 LDKUpdateFee o_conv;
10112 o_conv.inner = (void*)(o & (~1));
10113 o_conv.is_owned = (o & 1) || (o == 0);
10114 o_conv = UpdateFee_clone(&o_conv);
10115 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10116 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
10117 return (uint64_t)ret_conv;
10120 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
10121 LDKDecodeError e_conv;
10122 e_conv.inner = (void*)(e & (~1));
10123 e_conv.is_owned = (e & 1) || (e == 0);
10124 e_conv = DecodeError_clone(&e_conv);
10125 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10126 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
10127 return (uint64_t)ret_conv;
10130 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
10131 if ((_res & 1) != 0) return;
10132 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10134 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
10137 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
10138 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
10139 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10140 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
10141 return (uint64_t)ret_conv;
10144 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
10145 LDKUpdateFulfillHTLC o_conv;
10146 o_conv.inner = (void*)(o & (~1));
10147 o_conv.is_owned = (o & 1) || (o == 0);
10148 o_conv = UpdateFulfillHTLC_clone(&o_conv);
10149 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10150 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
10151 return (uint64_t)ret_conv;
10154 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
10155 LDKDecodeError e_conv;
10156 e_conv.inner = (void*)(e & (~1));
10157 e_conv.is_owned = (e & 1) || (e == 0);
10158 e_conv = DecodeError_clone(&e_conv);
10159 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10160 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
10161 return (uint64_t)ret_conv;
10164 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
10165 if ((_res & 1) != 0) return;
10166 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10168 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
10171 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
10172 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
10173 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10174 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
10175 return (uint64_t)ret_conv;
10178 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
10179 LDKUpdateAddHTLC o_conv;
10180 o_conv.inner = (void*)(o & (~1));
10181 o_conv.is_owned = (o & 1) || (o == 0);
10182 o_conv = UpdateAddHTLC_clone(&o_conv);
10183 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10184 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
10185 return (uint64_t)ret_conv;
10188 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
10189 LDKDecodeError e_conv;
10190 e_conv.inner = (void*)(e & (~1));
10191 e_conv.is_owned = (e & 1) || (e == 0);
10192 e_conv = DecodeError_clone(&e_conv);
10193 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10194 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
10195 return (uint64_t)ret_conv;
10198 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
10199 if ((_res & 1) != 0) return;
10200 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10202 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
10205 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
10206 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
10207 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10208 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
10209 return (uint64_t)ret_conv;
10212 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
10214 o_conv.inner = (void*)(o & (~1));
10215 o_conv.is_owned = (o & 1) || (o == 0);
10216 o_conv = Ping_clone(&o_conv);
10217 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10218 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
10219 return (uint64_t)ret_conv;
10222 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
10223 LDKDecodeError e_conv;
10224 e_conv.inner = (void*)(e & (~1));
10225 e_conv.is_owned = (e & 1) || (e == 0);
10226 e_conv = DecodeError_clone(&e_conv);
10227 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10228 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
10229 return (uint64_t)ret_conv;
10232 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
10233 if ((_res & 1) != 0) return;
10234 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
10236 CResult_PingDecodeErrorZ_free(_res_conv);
10239 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
10240 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
10241 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10242 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
10243 return (uint64_t)ret_conv;
10246 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
10248 o_conv.inner = (void*)(o & (~1));
10249 o_conv.is_owned = (o & 1) || (o == 0);
10250 o_conv = Pong_clone(&o_conv);
10251 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10252 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
10253 return (uint64_t)ret_conv;
10256 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
10257 LDKDecodeError e_conv;
10258 e_conv.inner = (void*)(e & (~1));
10259 e_conv.is_owned = (e & 1) || (e == 0);
10260 e_conv = DecodeError_clone(&e_conv);
10261 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10262 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
10263 return (uint64_t)ret_conv;
10266 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
10267 if ((_res & 1) != 0) return;
10268 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
10270 CResult_PongDecodeErrorZ_free(_res_conv);
10273 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
10274 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
10275 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10276 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
10277 return (uint64_t)ret_conv;
10280 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10281 LDKUnsignedChannelAnnouncement o_conv;
10282 o_conv.inner = (void*)(o & (~1));
10283 o_conv.is_owned = (o & 1) || (o == 0);
10284 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
10285 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10286 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
10287 return (uint64_t)ret_conv;
10290 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10291 LDKDecodeError e_conv;
10292 e_conv.inner = (void*)(e & (~1));
10293 e_conv.is_owned = (e & 1) || (e == 0);
10294 e_conv = DecodeError_clone(&e_conv);
10295 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10296 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
10297 return (uint64_t)ret_conv;
10300 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10301 if ((_res & 1) != 0) return;
10302 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10304 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
10307 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10308 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10309 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10310 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10311 return (uint64_t)ret_conv;
10314 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10315 LDKChannelAnnouncement o_conv;
10316 o_conv.inner = (void*)(o & (~1));
10317 o_conv.is_owned = (o & 1) || (o == 0);
10318 o_conv = ChannelAnnouncement_clone(&o_conv);
10319 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10320 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
10321 return (uint64_t)ret_conv;
10324 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10325 LDKDecodeError e_conv;
10326 e_conv.inner = (void*)(e & (~1));
10327 e_conv.is_owned = (e & 1) || (e == 0);
10328 e_conv = DecodeError_clone(&e_conv);
10329 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10330 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
10331 return (uint64_t)ret_conv;
10334 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10335 if ((_res & 1) != 0) return;
10336 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10338 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
10341 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10342 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10343 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10344 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10345 return (uint64_t)ret_conv;
10348 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10349 LDKUnsignedChannelUpdate o_conv;
10350 o_conv.inner = (void*)(o & (~1));
10351 o_conv.is_owned = (o & 1) || (o == 0);
10352 o_conv = UnsignedChannelUpdate_clone(&o_conv);
10353 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10354 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
10355 return (uint64_t)ret_conv;
10358 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
10359 LDKDecodeError e_conv;
10360 e_conv.inner = (void*)(e & (~1));
10361 e_conv.is_owned = (e & 1) || (e == 0);
10362 e_conv = DecodeError_clone(&e_conv);
10363 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10364 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
10365 return (uint64_t)ret_conv;
10368 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10369 if ((_res & 1) != 0) return;
10370 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10372 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
10375 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10376 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
10377 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10378 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
10379 return (uint64_t)ret_conv;
10382 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10383 LDKChannelUpdate o_conv;
10384 o_conv.inner = (void*)(o & (~1));
10385 o_conv.is_owned = (o & 1) || (o == 0);
10386 o_conv = ChannelUpdate_clone(&o_conv);
10387 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10388 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
10389 return (uint64_t)ret_conv;
10392 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
10393 LDKDecodeError e_conv;
10394 e_conv.inner = (void*)(e & (~1));
10395 e_conv.is_owned = (e & 1) || (e == 0);
10396 e_conv = DecodeError_clone(&e_conv);
10397 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10398 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
10399 return (uint64_t)ret_conv;
10402 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10403 if ((_res & 1) != 0) return;
10404 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10406 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
10409 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10410 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
10411 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10412 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
10413 return (uint64_t)ret_conv;
10416 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
10417 LDKErrorMessage o_conv;
10418 o_conv.inner = (void*)(o & (~1));
10419 o_conv.is_owned = (o & 1) || (o == 0);
10420 o_conv = ErrorMessage_clone(&o_conv);
10421 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10422 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
10423 return (uint64_t)ret_conv;
10426 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
10427 LDKDecodeError e_conv;
10428 e_conv.inner = (void*)(e & (~1));
10429 e_conv.is_owned = (e & 1) || (e == 0);
10430 e_conv = DecodeError_clone(&e_conv);
10431 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10432 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
10433 return (uint64_t)ret_conv;
10436 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
10437 if ((_res & 1) != 0) return;
10438 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
10440 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
10443 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
10444 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
10445 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10446 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
10447 return (uint64_t)ret_conv;
10450 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10451 LDKUnsignedNodeAnnouncement o_conv;
10452 o_conv.inner = (void*)(o & (~1));
10453 o_conv.is_owned = (o & 1) || (o == 0);
10454 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
10455 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10456 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
10457 return (uint64_t)ret_conv;
10460 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10461 LDKDecodeError e_conv;
10462 e_conv.inner = (void*)(e & (~1));
10463 e_conv.is_owned = (e & 1) || (e == 0);
10464 e_conv = DecodeError_clone(&e_conv);
10465 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10466 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
10467 return (uint64_t)ret_conv;
10470 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10471 if ((_res & 1) != 0) return;
10472 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10474 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
10477 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10478 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
10479 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10480 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
10481 return (uint64_t)ret_conv;
10484 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10485 LDKNodeAnnouncement o_conv;
10486 o_conv.inner = (void*)(o & (~1));
10487 o_conv.is_owned = (o & 1) || (o == 0);
10488 o_conv = NodeAnnouncement_clone(&o_conv);
10489 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10490 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
10491 return (uint64_t)ret_conv;
10494 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10495 LDKDecodeError e_conv;
10496 e_conv.inner = (void*)(e & (~1));
10497 e_conv.is_owned = (e & 1) || (e == 0);
10498 e_conv = DecodeError_clone(&e_conv);
10499 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10500 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
10501 return (uint64_t)ret_conv;
10504 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10505 if ((_res & 1) != 0) return;
10506 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10508 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
10511 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10512 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
10513 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10514 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
10515 return (uint64_t)ret_conv;
10518 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
10519 LDKQueryShortChannelIds o_conv;
10520 o_conv.inner = (void*)(o & (~1));
10521 o_conv.is_owned = (o & 1) || (o == 0);
10522 o_conv = QueryShortChannelIds_clone(&o_conv);
10523 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10524 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
10525 return (uint64_t)ret_conv;
10528 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
10529 LDKDecodeError e_conv;
10530 e_conv.inner = (void*)(e & (~1));
10531 e_conv.is_owned = (e & 1) || (e == 0);
10532 e_conv = DecodeError_clone(&e_conv);
10533 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10534 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
10535 return (uint64_t)ret_conv;
10538 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
10539 if ((_res & 1) != 0) return;
10540 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
10542 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
10545 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
10546 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
10547 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10548 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
10549 return (uint64_t)ret_conv;
10552 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
10553 LDKReplyShortChannelIdsEnd o_conv;
10554 o_conv.inner = (void*)(o & (~1));
10555 o_conv.is_owned = (o & 1) || (o == 0);
10556 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
10557 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10558 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
10559 return (uint64_t)ret_conv;
10562 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
10563 LDKDecodeError e_conv;
10564 e_conv.inner = (void*)(e & (~1));
10565 e_conv.is_owned = (e & 1) || (e == 0);
10566 e_conv = DecodeError_clone(&e_conv);
10567 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10568 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
10569 return (uint64_t)ret_conv;
10572 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
10573 if ((_res & 1) != 0) return;
10574 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
10576 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
10579 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
10580 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
10581 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10582 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
10583 return (uint64_t)ret_conv;
10586 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
10587 LDKQueryChannelRange o_conv;
10588 o_conv.inner = (void*)(o & (~1));
10589 o_conv.is_owned = (o & 1) || (o == 0);
10590 o_conv = QueryChannelRange_clone(&o_conv);
10591 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10592 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
10593 return (uint64_t)ret_conv;
10596 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
10597 LDKDecodeError e_conv;
10598 e_conv.inner = (void*)(e & (~1));
10599 e_conv.is_owned = (e & 1) || (e == 0);
10600 e_conv = DecodeError_clone(&e_conv);
10601 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10602 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
10603 return (uint64_t)ret_conv;
10606 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
10607 if ((_res & 1) != 0) return;
10608 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10610 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
10613 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10614 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
10615 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10616 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
10617 return (uint64_t)ret_conv;
10620 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
10621 LDKReplyChannelRange o_conv;
10622 o_conv.inner = (void*)(o & (~1));
10623 o_conv.is_owned = (o & 1) || (o == 0);
10624 o_conv = ReplyChannelRange_clone(&o_conv);
10625 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10626 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
10627 return (uint64_t)ret_conv;
10630 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
10631 LDKDecodeError e_conv;
10632 e_conv.inner = (void*)(e & (~1));
10633 e_conv.is_owned = (e & 1) || (e == 0);
10634 e_conv = DecodeError_clone(&e_conv);
10635 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10636 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
10637 return (uint64_t)ret_conv;
10640 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
10641 if ((_res & 1) != 0) return;
10642 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10644 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
10647 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10648 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
10649 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10650 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
10651 return (uint64_t)ret_conv;
10654 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
10655 LDKGossipTimestampFilter o_conv;
10656 o_conv.inner = (void*)(o & (~1));
10657 o_conv.is_owned = (o & 1) || (o == 0);
10658 o_conv = GossipTimestampFilter_clone(&o_conv);
10659 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10660 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
10661 return (uint64_t)ret_conv;
10664 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
10665 LDKDecodeError e_conv;
10666 e_conv.inner = (void*)(e & (~1));
10667 e_conv.is_owned = (e & 1) || (e == 0);
10668 e_conv = DecodeError_clone(&e_conv);
10669 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10670 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
10671 return (uint64_t)ret_conv;
10674 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
10675 if ((_res & 1) != 0) return;
10676 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
10678 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
10681 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
10682 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
10683 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10684 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
10685 return (uint64_t)ret_conv;
10688 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
10690 o_conv.inner = (void*)(o & (~1));
10691 o_conv.is_owned = (o & 1) || (o == 0);
10692 o_conv = Invoice_clone(&o_conv);
10693 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10694 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
10695 return (uint64_t)ret_conv;
10698 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
10699 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
10700 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10701 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
10702 return (uint64_t)ret_conv;
10705 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
10706 if ((_res & 1) != 0) return;
10707 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
10709 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
10712 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
10713 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
10714 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10715 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
10716 return (uint64_t)ret_conv;
10719 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
10720 if ((this_ptr & 1) != 0) return;
10721 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
10722 FREE((void*)this_ptr);
10723 Event_free(this_ptr_conv);
10726 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
10727 LDKEvent* orig_conv = (LDKEvent*)orig;
10728 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10729 *ret_copy = Event_clone(orig_conv);
10730 uint64_t ret_ref = (uint64_t)ret_copy;
10734 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) {
10735 LDKThirtyTwoBytes temporary_channel_id_ref;
10736 CHECK(*((uint32_t*)temporary_channel_id) == 32);
10737 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
10738 LDKCVec_u8Z output_script_ref;
10739 output_script_ref.datalen = *((uint32_t*)output_script);
10740 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
10741 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
10742 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10743 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
10744 uint64_t ret_ref = (uint64_t)ret_copy;
10748 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
10749 LDKThirtyTwoBytes payment_hash_ref;
10750 CHECK(*((uint32_t*)payment_hash) == 32);
10751 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10752 LDKThirtyTwoBytes payment_preimage_ref;
10753 CHECK(*((uint32_t*)payment_preimage) == 32);
10754 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10755 LDKThirtyTwoBytes payment_secret_ref;
10756 CHECK(*((uint32_t*)payment_secret) == 32);
10757 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10758 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10759 *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
10760 uint64_t ret_ref = (uint64_t)ret_copy;
10764 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
10765 LDKThirtyTwoBytes payment_preimage_ref;
10766 CHECK(*((uint32_t*)payment_preimage) == 32);
10767 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10768 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10769 *ret_copy = Event_payment_sent(payment_preimage_ref);
10770 uint64_t ret_ref = (uint64_t)ret_copy;
10774 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_hash, jboolean rejected_by_dest) {
10775 LDKThirtyTwoBytes payment_hash_ref;
10776 CHECK(*((uint32_t*)payment_hash) == 32);
10777 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10778 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10779 *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
10780 uint64_t ret_ref = (uint64_t)ret_copy;
10784 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
10785 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10786 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
10787 uint64_t ret_ref = (uint64_t)ret_copy;
10791 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
10792 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
10793 outputs_constr.datalen = *((uint32_t*)outputs);
10794 if (outputs_constr.datalen > 0)
10795 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10797 outputs_constr.data = NULL;
10798 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10799 for (size_t b = 0; b < outputs_constr.datalen; b++) {
10800 uint32_t outputs_conv_27 = outputs_vals[b];
10801 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
10802 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
10803 outputs_constr.data[b] = outputs_conv_27_conv;
10805 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10806 *ret_copy = Event_spendable_outputs(outputs_constr);
10807 uint64_t ret_ref = (uint64_t)ret_copy;
10811 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
10812 LDKEvent* obj_conv = (LDKEvent*)obj;
10813 LDKCVec_u8Z ret_var = Event_write(obj_conv);
10814 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10815 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10816 CVec_u8Z_free(ret_var);
10820 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
10821 if ((this_ptr & 1) != 0) return;
10822 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
10823 FREE((void*)this_ptr);
10824 MessageSendEvent_free(this_ptr_conv);
10827 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
10828 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
10829 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10830 *ret_copy = MessageSendEvent_clone(orig_conv);
10831 uint64_t ret_ref = (uint64_t)ret_copy;
10835 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
10836 LDKPublicKey node_id_ref;
10837 CHECK(*((uint32_t*)node_id) == 33);
10838 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10839 LDKAcceptChannel msg_conv;
10840 msg_conv.inner = (void*)(msg & (~1));
10841 msg_conv.is_owned = (msg & 1) || (msg == 0);
10842 msg_conv = AcceptChannel_clone(&msg_conv);
10843 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10844 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
10845 uint64_t ret_ref = (uint64_t)ret_copy;
10849 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
10850 LDKPublicKey node_id_ref;
10851 CHECK(*((uint32_t*)node_id) == 33);
10852 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10853 LDKOpenChannel msg_conv;
10854 msg_conv.inner = (void*)(msg & (~1));
10855 msg_conv.is_owned = (msg & 1) || (msg == 0);
10856 msg_conv = OpenChannel_clone(&msg_conv);
10857 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10858 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
10859 uint64_t ret_ref = (uint64_t)ret_copy;
10863 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
10864 LDKPublicKey node_id_ref;
10865 CHECK(*((uint32_t*)node_id) == 33);
10866 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10867 LDKFundingCreated msg_conv;
10868 msg_conv.inner = (void*)(msg & (~1));
10869 msg_conv.is_owned = (msg & 1) || (msg == 0);
10870 msg_conv = FundingCreated_clone(&msg_conv);
10871 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10872 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
10873 uint64_t ret_ref = (uint64_t)ret_copy;
10877 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
10878 LDKPublicKey node_id_ref;
10879 CHECK(*((uint32_t*)node_id) == 33);
10880 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10881 LDKFundingSigned msg_conv;
10882 msg_conv.inner = (void*)(msg & (~1));
10883 msg_conv.is_owned = (msg & 1) || (msg == 0);
10884 msg_conv = FundingSigned_clone(&msg_conv);
10885 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10886 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
10887 uint64_t ret_ref = (uint64_t)ret_copy;
10891 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
10892 LDKPublicKey node_id_ref;
10893 CHECK(*((uint32_t*)node_id) == 33);
10894 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10895 LDKFundingLocked msg_conv;
10896 msg_conv.inner = (void*)(msg & (~1));
10897 msg_conv.is_owned = (msg & 1) || (msg == 0);
10898 msg_conv = FundingLocked_clone(&msg_conv);
10899 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10900 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
10901 uint64_t ret_ref = (uint64_t)ret_copy;
10905 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
10906 LDKPublicKey node_id_ref;
10907 CHECK(*((uint32_t*)node_id) == 33);
10908 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10909 LDKAnnouncementSignatures msg_conv;
10910 msg_conv.inner = (void*)(msg & (~1));
10911 msg_conv.is_owned = (msg & 1) || (msg == 0);
10912 msg_conv = AnnouncementSignatures_clone(&msg_conv);
10913 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10914 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
10915 uint64_t ret_ref = (uint64_t)ret_copy;
10919 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
10920 LDKPublicKey node_id_ref;
10921 CHECK(*((uint32_t*)node_id) == 33);
10922 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10923 LDKCommitmentUpdate updates_conv;
10924 updates_conv.inner = (void*)(updates & (~1));
10925 updates_conv.is_owned = (updates & 1) || (updates == 0);
10926 updates_conv = CommitmentUpdate_clone(&updates_conv);
10927 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10928 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
10929 uint64_t ret_ref = (uint64_t)ret_copy;
10933 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
10934 LDKPublicKey node_id_ref;
10935 CHECK(*((uint32_t*)node_id) == 33);
10936 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10937 LDKRevokeAndACK msg_conv;
10938 msg_conv.inner = (void*)(msg & (~1));
10939 msg_conv.is_owned = (msg & 1) || (msg == 0);
10940 msg_conv = RevokeAndACK_clone(&msg_conv);
10941 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10942 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
10943 uint64_t ret_ref = (uint64_t)ret_copy;
10947 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
10948 LDKPublicKey node_id_ref;
10949 CHECK(*((uint32_t*)node_id) == 33);
10950 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10951 LDKClosingSigned msg_conv;
10952 msg_conv.inner = (void*)(msg & (~1));
10953 msg_conv.is_owned = (msg & 1) || (msg == 0);
10954 msg_conv = ClosingSigned_clone(&msg_conv);
10955 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10956 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
10957 uint64_t ret_ref = (uint64_t)ret_copy;
10961 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
10962 LDKPublicKey node_id_ref;
10963 CHECK(*((uint32_t*)node_id) == 33);
10964 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10965 LDKShutdown msg_conv;
10966 msg_conv.inner = (void*)(msg & (~1));
10967 msg_conv.is_owned = (msg & 1) || (msg == 0);
10968 msg_conv = Shutdown_clone(&msg_conv);
10969 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10970 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
10971 uint64_t ret_ref = (uint64_t)ret_copy;
10975 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
10976 LDKPublicKey node_id_ref;
10977 CHECK(*((uint32_t*)node_id) == 33);
10978 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
10979 LDKChannelReestablish msg_conv;
10980 msg_conv.inner = (void*)(msg & (~1));
10981 msg_conv.is_owned = (msg & 1) || (msg == 0);
10982 msg_conv = ChannelReestablish_clone(&msg_conv);
10983 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10984 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
10985 uint64_t ret_ref = (uint64_t)ret_copy;
10989 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
10990 LDKChannelAnnouncement msg_conv;
10991 msg_conv.inner = (void*)(msg & (~1));
10992 msg_conv.is_owned = (msg & 1) || (msg == 0);
10993 msg_conv = ChannelAnnouncement_clone(&msg_conv);
10994 LDKChannelUpdate update_msg_conv;
10995 update_msg_conv.inner = (void*)(update_msg & (~1));
10996 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
10997 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
10998 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10999 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
11000 uint64_t ret_ref = (uint64_t)ret_copy;
11004 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
11005 LDKNodeAnnouncement msg_conv;
11006 msg_conv.inner = (void*)(msg & (~1));
11007 msg_conv.is_owned = (msg & 1) || (msg == 0);
11008 msg_conv = NodeAnnouncement_clone(&msg_conv);
11009 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11010 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
11011 uint64_t ret_ref = (uint64_t)ret_copy;
11015 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
11016 LDKChannelUpdate msg_conv;
11017 msg_conv.inner = (void*)(msg & (~1));
11018 msg_conv.is_owned = (msg & 1) || (msg == 0);
11019 msg_conv = ChannelUpdate_clone(&msg_conv);
11020 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11021 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
11022 uint64_t ret_ref = (uint64_t)ret_copy;
11026 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
11027 LDKPublicKey node_id_ref;
11028 CHECK(*((uint32_t*)node_id) == 33);
11029 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11030 LDKChannelUpdate msg_conv;
11031 msg_conv.inner = (void*)(msg & (~1));
11032 msg_conv.is_owned = (msg & 1) || (msg == 0);
11033 msg_conv = ChannelUpdate_clone(&msg_conv);
11034 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11035 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
11036 uint64_t ret_ref = (uint64_t)ret_copy;
11040 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
11041 LDKPublicKey node_id_ref;
11042 CHECK(*((uint32_t*)node_id) == 33);
11043 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11044 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
11045 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11046 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
11047 uint64_t ret_ref = (uint64_t)ret_copy;
11051 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_payment_failure_network_update(uint32_t update) {
11052 LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
11053 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11054 *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
11055 uint64_t ret_ref = (uint64_t)ret_copy;
11059 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
11060 LDKPublicKey node_id_ref;
11061 CHECK(*((uint32_t*)node_id) == 33);
11062 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11063 LDKQueryChannelRange msg_conv;
11064 msg_conv.inner = (void*)(msg & (~1));
11065 msg_conv.is_owned = (msg & 1) || (msg == 0);
11066 msg_conv = QueryChannelRange_clone(&msg_conv);
11067 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11068 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
11069 uint64_t ret_ref = (uint64_t)ret_copy;
11073 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
11074 LDKPublicKey node_id_ref;
11075 CHECK(*((uint32_t*)node_id) == 33);
11076 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11077 LDKQueryShortChannelIds msg_conv;
11078 msg_conv.inner = (void*)(msg & (~1));
11079 msg_conv.is_owned = (msg & 1) || (msg == 0);
11080 msg_conv = QueryShortChannelIds_clone(&msg_conv);
11081 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11082 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
11083 uint64_t ret_ref = (uint64_t)ret_copy;
11087 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
11088 LDKPublicKey node_id_ref;
11089 CHECK(*((uint32_t*)node_id) == 33);
11090 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11091 LDKReplyChannelRange msg_conv;
11092 msg_conv.inner = (void*)(msg & (~1));
11093 msg_conv.is_owned = (msg & 1) || (msg == 0);
11094 msg_conv = ReplyChannelRange_clone(&msg_conv);
11095 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11096 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
11097 uint64_t ret_ref = (uint64_t)ret_copy;
11101 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
11102 if ((this_ptr & 1) != 0) return;
11103 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
11104 FREE((void*)this_ptr);
11105 MessageSendEventsProvider_free(this_ptr_conv);
11108 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
11109 if ((this_ptr & 1) != 0) return;
11110 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
11111 FREE((void*)this_ptr);
11112 EventsProvider_free(this_ptr_conv);
11115 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
11116 if ((this_ptr & 1) != 0) return;
11117 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
11118 FREE((void*)this_ptr);
11119 EventHandler_free(this_ptr_conv);
11122 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
11123 if ((this_ptr & 1) != 0) return;
11124 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
11125 FREE((void*)this_ptr);
11126 APIError_free(this_ptr_conv);
11129 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
11130 LDKAPIError* orig_conv = (LDKAPIError*)orig;
11131 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11132 *ret_copy = APIError_clone(orig_conv);
11133 uint64_t ret_ref = (uint64_t)ret_copy;
11137 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
11138 LDKStr err_conv = str_ref_to_owned_c(err);
11139 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11140 *ret_copy = APIError_apimisuse_error(err_conv);
11141 uint64_t ret_ref = (uint64_t)ret_copy;
11145 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
11146 LDKStr err_conv = str_ref_to_owned_c(err);
11147 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11148 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
11149 uint64_t ret_ref = (uint64_t)ret_copy;
11153 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
11154 LDKStr err_conv = str_ref_to_owned_c(err);
11155 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11156 *ret_copy = APIError_route_error(err_conv);
11157 uint64_t ret_ref = (uint64_t)ret_copy;
11161 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
11162 LDKStr err_conv = str_ref_to_owned_c(err);
11163 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11164 *ret_copy = APIError_channel_unavailable(err_conv);
11165 uint64_t ret_ref = (uint64_t)ret_copy;
11169 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
11170 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11171 *ret_copy = APIError_monitor_update_failed();
11172 uint64_t ret_ref = (uint64_t)ret_copy;
11176 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
11177 LDKu8slice msg_ref;
11178 msg_ref.datalen = *((uint32_t*)msg);
11179 msg_ref.data = (int8_t*)(msg + 4);
11180 unsigned char sk_arr[32];
11181 CHECK(*((uint32_t*)sk) == 32);
11182 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
11183 unsigned char (*sk_ref)[32] = &sk_arr;
11184 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11185 *ret_conv = sign(msg_ref, sk_ref);
11186 return (uint64_t)ret_conv;
11189 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
11190 LDKu8slice msg_ref;
11191 msg_ref.datalen = *((uint32_t*)msg);
11192 msg_ref.data = (int8_t*)(msg + 4);
11193 LDKStr sig_conv = str_ref_to_owned_c(sig);
11194 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11195 *ret_conv = recover_pk(msg_ref, sig_conv);
11196 return (uint64_t)ret_conv;
11199 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
11200 LDKu8slice msg_ref;
11201 msg_ref.datalen = *((uint32_t*)msg);
11202 msg_ref.data = (int8_t*)(msg + 4);
11203 LDKStr sig_conv = str_ref_to_owned_c(sig);
11204 LDKPublicKey pk_ref;
11205 CHECK(*((uint32_t*)pk) == 33);
11206 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
11207 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
11211 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
11212 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
11213 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
11217 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
11218 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
11222 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
11223 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
11227 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
11228 uint32_t ret_conv = LDKLevel_to_js(Level_info());
11232 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
11233 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
11237 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
11238 uint32_t ret_conv = LDKLevel_to_js(Level_error());
11242 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
11243 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
11244 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
11245 jboolean ret_val = Level_eq(a_conv, b_conv);
11249 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
11250 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
11251 int64_t ret_val = Level_hash(o_conv);
11255 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
11256 uint32_t ret_conv = LDKLevel_to_js(Level_max());
11260 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
11261 if ((this_ptr & 1) != 0) return;
11262 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
11263 FREE((void*)this_ptr);
11264 Logger_free(this_ptr_conv);
11267 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
11268 LDKChannelHandshakeConfig this_obj_conv;
11269 this_obj_conv.inner = (void*)(this_obj & (~1));
11270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11271 ChannelHandshakeConfig_free(this_obj_conv);
11274 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
11275 LDKChannelHandshakeConfig this_ptr_conv;
11276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11277 this_ptr_conv.is_owned = false;
11278 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
11282 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
11283 LDKChannelHandshakeConfig this_ptr_conv;
11284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11285 this_ptr_conv.is_owned = false;
11286 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
11289 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
11290 LDKChannelHandshakeConfig this_ptr_conv;
11291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11292 this_ptr_conv.is_owned = false;
11293 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
11297 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
11298 LDKChannelHandshakeConfig this_ptr_conv;
11299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11300 this_ptr_conv.is_owned = false;
11301 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
11304 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
11305 LDKChannelHandshakeConfig this_ptr_conv;
11306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11307 this_ptr_conv.is_owned = false;
11308 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
11312 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11313 LDKChannelHandshakeConfig this_ptr_conv;
11314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11315 this_ptr_conv.is_owned = false;
11316 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
11319 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) {
11320 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
11321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11323 uint64_t ret_ref = (uint64_t)ret_var.inner;
11324 if (ret_var.is_owned) {
11330 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
11331 LDKChannelHandshakeConfig orig_conv;
11332 orig_conv.inner = (void*)(orig & (~1));
11333 orig_conv.is_owned = false;
11334 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
11335 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11336 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11337 uint64_t ret_ref = (uint64_t)ret_var.inner;
11338 if (ret_var.is_owned) {
11344 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
11345 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
11346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11348 uint64_t ret_ref = (uint64_t)ret_var.inner;
11349 if (ret_var.is_owned) {
11355 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
11356 LDKChannelHandshakeLimits this_obj_conv;
11357 this_obj_conv.inner = (void*)(this_obj & (~1));
11358 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11359 ChannelHandshakeLimits_free(this_obj_conv);
11362 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
11363 LDKChannelHandshakeLimits this_ptr_conv;
11364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11365 this_ptr_conv.is_owned = false;
11366 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
11370 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
11371 LDKChannelHandshakeLimits this_ptr_conv;
11372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11373 this_ptr_conv.is_owned = false;
11374 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
11377 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
11378 LDKChannelHandshakeLimits this_ptr_conv;
11379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11380 this_ptr_conv.is_owned = false;
11381 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
11385 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11386 LDKChannelHandshakeLimits this_ptr_conv;
11387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11388 this_ptr_conv.is_owned = false;
11389 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
11392 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11393 LDKChannelHandshakeLimits this_ptr_conv;
11394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11395 this_ptr_conv.is_owned = false;
11396 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
11400 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11401 LDKChannelHandshakeLimits this_ptr_conv;
11402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11403 this_ptr_conv.is_owned = false;
11404 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11407 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
11408 LDKChannelHandshakeLimits this_ptr_conv;
11409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11410 this_ptr_conv.is_owned = false;
11411 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
11415 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11416 LDKChannelHandshakeLimits this_ptr_conv;
11417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11418 this_ptr_conv.is_owned = false;
11419 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
11422 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
11423 LDKChannelHandshakeLimits this_ptr_conv;
11424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11425 this_ptr_conv.is_owned = false;
11426 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
11430 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11431 LDKChannelHandshakeLimits this_ptr_conv;
11432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11433 this_ptr_conv.is_owned = false;
11434 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
11437 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
11438 LDKChannelHandshakeLimits this_ptr_conv;
11439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11440 this_ptr_conv.is_owned = false;
11441 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
11445 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
11446 LDKChannelHandshakeLimits this_ptr_conv;
11447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11448 this_ptr_conv.is_owned = false;
11449 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
11452 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
11453 LDKChannelHandshakeLimits this_ptr_conv;
11454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11455 this_ptr_conv.is_owned = false;
11456 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
11460 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
11461 LDKChannelHandshakeLimits this_ptr_conv;
11462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11463 this_ptr_conv.is_owned = false;
11464 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
11467 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
11468 LDKChannelHandshakeLimits this_ptr_conv;
11469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11470 this_ptr_conv.is_owned = false;
11471 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
11475 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
11476 LDKChannelHandshakeLimits this_ptr_conv;
11477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11478 this_ptr_conv.is_owned = false;
11479 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
11482 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) {
11483 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);
11484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11486 uint64_t ret_ref = (uint64_t)ret_var.inner;
11487 if (ret_var.is_owned) {
11493 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
11494 LDKChannelHandshakeLimits orig_conv;
11495 orig_conv.inner = (void*)(orig & (~1));
11496 orig_conv.is_owned = false;
11497 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
11498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11500 uint64_t ret_ref = (uint64_t)ret_var.inner;
11501 if (ret_var.is_owned) {
11507 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
11508 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
11509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11511 uint64_t ret_ref = (uint64_t)ret_var.inner;
11512 if (ret_var.is_owned) {
11518 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
11519 LDKChannelConfig this_obj_conv;
11520 this_obj_conv.inner = (void*)(this_obj & (~1));
11521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11522 ChannelConfig_free(this_obj_conv);
11525 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
11526 LDKChannelConfig this_ptr_conv;
11527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11528 this_ptr_conv.is_owned = false;
11529 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
11533 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
11534 LDKChannelConfig this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = false;
11537 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
11540 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
11541 LDKChannelConfig this_ptr_conv;
11542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11543 this_ptr_conv.is_owned = false;
11544 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
11548 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
11549 LDKChannelConfig this_ptr_conv;
11550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11551 this_ptr_conv.is_owned = false;
11552 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
11555 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
11556 LDKChannelConfig this_ptr_conv;
11557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11558 this_ptr_conv.is_owned = false;
11559 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
11563 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
11564 LDKChannelConfig this_ptr_conv;
11565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11566 this_ptr_conv.is_owned = false;
11567 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
11570 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
11571 LDKChannelConfig this_ptr_conv;
11572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11573 this_ptr_conv.is_owned = false;
11574 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
11578 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
11579 LDKChannelConfig this_ptr_conv;
11580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11581 this_ptr_conv.is_owned = false;
11582 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
11585 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
11586 LDKChannelConfig this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = false;
11589 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
11593 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
11594 LDKChannelConfig this_ptr_conv;
11595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11596 this_ptr_conv.is_owned = false;
11597 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
11600 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) {
11601 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);
11602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11604 uint64_t ret_ref = (uint64_t)ret_var.inner;
11605 if (ret_var.is_owned) {
11611 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
11612 LDKChannelConfig orig_conv;
11613 orig_conv.inner = (void*)(orig & (~1));
11614 orig_conv.is_owned = false;
11615 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
11616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11618 uint64_t ret_ref = (uint64_t)ret_var.inner;
11619 if (ret_var.is_owned) {
11625 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
11626 LDKChannelConfig ret_var = ChannelConfig_default();
11627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11629 uint64_t ret_ref = (uint64_t)ret_var.inner;
11630 if (ret_var.is_owned) {
11636 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
11637 LDKChannelConfig obj_conv;
11638 obj_conv.inner = (void*)(obj & (~1));
11639 obj_conv.is_owned = false;
11640 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
11641 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11642 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11643 CVec_u8Z_free(ret_var);
11647 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
11648 LDKu8slice ser_ref;
11649 ser_ref.datalen = *((uint32_t*)ser);
11650 ser_ref.data = (int8_t*)(ser + 4);
11651 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11652 *ret_conv = ChannelConfig_read(ser_ref);
11653 return (uint64_t)ret_conv;
11656 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
11657 LDKUserConfig this_obj_conv;
11658 this_obj_conv.inner = (void*)(this_obj & (~1));
11659 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11660 UserConfig_free(this_obj_conv);
11663 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
11664 LDKUserConfig this_ptr_conv;
11665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11666 this_ptr_conv.is_owned = false;
11667 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
11668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11670 uint64_t ret_ref = (uint64_t)ret_var.inner;
11671 if (ret_var.is_owned) {
11677 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
11678 LDKUserConfig this_ptr_conv;
11679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11680 this_ptr_conv.is_owned = false;
11681 LDKChannelHandshakeConfig val_conv;
11682 val_conv.inner = (void*)(val & (~1));
11683 val_conv.is_owned = (val & 1) || (val == 0);
11684 val_conv = ChannelHandshakeConfig_clone(&val_conv);
11685 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
11688 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
11689 LDKUserConfig this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = false;
11692 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
11693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11695 uint64_t ret_ref = (uint64_t)ret_var.inner;
11696 if (ret_var.is_owned) {
11702 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
11703 LDKUserConfig this_ptr_conv;
11704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11705 this_ptr_conv.is_owned = false;
11706 LDKChannelHandshakeLimits val_conv;
11707 val_conv.inner = (void*)(val & (~1));
11708 val_conv.is_owned = (val & 1) || (val == 0);
11709 val_conv = ChannelHandshakeLimits_clone(&val_conv);
11710 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
11713 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
11714 LDKUserConfig this_ptr_conv;
11715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11716 this_ptr_conv.is_owned = false;
11717 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
11718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11720 uint64_t ret_ref = (uint64_t)ret_var.inner;
11721 if (ret_var.is_owned) {
11727 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
11728 LDKUserConfig this_ptr_conv;
11729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11730 this_ptr_conv.is_owned = false;
11731 LDKChannelConfig val_conv;
11732 val_conv.inner = (void*)(val & (~1));
11733 val_conv.is_owned = (val & 1) || (val == 0);
11734 val_conv = ChannelConfig_clone(&val_conv);
11735 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
11738 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
11739 LDKUserConfig this_ptr_conv;
11740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11741 this_ptr_conv.is_owned = false;
11742 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
11746 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
11747 LDKUserConfig this_ptr_conv;
11748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11749 this_ptr_conv.is_owned = false;
11750 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
11753 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) {
11754 LDKChannelHandshakeConfig own_channel_config_arg_conv;
11755 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
11756 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
11757 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
11758 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
11759 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
11760 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
11761 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
11762 LDKChannelConfig channel_options_arg_conv;
11763 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
11764 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
11765 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
11766 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);
11767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11769 uint64_t ret_ref = (uint64_t)ret_var.inner;
11770 if (ret_var.is_owned) {
11776 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
11777 LDKUserConfig orig_conv;
11778 orig_conv.inner = (void*)(orig & (~1));
11779 orig_conv.is_owned = false;
11780 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
11781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11783 uint64_t ret_ref = (uint64_t)ret_var.inner;
11784 if (ret_var.is_owned) {
11790 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
11791 LDKUserConfig ret_var = UserConfig_default();
11792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11794 uint64_t ret_ref = (uint64_t)ret_var.inner;
11795 if (ret_var.is_owned) {
11801 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
11802 LDKBestBlock this_obj_conv;
11803 this_obj_conv.inner = (void*)(this_obj & (~1));
11804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11805 BestBlock_free(this_obj_conv);
11808 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
11809 LDKBestBlock orig_conv;
11810 orig_conv.inner = (void*)(orig & (~1));
11811 orig_conv.is_owned = false;
11812 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
11813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11815 uint64_t ret_ref = (uint64_t)ret_var.inner;
11816 if (ret_var.is_owned) {
11822 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
11823 LDKNetwork network_conv = LDKNetwork_from_js(network);
11824 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
11825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11827 uint64_t ret_ref = (uint64_t)ret_var.inner;
11828 if (ret_var.is_owned) {
11834 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
11835 LDKThirtyTwoBytes block_hash_ref;
11836 CHECK(*((uint32_t*)block_hash) == 32);
11837 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
11838 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
11839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11841 uint64_t ret_ref = (uint64_t)ret_var.inner;
11842 if (ret_var.is_owned) {
11848 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
11849 LDKBestBlock this_arg_conv;
11850 this_arg_conv.inner = (void*)(this_arg & (~1));
11851 this_arg_conv.is_owned = false;
11852 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11853 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
11857 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
11858 LDKBestBlock this_arg_conv;
11859 this_arg_conv.inner = (void*)(this_arg & (~1));
11860 this_arg_conv.is_owned = false;
11861 int32_t ret_val = BestBlock_height(&this_arg_conv);
11865 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
11866 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
11867 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
11871 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
11872 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
11876 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
11877 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
11881 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
11882 if ((this_ptr & 1) != 0) return;
11883 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
11884 FREE((void*)this_ptr);
11885 Access_free(this_ptr_conv);
11888 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
11889 if ((this_ptr & 1) != 0) return;
11890 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
11891 FREE((void*)this_ptr);
11892 Listen_free(this_ptr_conv);
11895 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
11896 if ((this_ptr & 1) != 0) return;
11897 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
11898 FREE((void*)this_ptr);
11899 Confirm_free(this_ptr_conv);
11902 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
11903 if ((this_ptr & 1) != 0) return;
11904 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
11905 FREE((void*)this_ptr);
11906 Watch_free(this_ptr_conv);
11909 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
11910 if ((this_ptr & 1) != 0) return;
11911 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
11912 FREE((void*)this_ptr);
11913 Filter_free(this_ptr_conv);
11916 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
11917 LDKWatchedOutput this_obj_conv;
11918 this_obj_conv.inner = (void*)(this_obj & (~1));
11919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11920 WatchedOutput_free(this_obj_conv);
11923 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
11924 LDKWatchedOutput this_ptr_conv;
11925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11926 this_ptr_conv.is_owned = false;
11927 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11928 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
11932 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
11933 LDKWatchedOutput this_ptr_conv;
11934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11935 this_ptr_conv.is_owned = false;
11936 LDKThirtyTwoBytes val_ref;
11937 CHECK(*((uint32_t*)val) == 32);
11938 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11939 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
11942 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
11943 LDKWatchedOutput this_ptr_conv;
11944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11945 this_ptr_conv.is_owned = false;
11946 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
11947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11949 uint64_t ret_ref = (uint64_t)ret_var.inner;
11950 if (ret_var.is_owned) {
11956 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
11957 LDKWatchedOutput this_ptr_conv;
11958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11959 this_ptr_conv.is_owned = false;
11960 LDKOutPoint val_conv;
11961 val_conv.inner = (void*)(val & (~1));
11962 val_conv.is_owned = (val & 1) || (val == 0);
11963 val_conv = OutPoint_clone(&val_conv);
11964 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
11967 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
11968 LDKWatchedOutput this_ptr_conv;
11969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11970 this_ptr_conv.is_owned = false;
11971 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
11972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11977 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
11978 LDKWatchedOutput this_ptr_conv;
11979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11980 this_ptr_conv.is_owned = false;
11981 LDKCVec_u8Z val_ref;
11982 val_ref.datalen = *((uint32_t*)val);
11983 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11984 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11985 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
11988 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
11989 LDKThirtyTwoBytes block_hash_arg_ref;
11990 CHECK(*((uint32_t*)block_hash_arg) == 32);
11991 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
11992 LDKOutPoint outpoint_arg_conv;
11993 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11994 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11995 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11996 LDKCVec_u8Z script_pubkey_arg_ref;
11997 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
11998 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11999 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
12000 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
12001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12003 uint64_t ret_ref = (uint64_t)ret_var.inner;
12004 if (ret_var.is_owned) {
12010 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
12011 LDKWatchedOutput orig_conv;
12012 orig_conv.inner = (void*)(orig & (~1));
12013 orig_conv.is_owned = false;
12014 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
12015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12017 uint64_t ret_ref = (uint64_t)ret_var.inner;
12018 if (ret_var.is_owned) {
12024 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
12025 LDKWatchedOutput o_conv;
12026 o_conv.inner = (void*)(o & (~1));
12027 o_conv.is_owned = false;
12028 int64_t ret_val = WatchedOutput_hash(&o_conv);
12032 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
12033 if ((this_ptr & 1) != 0) return;
12034 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
12035 FREE((void*)this_ptr);
12036 BroadcasterInterface_free(this_ptr_conv);
12039 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
12040 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
12041 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
12045 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
12046 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
12050 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
12051 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
12055 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
12056 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
12060 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
12061 if ((this_ptr & 1) != 0) return;
12062 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
12063 FREE((void*)this_ptr);
12064 FeeEstimator_free(this_ptr_conv);
12067 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
12068 LDKChainMonitor this_obj_conv;
12069 this_obj_conv.inner = (void*)(this_obj & (~1));
12070 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12071 ChainMonitor_free(this_obj_conv);
12074 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
12075 LDKFilter *chain_source_conv_ptr = NULL;
12076 if (chain_source != 0) {
12077 LDKFilter chain_source_conv;
12078 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
12079 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12080 *chain_source_conv_ptr = chain_source_conv;
12082 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12083 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12084 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
12085 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
12086 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
12087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12089 uint64_t ret_ref = (uint64_t)ret_var.inner;
12090 if (ret_var.is_owned) {
12096 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
12097 LDKChainMonitor this_arg_conv;
12098 this_arg_conv.inner = (void*)(this_arg & (~1));
12099 this_arg_conv.is_owned = false;
12100 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12101 *ret = ChainMonitor_as_Listen(&this_arg_conv);
12102 return (uint64_t)ret;
12105 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
12106 LDKChainMonitor this_arg_conv;
12107 this_arg_conv.inner = (void*)(this_arg & (~1));
12108 this_arg_conv.is_owned = false;
12109 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12110 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
12111 return (uint64_t)ret;
12114 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
12115 LDKChainMonitor this_arg_conv;
12116 this_arg_conv.inner = (void*)(this_arg & (~1));
12117 this_arg_conv.is_owned = false;
12118 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
12119 *ret = ChainMonitor_as_Watch(&this_arg_conv);
12120 return (uint64_t)ret;
12123 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
12124 LDKChainMonitor this_arg_conv;
12125 this_arg_conv.inner = (void*)(this_arg & (~1));
12126 this_arg_conv.is_owned = false;
12127 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12128 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
12129 return (uint64_t)ret;
12132 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
12133 LDKChannelMonitorUpdate this_obj_conv;
12134 this_obj_conv.inner = (void*)(this_obj & (~1));
12135 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12136 ChannelMonitorUpdate_free(this_obj_conv);
12139 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
12140 LDKChannelMonitorUpdate this_ptr_conv;
12141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12142 this_ptr_conv.is_owned = false;
12143 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
12147 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
12148 LDKChannelMonitorUpdate this_ptr_conv;
12149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12150 this_ptr_conv.is_owned = false;
12151 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
12154 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
12155 LDKChannelMonitorUpdate orig_conv;
12156 orig_conv.inner = (void*)(orig & (~1));
12157 orig_conv.is_owned = false;
12158 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
12159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12161 uint64_t ret_ref = (uint64_t)ret_var.inner;
12162 if (ret_var.is_owned) {
12168 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
12169 LDKChannelMonitorUpdate obj_conv;
12170 obj_conv.inner = (void*)(obj & (~1));
12171 obj_conv.is_owned = false;
12172 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
12173 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12174 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12175 CVec_u8Z_free(ret_var);
12179 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
12180 LDKu8slice ser_ref;
12181 ser_ref.datalen = *((uint32_t*)ser);
12182 ser_ref.data = (int8_t*)(ser + 4);
12183 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12184 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
12185 return (uint64_t)ret_conv;
12188 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
12189 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
12190 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
12194 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
12195 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
12199 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
12200 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
12204 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
12205 LDKMonitorUpdateError this_obj_conv;
12206 this_obj_conv.inner = (void*)(this_obj & (~1));
12207 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12208 MonitorUpdateError_free(this_obj_conv);
12211 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
12212 LDKMonitorUpdateError orig_conv;
12213 orig_conv.inner = (void*)(orig & (~1));
12214 orig_conv.is_owned = false;
12215 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
12216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12218 uint64_t ret_ref = (uint64_t)ret_var.inner;
12219 if (ret_var.is_owned) {
12225 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
12226 if ((this_ptr & 1) != 0) return;
12227 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
12228 FREE((void*)this_ptr);
12229 MonitorEvent_free(this_ptr_conv);
12232 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
12233 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
12234 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12235 *ret_copy = MonitorEvent_clone(orig_conv);
12236 uint64_t ret_ref = (uint64_t)ret_copy;
12240 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
12241 LDKHTLCUpdate a_conv;
12242 a_conv.inner = (void*)(a & (~1));
12243 a_conv.is_owned = (a & 1) || (a == 0);
12244 a_conv = HTLCUpdate_clone(&a_conv);
12245 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12246 *ret_copy = MonitorEvent_htlcevent(a_conv);
12247 uint64_t ret_ref = (uint64_t)ret_copy;
12251 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_broadcasted(uint32_t a) {
12252 LDKOutPoint a_conv;
12253 a_conv.inner = (void*)(a & (~1));
12254 a_conv.is_owned = (a & 1) || (a == 0);
12255 a_conv = OutPoint_clone(&a_conv);
12256 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12257 *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
12258 uint64_t ret_ref = (uint64_t)ret_copy;
12262 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
12263 LDKHTLCUpdate this_obj_conv;
12264 this_obj_conv.inner = (void*)(this_obj & (~1));
12265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12266 HTLCUpdate_free(this_obj_conv);
12269 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
12270 LDKHTLCUpdate orig_conv;
12271 orig_conv.inner = (void*)(orig & (~1));
12272 orig_conv.is_owned = false;
12273 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
12274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12276 uint64_t ret_ref = (uint64_t)ret_var.inner;
12277 if (ret_var.is_owned) {
12283 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
12284 LDKHTLCUpdate obj_conv;
12285 obj_conv.inner = (void*)(obj & (~1));
12286 obj_conv.is_owned = false;
12287 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
12288 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12289 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12290 CVec_u8Z_free(ret_var);
12294 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
12295 LDKu8slice ser_ref;
12296 ser_ref.datalen = *((uint32_t*)ser);
12297 ser_ref.data = (int8_t*)(ser + 4);
12298 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12299 *ret_conv = HTLCUpdate_read(ser_ref);
12300 return (uint64_t)ret_conv;
12303 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
12304 LDKChannelMonitor this_obj_conv;
12305 this_obj_conv.inner = (void*)(this_obj & (~1));
12306 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12307 ChannelMonitor_free(this_obj_conv);
12310 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
12311 LDKChannelMonitor orig_conv;
12312 orig_conv.inner = (void*)(orig & (~1));
12313 orig_conv.is_owned = false;
12314 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
12315 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12316 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12317 uint64_t ret_ref = (uint64_t)ret_var.inner;
12318 if (ret_var.is_owned) {
12324 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
12325 LDKChannelMonitor obj_conv;
12326 obj_conv.inner = (void*)(obj & (~1));
12327 obj_conv.is_owned = false;
12328 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
12329 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12330 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12331 CVec_u8Z_free(ret_var);
12335 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) {
12336 LDKChannelMonitor this_arg_conv;
12337 this_arg_conv.inner = (void*)(this_arg & (~1));
12338 this_arg_conv.is_owned = false;
12339 LDKChannelMonitorUpdate updates_conv;
12340 updates_conv.inner = (void*)(updates & (~1));
12341 updates_conv.is_owned = false;
12342 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12343 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12344 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12345 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12346 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
12347 return (uint64_t)ret_conv;
12350 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
12351 LDKChannelMonitor this_arg_conv;
12352 this_arg_conv.inner = (void*)(this_arg & (~1));
12353 this_arg_conv.is_owned = false;
12354 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
12358 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
12359 LDKChannelMonitor this_arg_conv;
12360 this_arg_conv.inner = (void*)(this_arg & (~1));
12361 this_arg_conv.is_owned = false;
12362 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12363 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
12364 return (uint64_t)ret_ref;
12367 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
12368 LDKChannelMonitor this_arg_conv;
12369 this_arg_conv.inner = (void*)(this_arg & (~1));
12370 this_arg_conv.is_owned = false;
12371 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
12372 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12373 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12374 for (size_t c = 0; c < ret_var.datalen; c++) {
12375 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12376 *ret_conv_54_ref = ret_var.data[c];
12377 ret_arr_ptr[c] = (uint64_t)ret_conv_54_ref;
12379 FREE(ret_var.data);
12383 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
12384 LDKChannelMonitor this_arg_conv;
12385 this_arg_conv.inner = (void*)(this_arg & (~1));
12386 this_arg_conv.is_owned = false;
12387 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
12388 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
12391 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
12392 LDKChannelMonitor this_arg_conv;
12393 this_arg_conv.inner = (void*)(this_arg & (~1));
12394 this_arg_conv.is_owned = false;
12395 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
12396 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12397 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12398 for (size_t o = 0; o < ret_var.datalen; o++) {
12399 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12400 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
12401 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
12402 ret_arr_ptr[o] = ret_conv_14_ref;
12404 FREE(ret_var.data);
12408 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
12409 LDKChannelMonitor this_arg_conv;
12410 this_arg_conv.inner = (void*)(this_arg & (~1));
12411 this_arg_conv.is_owned = false;
12412 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
12413 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12414 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12415 for (size_t h = 0; h < ret_var.datalen; h++) {
12416 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12417 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
12418 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
12419 ret_arr_ptr[h] = ret_conv_7_ref;
12421 FREE(ret_var.data);
12425 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
12426 LDKChannelMonitor this_arg_conv;
12427 this_arg_conv.inner = (void*)(this_arg & (~1));
12428 this_arg_conv.is_owned = false;
12429 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12430 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
12431 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12432 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12433 for (size_t m = 0; m < ret_var.datalen; m++) {
12434 LDKTransaction ret_conv_12_var = ret_var.data[m];
12435 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12436 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
12437 Transaction_free(ret_conv_12_var);
12438 ret_arr_ptr[m] = ret_conv_12_arr;
12440 FREE(ret_var.data);
12444 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) {
12445 LDKChannelMonitor this_arg_conv;
12446 this_arg_conv.inner = (void*)(this_arg & (~1));
12447 this_arg_conv.is_owned = false;
12448 unsigned char header_arr[80];
12449 CHECK(*((uint32_t*)header) == 80);
12450 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12451 unsigned char (*header_ref)[80] = &header_arr;
12452 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12453 txdata_constr.datalen = *((uint32_t*)txdata);
12454 if (txdata_constr.datalen > 0)
12455 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12457 txdata_constr.data = NULL;
12458 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12459 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12460 uint32_t txdata_conv_30 = txdata_vals[e];
12461 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12462 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12463 txdata_constr.data[e] = txdata_conv_30_conv;
12465 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12466 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12467 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12468 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);
12469 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12470 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12471 for (size_t x = 0; x < ret_var.datalen; x++) {
12472 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12473 *ret_conv_49_ref = ret_var.data[x];
12474 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12476 FREE(ret_var.data);
12480 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) {
12481 LDKChannelMonitor this_arg_conv;
12482 this_arg_conv.inner = (void*)(this_arg & (~1));
12483 this_arg_conv.is_owned = false;
12484 unsigned char header_arr[80];
12485 CHECK(*((uint32_t*)header) == 80);
12486 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12487 unsigned char (*header_ref)[80] = &header_arr;
12488 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12489 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12490 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12491 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12494 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) {
12495 LDKChannelMonitor this_arg_conv;
12496 this_arg_conv.inner = (void*)(this_arg & (~1));
12497 this_arg_conv.is_owned = false;
12498 unsigned char header_arr[80];
12499 CHECK(*((uint32_t*)header) == 80);
12500 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12501 unsigned char (*header_ref)[80] = &header_arr;
12502 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12503 txdata_constr.datalen = *((uint32_t*)txdata);
12504 if (txdata_constr.datalen > 0)
12505 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12507 txdata_constr.data = NULL;
12508 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12509 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12510 uint32_t txdata_conv_30 = txdata_vals[e];
12511 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12512 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12513 txdata_constr.data[e] = txdata_conv_30_conv;
12515 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12516 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12517 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12518 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);
12519 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12520 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12521 for (size_t x = 0; x < ret_var.datalen; x++) {
12522 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12523 *ret_conv_49_ref = ret_var.data[x];
12524 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12526 FREE(ret_var.data);
12530 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) {
12531 LDKChannelMonitor this_arg_conv;
12532 this_arg_conv.inner = (void*)(this_arg & (~1));
12533 this_arg_conv.is_owned = false;
12534 unsigned char txid_arr[32];
12535 CHECK(*((uint32_t*)txid) == 32);
12536 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
12537 unsigned char (*txid_ref)[32] = &txid_arr;
12538 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12539 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12540 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12541 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
12544 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) {
12545 LDKChannelMonitor this_arg_conv;
12546 this_arg_conv.inner = (void*)(this_arg & (~1));
12547 this_arg_conv.is_owned = false;
12548 unsigned char header_arr[80];
12549 CHECK(*((uint32_t*)header) == 80);
12550 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12551 unsigned char (*header_ref)[80] = &header_arr;
12552 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12553 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12554 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12555 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12556 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12557 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12558 for (size_t x = 0; x < ret_var.datalen; x++) {
12559 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12560 *ret_conv_49_ref = ret_var.data[x];
12561 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12563 FREE(ret_var.data);
12567 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
12568 LDKChannelMonitor this_arg_conv;
12569 this_arg_conv.inner = (void*)(this_arg & (~1));
12570 this_arg_conv.is_owned = false;
12571 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
12572 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12573 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12574 for (size_t m = 0; m < ret_var.datalen; m++) {
12575 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12576 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
12577 ret_arr_ptr[m] = ret_conv_12_arr;
12579 FREE(ret_var.data);
12583 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
12584 LDKChannelMonitor this_arg_conv;
12585 this_arg_conv.inner = (void*)(this_arg & (~1));
12586 this_arg_conv.is_owned = false;
12587 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
12588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12590 uint64_t ret_ref = (uint64_t)ret_var.inner;
12591 if (ret_var.is_owned) {
12597 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
12598 if ((this_ptr & 1) != 0) return;
12599 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
12600 FREE((void*)this_ptr);
12601 Persist_free(this_ptr_conv);
12604 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
12605 LDKu8slice ser_ref;
12606 ser_ref.datalen = *((uint32_t*)ser);
12607 ser_ref.data = (int8_t*)(ser + 4);
12608 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
12609 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12610 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
12611 return (uint64_t)ret_conv;
12614 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
12615 LDKOutPoint this_obj_conv;
12616 this_obj_conv.inner = (void*)(this_obj & (~1));
12617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12618 OutPoint_free(this_obj_conv);
12621 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
12622 LDKOutPoint this_ptr_conv;
12623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12624 this_ptr_conv.is_owned = false;
12625 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12626 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
12630 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
12631 LDKOutPoint this_ptr_conv;
12632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12633 this_ptr_conv.is_owned = false;
12634 LDKThirtyTwoBytes val_ref;
12635 CHECK(*((uint32_t*)val) == 32);
12636 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12637 OutPoint_set_txid(&this_ptr_conv, val_ref);
12640 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
12641 LDKOutPoint this_ptr_conv;
12642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12643 this_ptr_conv.is_owned = false;
12644 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
12648 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
12649 LDKOutPoint this_ptr_conv;
12650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12651 this_ptr_conv.is_owned = false;
12652 OutPoint_set_index(&this_ptr_conv, val);
12655 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
12656 LDKThirtyTwoBytes txid_arg_ref;
12657 CHECK(*((uint32_t*)txid_arg) == 32);
12658 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
12659 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
12660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12662 uint64_t ret_ref = (uint64_t)ret_var.inner;
12663 if (ret_var.is_owned) {
12669 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
12670 LDKOutPoint orig_conv;
12671 orig_conv.inner = (void*)(orig & (~1));
12672 orig_conv.is_owned = false;
12673 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
12674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12676 uint64_t ret_ref = (uint64_t)ret_var.inner;
12677 if (ret_var.is_owned) {
12683 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
12684 LDKOutPoint a_conv;
12685 a_conv.inner = (void*)(a & (~1));
12686 a_conv.is_owned = false;
12687 LDKOutPoint b_conv;
12688 b_conv.inner = (void*)(b & (~1));
12689 b_conv.is_owned = false;
12690 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
12694 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
12695 LDKOutPoint o_conv;
12696 o_conv.inner = (void*)(o & (~1));
12697 o_conv.is_owned = false;
12698 int64_t ret_val = OutPoint_hash(&o_conv);
12702 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
12703 LDKOutPoint this_arg_conv;
12704 this_arg_conv.inner = (void*)(this_arg & (~1));
12705 this_arg_conv.is_owned = false;
12706 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12707 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
12711 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
12712 LDKOutPoint obj_conv;
12713 obj_conv.inner = (void*)(obj & (~1));
12714 obj_conv.is_owned = false;
12715 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
12716 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12717 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12718 CVec_u8Z_free(ret_var);
12722 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
12723 LDKu8slice ser_ref;
12724 ser_ref.datalen = *((uint32_t*)ser);
12725 ser_ref.data = (int8_t*)(ser + 4);
12726 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12727 *ret_conv = OutPoint_read(ser_ref);
12728 return (uint64_t)ret_conv;
12731 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
12732 LDKDelayedPaymentOutputDescriptor this_obj_conv;
12733 this_obj_conv.inner = (void*)(this_obj & (~1));
12734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12735 DelayedPaymentOutputDescriptor_free(this_obj_conv);
12738 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
12739 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12741 this_ptr_conv.is_owned = false;
12742 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
12743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12745 uint64_t ret_ref = (uint64_t)ret_var.inner;
12746 if (ret_var.is_owned) {
12752 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
12753 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12755 this_ptr_conv.is_owned = false;
12756 LDKOutPoint val_conv;
12757 val_conv.inner = (void*)(val & (~1));
12758 val_conv.is_owned = (val & 1) || (val == 0);
12759 val_conv = OutPoint_clone(&val_conv);
12760 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
12763 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
12764 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12766 this_ptr_conv.is_owned = false;
12767 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12768 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12772 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12773 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12775 this_ptr_conv.is_owned = false;
12776 LDKPublicKey val_ref;
12777 CHECK(*((uint32_t*)val) == 33);
12778 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12779 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
12782 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
12783 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12785 this_ptr_conv.is_owned = false;
12786 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
12790 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12791 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12793 this_ptr_conv.is_owned = false;
12794 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
12797 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
12798 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12800 this_ptr_conv.is_owned = false;
12801 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
12802 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
12805 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
12806 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12808 this_ptr_conv.is_owned = false;
12809 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12810 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
12814 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
12815 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12817 this_ptr_conv.is_owned = false;
12818 LDKPublicKey val_ref;
12819 CHECK(*((uint32_t*)val) == 33);
12820 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12821 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
12824 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
12825 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12827 this_ptr_conv.is_owned = false;
12828 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12829 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
12833 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
12834 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12836 this_ptr_conv.is_owned = false;
12837 LDKThirtyTwoBytes val_ref;
12838 CHECK(*((uint32_t*)val) == 32);
12839 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12840 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
12843 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
12844 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12846 this_ptr_conv.is_owned = false;
12847 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
12851 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
12852 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
12853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12854 this_ptr_conv.is_owned = false;
12855 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
12858 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) {
12859 LDKOutPoint outpoint_arg_conv;
12860 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
12861 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
12862 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
12863 LDKPublicKey per_commitment_point_arg_ref;
12864 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
12865 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
12866 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
12867 LDKPublicKey revocation_pubkey_arg_ref;
12868 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
12869 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
12870 LDKThirtyTwoBytes channel_keys_id_arg_ref;
12871 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
12872 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
12873 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);
12874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12876 uint64_t ret_ref = (uint64_t)ret_var.inner;
12877 if (ret_var.is_owned) {
12883 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
12884 LDKDelayedPaymentOutputDescriptor orig_conv;
12885 orig_conv.inner = (void*)(orig & (~1));
12886 orig_conv.is_owned = false;
12887 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
12888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12890 uint64_t ret_ref = (uint64_t)ret_var.inner;
12891 if (ret_var.is_owned) {
12897 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
12898 LDKDelayedPaymentOutputDescriptor obj_conv;
12899 obj_conv.inner = (void*)(obj & (~1));
12900 obj_conv.is_owned = false;
12901 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
12902 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12903 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12904 CVec_u8Z_free(ret_var);
12908 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
12909 LDKu8slice ser_ref;
12910 ser_ref.datalen = *((uint32_t*)ser);
12911 ser_ref.data = (int8_t*)(ser + 4);
12912 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12913 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
12914 return (uint64_t)ret_conv;
12917 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
12918 LDKStaticPaymentOutputDescriptor this_obj_conv;
12919 this_obj_conv.inner = (void*)(this_obj & (~1));
12920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12921 StaticPaymentOutputDescriptor_free(this_obj_conv);
12924 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
12925 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12927 this_ptr_conv.is_owned = false;
12928 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
12929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12931 uint64_t ret_ref = (uint64_t)ret_var.inner;
12932 if (ret_var.is_owned) {
12938 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
12939 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12941 this_ptr_conv.is_owned = false;
12942 LDKOutPoint val_conv;
12943 val_conv.inner = (void*)(val & (~1));
12944 val_conv.is_owned = (val & 1) || (val == 0);
12945 val_conv = OutPoint_clone(&val_conv);
12946 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
12949 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
12950 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12952 this_ptr_conv.is_owned = false;
12953 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
12954 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
12957 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
12958 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12960 this_ptr_conv.is_owned = false;
12961 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12962 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
12966 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
12967 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12969 this_ptr_conv.is_owned = false;
12970 LDKThirtyTwoBytes val_ref;
12971 CHECK(*((uint32_t*)val) == 32);
12972 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12973 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
12976 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
12977 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12979 this_ptr_conv.is_owned = false;
12980 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
12984 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
12985 LDKStaticPaymentOutputDescriptor this_ptr_conv;
12986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12987 this_ptr_conv.is_owned = false;
12988 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
12991 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) {
12992 LDKOutPoint outpoint_arg_conv;
12993 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
12994 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
12995 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
12996 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
12997 LDKThirtyTwoBytes channel_keys_id_arg_ref;
12998 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
12999 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
13000 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
13001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13003 uint64_t ret_ref = (uint64_t)ret_var.inner;
13004 if (ret_var.is_owned) {
13010 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
13011 LDKStaticPaymentOutputDescriptor orig_conv;
13012 orig_conv.inner = (void*)(orig & (~1));
13013 orig_conv.is_owned = false;
13014 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
13015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13017 uint64_t ret_ref = (uint64_t)ret_var.inner;
13018 if (ret_var.is_owned) {
13024 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
13025 LDKStaticPaymentOutputDescriptor obj_conv;
13026 obj_conv.inner = (void*)(obj & (~1));
13027 obj_conv.is_owned = false;
13028 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
13029 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13030 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13031 CVec_u8Z_free(ret_var);
13035 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
13036 LDKu8slice ser_ref;
13037 ser_ref.datalen = *((uint32_t*)ser);
13038 ser_ref.data = (int8_t*)(ser + 4);
13039 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13040 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
13041 return (uint64_t)ret_conv;
13044 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
13045 if ((this_ptr & 1) != 0) return;
13046 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
13047 FREE((void*)this_ptr);
13048 SpendableOutputDescriptor_free(this_ptr_conv);
13051 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
13052 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
13053 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13054 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
13055 uint64_t ret_ref = (uint64_t)ret_copy;
13059 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
13060 LDKOutPoint outpoint_conv;
13061 outpoint_conv.inner = (void*)(outpoint & (~1));
13062 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
13063 outpoint_conv = OutPoint_clone(&outpoint_conv);
13064 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
13065 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13066 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
13067 uint64_t ret_ref = (uint64_t)ret_copy;
13071 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
13072 LDKDelayedPaymentOutputDescriptor a_conv;
13073 a_conv.inner = (void*)(a & (~1));
13074 a_conv.is_owned = (a & 1) || (a == 0);
13075 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
13076 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13077 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
13078 uint64_t ret_ref = (uint64_t)ret_copy;
13082 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
13083 LDKStaticPaymentOutputDescriptor a_conv;
13084 a_conv.inner = (void*)(a & (~1));
13085 a_conv.is_owned = (a & 1) || (a == 0);
13086 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
13087 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13088 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
13089 uint64_t ret_ref = (uint64_t)ret_copy;
13093 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
13094 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
13095 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
13096 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13097 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13098 CVec_u8Z_free(ret_var);
13102 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
13103 LDKu8slice ser_ref;
13104 ser_ref.datalen = *((uint32_t*)ser);
13105 ser_ref.data = (int8_t*)(ser + 4);
13106 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13107 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
13108 return (uint64_t)ret_conv;
13111 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
13112 if ((this_ptr & 1) != 0) return;
13113 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
13114 FREE((void*)this_ptr);
13115 BaseSign_free(this_ptr_conv);
13118 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
13119 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
13120 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13121 *ret = Sign_clone(orig_conv);
13122 return (uint64_t)ret;
13125 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
13126 if ((this_ptr & 1) != 0) return;
13127 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
13128 FREE((void*)this_ptr);
13129 Sign_free(this_ptr_conv);
13132 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
13133 if ((this_ptr & 1) != 0) return;
13134 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
13135 FREE((void*)this_ptr);
13136 KeysInterface_free(this_ptr_conv);
13139 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
13140 LDKInMemorySigner this_obj_conv;
13141 this_obj_conv.inner = (void*)(this_obj & (~1));
13142 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13143 InMemorySigner_free(this_obj_conv);
13146 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
13147 LDKInMemorySigner this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = false;
13150 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13151 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
13155 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
13156 LDKInMemorySigner this_ptr_conv;
13157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13158 this_ptr_conv.is_owned = false;
13159 LDKSecretKey val_ref;
13160 CHECK(*((uint32_t*)val) == 32);
13161 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13162 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
13165 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
13166 LDKInMemorySigner this_ptr_conv;
13167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13168 this_ptr_conv.is_owned = false;
13169 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13170 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
13174 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
13175 LDKInMemorySigner this_ptr_conv;
13176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13177 this_ptr_conv.is_owned = false;
13178 LDKSecretKey val_ref;
13179 CHECK(*((uint32_t*)val) == 32);
13180 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13181 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
13184 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
13185 LDKInMemorySigner this_ptr_conv;
13186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13187 this_ptr_conv.is_owned = false;
13188 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13189 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
13193 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
13194 LDKInMemorySigner this_ptr_conv;
13195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13196 this_ptr_conv.is_owned = false;
13197 LDKSecretKey val_ref;
13198 CHECK(*((uint32_t*)val) == 32);
13199 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13200 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
13203 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
13204 LDKInMemorySigner this_ptr_conv;
13205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13206 this_ptr_conv.is_owned = false;
13207 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13208 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
13212 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
13213 LDKInMemorySigner this_ptr_conv;
13214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13215 this_ptr_conv.is_owned = false;
13216 LDKSecretKey val_ref;
13217 CHECK(*((uint32_t*)val) == 32);
13218 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13219 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
13222 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
13223 LDKInMemorySigner this_ptr_conv;
13224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13225 this_ptr_conv.is_owned = false;
13226 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13227 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
13231 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
13232 LDKInMemorySigner this_ptr_conv;
13233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13234 this_ptr_conv.is_owned = false;
13235 LDKSecretKey val_ref;
13236 CHECK(*((uint32_t*)val) == 32);
13237 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13238 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
13241 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
13242 LDKInMemorySigner this_ptr_conv;
13243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13244 this_ptr_conv.is_owned = false;
13245 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13246 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
13250 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
13251 LDKInMemorySigner this_ptr_conv;
13252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13253 this_ptr_conv.is_owned = false;
13254 LDKThirtyTwoBytes val_ref;
13255 CHECK(*((uint32_t*)val) == 32);
13256 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13257 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
13260 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
13261 LDKInMemorySigner orig_conv;
13262 orig_conv.inner = (void*)(orig & (~1));
13263 orig_conv.is_owned = false;
13264 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
13265 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13266 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13267 uint64_t ret_ref = (uint64_t)ret_var.inner;
13268 if (ret_var.is_owned) {
13274 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) {
13275 LDKSecretKey funding_key_ref;
13276 CHECK(*((uint32_t*)funding_key) == 32);
13277 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
13278 LDKSecretKey revocation_base_key_ref;
13279 CHECK(*((uint32_t*)revocation_base_key) == 32);
13280 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
13281 LDKSecretKey payment_key_ref;
13282 CHECK(*((uint32_t*)payment_key) == 32);
13283 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
13284 LDKSecretKey delayed_payment_base_key_ref;
13285 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
13286 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
13287 LDKSecretKey htlc_base_key_ref;
13288 CHECK(*((uint32_t*)htlc_base_key) == 32);
13289 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
13290 LDKThirtyTwoBytes commitment_seed_ref;
13291 CHECK(*((uint32_t*)commitment_seed) == 32);
13292 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
13293 LDKThirtyTwoBytes channel_keys_id_ref;
13294 CHECK(*((uint32_t*)channel_keys_id) == 32);
13295 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
13296 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);
13297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13299 uint64_t ret_ref = (uint64_t)ret_var.inner;
13300 if (ret_var.is_owned) {
13306 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
13307 LDKInMemorySigner this_arg_conv;
13308 this_arg_conv.inner = (void*)(this_arg & (~1));
13309 this_arg_conv.is_owned = false;
13310 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
13311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13313 uint64_t ret_ref = (uint64_t)ret_var.inner;
13314 if (ret_var.is_owned) {
13320 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
13321 LDKInMemorySigner this_arg_conv;
13322 this_arg_conv.inner = (void*)(this_arg & (~1));
13323 this_arg_conv.is_owned = false;
13324 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
13328 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
13329 LDKInMemorySigner this_arg_conv;
13330 this_arg_conv.inner = (void*)(this_arg & (~1));
13331 this_arg_conv.is_owned = false;
13332 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
13336 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
13337 LDKInMemorySigner this_arg_conv;
13338 this_arg_conv.inner = (void*)(this_arg & (~1));
13339 this_arg_conv.is_owned = false;
13340 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
13344 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
13345 LDKInMemorySigner this_arg_conv;
13346 this_arg_conv.inner = (void*)(this_arg & (~1));
13347 this_arg_conv.is_owned = false;
13348 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
13349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13351 uint64_t ret_ref = (uint64_t)ret_var.inner;
13352 if (ret_var.is_owned) {
13358 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
13359 LDKInMemorySigner this_arg_conv;
13360 this_arg_conv.inner = (void*)(this_arg & (~1));
13361 this_arg_conv.is_owned = false;
13362 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
13363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13365 uint64_t ret_ref = (uint64_t)ret_var.inner;
13366 if (ret_var.is_owned) {
13372 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) {
13373 LDKInMemorySigner this_arg_conv;
13374 this_arg_conv.inner = (void*)(this_arg & (~1));
13375 this_arg_conv.is_owned = false;
13376 LDKTransaction spend_tx_ref;
13377 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13378 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13379 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13380 spend_tx_ref.data_is_owned = true;
13381 LDKStaticPaymentOutputDescriptor descriptor_conv;
13382 descriptor_conv.inner = (void*)(descriptor & (~1));
13383 descriptor_conv.is_owned = false;
13384 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13385 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13386 return (uint64_t)ret_conv;
13389 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) {
13390 LDKInMemorySigner this_arg_conv;
13391 this_arg_conv.inner = (void*)(this_arg & (~1));
13392 this_arg_conv.is_owned = false;
13393 LDKTransaction spend_tx_ref;
13394 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13395 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13396 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13397 spend_tx_ref.data_is_owned = true;
13398 LDKDelayedPaymentOutputDescriptor descriptor_conv;
13399 descriptor_conv.inner = (void*)(descriptor & (~1));
13400 descriptor_conv.is_owned = false;
13401 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13402 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13403 return (uint64_t)ret_conv;
13406 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
13407 LDKInMemorySigner this_arg_conv;
13408 this_arg_conv.inner = (void*)(this_arg & (~1));
13409 this_arg_conv.is_owned = false;
13410 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
13411 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
13412 return (uint64_t)ret;
13415 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
13416 LDKInMemorySigner this_arg_conv;
13417 this_arg_conv.inner = (void*)(this_arg & (~1));
13418 this_arg_conv.is_owned = false;
13419 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13420 *ret = InMemorySigner_as_Sign(&this_arg_conv);
13421 return (uint64_t)ret;
13424 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
13425 LDKInMemorySigner obj_conv;
13426 obj_conv.inner = (void*)(obj & (~1));
13427 obj_conv.is_owned = false;
13428 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
13429 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13430 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13431 CVec_u8Z_free(ret_var);
13435 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
13436 LDKu8slice ser_ref;
13437 ser_ref.datalen = *((uint32_t*)ser);
13438 ser_ref.data = (int8_t*)(ser + 4);
13439 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13440 *ret_conv = InMemorySigner_read(ser_ref);
13441 return (uint64_t)ret_conv;
13444 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
13445 LDKKeysManager this_obj_conv;
13446 this_obj_conv.inner = (void*)(this_obj & (~1));
13447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13448 KeysManager_free(this_obj_conv);
13451 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
13452 unsigned char seed_arr[32];
13453 CHECK(*((uint32_t*)seed) == 32);
13454 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
13455 unsigned char (*seed_ref)[32] = &seed_arr;
13456 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
13457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13459 uint64_t ret_ref = (uint64_t)ret_var.inner;
13460 if (ret_var.is_owned) {
13466 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
13467 LDKKeysManager this_arg_conv;
13468 this_arg_conv.inner = (void*)(this_arg & (~1));
13469 this_arg_conv.is_owned = false;
13470 unsigned char params_arr[32];
13471 CHECK(*((uint32_t*)params) == 32);
13472 memcpy(params_arr, (uint8_t*)(params + 4), 32);
13473 unsigned char (*params_ref)[32] = ¶ms_arr;
13474 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
13475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13477 uint64_t ret_ref = (uint64_t)ret_var.inner;
13478 if (ret_var.is_owned) {
13484 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) {
13485 LDKKeysManager this_arg_conv;
13486 this_arg_conv.inner = (void*)(this_arg & (~1));
13487 this_arg_conv.is_owned = false;
13488 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13489 descriptors_constr.datalen = *((uint32_t*)descriptors);
13490 if (descriptors_constr.datalen > 0)
13491 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13493 descriptors_constr.data = NULL;
13494 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
13495 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13496 uint32_t descriptors_conv_27 = descriptors_vals[b];
13497 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
13498 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
13499 descriptors_constr.data[b] = descriptors_conv_27_conv;
13501 LDKCVec_TxOutZ outputs_constr;
13502 outputs_constr.datalen = *((uint32_t*)outputs);
13503 if (outputs_constr.datalen > 0)
13504 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13506 outputs_constr.data = NULL;
13507 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
13508 for (size_t h = 0; h < outputs_constr.datalen; h++) {
13509 uint32_t outputs_conv_7 = outputs_vals[h];
13510 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
13511 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
13512 outputs_constr.data[h] = outputs_conv_7_conv;
13514 LDKCVec_u8Z change_destination_script_ref;
13515 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
13516 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13517 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
13518 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13519 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
13520 return (uint64_t)ret_conv;
13523 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
13524 LDKKeysManager this_arg_conv;
13525 this_arg_conv.inner = (void*)(this_arg & (~1));
13526 this_arg_conv.is_owned = false;
13527 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
13528 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
13529 return (uint64_t)ret;
13532 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
13533 LDKChannelManager this_obj_conv;
13534 this_obj_conv.inner = (void*)(this_obj & (~1));
13535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13536 ChannelManager_free(this_obj_conv);
13539 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
13540 LDKChainParameters this_obj_conv;
13541 this_obj_conv.inner = (void*)(this_obj & (~1));
13542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13543 ChainParameters_free(this_obj_conv);
13546 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
13547 LDKChainParameters this_ptr_conv;
13548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13549 this_ptr_conv.is_owned = false;
13550 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
13554 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
13555 LDKChainParameters this_ptr_conv;
13556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13557 this_ptr_conv.is_owned = false;
13558 LDKNetwork val_conv = LDKNetwork_from_js(val);
13559 ChainParameters_set_network(&this_ptr_conv, val_conv);
13562 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
13563 LDKChainParameters this_ptr_conv;
13564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13565 this_ptr_conv.is_owned = false;
13566 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
13567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13569 uint64_t ret_ref = (uint64_t)ret_var.inner;
13570 if (ret_var.is_owned) {
13576 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
13577 LDKChainParameters this_ptr_conv;
13578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13579 this_ptr_conv.is_owned = false;
13580 LDKBestBlock val_conv;
13581 val_conv.inner = (void*)(val & (~1));
13582 val_conv.is_owned = (val & 1) || (val == 0);
13583 val_conv = BestBlock_clone(&val_conv);
13584 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
13587 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
13588 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
13589 LDKBestBlock best_block_arg_conv;
13590 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
13591 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
13592 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
13593 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
13594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13596 uint64_t ret_ref = (uint64_t)ret_var.inner;
13597 if (ret_var.is_owned) {
13603 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
13604 LDKChainParameters orig_conv;
13605 orig_conv.inner = (void*)(orig & (~1));
13606 orig_conv.is_owned = false;
13607 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
13608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13610 uint64_t ret_ref = (uint64_t)ret_var.inner;
13611 if (ret_var.is_owned) {
13617 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
13618 LDKChannelCounterparty this_obj_conv;
13619 this_obj_conv.inner = (void*)(this_obj & (~1));
13620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13621 ChannelCounterparty_free(this_obj_conv);
13624 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
13625 LDKChannelCounterparty this_ptr_conv;
13626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13627 this_ptr_conv.is_owned = false;
13628 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13629 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
13633 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
13634 LDKChannelCounterparty this_ptr_conv;
13635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13636 this_ptr_conv.is_owned = false;
13637 LDKPublicKey val_ref;
13638 CHECK(*((uint32_t*)val) == 33);
13639 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13640 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
13643 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
13644 LDKChannelCounterparty this_ptr_conv;
13645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13646 this_ptr_conv.is_owned = false;
13647 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
13648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13650 uint64_t ret_ref = (uint64_t)ret_var.inner;
13651 if (ret_var.is_owned) {
13657 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
13658 LDKChannelCounterparty this_ptr_conv;
13659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13660 this_ptr_conv.is_owned = false;
13661 LDKInitFeatures val_conv;
13662 val_conv.inner = (void*)(val & (~1));
13663 val_conv.is_owned = (val & 1) || (val == 0);
13664 val_conv = InitFeatures_clone(&val_conv);
13665 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
13668 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
13669 LDKChannelCounterparty this_ptr_conv;
13670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13671 this_ptr_conv.is_owned = false;
13672 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
13676 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
13677 LDKChannelCounterparty this_ptr_conv;
13678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13679 this_ptr_conv.is_owned = false;
13680 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
13683 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
13684 LDKChannelCounterparty orig_conv;
13685 orig_conv.inner = (void*)(orig & (~1));
13686 orig_conv.is_owned = false;
13687 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
13688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13690 uint64_t ret_ref = (uint64_t)ret_var.inner;
13691 if (ret_var.is_owned) {
13697 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
13698 LDKChannelDetails this_obj_conv;
13699 this_obj_conv.inner = (void*)(this_obj & (~1));
13700 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13701 ChannelDetails_free(this_obj_conv);
13704 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
13705 LDKChannelDetails this_ptr_conv;
13706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13707 this_ptr_conv.is_owned = false;
13708 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13709 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
13713 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13714 LDKChannelDetails this_ptr_conv;
13715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13716 this_ptr_conv.is_owned = false;
13717 LDKThirtyTwoBytes val_ref;
13718 CHECK(*((uint32_t*)val) == 32);
13719 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13720 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
13723 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
13724 LDKChannelDetails this_ptr_conv;
13725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13726 this_ptr_conv.is_owned = false;
13727 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
13728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13730 uint64_t ret_ref = (uint64_t)ret_var.inner;
13731 if (ret_var.is_owned) {
13737 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
13738 LDKChannelDetails this_ptr_conv;
13739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13740 this_ptr_conv.is_owned = false;
13741 LDKChannelCounterparty val_conv;
13742 val_conv.inner = (void*)(val & (~1));
13743 val_conv.is_owned = (val & 1) || (val == 0);
13744 val_conv = ChannelCounterparty_clone(&val_conv);
13745 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
13748 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
13749 LDKChannelDetails this_ptr_conv;
13750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13751 this_ptr_conv.is_owned = false;
13752 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
13753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13755 uint64_t ret_ref = (uint64_t)ret_var.inner;
13756 if (ret_var.is_owned) {
13762 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
13763 LDKChannelDetails this_ptr_conv;
13764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13765 this_ptr_conv.is_owned = false;
13766 LDKOutPoint val_conv;
13767 val_conv.inner = (void*)(val & (~1));
13768 val_conv.is_owned = (val & 1) || (val == 0);
13769 val_conv = OutPoint_clone(&val_conv);
13770 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
13773 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
13774 LDKChannelDetails this_ptr_conv;
13775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13776 this_ptr_conv.is_owned = false;
13777 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
13778 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
13779 uint64_t ret_ref = (uint64_t)ret_copy;
13783 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
13784 LDKChannelDetails this_ptr_conv;
13785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13786 this_ptr_conv.is_owned = false;
13787 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
13788 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
13791 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
13792 LDKChannelDetails this_ptr_conv;
13793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13794 this_ptr_conv.is_owned = false;
13795 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
13799 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
13800 LDKChannelDetails this_ptr_conv;
13801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13802 this_ptr_conv.is_owned = false;
13803 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
13806 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
13807 LDKChannelDetails this_ptr_conv;
13808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13809 this_ptr_conv.is_owned = false;
13810 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
13811 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
13812 uint64_t ret_ref = (uint64_t)ret_copy;
13816 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
13817 LDKChannelDetails this_ptr_conv;
13818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13819 this_ptr_conv.is_owned = false;
13820 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
13821 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
13824 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
13825 LDKChannelDetails this_ptr_conv;
13826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13827 this_ptr_conv.is_owned = false;
13828 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
13832 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
13833 LDKChannelDetails this_ptr_conv;
13834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13835 this_ptr_conv.is_owned = false;
13836 ChannelDetails_set_user_id(&this_ptr_conv, val);
13839 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
13840 LDKChannelDetails this_ptr_conv;
13841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13842 this_ptr_conv.is_owned = false;
13843 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
13847 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
13848 LDKChannelDetails this_ptr_conv;
13849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13850 this_ptr_conv.is_owned = false;
13851 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
13854 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
13855 LDKChannelDetails this_ptr_conv;
13856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13857 this_ptr_conv.is_owned = false;
13858 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
13862 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
13863 LDKChannelDetails this_ptr_conv;
13864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13865 this_ptr_conv.is_owned = false;
13866 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
13869 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
13870 LDKChannelDetails this_ptr_conv;
13871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13872 this_ptr_conv.is_owned = false;
13873 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13874 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
13875 uint64_t ret_ref = (uint64_t)ret_copy;
13879 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
13880 LDKChannelDetails this_ptr_conv;
13881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13882 this_ptr_conv.is_owned = false;
13883 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
13884 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
13887 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
13888 LDKChannelDetails this_ptr_conv;
13889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13890 this_ptr_conv.is_owned = false;
13891 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13892 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
13893 uint64_t ret_ref = (uint64_t)ret_copy;
13897 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
13898 LDKChannelDetails this_ptr_conv;
13899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13900 this_ptr_conv.is_owned = false;
13901 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
13902 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
13905 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
13906 LDKChannelDetails this_ptr_conv;
13907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13908 this_ptr_conv.is_owned = false;
13909 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
13913 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
13914 LDKChannelDetails this_ptr_conv;
13915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13916 this_ptr_conv.is_owned = false;
13917 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
13920 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
13921 LDKChannelDetails this_ptr_conv;
13922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13923 this_ptr_conv.is_owned = false;
13924 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
13928 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
13929 LDKChannelDetails this_ptr_conv;
13930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13931 this_ptr_conv.is_owned = false;
13932 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
13935 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
13936 LDKChannelDetails this_ptr_conv;
13937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13938 this_ptr_conv.is_owned = false;
13939 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
13943 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
13944 LDKChannelDetails this_ptr_conv;
13945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13946 this_ptr_conv.is_owned = false;
13947 ChannelDetails_set_is_usable(&this_ptr_conv, val);
13950 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
13951 LDKChannelDetails this_ptr_conv;
13952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13953 this_ptr_conv.is_owned = false;
13954 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
13958 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
13959 LDKChannelDetails this_ptr_conv;
13960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13961 this_ptr_conv.is_owned = false;
13962 ChannelDetails_set_is_public(&this_ptr_conv, val);
13965 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
13966 LDKThirtyTwoBytes channel_id_arg_ref;
13967 CHECK(*((uint32_t*)channel_id_arg) == 32);
13968 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13969 LDKChannelCounterparty counterparty_arg_conv;
13970 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
13971 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
13972 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
13973 LDKOutPoint funding_txo_arg_conv;
13974 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
13975 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
13976 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
13977 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
13978 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
13979 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
13980 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
13981 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
13982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13984 uint64_t ret_ref = (uint64_t)ret_var.inner;
13985 if (ret_var.is_owned) {
13991 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
13992 LDKChannelDetails orig_conv;
13993 orig_conv.inner = (void*)(orig & (~1));
13994 orig_conv.is_owned = false;
13995 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
13996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13998 uint64_t ret_ref = (uint64_t)ret_var.inner;
13999 if (ret_var.is_owned) {
14005 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
14006 if ((this_ptr & 1) != 0) return;
14007 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
14008 FREE((void*)this_ptr);
14009 PaymentSendFailure_free(this_ptr_conv);
14012 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
14013 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
14014 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14015 *ret_copy = PaymentSendFailure_clone(orig_conv);
14016 uint64_t ret_ref = (uint64_t)ret_copy;
14020 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
14021 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
14022 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14023 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
14024 uint64_t ret_ref = (uint64_t)ret_copy;
14028 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
14029 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14030 a_constr.datalen = *((uint32_t*)a);
14031 if (a_constr.datalen > 0)
14032 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14034 a_constr.data = NULL;
14035 uint32_t* a_vals = (uint32_t*)(a + 4);
14036 for (size_t w = 0; w < a_constr.datalen; w++) {
14037 uint32_t a_conv_22 = a_vals[w];
14038 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14039 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14040 a_constr.data[w] = a_conv_22_conv;
14042 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14043 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
14044 uint64_t ret_ref = (uint64_t)ret_copy;
14048 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
14049 LDKCVec_APIErrorZ a_constr;
14050 a_constr.datalen = *((uint32_t*)a);
14051 if (a_constr.datalen > 0)
14052 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14054 a_constr.data = NULL;
14055 uint32_t* a_vals = (uint32_t*)(a + 4);
14056 for (size_t k = 0; k < a_constr.datalen; k++) {
14057 uint32_t a_conv_10 = a_vals[k];
14058 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
14059 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
14060 a_constr.data[k] = a_conv_10_conv;
14062 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14063 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
14064 uint64_t ret_ref = (uint64_t)ret_copy;
14068 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
14069 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14070 a_constr.datalen = *((uint32_t*)a);
14071 if (a_constr.datalen > 0)
14072 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14074 a_constr.data = NULL;
14075 uint32_t* a_vals = (uint32_t*)(a + 4);
14076 for (size_t w = 0; w < a_constr.datalen; w++) {
14077 uint32_t a_conv_22 = a_vals[w];
14078 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14079 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14080 a_constr.data[w] = a_conv_22_conv;
14082 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14083 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
14084 uint64_t ret_ref = (uint64_t)ret_copy;
14088 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) {
14089 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
14090 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14091 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14092 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14093 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14094 LDKUserConfig config_conv;
14095 config_conv.inner = (void*)(config & (~1));
14096 config_conv.is_owned = (config & 1) || (config == 0);
14097 config_conv = UserConfig_clone(&config_conv);
14098 LDKChainParameters params_conv;
14099 params_conv.inner = (void*)(params & (~1));
14100 params_conv.is_owned = (params & 1) || (params == 0);
14101 params_conv = ChainParameters_clone(¶ms_conv);
14102 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
14103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14105 uint64_t ret_ref = (uint64_t)ret_var.inner;
14106 if (ret_var.is_owned) {
14112 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
14113 LDKChannelManager this_arg_conv;
14114 this_arg_conv.inner = (void*)(this_arg & (~1));
14115 this_arg_conv.is_owned = false;
14116 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
14117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14119 uint64_t ret_ref = (uint64_t)ret_var.inner;
14120 if (ret_var.is_owned) {
14126 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) {
14127 LDKChannelManager this_arg_conv;
14128 this_arg_conv.inner = (void*)(this_arg & (~1));
14129 this_arg_conv.is_owned = false;
14130 LDKPublicKey their_network_key_ref;
14131 CHECK(*((uint32_t*)their_network_key) == 33);
14132 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
14133 LDKUserConfig override_config_conv;
14134 override_config_conv.inner = (void*)(override_config & (~1));
14135 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
14136 override_config_conv = UserConfig_clone(&override_config_conv);
14137 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14138 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
14139 return (uint64_t)ret_conv;
14142 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
14143 LDKChannelManager this_arg_conv;
14144 this_arg_conv.inner = (void*)(this_arg & (~1));
14145 this_arg_conv.is_owned = false;
14146 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
14147 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14148 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14149 for (size_t q = 0; q < ret_var.datalen; q++) {
14150 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14151 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14152 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14153 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14154 if (ret_conv_16_var.is_owned) {
14155 ret_conv_16_ref |= 1;
14157 ret_arr_ptr[q] = ret_conv_16_ref;
14159 FREE(ret_var.data);
14163 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
14164 LDKChannelManager this_arg_conv;
14165 this_arg_conv.inner = (void*)(this_arg & (~1));
14166 this_arg_conv.is_owned = false;
14167 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
14168 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14169 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14170 for (size_t q = 0; q < ret_var.datalen; q++) {
14171 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14172 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14173 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14174 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14175 if (ret_conv_16_var.is_owned) {
14176 ret_conv_16_ref |= 1;
14178 ret_arr_ptr[q] = ret_conv_16_ref;
14180 FREE(ret_var.data);
14184 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14185 LDKChannelManager this_arg_conv;
14186 this_arg_conv.inner = (void*)(this_arg & (~1));
14187 this_arg_conv.is_owned = false;
14188 unsigned char channel_id_arr[32];
14189 CHECK(*((uint32_t*)channel_id) == 32);
14190 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14191 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14192 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14193 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
14194 return (uint64_t)ret_conv;
14197 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14198 LDKChannelManager this_arg_conv;
14199 this_arg_conv.inner = (void*)(this_arg & (~1));
14200 this_arg_conv.is_owned = false;
14201 unsigned char channel_id_arr[32];
14202 CHECK(*((uint32_t*)channel_id) == 32);
14203 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14204 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14205 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14206 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
14207 return (uint64_t)ret_conv;
14210 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
14211 LDKChannelManager this_arg_conv;
14212 this_arg_conv.inner = (void*)(this_arg & (~1));
14213 this_arg_conv.is_owned = false;
14214 ChannelManager_force_close_all_channels(&this_arg_conv);
14217 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
14218 LDKChannelManager this_arg_conv;
14219 this_arg_conv.inner = (void*)(this_arg & (~1));
14220 this_arg_conv.is_owned = false;
14221 LDKRoute route_conv;
14222 route_conv.inner = (void*)(route & (~1));
14223 route_conv.is_owned = false;
14224 LDKThirtyTwoBytes payment_hash_ref;
14225 CHECK(*((uint32_t*)payment_hash) == 32);
14226 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14227 LDKThirtyTwoBytes payment_secret_ref;
14228 CHECK(*((uint32_t*)payment_secret) == 32);
14229 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
14230 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14231 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
14232 return (uint64_t)ret_conv;
14235 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
14236 LDKChannelManager this_arg_conv;
14237 this_arg_conv.inner = (void*)(this_arg & (~1));
14238 this_arg_conv.is_owned = false;
14239 unsigned char temporary_channel_id_arr[32];
14240 CHECK(*((uint32_t*)temporary_channel_id) == 32);
14241 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
14242 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
14243 LDKTransaction funding_transaction_ref;
14244 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
14245 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
14246 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
14247 funding_transaction_ref.data_is_owned = true;
14248 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14249 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
14250 return (uint64_t)ret_conv;
14253 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
14254 LDKChannelManager this_arg_conv;
14255 this_arg_conv.inner = (void*)(this_arg & (~1));
14256 this_arg_conv.is_owned = false;
14257 LDKThreeBytes rgb_ref;
14258 CHECK(*((uint32_t*)rgb) == 3);
14259 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
14260 LDKThirtyTwoBytes alias_ref;
14261 CHECK(*((uint32_t*)alias) == 32);
14262 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
14263 LDKCVec_NetAddressZ addresses_constr;
14264 addresses_constr.datalen = *((uint32_t*)addresses);
14265 if (addresses_constr.datalen > 0)
14266 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14268 addresses_constr.data = NULL;
14269 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
14270 for (size_t m = 0; m < addresses_constr.datalen; m++) {
14271 uint32_t addresses_conv_12 = addresses_vals[m];
14272 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
14273 addresses_constr.data[m] = addresses_conv_12_conv;
14275 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
14278 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
14279 LDKChannelManager this_arg_conv;
14280 this_arg_conv.inner = (void*)(this_arg & (~1));
14281 this_arg_conv.is_owned = false;
14282 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
14285 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
14286 LDKChannelManager this_arg_conv;
14287 this_arg_conv.inner = (void*)(this_arg & (~1));
14288 this_arg_conv.is_owned = false;
14289 ChannelManager_timer_tick_occurred(&this_arg_conv);
14292 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
14293 LDKChannelManager this_arg_conv;
14294 this_arg_conv.inner = (void*)(this_arg & (~1));
14295 this_arg_conv.is_owned = false;
14296 unsigned char payment_hash_arr[32];
14297 CHECK(*((uint32_t*)payment_hash) == 32);
14298 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
14299 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14300 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
14304 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
14305 LDKChannelManager this_arg_conv;
14306 this_arg_conv.inner = (void*)(this_arg & (~1));
14307 this_arg_conv.is_owned = false;
14308 LDKThirtyTwoBytes payment_preimage_ref;
14309 CHECK(*((uint32_t*)payment_preimage) == 32);
14310 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
14311 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
14315 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
14316 LDKChannelManager this_arg_conv;
14317 this_arg_conv.inner = (void*)(this_arg & (~1));
14318 this_arg_conv.is_owned = false;
14319 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14320 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
14324 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
14325 LDKChannelManager this_arg_conv;
14326 this_arg_conv.inner = (void*)(this_arg & (~1));
14327 this_arg_conv.is_owned = false;
14328 LDKOutPoint funding_txo_conv;
14329 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14330 funding_txo_conv.is_owned = false;
14331 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
14334 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) {
14335 LDKChannelManager this_arg_conv;
14336 this_arg_conv.inner = (void*)(this_arg & (~1));
14337 this_arg_conv.is_owned = false;
14338 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14339 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14340 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
14341 return (uint64_t)ret_ref;
14344 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) {
14345 LDKChannelManager this_arg_conv;
14346 this_arg_conv.inner = (void*)(this_arg & (~1));
14347 this_arg_conv.is_owned = false;
14348 LDKThirtyTwoBytes payment_hash_ref;
14349 CHECK(*((uint32_t*)payment_hash) == 32);
14350 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14351 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14352 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14353 *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);
14354 return (uint64_t)ret_conv;
14357 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
14358 LDKChannelManager this_arg_conv;
14359 this_arg_conv.inner = (void*)(this_arg & (~1));
14360 this_arg_conv.is_owned = false;
14361 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14362 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
14363 return (uint64_t)ret;
14366 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
14367 LDKChannelManager this_arg_conv;
14368 this_arg_conv.inner = (void*)(this_arg & (~1));
14369 this_arg_conv.is_owned = false;
14370 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14371 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
14372 return (uint64_t)ret;
14375 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
14376 LDKChannelManager this_arg_conv;
14377 this_arg_conv.inner = (void*)(this_arg & (~1));
14378 this_arg_conv.is_owned = false;
14379 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14380 *ret = ChannelManager_as_Listen(&this_arg_conv);
14381 return (uint64_t)ret;
14384 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
14385 LDKChannelManager this_arg_conv;
14386 this_arg_conv.inner = (void*)(this_arg & (~1));
14387 this_arg_conv.is_owned = false;
14388 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14389 *ret = ChannelManager_as_Confirm(&this_arg_conv);
14390 return (uint64_t)ret;
14393 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
14394 LDKChannelManager this_arg_conv;
14395 this_arg_conv.inner = (void*)(this_arg & (~1));
14396 this_arg_conv.is_owned = false;
14397 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
14401 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
14402 LDKChannelManager this_arg_conv;
14403 this_arg_conv.inner = (void*)(this_arg & (~1));
14404 this_arg_conv.is_owned = false;
14405 ChannelManager_await_persistable_update(&this_arg_conv);
14408 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
14409 LDKChannelManager this_arg_conv;
14410 this_arg_conv.inner = (void*)(this_arg & (~1));
14411 this_arg_conv.is_owned = false;
14412 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
14413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14415 uint64_t ret_ref = (uint64_t)ret_var.inner;
14416 if (ret_var.is_owned) {
14422 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
14423 LDKChannelManager this_arg_conv;
14424 this_arg_conv.inner = (void*)(this_arg & (~1));
14425 this_arg_conv.is_owned = false;
14426 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14427 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
14428 return (uint64_t)ret;
14431 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
14432 LDKChannelManager obj_conv;
14433 obj_conv.inner = (void*)(obj & (~1));
14434 obj_conv.is_owned = false;
14435 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
14436 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14437 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14438 CVec_u8Z_free(ret_var);
14442 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
14443 LDKChannelManagerReadArgs this_obj_conv;
14444 this_obj_conv.inner = (void*)(this_obj & (~1));
14445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14446 ChannelManagerReadArgs_free(this_obj_conv);
14449 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
14450 LDKChannelManagerReadArgs this_ptr_conv;
14451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14452 this_ptr_conv.is_owned = false;
14453 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
14457 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
14458 LDKChannelManagerReadArgs this_ptr_conv;
14459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14460 this_ptr_conv.is_owned = false;
14461 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
14462 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
14465 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
14466 LDKChannelManagerReadArgs this_ptr_conv;
14467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14468 this_ptr_conv.is_owned = false;
14469 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
14473 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
14474 LDKChannelManagerReadArgs this_ptr_conv;
14475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14476 this_ptr_conv.is_owned = false;
14477 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
14478 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
14481 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
14482 LDKChannelManagerReadArgs this_ptr_conv;
14483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14484 this_ptr_conv.is_owned = false;
14485 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
14489 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
14490 LDKChannelManagerReadArgs this_ptr_conv;
14491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14492 this_ptr_conv.is_owned = false;
14493 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
14494 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
14497 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
14498 LDKChannelManagerReadArgs this_ptr_conv;
14499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14500 this_ptr_conv.is_owned = false;
14501 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
14505 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
14506 LDKChannelManagerReadArgs this_ptr_conv;
14507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14508 this_ptr_conv.is_owned = false;
14509 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
14510 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
14513 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
14514 LDKChannelManagerReadArgs this_ptr_conv;
14515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14516 this_ptr_conv.is_owned = false;
14517 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
14521 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
14522 LDKChannelManagerReadArgs this_ptr_conv;
14523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14524 this_ptr_conv.is_owned = false;
14525 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
14526 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
14529 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
14530 LDKChannelManagerReadArgs this_ptr_conv;
14531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14532 this_ptr_conv.is_owned = false;
14533 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
14534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14536 uint64_t ret_ref = (uint64_t)ret_var.inner;
14537 if (ret_var.is_owned) {
14543 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
14544 LDKChannelManagerReadArgs this_ptr_conv;
14545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14546 this_ptr_conv.is_owned = false;
14547 LDKUserConfig val_conv;
14548 val_conv.inner = (void*)(val & (~1));
14549 val_conv.is_owned = (val & 1) || (val == 0);
14550 val_conv = UserConfig_clone(&val_conv);
14551 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
14554 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) {
14555 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14556 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14557 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14558 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14559 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14560 LDKUserConfig default_config_conv;
14561 default_config_conv.inner = (void*)(default_config & (~1));
14562 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
14563 default_config_conv = UserConfig_clone(&default_config_conv);
14564 LDKCVec_ChannelMonitorZ channel_monitors_constr;
14565 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
14566 if (channel_monitors_constr.datalen > 0)
14567 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
14569 channel_monitors_constr.data = NULL;
14570 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
14571 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
14572 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
14573 LDKChannelMonitor channel_monitors_conv_16_conv;
14574 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
14575 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
14576 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
14578 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);
14579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14581 uint64_t ret_ref = (uint64_t)ret_var.inner;
14582 if (ret_var.is_owned) {
14588 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
14589 LDKu8slice ser_ref;
14590 ser_ref.datalen = *((uint32_t*)ser);
14591 ser_ref.data = (int8_t*)(ser + 4);
14592 LDKChannelManagerReadArgs arg_conv;
14593 arg_conv.inner = (void*)(arg & (~1));
14594 arg_conv.is_owned = (arg & 1) || (arg == 0);
14595 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
14596 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14597 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
14598 return (uint64_t)ret_conv;
14601 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
14602 LDKDecodeError this_obj_conv;
14603 this_obj_conv.inner = (void*)(this_obj & (~1));
14604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14605 DecodeError_free(this_obj_conv);
14608 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
14609 LDKDecodeError orig_conv;
14610 orig_conv.inner = (void*)(orig & (~1));
14611 orig_conv.is_owned = false;
14612 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
14613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14615 uint64_t ret_ref = (uint64_t)ret_var.inner;
14616 if (ret_var.is_owned) {
14622 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
14623 LDKInit this_obj_conv;
14624 this_obj_conv.inner = (void*)(this_obj & (~1));
14625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14626 Init_free(this_obj_conv);
14629 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
14630 LDKInit this_ptr_conv;
14631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14632 this_ptr_conv.is_owned = false;
14633 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
14634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14636 uint64_t ret_ref = (uint64_t)ret_var.inner;
14637 if (ret_var.is_owned) {
14643 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
14644 LDKInit this_ptr_conv;
14645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14646 this_ptr_conv.is_owned = false;
14647 LDKInitFeatures val_conv;
14648 val_conv.inner = (void*)(val & (~1));
14649 val_conv.is_owned = (val & 1) || (val == 0);
14650 val_conv = InitFeatures_clone(&val_conv);
14651 Init_set_features(&this_ptr_conv, val_conv);
14654 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
14655 LDKInitFeatures features_arg_conv;
14656 features_arg_conv.inner = (void*)(features_arg & (~1));
14657 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14658 features_arg_conv = InitFeatures_clone(&features_arg_conv);
14659 LDKInit ret_var = Init_new(features_arg_conv);
14660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14662 uint64_t ret_ref = (uint64_t)ret_var.inner;
14663 if (ret_var.is_owned) {
14669 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
14671 orig_conv.inner = (void*)(orig & (~1));
14672 orig_conv.is_owned = false;
14673 LDKInit ret_var = Init_clone(&orig_conv);
14674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14676 uint64_t ret_ref = (uint64_t)ret_var.inner;
14677 if (ret_var.is_owned) {
14683 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
14684 LDKErrorMessage this_obj_conv;
14685 this_obj_conv.inner = (void*)(this_obj & (~1));
14686 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14687 ErrorMessage_free(this_obj_conv);
14690 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
14691 LDKErrorMessage this_ptr_conv;
14692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14693 this_ptr_conv.is_owned = false;
14694 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14695 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
14699 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14700 LDKErrorMessage this_ptr_conv;
14701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14702 this_ptr_conv.is_owned = false;
14703 LDKThirtyTwoBytes val_ref;
14704 CHECK(*((uint32_t*)val) == 32);
14705 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14706 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
14709 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
14710 LDKErrorMessage this_ptr_conv;
14711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14712 this_ptr_conv.is_owned = false;
14713 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
14714 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14719 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
14720 LDKErrorMessage this_ptr_conv;
14721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14722 this_ptr_conv.is_owned = false;
14723 LDKStr val_conv = str_ref_to_owned_c(val);
14724 ErrorMessage_set_data(&this_ptr_conv, val_conv);
14727 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
14728 LDKThirtyTwoBytes channel_id_arg_ref;
14729 CHECK(*((uint32_t*)channel_id_arg) == 32);
14730 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14731 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
14732 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
14733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14735 uint64_t ret_ref = (uint64_t)ret_var.inner;
14736 if (ret_var.is_owned) {
14742 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
14743 LDKErrorMessage orig_conv;
14744 orig_conv.inner = (void*)(orig & (~1));
14745 orig_conv.is_owned = false;
14746 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
14747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14749 uint64_t ret_ref = (uint64_t)ret_var.inner;
14750 if (ret_var.is_owned) {
14756 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
14757 LDKPing this_obj_conv;
14758 this_obj_conv.inner = (void*)(this_obj & (~1));
14759 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14760 Ping_free(this_obj_conv);
14763 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
14764 LDKPing this_ptr_conv;
14765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14766 this_ptr_conv.is_owned = false;
14767 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
14771 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
14772 LDKPing this_ptr_conv;
14773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14774 this_ptr_conv.is_owned = false;
14775 Ping_set_ponglen(&this_ptr_conv, val);
14778 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
14779 LDKPing this_ptr_conv;
14780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14781 this_ptr_conv.is_owned = false;
14782 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
14786 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
14787 LDKPing this_ptr_conv;
14788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14789 this_ptr_conv.is_owned = false;
14790 Ping_set_byteslen(&this_ptr_conv, val);
14793 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
14794 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
14795 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14796 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14797 uint64_t ret_ref = (uint64_t)ret_var.inner;
14798 if (ret_var.is_owned) {
14804 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
14806 orig_conv.inner = (void*)(orig & (~1));
14807 orig_conv.is_owned = false;
14808 LDKPing ret_var = Ping_clone(&orig_conv);
14809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14811 uint64_t ret_ref = (uint64_t)ret_var.inner;
14812 if (ret_var.is_owned) {
14818 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
14819 LDKPong this_obj_conv;
14820 this_obj_conv.inner = (void*)(this_obj & (~1));
14821 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14822 Pong_free(this_obj_conv);
14825 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
14826 LDKPong this_ptr_conv;
14827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14828 this_ptr_conv.is_owned = false;
14829 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
14833 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
14834 LDKPong this_ptr_conv;
14835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14836 this_ptr_conv.is_owned = false;
14837 Pong_set_byteslen(&this_ptr_conv, val);
14840 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
14841 LDKPong ret_var = Pong_new(byteslen_arg);
14842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14844 uint64_t ret_ref = (uint64_t)ret_var.inner;
14845 if (ret_var.is_owned) {
14851 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
14853 orig_conv.inner = (void*)(orig & (~1));
14854 orig_conv.is_owned = false;
14855 LDKPong ret_var = Pong_clone(&orig_conv);
14856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14858 uint64_t ret_ref = (uint64_t)ret_var.inner;
14859 if (ret_var.is_owned) {
14865 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
14866 LDKOpenChannel this_obj_conv;
14867 this_obj_conv.inner = (void*)(this_obj & (~1));
14868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14869 OpenChannel_free(this_obj_conv);
14872 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
14873 LDKOpenChannel this_ptr_conv;
14874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14875 this_ptr_conv.is_owned = false;
14876 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14877 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
14881 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14882 LDKOpenChannel this_ptr_conv;
14883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14884 this_ptr_conv.is_owned = false;
14885 LDKThirtyTwoBytes val_ref;
14886 CHECK(*((uint32_t*)val) == 32);
14887 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14888 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
14891 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
14892 LDKOpenChannel this_ptr_conv;
14893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14894 this_ptr_conv.is_owned = false;
14895 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14896 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
14900 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
14901 LDKOpenChannel this_ptr_conv;
14902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14903 this_ptr_conv.is_owned = false;
14904 LDKThirtyTwoBytes val_ref;
14905 CHECK(*((uint32_t*)val) == 32);
14906 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14907 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
14910 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
14911 LDKOpenChannel this_ptr_conv;
14912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14913 this_ptr_conv.is_owned = false;
14914 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
14918 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
14919 LDKOpenChannel this_ptr_conv;
14920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14921 this_ptr_conv.is_owned = false;
14922 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
14925 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
14926 LDKOpenChannel this_ptr_conv;
14927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14928 this_ptr_conv.is_owned = false;
14929 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
14933 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
14934 LDKOpenChannel this_ptr_conv;
14935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14936 this_ptr_conv.is_owned = false;
14937 OpenChannel_set_push_msat(&this_ptr_conv, val);
14940 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
14941 LDKOpenChannel this_ptr_conv;
14942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14943 this_ptr_conv.is_owned = false;
14944 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
14948 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
14949 LDKOpenChannel this_ptr_conv;
14950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14951 this_ptr_conv.is_owned = false;
14952 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
14955 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
14956 LDKOpenChannel this_ptr_conv;
14957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14958 this_ptr_conv.is_owned = false;
14959 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
14963 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
14964 LDKOpenChannel this_ptr_conv;
14965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14966 this_ptr_conv.is_owned = false;
14967 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
14970 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
14971 LDKOpenChannel this_ptr_conv;
14972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14973 this_ptr_conv.is_owned = false;
14974 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
14978 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
14979 LDKOpenChannel this_ptr_conv;
14980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14981 this_ptr_conv.is_owned = false;
14982 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
14985 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
14986 LDKOpenChannel this_ptr_conv;
14987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14988 this_ptr_conv.is_owned = false;
14989 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
14993 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14994 LDKOpenChannel this_ptr_conv;
14995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14996 this_ptr_conv.is_owned = false;
14997 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15000 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
15001 LDKOpenChannel this_ptr_conv;
15002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15003 this_ptr_conv.is_owned = false;
15004 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
15008 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
15009 LDKOpenChannel this_ptr_conv;
15010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15011 this_ptr_conv.is_owned = false;
15012 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
15015 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
15016 LDKOpenChannel this_ptr_conv;
15017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15018 this_ptr_conv.is_owned = false;
15019 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
15023 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15024 LDKOpenChannel this_ptr_conv;
15025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15026 this_ptr_conv.is_owned = false;
15027 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
15030 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15031 LDKOpenChannel this_ptr_conv;
15032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15033 this_ptr_conv.is_owned = false;
15034 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
15038 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15039 LDKOpenChannel this_ptr_conv;
15040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15041 this_ptr_conv.is_owned = false;
15042 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15045 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
15046 LDKOpenChannel this_ptr_conv;
15047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15048 this_ptr_conv.is_owned = false;
15049 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15050 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15054 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15055 LDKOpenChannel this_ptr_conv;
15056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15057 this_ptr_conv.is_owned = false;
15058 LDKPublicKey val_ref;
15059 CHECK(*((uint32_t*)val) == 33);
15060 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15061 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15064 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
15065 LDKOpenChannel this_ptr_conv;
15066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15067 this_ptr_conv.is_owned = false;
15068 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15069 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15073 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15074 LDKOpenChannel this_ptr_conv;
15075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15076 this_ptr_conv.is_owned = false;
15077 LDKPublicKey val_ref;
15078 CHECK(*((uint32_t*)val) == 33);
15079 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15080 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15083 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
15084 LDKOpenChannel this_ptr_conv;
15085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15086 this_ptr_conv.is_owned = false;
15087 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15088 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15092 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15093 LDKOpenChannel this_ptr_conv;
15094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15095 this_ptr_conv.is_owned = false;
15096 LDKPublicKey val_ref;
15097 CHECK(*((uint32_t*)val) == 33);
15098 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15099 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
15102 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15103 LDKOpenChannel this_ptr_conv;
15104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15105 this_ptr_conv.is_owned = false;
15106 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15107 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15111 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15112 LDKOpenChannel this_ptr_conv;
15113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15114 this_ptr_conv.is_owned = false;
15115 LDKPublicKey val_ref;
15116 CHECK(*((uint32_t*)val) == 33);
15117 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15118 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15121 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
15122 LDKOpenChannel this_ptr_conv;
15123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15124 this_ptr_conv.is_owned = false;
15125 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15126 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15130 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15131 LDKOpenChannel this_ptr_conv;
15132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15133 this_ptr_conv.is_owned = false;
15134 LDKPublicKey val_ref;
15135 CHECK(*((uint32_t*)val) == 33);
15136 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15137 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15140 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15141 LDKOpenChannel this_ptr_conv;
15142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15143 this_ptr_conv.is_owned = false;
15144 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15145 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15149 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15150 LDKOpenChannel this_ptr_conv;
15151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15152 this_ptr_conv.is_owned = false;
15153 LDKPublicKey val_ref;
15154 CHECK(*((uint32_t*)val) == 33);
15155 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15156 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15159 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
15160 LDKOpenChannel this_ptr_conv;
15161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15162 this_ptr_conv.is_owned = false;
15163 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
15167 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
15168 LDKOpenChannel this_ptr_conv;
15169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15170 this_ptr_conv.is_owned = false;
15171 OpenChannel_set_channel_flags(&this_ptr_conv, val);
15174 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
15175 LDKOpenChannel orig_conv;
15176 orig_conv.inner = (void*)(orig & (~1));
15177 orig_conv.is_owned = false;
15178 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
15179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15181 uint64_t ret_ref = (uint64_t)ret_var.inner;
15182 if (ret_var.is_owned) {
15188 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
15189 LDKAcceptChannel this_obj_conv;
15190 this_obj_conv.inner = (void*)(this_obj & (~1));
15191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15192 AcceptChannel_free(this_obj_conv);
15195 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
15196 LDKAcceptChannel this_ptr_conv;
15197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15198 this_ptr_conv.is_owned = false;
15199 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15200 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
15204 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15205 LDKAcceptChannel this_ptr_conv;
15206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15207 this_ptr_conv.is_owned = false;
15208 LDKThirtyTwoBytes val_ref;
15209 CHECK(*((uint32_t*)val) == 32);
15210 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15211 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
15214 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
15215 LDKAcceptChannel this_ptr_conv;
15216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15217 this_ptr_conv.is_owned = false;
15218 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
15222 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
15223 LDKAcceptChannel this_ptr_conv;
15224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15225 this_ptr_conv.is_owned = false;
15226 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
15229 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
15230 LDKAcceptChannel this_ptr_conv;
15231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15232 this_ptr_conv.is_owned = false;
15233 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
15237 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
15238 LDKAcceptChannel this_ptr_conv;
15239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15240 this_ptr_conv.is_owned = false;
15241 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15244 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
15245 LDKAcceptChannel this_ptr_conv;
15246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15247 this_ptr_conv.is_owned = false;
15248 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
15252 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
15253 LDKAcceptChannel this_ptr_conv;
15254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15255 this_ptr_conv.is_owned = false;
15256 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
15259 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
15260 LDKAcceptChannel this_ptr_conv;
15261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15262 this_ptr_conv.is_owned = false;
15263 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
15267 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
15268 LDKAcceptChannel this_ptr_conv;
15269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15270 this_ptr_conv.is_owned = false;
15271 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15274 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
15275 LDKAcceptChannel this_ptr_conv;
15276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15277 this_ptr_conv.is_owned = false;
15278 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
15282 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
15283 LDKAcceptChannel this_ptr_conv;
15284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15285 this_ptr_conv.is_owned = false;
15286 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
15289 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
15290 LDKAcceptChannel this_ptr_conv;
15291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15292 this_ptr_conv.is_owned = false;
15293 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
15297 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15298 LDKAcceptChannel this_ptr_conv;
15299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15300 this_ptr_conv.is_owned = false;
15301 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
15304 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15305 LDKAcceptChannel this_ptr_conv;
15306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15307 this_ptr_conv.is_owned = false;
15308 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
15312 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15313 LDKAcceptChannel this_ptr_conv;
15314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15315 this_ptr_conv.is_owned = false;
15316 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15319 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
15320 LDKAcceptChannel this_ptr_conv;
15321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15322 this_ptr_conv.is_owned = false;
15323 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15324 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15328 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15329 LDKAcceptChannel this_ptr_conv;
15330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15331 this_ptr_conv.is_owned = false;
15332 LDKPublicKey val_ref;
15333 CHECK(*((uint32_t*)val) == 33);
15334 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15335 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15338 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
15339 LDKAcceptChannel this_ptr_conv;
15340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15341 this_ptr_conv.is_owned = false;
15342 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15343 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15347 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15348 LDKAcceptChannel this_ptr_conv;
15349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15350 this_ptr_conv.is_owned = false;
15351 LDKPublicKey val_ref;
15352 CHECK(*((uint32_t*)val) == 33);
15353 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15354 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15357 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
15358 LDKAcceptChannel this_ptr_conv;
15359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15360 this_ptr_conv.is_owned = false;
15361 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15362 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15366 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15367 LDKAcceptChannel this_ptr_conv;
15368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15369 this_ptr_conv.is_owned = false;
15370 LDKPublicKey val_ref;
15371 CHECK(*((uint32_t*)val) == 33);
15372 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15373 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
15376 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15377 LDKAcceptChannel this_ptr_conv;
15378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15379 this_ptr_conv.is_owned = false;
15380 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15381 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15385 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15386 LDKAcceptChannel this_ptr_conv;
15387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15388 this_ptr_conv.is_owned = false;
15389 LDKPublicKey val_ref;
15390 CHECK(*((uint32_t*)val) == 33);
15391 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15392 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15395 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
15396 LDKAcceptChannel this_ptr_conv;
15397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15398 this_ptr_conv.is_owned = false;
15399 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15400 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15404 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15405 LDKAcceptChannel this_ptr_conv;
15406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15407 this_ptr_conv.is_owned = false;
15408 LDKPublicKey val_ref;
15409 CHECK(*((uint32_t*)val) == 33);
15410 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15411 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15414 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15415 LDKAcceptChannel this_ptr_conv;
15416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15417 this_ptr_conv.is_owned = false;
15418 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15419 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15423 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15424 LDKAcceptChannel this_ptr_conv;
15425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15426 this_ptr_conv.is_owned = false;
15427 LDKPublicKey val_ref;
15428 CHECK(*((uint32_t*)val) == 33);
15429 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15430 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15433 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
15434 LDKAcceptChannel orig_conv;
15435 orig_conv.inner = (void*)(orig & (~1));
15436 orig_conv.is_owned = false;
15437 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
15438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15440 uint64_t ret_ref = (uint64_t)ret_var.inner;
15441 if (ret_var.is_owned) {
15447 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
15448 LDKFundingCreated this_obj_conv;
15449 this_obj_conv.inner = (void*)(this_obj & (~1));
15450 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15451 FundingCreated_free(this_obj_conv);
15454 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
15455 LDKFundingCreated this_ptr_conv;
15456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15457 this_ptr_conv.is_owned = false;
15458 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15459 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
15463 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15464 LDKFundingCreated this_ptr_conv;
15465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15466 this_ptr_conv.is_owned = false;
15467 LDKThirtyTwoBytes val_ref;
15468 CHECK(*((uint32_t*)val) == 32);
15469 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15470 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
15473 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
15474 LDKFundingCreated this_ptr_conv;
15475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15476 this_ptr_conv.is_owned = false;
15477 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15478 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
15482 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
15483 LDKFundingCreated this_ptr_conv;
15484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15485 this_ptr_conv.is_owned = false;
15486 LDKThirtyTwoBytes val_ref;
15487 CHECK(*((uint32_t*)val) == 32);
15488 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15489 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
15492 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
15493 LDKFundingCreated this_ptr_conv;
15494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15495 this_ptr_conv.is_owned = false;
15496 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
15500 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
15501 LDKFundingCreated this_ptr_conv;
15502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15503 this_ptr_conv.is_owned = false;
15504 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
15507 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
15508 LDKFundingCreated this_ptr_conv;
15509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15510 this_ptr_conv.is_owned = false;
15511 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15512 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
15516 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
15517 LDKFundingCreated this_ptr_conv;
15518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15519 this_ptr_conv.is_owned = false;
15520 LDKSignature val_ref;
15521 CHECK(*((uint32_t*)val) == 64);
15522 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15523 FundingCreated_set_signature(&this_ptr_conv, val_ref);
15526 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) {
15527 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
15528 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
15529 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
15530 LDKThirtyTwoBytes funding_txid_arg_ref;
15531 CHECK(*((uint32_t*)funding_txid_arg) == 32);
15532 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
15533 LDKSignature signature_arg_ref;
15534 CHECK(*((uint32_t*)signature_arg) == 64);
15535 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15536 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
15537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15539 uint64_t ret_ref = (uint64_t)ret_var.inner;
15540 if (ret_var.is_owned) {
15546 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
15547 LDKFundingCreated orig_conv;
15548 orig_conv.inner = (void*)(orig & (~1));
15549 orig_conv.is_owned = false;
15550 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
15551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15553 uint64_t ret_ref = (uint64_t)ret_var.inner;
15554 if (ret_var.is_owned) {
15560 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
15561 LDKFundingSigned this_obj_conv;
15562 this_obj_conv.inner = (void*)(this_obj & (~1));
15563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15564 FundingSigned_free(this_obj_conv);
15567 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
15568 LDKFundingSigned this_ptr_conv;
15569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15570 this_ptr_conv.is_owned = false;
15571 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15572 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
15576 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15577 LDKFundingSigned this_ptr_conv;
15578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15579 this_ptr_conv.is_owned = false;
15580 LDKThirtyTwoBytes val_ref;
15581 CHECK(*((uint32_t*)val) == 32);
15582 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15583 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
15586 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
15587 LDKFundingSigned this_ptr_conv;
15588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15589 this_ptr_conv.is_owned = false;
15590 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15591 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
15595 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
15596 LDKFundingSigned this_ptr_conv;
15597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15598 this_ptr_conv.is_owned = false;
15599 LDKSignature val_ref;
15600 CHECK(*((uint32_t*)val) == 64);
15601 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15602 FundingSigned_set_signature(&this_ptr_conv, val_ref);
15605 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
15606 LDKThirtyTwoBytes channel_id_arg_ref;
15607 CHECK(*((uint32_t*)channel_id_arg) == 32);
15608 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15609 LDKSignature signature_arg_ref;
15610 CHECK(*((uint32_t*)signature_arg) == 64);
15611 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15612 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
15613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15615 uint64_t ret_ref = (uint64_t)ret_var.inner;
15616 if (ret_var.is_owned) {
15622 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
15623 LDKFundingSigned orig_conv;
15624 orig_conv.inner = (void*)(orig & (~1));
15625 orig_conv.is_owned = false;
15626 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
15627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15629 uint64_t ret_ref = (uint64_t)ret_var.inner;
15630 if (ret_var.is_owned) {
15636 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
15637 LDKFundingLocked this_obj_conv;
15638 this_obj_conv.inner = (void*)(this_obj & (~1));
15639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15640 FundingLocked_free(this_obj_conv);
15643 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
15644 LDKFundingLocked this_ptr_conv;
15645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15646 this_ptr_conv.is_owned = false;
15647 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15648 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
15652 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15653 LDKFundingLocked this_ptr_conv;
15654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15655 this_ptr_conv.is_owned = false;
15656 LDKThirtyTwoBytes val_ref;
15657 CHECK(*((uint32_t*)val) == 32);
15658 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15659 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
15662 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
15663 LDKFundingLocked this_ptr_conv;
15664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15665 this_ptr_conv.is_owned = false;
15666 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15667 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15671 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15672 LDKFundingLocked this_ptr_conv;
15673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15674 this_ptr_conv.is_owned = false;
15675 LDKPublicKey val_ref;
15676 CHECK(*((uint32_t*)val) == 33);
15677 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15678 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
15681 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
15682 LDKThirtyTwoBytes channel_id_arg_ref;
15683 CHECK(*((uint32_t*)channel_id_arg) == 32);
15684 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15685 LDKPublicKey next_per_commitment_point_arg_ref;
15686 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
15687 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
15688 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
15689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15691 uint64_t ret_ref = (uint64_t)ret_var.inner;
15692 if (ret_var.is_owned) {
15698 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
15699 LDKFundingLocked orig_conv;
15700 orig_conv.inner = (void*)(orig & (~1));
15701 orig_conv.is_owned = false;
15702 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
15703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15705 uint64_t ret_ref = (uint64_t)ret_var.inner;
15706 if (ret_var.is_owned) {
15712 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
15713 LDKShutdown this_obj_conv;
15714 this_obj_conv.inner = (void*)(this_obj & (~1));
15715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15716 Shutdown_free(this_obj_conv);
15719 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
15720 LDKShutdown this_ptr_conv;
15721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15722 this_ptr_conv.is_owned = false;
15723 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15724 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
15728 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15729 LDKShutdown this_ptr_conv;
15730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15731 this_ptr_conv.is_owned = false;
15732 LDKThirtyTwoBytes val_ref;
15733 CHECK(*((uint32_t*)val) == 32);
15734 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15735 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
15738 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
15739 LDKShutdown this_ptr_conv;
15740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15741 this_ptr_conv.is_owned = false;
15742 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
15743 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15744 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15748 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
15749 LDKShutdown this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = false;
15752 LDKCVec_u8Z val_ref;
15753 val_ref.datalen = *((uint32_t*)val);
15754 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15755 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15756 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
15759 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
15760 LDKThirtyTwoBytes channel_id_arg_ref;
15761 CHECK(*((uint32_t*)channel_id_arg) == 32);
15762 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15763 LDKCVec_u8Z scriptpubkey_arg_ref;
15764 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
15765 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15766 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
15767 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
15768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15770 uint64_t ret_ref = (uint64_t)ret_var.inner;
15771 if (ret_var.is_owned) {
15777 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
15778 LDKShutdown orig_conv;
15779 orig_conv.inner = (void*)(orig & (~1));
15780 orig_conv.is_owned = false;
15781 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
15782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15784 uint64_t ret_ref = (uint64_t)ret_var.inner;
15785 if (ret_var.is_owned) {
15791 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
15792 LDKClosingSigned this_obj_conv;
15793 this_obj_conv.inner = (void*)(this_obj & (~1));
15794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15795 ClosingSigned_free(this_obj_conv);
15798 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
15799 LDKClosingSigned this_ptr_conv;
15800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15801 this_ptr_conv.is_owned = false;
15802 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15803 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
15807 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15808 LDKClosingSigned this_ptr_conv;
15809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15810 this_ptr_conv.is_owned = false;
15811 LDKThirtyTwoBytes val_ref;
15812 CHECK(*((uint32_t*)val) == 32);
15813 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15814 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
15817 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
15818 LDKClosingSigned this_ptr_conv;
15819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15820 this_ptr_conv.is_owned = false;
15821 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
15825 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
15826 LDKClosingSigned this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = false;
15829 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
15832 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
15833 LDKClosingSigned this_ptr_conv;
15834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15835 this_ptr_conv.is_owned = false;
15836 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15837 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
15841 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
15842 LDKClosingSigned this_ptr_conv;
15843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15844 this_ptr_conv.is_owned = false;
15845 LDKSignature val_ref;
15846 CHECK(*((uint32_t*)val) == 64);
15847 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15848 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
15851 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
15852 LDKThirtyTwoBytes channel_id_arg_ref;
15853 CHECK(*((uint32_t*)channel_id_arg) == 32);
15854 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15855 LDKSignature signature_arg_ref;
15856 CHECK(*((uint32_t*)signature_arg) == 64);
15857 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15858 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
15859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15861 uint64_t ret_ref = (uint64_t)ret_var.inner;
15862 if (ret_var.is_owned) {
15868 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
15869 LDKClosingSigned orig_conv;
15870 orig_conv.inner = (void*)(orig & (~1));
15871 orig_conv.is_owned = false;
15872 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
15873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15875 uint64_t ret_ref = (uint64_t)ret_var.inner;
15876 if (ret_var.is_owned) {
15882 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
15883 LDKUpdateAddHTLC this_obj_conv;
15884 this_obj_conv.inner = (void*)(this_obj & (~1));
15885 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15886 UpdateAddHTLC_free(this_obj_conv);
15889 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
15890 LDKUpdateAddHTLC this_ptr_conv;
15891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15892 this_ptr_conv.is_owned = false;
15893 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15894 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
15898 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15899 LDKUpdateAddHTLC this_ptr_conv;
15900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15901 this_ptr_conv.is_owned = false;
15902 LDKThirtyTwoBytes val_ref;
15903 CHECK(*((uint32_t*)val) == 32);
15904 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15905 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
15908 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
15909 LDKUpdateAddHTLC this_ptr_conv;
15910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15911 this_ptr_conv.is_owned = false;
15912 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
15916 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
15917 LDKUpdateAddHTLC this_ptr_conv;
15918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15919 this_ptr_conv.is_owned = false;
15920 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
15923 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
15924 LDKUpdateAddHTLC this_ptr_conv;
15925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15926 this_ptr_conv.is_owned = false;
15927 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
15931 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
15932 LDKUpdateAddHTLC this_ptr_conv;
15933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15934 this_ptr_conv.is_owned = false;
15935 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
15938 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
15939 LDKUpdateAddHTLC this_ptr_conv;
15940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15941 this_ptr_conv.is_owned = false;
15942 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15943 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
15947 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
15948 LDKUpdateAddHTLC this_ptr_conv;
15949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15950 this_ptr_conv.is_owned = false;
15951 LDKThirtyTwoBytes val_ref;
15952 CHECK(*((uint32_t*)val) == 32);
15953 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15954 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
15957 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
15958 LDKUpdateAddHTLC this_ptr_conv;
15959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15960 this_ptr_conv.is_owned = false;
15961 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
15965 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
15966 LDKUpdateAddHTLC this_ptr_conv;
15967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15968 this_ptr_conv.is_owned = false;
15969 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
15972 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
15973 LDKUpdateAddHTLC orig_conv;
15974 orig_conv.inner = (void*)(orig & (~1));
15975 orig_conv.is_owned = false;
15976 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
15980 if (ret_var.is_owned) {
15986 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
15987 LDKUpdateFulfillHTLC this_obj_conv;
15988 this_obj_conv.inner = (void*)(this_obj & (~1));
15989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15990 UpdateFulfillHTLC_free(this_obj_conv);
15993 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
15994 LDKUpdateFulfillHTLC this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = false;
15997 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15998 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
16002 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16003 LDKUpdateFulfillHTLC this_ptr_conv;
16004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16005 this_ptr_conv.is_owned = false;
16006 LDKThirtyTwoBytes val_ref;
16007 CHECK(*((uint32_t*)val) == 32);
16008 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16009 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
16012 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
16013 LDKUpdateFulfillHTLC this_ptr_conv;
16014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16015 this_ptr_conv.is_owned = false;
16016 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
16020 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16021 LDKUpdateFulfillHTLC this_ptr_conv;
16022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16023 this_ptr_conv.is_owned = false;
16024 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
16027 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
16028 LDKUpdateFulfillHTLC this_ptr_conv;
16029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16030 this_ptr_conv.is_owned = false;
16031 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16032 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
16036 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
16037 LDKUpdateFulfillHTLC this_ptr_conv;
16038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16039 this_ptr_conv.is_owned = false;
16040 LDKThirtyTwoBytes val_ref;
16041 CHECK(*((uint32_t*)val) == 32);
16042 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16043 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
16046 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
16047 LDKThirtyTwoBytes channel_id_arg_ref;
16048 CHECK(*((uint32_t*)channel_id_arg) == 32);
16049 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16050 LDKThirtyTwoBytes payment_preimage_arg_ref;
16051 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
16052 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
16053 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
16054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16056 uint64_t ret_ref = (uint64_t)ret_var.inner;
16057 if (ret_var.is_owned) {
16063 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
16064 LDKUpdateFulfillHTLC orig_conv;
16065 orig_conv.inner = (void*)(orig & (~1));
16066 orig_conv.is_owned = false;
16067 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
16068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16070 uint64_t ret_ref = (uint64_t)ret_var.inner;
16071 if (ret_var.is_owned) {
16077 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
16078 LDKUpdateFailHTLC this_obj_conv;
16079 this_obj_conv.inner = (void*)(this_obj & (~1));
16080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16081 UpdateFailHTLC_free(this_obj_conv);
16084 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
16085 LDKUpdateFailHTLC this_ptr_conv;
16086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16087 this_ptr_conv.is_owned = false;
16088 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16089 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
16093 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16094 LDKUpdateFailHTLC this_ptr_conv;
16095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16096 this_ptr_conv.is_owned = false;
16097 LDKThirtyTwoBytes val_ref;
16098 CHECK(*((uint32_t*)val) == 32);
16099 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16100 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
16103 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
16104 LDKUpdateFailHTLC this_ptr_conv;
16105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16106 this_ptr_conv.is_owned = false;
16107 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
16111 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16112 LDKUpdateFailHTLC this_ptr_conv;
16113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16114 this_ptr_conv.is_owned = false;
16115 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
16118 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
16119 LDKUpdateFailHTLC orig_conv;
16120 orig_conv.inner = (void*)(orig & (~1));
16121 orig_conv.is_owned = false;
16122 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
16123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16125 uint64_t ret_ref = (uint64_t)ret_var.inner;
16126 if (ret_var.is_owned) {
16132 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
16133 LDKUpdateFailMalformedHTLC this_obj_conv;
16134 this_obj_conv.inner = (void*)(this_obj & (~1));
16135 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16136 UpdateFailMalformedHTLC_free(this_obj_conv);
16139 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
16140 LDKUpdateFailMalformedHTLC this_ptr_conv;
16141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16142 this_ptr_conv.is_owned = false;
16143 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16144 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
16148 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16149 LDKUpdateFailMalformedHTLC this_ptr_conv;
16150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16151 this_ptr_conv.is_owned = false;
16152 LDKThirtyTwoBytes val_ref;
16153 CHECK(*((uint32_t*)val) == 32);
16154 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16155 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
16158 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
16159 LDKUpdateFailMalformedHTLC this_ptr_conv;
16160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16161 this_ptr_conv.is_owned = false;
16162 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
16166 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16167 LDKUpdateFailMalformedHTLC this_ptr_conv;
16168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16169 this_ptr_conv.is_owned = false;
16170 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
16173 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
16174 LDKUpdateFailMalformedHTLC this_ptr_conv;
16175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16176 this_ptr_conv.is_owned = false;
16177 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
16181 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
16182 LDKUpdateFailMalformedHTLC this_ptr_conv;
16183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16184 this_ptr_conv.is_owned = false;
16185 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
16188 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
16189 LDKUpdateFailMalformedHTLC orig_conv;
16190 orig_conv.inner = (void*)(orig & (~1));
16191 orig_conv.is_owned = false;
16192 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
16193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16195 uint64_t ret_ref = (uint64_t)ret_var.inner;
16196 if (ret_var.is_owned) {
16202 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
16203 LDKCommitmentSigned this_obj_conv;
16204 this_obj_conv.inner = (void*)(this_obj & (~1));
16205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16206 CommitmentSigned_free(this_obj_conv);
16209 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
16210 LDKCommitmentSigned this_ptr_conv;
16211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16212 this_ptr_conv.is_owned = false;
16213 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16214 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
16218 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16219 LDKCommitmentSigned this_ptr_conv;
16220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16221 this_ptr_conv.is_owned = false;
16222 LDKThirtyTwoBytes val_ref;
16223 CHECK(*((uint32_t*)val) == 32);
16224 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16225 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
16228 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
16229 LDKCommitmentSigned this_ptr_conv;
16230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16231 this_ptr_conv.is_owned = false;
16232 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16233 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
16237 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
16238 LDKCommitmentSigned this_ptr_conv;
16239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16240 this_ptr_conv.is_owned = false;
16241 LDKSignature val_ref;
16242 CHECK(*((uint32_t*)val) == 64);
16243 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16244 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
16247 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
16248 LDKCommitmentSigned this_ptr_conv;
16249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16250 this_ptr_conv.is_owned = false;
16251 LDKCVec_SignatureZ val_constr;
16252 val_constr.datalen = *((uint32_t*)val);
16253 if (val_constr.datalen > 0)
16254 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16256 val_constr.data = NULL;
16257 int8_tArray* val_vals = (int8_tArray*)(val + 4);
16258 for (size_t m = 0; m < val_constr.datalen; m++) {
16259 int8_tArray val_conv_12 = val_vals[m];
16260 LDKSignature val_conv_12_ref;
16261 CHECK(*((uint32_t*)val_conv_12) == 64);
16262 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
16263 val_constr.data[m] = val_conv_12_ref;
16265 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
16268 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
16269 LDKThirtyTwoBytes channel_id_arg_ref;
16270 CHECK(*((uint32_t*)channel_id_arg) == 32);
16271 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16272 LDKSignature signature_arg_ref;
16273 CHECK(*((uint32_t*)signature_arg) == 64);
16274 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16275 LDKCVec_SignatureZ htlc_signatures_arg_constr;
16276 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
16277 if (htlc_signatures_arg_constr.datalen > 0)
16278 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16280 htlc_signatures_arg_constr.data = NULL;
16281 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
16282 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
16283 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
16284 LDKSignature htlc_signatures_arg_conv_12_ref;
16285 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
16286 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
16287 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
16289 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
16290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16292 uint64_t ret_ref = (uint64_t)ret_var.inner;
16293 if (ret_var.is_owned) {
16299 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
16300 LDKCommitmentSigned orig_conv;
16301 orig_conv.inner = (void*)(orig & (~1));
16302 orig_conv.is_owned = false;
16303 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
16304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16306 uint64_t ret_ref = (uint64_t)ret_var.inner;
16307 if (ret_var.is_owned) {
16313 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
16314 LDKRevokeAndACK this_obj_conv;
16315 this_obj_conv.inner = (void*)(this_obj & (~1));
16316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16317 RevokeAndACK_free(this_obj_conv);
16320 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
16321 LDKRevokeAndACK this_ptr_conv;
16322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16323 this_ptr_conv.is_owned = false;
16324 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16325 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
16329 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16330 LDKRevokeAndACK this_ptr_conv;
16331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16332 this_ptr_conv.is_owned = false;
16333 LDKThirtyTwoBytes val_ref;
16334 CHECK(*((uint32_t*)val) == 32);
16335 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16336 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
16339 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
16340 LDKRevokeAndACK this_ptr_conv;
16341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16342 this_ptr_conv.is_owned = false;
16343 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16344 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
16348 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16349 LDKRevokeAndACK this_ptr_conv;
16350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16351 this_ptr_conv.is_owned = false;
16352 LDKThirtyTwoBytes val_ref;
16353 CHECK(*((uint32_t*)val) == 32);
16354 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16355 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
16358 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
16359 LDKRevokeAndACK 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(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16363 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16367 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16368 LDKRevokeAndACK this_ptr_conv;
16369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16370 this_ptr_conv.is_owned = false;
16371 LDKPublicKey val_ref;
16372 CHECK(*((uint32_t*)val) == 33);
16373 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16374 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
16377 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) {
16378 LDKThirtyTwoBytes channel_id_arg_ref;
16379 CHECK(*((uint32_t*)channel_id_arg) == 32);
16380 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16381 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
16382 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
16383 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
16384 LDKPublicKey next_per_commitment_point_arg_ref;
16385 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
16386 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
16387 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
16388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16390 uint64_t ret_ref = (uint64_t)ret_var.inner;
16391 if (ret_var.is_owned) {
16397 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
16398 LDKRevokeAndACK orig_conv;
16399 orig_conv.inner = (void*)(orig & (~1));
16400 orig_conv.is_owned = false;
16401 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
16402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16404 uint64_t ret_ref = (uint64_t)ret_var.inner;
16405 if (ret_var.is_owned) {
16411 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
16412 LDKUpdateFee this_obj_conv;
16413 this_obj_conv.inner = (void*)(this_obj & (~1));
16414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16415 UpdateFee_free(this_obj_conv);
16418 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
16419 LDKUpdateFee this_ptr_conv;
16420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16421 this_ptr_conv.is_owned = false;
16422 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16423 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
16427 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16428 LDKUpdateFee this_ptr_conv;
16429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16430 this_ptr_conv.is_owned = false;
16431 LDKThirtyTwoBytes val_ref;
16432 CHECK(*((uint32_t*)val) == 32);
16433 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16434 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
16437 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
16438 LDKUpdateFee this_ptr_conv;
16439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16440 this_ptr_conv.is_owned = false;
16441 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
16445 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16446 LDKUpdateFee this_ptr_conv;
16447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16448 this_ptr_conv.is_owned = false;
16449 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
16452 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
16453 LDKThirtyTwoBytes channel_id_arg_ref;
16454 CHECK(*((uint32_t*)channel_id_arg) == 32);
16455 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16456 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
16457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16459 uint64_t ret_ref = (uint64_t)ret_var.inner;
16460 if (ret_var.is_owned) {
16466 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
16467 LDKUpdateFee orig_conv;
16468 orig_conv.inner = (void*)(orig & (~1));
16469 orig_conv.is_owned = false;
16470 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
16471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16473 uint64_t ret_ref = (uint64_t)ret_var.inner;
16474 if (ret_var.is_owned) {
16480 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
16481 LDKDataLossProtect this_obj_conv;
16482 this_obj_conv.inner = (void*)(this_obj & (~1));
16483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16484 DataLossProtect_free(this_obj_conv);
16487 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
16488 LDKDataLossProtect this_ptr_conv;
16489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16490 this_ptr_conv.is_owned = false;
16491 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16492 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
16496 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16497 LDKDataLossProtect this_ptr_conv;
16498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16499 this_ptr_conv.is_owned = false;
16500 LDKThirtyTwoBytes val_ref;
16501 CHECK(*((uint32_t*)val) == 32);
16502 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16503 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
16506 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
16507 LDKDataLossProtect this_ptr_conv;
16508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16509 this_ptr_conv.is_owned = false;
16510 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16511 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16515 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16516 LDKDataLossProtect this_ptr_conv;
16517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16518 this_ptr_conv.is_owned = false;
16519 LDKPublicKey val_ref;
16520 CHECK(*((uint32_t*)val) == 33);
16521 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16522 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
16525 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
16526 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
16527 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
16528 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
16529 LDKPublicKey my_current_per_commitment_point_arg_ref;
16530 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
16531 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
16532 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
16533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16535 uint64_t ret_ref = (uint64_t)ret_var.inner;
16536 if (ret_var.is_owned) {
16542 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
16543 LDKDataLossProtect orig_conv;
16544 orig_conv.inner = (void*)(orig & (~1));
16545 orig_conv.is_owned = false;
16546 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
16547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16549 uint64_t ret_ref = (uint64_t)ret_var.inner;
16550 if (ret_var.is_owned) {
16556 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
16557 LDKChannelReestablish this_obj_conv;
16558 this_obj_conv.inner = (void*)(this_obj & (~1));
16559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16560 ChannelReestablish_free(this_obj_conv);
16563 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
16564 LDKChannelReestablish this_ptr_conv;
16565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16566 this_ptr_conv.is_owned = false;
16567 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16568 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
16572 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16573 LDKChannelReestablish this_ptr_conv;
16574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16575 this_ptr_conv.is_owned = false;
16576 LDKThirtyTwoBytes val_ref;
16577 CHECK(*((uint32_t*)val) == 32);
16578 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16579 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
16582 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
16583 LDKChannelReestablish this_ptr_conv;
16584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16585 this_ptr_conv.is_owned = false;
16586 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
16590 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
16591 LDKChannelReestablish this_ptr_conv;
16592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16593 this_ptr_conv.is_owned = false;
16594 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
16597 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
16598 LDKChannelReestablish this_ptr_conv;
16599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16600 this_ptr_conv.is_owned = false;
16601 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
16605 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
16606 LDKChannelReestablish this_ptr_conv;
16607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16608 this_ptr_conv.is_owned = false;
16609 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
16612 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
16613 LDKChannelReestablish orig_conv;
16614 orig_conv.inner = (void*)(orig & (~1));
16615 orig_conv.is_owned = false;
16616 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
16617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16619 uint64_t ret_ref = (uint64_t)ret_var.inner;
16620 if (ret_var.is_owned) {
16626 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
16627 LDKAnnouncementSignatures this_obj_conv;
16628 this_obj_conv.inner = (void*)(this_obj & (~1));
16629 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16630 AnnouncementSignatures_free(this_obj_conv);
16633 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
16634 LDKAnnouncementSignatures this_ptr_conv;
16635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16636 this_ptr_conv.is_owned = false;
16637 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16638 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
16642 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16643 LDKAnnouncementSignatures this_ptr_conv;
16644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16645 this_ptr_conv.is_owned = false;
16646 LDKThirtyTwoBytes val_ref;
16647 CHECK(*((uint32_t*)val) == 32);
16648 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16649 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
16652 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
16653 LDKAnnouncementSignatures this_ptr_conv;
16654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16655 this_ptr_conv.is_owned = false;
16656 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
16660 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
16661 LDKAnnouncementSignatures this_ptr_conv;
16662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16663 this_ptr_conv.is_owned = false;
16664 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
16667 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
16668 LDKAnnouncementSignatures this_ptr_conv;
16669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16670 this_ptr_conv.is_owned = false;
16671 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16672 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
16676 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
16677 LDKAnnouncementSignatures this_ptr_conv;
16678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16679 this_ptr_conv.is_owned = false;
16680 LDKSignature val_ref;
16681 CHECK(*((uint32_t*)val) == 64);
16682 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16683 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
16686 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
16687 LDKAnnouncementSignatures this_ptr_conv;
16688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16689 this_ptr_conv.is_owned = false;
16690 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16691 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
16695 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
16696 LDKAnnouncementSignatures this_ptr_conv;
16697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16698 this_ptr_conv.is_owned = false;
16699 LDKSignature val_ref;
16700 CHECK(*((uint32_t*)val) == 64);
16701 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16702 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
16705 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) {
16706 LDKThirtyTwoBytes channel_id_arg_ref;
16707 CHECK(*((uint32_t*)channel_id_arg) == 32);
16708 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16709 LDKSignature node_signature_arg_ref;
16710 CHECK(*((uint32_t*)node_signature_arg) == 64);
16711 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
16712 LDKSignature bitcoin_signature_arg_ref;
16713 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
16714 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
16715 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
16716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16718 uint64_t ret_ref = (uint64_t)ret_var.inner;
16719 if (ret_var.is_owned) {
16725 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
16726 LDKAnnouncementSignatures orig_conv;
16727 orig_conv.inner = (void*)(orig & (~1));
16728 orig_conv.is_owned = false;
16729 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
16730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16732 uint64_t ret_ref = (uint64_t)ret_var.inner;
16733 if (ret_var.is_owned) {
16739 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
16740 if ((this_ptr & 1) != 0) return;
16741 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
16742 FREE((void*)this_ptr);
16743 NetAddress_free(this_ptr_conv);
16746 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
16747 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
16748 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16749 *ret_copy = NetAddress_clone(orig_conv);
16750 uint64_t ret_ref = (uint64_t)ret_copy;
16754 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
16755 LDKFourBytes addr_ref;
16756 CHECK(*((uint32_t*)addr) == 4);
16757 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
16758 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16759 *ret_copy = NetAddress_ipv4(addr_ref, port);
16760 uint64_t ret_ref = (uint64_t)ret_copy;
16764 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
16765 LDKSixteenBytes addr_ref;
16766 CHECK(*((uint32_t*)addr) == 16);
16767 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
16768 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16769 *ret_copy = NetAddress_ipv6(addr_ref, port);
16770 uint64_t ret_ref = (uint64_t)ret_copy;
16774 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
16775 LDKTenBytes addr_ref;
16776 CHECK(*((uint32_t*)addr) == 10);
16777 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
16778 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16779 *ret_copy = NetAddress_onion_v2(addr_ref, port);
16780 uint64_t ret_ref = (uint64_t)ret_copy;
16784 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
16785 LDKThirtyTwoBytes ed25519_pubkey_ref;
16786 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
16787 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
16788 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
16789 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
16790 uint64_t ret_ref = (uint64_t)ret_copy;
16794 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
16795 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
16796 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
16797 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16798 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16799 CVec_u8Z_free(ret_var);
16803 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
16804 LDKu8slice ser_ref;
16805 ser_ref.datalen = *((uint32_t*)ser);
16806 ser_ref.data = (int8_t*)(ser + 4);
16807 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
16808 *ret_conv = Result_read(ser_ref);
16809 return (uint64_t)ret_conv;
16812 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
16813 LDKu8slice ser_ref;
16814 ser_ref.datalen = *((uint32_t*)ser);
16815 ser_ref.data = (int8_t*)(ser + 4);
16816 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
16817 *ret_conv = NetAddress_read(ser_ref);
16818 return (uint64_t)ret_conv;
16821 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
16822 LDKUnsignedNodeAnnouncement this_obj_conv;
16823 this_obj_conv.inner = (void*)(this_obj & (~1));
16824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16825 UnsignedNodeAnnouncement_free(this_obj_conv);
16828 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
16829 LDKUnsignedNodeAnnouncement this_ptr_conv;
16830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16831 this_ptr_conv.is_owned = false;
16832 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
16833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16835 uint64_t ret_ref = (uint64_t)ret_var.inner;
16836 if (ret_var.is_owned) {
16842 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
16843 LDKUnsignedNodeAnnouncement this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = false;
16846 LDKNodeFeatures val_conv;
16847 val_conv.inner = (void*)(val & (~1));
16848 val_conv.is_owned = (val & 1) || (val == 0);
16849 val_conv = NodeFeatures_clone(&val_conv);
16850 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
16853 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
16854 LDKUnsignedNodeAnnouncement this_ptr_conv;
16855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16856 this_ptr_conv.is_owned = false;
16857 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
16861 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
16862 LDKUnsignedNodeAnnouncement this_ptr_conv;
16863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16864 this_ptr_conv.is_owned = false;
16865 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
16868 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
16869 LDKUnsignedNodeAnnouncement this_ptr_conv;
16870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16871 this_ptr_conv.is_owned = false;
16872 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16873 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
16877 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
16878 LDKUnsignedNodeAnnouncement this_ptr_conv;
16879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16880 this_ptr_conv.is_owned = false;
16881 LDKPublicKey val_ref;
16882 CHECK(*((uint32_t*)val) == 33);
16883 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16884 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
16887 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
16888 LDKUnsignedNodeAnnouncement this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
16892 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
16896 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
16897 LDKUnsignedNodeAnnouncement this_ptr_conv;
16898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16899 this_ptr_conv.is_owned = false;
16900 LDKThreeBytes val_ref;
16901 CHECK(*((uint32_t*)val) == 3);
16902 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
16903 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
16906 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
16907 LDKUnsignedNodeAnnouncement this_ptr_conv;
16908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16909 this_ptr_conv.is_owned = false;
16910 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16911 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
16915 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
16916 LDKUnsignedNodeAnnouncement this_ptr_conv;
16917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16918 this_ptr_conv.is_owned = false;
16919 LDKThirtyTwoBytes val_ref;
16920 CHECK(*((uint32_t*)val) == 32);
16921 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16922 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
16925 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
16926 LDKUnsignedNodeAnnouncement this_ptr_conv;
16927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16928 this_ptr_conv.is_owned = false;
16929 LDKCVec_NetAddressZ val_constr;
16930 val_constr.datalen = *((uint32_t*)val);
16931 if (val_constr.datalen > 0)
16932 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16934 val_constr.data = NULL;
16935 uint32_t* val_vals = (uint32_t*)(val + 4);
16936 for (size_t m = 0; m < val_constr.datalen; m++) {
16937 uint32_t val_conv_12 = val_vals[m];
16938 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
16939 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
16940 val_constr.data[m] = val_conv_12_conv;
16942 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
16945 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
16946 LDKUnsignedNodeAnnouncement orig_conv;
16947 orig_conv.inner = (void*)(orig & (~1));
16948 orig_conv.is_owned = false;
16949 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
16950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16952 uint64_t ret_ref = (uint64_t)ret_var.inner;
16953 if (ret_var.is_owned) {
16959 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
16960 LDKNodeAnnouncement this_obj_conv;
16961 this_obj_conv.inner = (void*)(this_obj & (~1));
16962 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16963 NodeAnnouncement_free(this_obj_conv);
16966 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
16967 LDKNodeAnnouncement this_ptr_conv;
16968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16969 this_ptr_conv.is_owned = false;
16970 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16971 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
16975 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
16976 LDKNodeAnnouncement this_ptr_conv;
16977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16978 this_ptr_conv.is_owned = false;
16979 LDKSignature val_ref;
16980 CHECK(*((uint32_t*)val) == 64);
16981 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16982 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
16985 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
16986 LDKNodeAnnouncement this_ptr_conv;
16987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16988 this_ptr_conv.is_owned = false;
16989 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
16990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16992 uint64_t ret_ref = (uint64_t)ret_var.inner;
16993 if (ret_var.is_owned) {
16999 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17000 LDKNodeAnnouncement this_ptr_conv;
17001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17002 this_ptr_conv.is_owned = false;
17003 LDKUnsignedNodeAnnouncement val_conv;
17004 val_conv.inner = (void*)(val & (~1));
17005 val_conv.is_owned = (val & 1) || (val == 0);
17006 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
17007 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
17010 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
17011 LDKSignature signature_arg_ref;
17012 CHECK(*((uint32_t*)signature_arg) == 64);
17013 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17014 LDKUnsignedNodeAnnouncement contents_arg_conv;
17015 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17016 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17017 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
17018 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
17019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17021 uint64_t ret_ref = (uint64_t)ret_var.inner;
17022 if (ret_var.is_owned) {
17028 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
17029 LDKNodeAnnouncement orig_conv;
17030 orig_conv.inner = (void*)(orig & (~1));
17031 orig_conv.is_owned = false;
17032 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
17033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17035 uint64_t ret_ref = (uint64_t)ret_var.inner;
17036 if (ret_var.is_owned) {
17042 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
17043 LDKUnsignedChannelAnnouncement this_obj_conv;
17044 this_obj_conv.inner = (void*)(this_obj & (~1));
17045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17046 UnsignedChannelAnnouncement_free(this_obj_conv);
17049 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
17050 LDKUnsignedChannelAnnouncement this_ptr_conv;
17051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17052 this_ptr_conv.is_owned = false;
17053 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
17054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17056 uint64_t ret_ref = (uint64_t)ret_var.inner;
17057 if (ret_var.is_owned) {
17063 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
17064 LDKUnsignedChannelAnnouncement this_ptr_conv;
17065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17066 this_ptr_conv.is_owned = false;
17067 LDKChannelFeatures val_conv;
17068 val_conv.inner = (void*)(val & (~1));
17069 val_conv.is_owned = (val & 1) || (val == 0);
17070 val_conv = ChannelFeatures_clone(&val_conv);
17071 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
17074 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
17075 LDKUnsignedChannelAnnouncement this_ptr_conv;
17076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17077 this_ptr_conv.is_owned = false;
17078 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17079 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
17083 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17084 LDKUnsignedChannelAnnouncement this_ptr_conv;
17085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17086 this_ptr_conv.is_owned = false;
17087 LDKThirtyTwoBytes val_ref;
17088 CHECK(*((uint32_t*)val) == 32);
17089 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17090 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
17093 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
17094 LDKUnsignedChannelAnnouncement this_ptr_conv;
17095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17096 this_ptr_conv.is_owned = false;
17097 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
17101 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17102 LDKUnsignedChannelAnnouncement this_ptr_conv;
17103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17104 this_ptr_conv.is_owned = false;
17105 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
17108 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
17109 LDKUnsignedChannelAnnouncement this_ptr_conv;
17110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17111 this_ptr_conv.is_owned = false;
17112 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17113 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
17117 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
17118 LDKUnsignedChannelAnnouncement this_ptr_conv;
17119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17120 this_ptr_conv.is_owned = false;
17121 LDKPublicKey val_ref;
17122 CHECK(*((uint32_t*)val) == 33);
17123 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17124 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
17127 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
17128 LDKUnsignedChannelAnnouncement this_ptr_conv;
17129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17130 this_ptr_conv.is_owned = false;
17131 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17132 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
17136 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
17137 LDKUnsignedChannelAnnouncement this_ptr_conv;
17138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17139 this_ptr_conv.is_owned = false;
17140 LDKPublicKey val_ref;
17141 CHECK(*((uint32_t*)val) == 33);
17142 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17143 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
17146 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
17147 LDKUnsignedChannelAnnouncement this_ptr_conv;
17148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17149 this_ptr_conv.is_owned = false;
17150 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17151 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
17155 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
17156 LDKUnsignedChannelAnnouncement this_ptr_conv;
17157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17158 this_ptr_conv.is_owned = false;
17159 LDKPublicKey val_ref;
17160 CHECK(*((uint32_t*)val) == 33);
17161 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17162 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
17165 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
17166 LDKUnsignedChannelAnnouncement this_ptr_conv;
17167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17168 this_ptr_conv.is_owned = false;
17169 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17170 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
17174 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
17175 LDKUnsignedChannelAnnouncement this_ptr_conv;
17176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17177 this_ptr_conv.is_owned = false;
17178 LDKPublicKey val_ref;
17179 CHECK(*((uint32_t*)val) == 33);
17180 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17181 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
17184 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
17185 LDKUnsignedChannelAnnouncement orig_conv;
17186 orig_conv.inner = (void*)(orig & (~1));
17187 orig_conv.is_owned = false;
17188 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
17189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17191 uint64_t ret_ref = (uint64_t)ret_var.inner;
17192 if (ret_var.is_owned) {
17198 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
17199 LDKChannelAnnouncement this_obj_conv;
17200 this_obj_conv.inner = (void*)(this_obj & (~1));
17201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17202 ChannelAnnouncement_free(this_obj_conv);
17205 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
17206 LDKChannelAnnouncement this_ptr_conv;
17207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17208 this_ptr_conv.is_owned = false;
17209 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17210 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
17214 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
17215 LDKChannelAnnouncement this_ptr_conv;
17216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17217 this_ptr_conv.is_owned = false;
17218 LDKSignature val_ref;
17219 CHECK(*((uint32_t*)val) == 64);
17220 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17221 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
17224 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
17225 LDKChannelAnnouncement this_ptr_conv;
17226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17227 this_ptr_conv.is_owned = false;
17228 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17229 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
17233 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
17234 LDKChannelAnnouncement this_ptr_conv;
17235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17236 this_ptr_conv.is_owned = false;
17237 LDKSignature val_ref;
17238 CHECK(*((uint32_t*)val) == 64);
17239 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17240 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
17243 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
17244 LDKChannelAnnouncement this_ptr_conv;
17245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17246 this_ptr_conv.is_owned = false;
17247 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17248 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
17252 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
17253 LDKChannelAnnouncement this_ptr_conv;
17254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17255 this_ptr_conv.is_owned = false;
17256 LDKSignature val_ref;
17257 CHECK(*((uint32_t*)val) == 64);
17258 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17259 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
17262 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
17263 LDKChannelAnnouncement this_ptr_conv;
17264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17265 this_ptr_conv.is_owned = false;
17266 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17267 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
17271 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
17272 LDKChannelAnnouncement this_ptr_conv;
17273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17274 this_ptr_conv.is_owned = false;
17275 LDKSignature val_ref;
17276 CHECK(*((uint32_t*)val) == 64);
17277 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17278 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
17281 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
17282 LDKChannelAnnouncement this_ptr_conv;
17283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17284 this_ptr_conv.is_owned = false;
17285 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
17286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17288 uint64_t ret_ref = (uint64_t)ret_var.inner;
17289 if (ret_var.is_owned) {
17295 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17296 LDKChannelAnnouncement this_ptr_conv;
17297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17298 this_ptr_conv.is_owned = false;
17299 LDKUnsignedChannelAnnouncement val_conv;
17300 val_conv.inner = (void*)(val & (~1));
17301 val_conv.is_owned = (val & 1) || (val == 0);
17302 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
17303 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
17306 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) {
17307 LDKSignature node_signature_1_arg_ref;
17308 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
17309 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
17310 LDKSignature node_signature_2_arg_ref;
17311 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
17312 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
17313 LDKSignature bitcoin_signature_1_arg_ref;
17314 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
17315 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
17316 LDKSignature bitcoin_signature_2_arg_ref;
17317 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
17318 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
17319 LDKUnsignedChannelAnnouncement contents_arg_conv;
17320 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17321 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17322 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
17323 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);
17324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17326 uint64_t ret_ref = (uint64_t)ret_var.inner;
17327 if (ret_var.is_owned) {
17333 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
17334 LDKChannelAnnouncement orig_conv;
17335 orig_conv.inner = (void*)(orig & (~1));
17336 orig_conv.is_owned = false;
17337 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
17338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17340 uint64_t ret_ref = (uint64_t)ret_var.inner;
17341 if (ret_var.is_owned) {
17347 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
17348 LDKUnsignedChannelUpdate this_obj_conv;
17349 this_obj_conv.inner = (void*)(this_obj & (~1));
17350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17351 UnsignedChannelUpdate_free(this_obj_conv);
17354 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
17355 LDKUnsignedChannelUpdate this_ptr_conv;
17356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17357 this_ptr_conv.is_owned = false;
17358 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17359 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
17363 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17364 LDKUnsignedChannelUpdate this_ptr_conv;
17365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17366 this_ptr_conv.is_owned = false;
17367 LDKThirtyTwoBytes val_ref;
17368 CHECK(*((uint32_t*)val) == 32);
17369 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17370 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
17373 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
17374 LDKUnsignedChannelUpdate this_ptr_conv;
17375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17376 this_ptr_conv.is_owned = false;
17377 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
17381 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17382 LDKUnsignedChannelUpdate this_ptr_conv;
17383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17384 this_ptr_conv.is_owned = false;
17385 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
17388 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
17389 LDKUnsignedChannelUpdate this_ptr_conv;
17390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17391 this_ptr_conv.is_owned = false;
17392 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
17396 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
17397 LDKUnsignedChannelUpdate this_ptr_conv;
17398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17399 this_ptr_conv.is_owned = false;
17400 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
17403 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
17404 LDKUnsignedChannelUpdate this_ptr_conv;
17405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17406 this_ptr_conv.is_owned = false;
17407 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
17411 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
17412 LDKUnsignedChannelUpdate this_ptr_conv;
17413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17414 this_ptr_conv.is_owned = false;
17415 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
17418 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
17419 LDKUnsignedChannelUpdate this_ptr_conv;
17420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17421 this_ptr_conv.is_owned = false;
17422 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
17426 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17427 LDKUnsignedChannelUpdate this_ptr_conv;
17428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17429 this_ptr_conv.is_owned = false;
17430 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
17433 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
17434 LDKUnsignedChannelUpdate this_ptr_conv;
17435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17436 this_ptr_conv.is_owned = false;
17437 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
17441 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17442 LDKUnsignedChannelUpdate this_ptr_conv;
17443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17444 this_ptr_conv.is_owned = false;
17445 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
17448 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
17449 LDKUnsignedChannelUpdate this_ptr_conv;
17450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17451 this_ptr_conv.is_owned = false;
17452 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
17456 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
17457 LDKUnsignedChannelUpdate this_ptr_conv;
17458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17459 this_ptr_conv.is_owned = false;
17460 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
17463 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
17464 LDKUnsignedChannelUpdate this_ptr_conv;
17465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17466 this_ptr_conv.is_owned = false;
17467 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
17471 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17472 LDKUnsignedChannelUpdate this_ptr_conv;
17473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17474 this_ptr_conv.is_owned = false;
17475 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
17478 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
17479 LDKUnsignedChannelUpdate orig_conv;
17480 orig_conv.inner = (void*)(orig & (~1));
17481 orig_conv.is_owned = false;
17482 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
17483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17485 uint64_t ret_ref = (uint64_t)ret_var.inner;
17486 if (ret_var.is_owned) {
17492 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
17493 LDKChannelUpdate this_obj_conv;
17494 this_obj_conv.inner = (void*)(this_obj & (~1));
17495 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17496 ChannelUpdate_free(this_obj_conv);
17499 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
17500 LDKChannelUpdate this_ptr_conv;
17501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17502 this_ptr_conv.is_owned = false;
17503 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17504 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
17508 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
17509 LDKChannelUpdate this_ptr_conv;
17510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17511 this_ptr_conv.is_owned = false;
17512 LDKSignature val_ref;
17513 CHECK(*((uint32_t*)val) == 64);
17514 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17515 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
17518 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
17519 LDKChannelUpdate this_ptr_conv;
17520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17521 this_ptr_conv.is_owned = false;
17522 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
17523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17525 uint64_t ret_ref = (uint64_t)ret_var.inner;
17526 if (ret_var.is_owned) {
17532 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
17533 LDKChannelUpdate this_ptr_conv;
17534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17535 this_ptr_conv.is_owned = false;
17536 LDKUnsignedChannelUpdate val_conv;
17537 val_conv.inner = (void*)(val & (~1));
17538 val_conv.is_owned = (val & 1) || (val == 0);
17539 val_conv = UnsignedChannelUpdate_clone(&val_conv);
17540 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
17543 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
17544 LDKSignature signature_arg_ref;
17545 CHECK(*((uint32_t*)signature_arg) == 64);
17546 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17547 LDKUnsignedChannelUpdate contents_arg_conv;
17548 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17549 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17550 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
17551 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
17552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17554 uint64_t ret_ref = (uint64_t)ret_var.inner;
17555 if (ret_var.is_owned) {
17561 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
17562 LDKChannelUpdate orig_conv;
17563 orig_conv.inner = (void*)(orig & (~1));
17564 orig_conv.is_owned = false;
17565 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
17566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17568 uint64_t ret_ref = (uint64_t)ret_var.inner;
17569 if (ret_var.is_owned) {
17575 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
17576 LDKQueryChannelRange this_obj_conv;
17577 this_obj_conv.inner = (void*)(this_obj & (~1));
17578 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17579 QueryChannelRange_free(this_obj_conv);
17582 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
17583 LDKQueryChannelRange this_ptr_conv;
17584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17585 this_ptr_conv.is_owned = false;
17586 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17587 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
17591 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17592 LDKQueryChannelRange this_ptr_conv;
17593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17594 this_ptr_conv.is_owned = false;
17595 LDKThirtyTwoBytes val_ref;
17596 CHECK(*((uint32_t*)val) == 32);
17597 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17598 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
17601 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
17602 LDKQueryChannelRange this_ptr_conv;
17603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17604 this_ptr_conv.is_owned = false;
17605 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
17609 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
17610 LDKQueryChannelRange this_ptr_conv;
17611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17612 this_ptr_conv.is_owned = false;
17613 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
17616 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
17617 LDKQueryChannelRange this_ptr_conv;
17618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17619 this_ptr_conv.is_owned = false;
17620 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
17624 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
17625 LDKQueryChannelRange this_ptr_conv;
17626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17627 this_ptr_conv.is_owned = false;
17628 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
17631 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
17632 LDKThirtyTwoBytes chain_hash_arg_ref;
17633 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17634 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17635 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
17636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17638 uint64_t ret_ref = (uint64_t)ret_var.inner;
17639 if (ret_var.is_owned) {
17645 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
17646 LDKQueryChannelRange orig_conv;
17647 orig_conv.inner = (void*)(orig & (~1));
17648 orig_conv.is_owned = false;
17649 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
17650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17652 uint64_t ret_ref = (uint64_t)ret_var.inner;
17653 if (ret_var.is_owned) {
17659 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
17660 LDKReplyChannelRange this_obj_conv;
17661 this_obj_conv.inner = (void*)(this_obj & (~1));
17662 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17663 ReplyChannelRange_free(this_obj_conv);
17666 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
17667 LDKReplyChannelRange this_ptr_conv;
17668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17669 this_ptr_conv.is_owned = false;
17670 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17671 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
17675 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17676 LDKReplyChannelRange this_ptr_conv;
17677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17678 this_ptr_conv.is_owned = false;
17679 LDKThirtyTwoBytes val_ref;
17680 CHECK(*((uint32_t*)val) == 32);
17681 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17682 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
17685 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
17686 LDKReplyChannelRange this_ptr_conv;
17687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17688 this_ptr_conv.is_owned = false;
17689 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
17693 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
17694 LDKReplyChannelRange this_ptr_conv;
17695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17696 this_ptr_conv.is_owned = false;
17697 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
17700 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
17701 LDKReplyChannelRange this_ptr_conv;
17702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17703 this_ptr_conv.is_owned = false;
17704 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
17708 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
17709 LDKReplyChannelRange this_ptr_conv;
17710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17711 this_ptr_conv.is_owned = false;
17712 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
17715 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
17716 LDKReplyChannelRange this_ptr_conv;
17717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17718 this_ptr_conv.is_owned = false;
17719 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
17723 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
17724 LDKReplyChannelRange this_ptr_conv;
17725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17726 this_ptr_conv.is_owned = false;
17727 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
17730 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
17731 LDKReplyChannelRange this_ptr_conv;
17732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17733 this_ptr_conv.is_owned = false;
17734 LDKCVec_u64Z val_constr;
17735 val_constr.datalen = *((uint32_t*)val);
17736 if (val_constr.datalen > 0)
17737 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17739 val_constr.data = NULL;
17740 int64_t* val_vals = (int64_t*)(val + 4);
17741 for (size_t i = 0; i < val_constr.datalen; i++) {
17742 int64_t val_conv_8 = val_vals[i];
17743 val_constr.data[i] = val_conv_8;
17745 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
17748 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) {
17749 LDKThirtyTwoBytes chain_hash_arg_ref;
17750 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17751 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17752 LDKCVec_u64Z short_channel_ids_arg_constr;
17753 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
17754 if (short_channel_ids_arg_constr.datalen > 0)
17755 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17757 short_channel_ids_arg_constr.data = NULL;
17758 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
17759 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
17760 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
17761 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
17763 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
17764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17766 uint64_t ret_ref = (uint64_t)ret_var.inner;
17767 if (ret_var.is_owned) {
17773 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
17774 LDKReplyChannelRange orig_conv;
17775 orig_conv.inner = (void*)(orig & (~1));
17776 orig_conv.is_owned = false;
17777 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
17778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17780 uint64_t ret_ref = (uint64_t)ret_var.inner;
17781 if (ret_var.is_owned) {
17787 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
17788 LDKQueryShortChannelIds this_obj_conv;
17789 this_obj_conv.inner = (void*)(this_obj & (~1));
17790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17791 QueryShortChannelIds_free(this_obj_conv);
17794 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
17795 LDKQueryShortChannelIds this_ptr_conv;
17796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17797 this_ptr_conv.is_owned = false;
17798 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17799 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
17803 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17804 LDKQueryShortChannelIds this_ptr_conv;
17805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17806 this_ptr_conv.is_owned = false;
17807 LDKThirtyTwoBytes val_ref;
17808 CHECK(*((uint32_t*)val) == 32);
17809 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17810 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
17813 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
17814 LDKQueryShortChannelIds this_ptr_conv;
17815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17816 this_ptr_conv.is_owned = false;
17817 LDKCVec_u64Z val_constr;
17818 val_constr.datalen = *((uint32_t*)val);
17819 if (val_constr.datalen > 0)
17820 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17822 val_constr.data = NULL;
17823 int64_t* val_vals = (int64_t*)(val + 4);
17824 for (size_t i = 0; i < val_constr.datalen; i++) {
17825 int64_t val_conv_8 = val_vals[i];
17826 val_constr.data[i] = val_conv_8;
17828 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
17831 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
17832 LDKThirtyTwoBytes chain_hash_arg_ref;
17833 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17834 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17835 LDKCVec_u64Z short_channel_ids_arg_constr;
17836 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
17837 if (short_channel_ids_arg_constr.datalen > 0)
17838 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17840 short_channel_ids_arg_constr.data = NULL;
17841 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
17842 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
17843 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
17844 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
17846 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
17847 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17848 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17849 uint64_t ret_ref = (uint64_t)ret_var.inner;
17850 if (ret_var.is_owned) {
17856 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
17857 LDKQueryShortChannelIds orig_conv;
17858 orig_conv.inner = (void*)(orig & (~1));
17859 orig_conv.is_owned = false;
17860 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
17861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17863 uint64_t ret_ref = (uint64_t)ret_var.inner;
17864 if (ret_var.is_owned) {
17870 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
17871 LDKReplyShortChannelIdsEnd this_obj_conv;
17872 this_obj_conv.inner = (void*)(this_obj & (~1));
17873 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17874 ReplyShortChannelIdsEnd_free(this_obj_conv);
17877 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
17878 LDKReplyShortChannelIdsEnd this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17882 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
17886 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17887 LDKReplyShortChannelIdsEnd this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 LDKThirtyTwoBytes val_ref;
17891 CHECK(*((uint32_t*)val) == 32);
17892 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17893 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
17896 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
17897 LDKReplyShortChannelIdsEnd this_ptr_conv;
17898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17899 this_ptr_conv.is_owned = false;
17900 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
17904 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
17905 LDKReplyShortChannelIdsEnd this_ptr_conv;
17906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17907 this_ptr_conv.is_owned = false;
17908 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
17911 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
17912 LDKThirtyTwoBytes chain_hash_arg_ref;
17913 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17914 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17915 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
17916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17918 uint64_t ret_ref = (uint64_t)ret_var.inner;
17919 if (ret_var.is_owned) {
17925 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
17926 LDKReplyShortChannelIdsEnd orig_conv;
17927 orig_conv.inner = (void*)(orig & (~1));
17928 orig_conv.is_owned = false;
17929 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
17930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17932 uint64_t ret_ref = (uint64_t)ret_var.inner;
17933 if (ret_var.is_owned) {
17939 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
17940 LDKGossipTimestampFilter this_obj_conv;
17941 this_obj_conv.inner = (void*)(this_obj & (~1));
17942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17943 GossipTimestampFilter_free(this_obj_conv);
17946 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
17947 LDKGossipTimestampFilter this_ptr_conv;
17948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17949 this_ptr_conv.is_owned = false;
17950 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17951 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
17955 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17956 LDKGossipTimestampFilter this_ptr_conv;
17957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17958 this_ptr_conv.is_owned = false;
17959 LDKThirtyTwoBytes val_ref;
17960 CHECK(*((uint32_t*)val) == 32);
17961 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17962 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
17965 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
17966 LDKGossipTimestampFilter this_ptr_conv;
17967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17968 this_ptr_conv.is_owned = false;
17969 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
17973 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
17974 LDKGossipTimestampFilter this_ptr_conv;
17975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17976 this_ptr_conv.is_owned = false;
17977 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
17980 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
17981 LDKGossipTimestampFilter this_ptr_conv;
17982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17983 this_ptr_conv.is_owned = false;
17984 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
17988 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
17989 LDKGossipTimestampFilter this_ptr_conv;
17990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17991 this_ptr_conv.is_owned = false;
17992 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
17995 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
17996 LDKThirtyTwoBytes chain_hash_arg_ref;
17997 CHECK(*((uint32_t*)chain_hash_arg) == 32);
17998 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
17999 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
18000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18002 uint64_t ret_ref = (uint64_t)ret_var.inner;
18003 if (ret_var.is_owned) {
18009 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
18010 LDKGossipTimestampFilter orig_conv;
18011 orig_conv.inner = (void*)(orig & (~1));
18012 orig_conv.is_owned = false;
18013 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
18014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18016 uint64_t ret_ref = (uint64_t)ret_var.inner;
18017 if (ret_var.is_owned) {
18023 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
18024 if ((this_ptr & 1) != 0) return;
18025 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
18026 FREE((void*)this_ptr);
18027 ErrorAction_free(this_ptr_conv);
18030 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
18031 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
18032 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18033 *ret_copy = ErrorAction_clone(orig_conv);
18034 uint64_t ret_ref = (uint64_t)ret_copy;
18038 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
18039 LDKErrorMessage msg_conv;
18040 msg_conv.inner = (void*)(msg & (~1));
18041 msg_conv.is_owned = (msg & 1) || (msg == 0);
18042 msg_conv = ErrorMessage_clone(&msg_conv);
18043 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18044 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
18045 uint64_t ret_ref = (uint64_t)ret_copy;
18049 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
18050 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18051 *ret_copy = ErrorAction_ignore_error();
18052 uint64_t ret_ref = (uint64_t)ret_copy;
18056 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
18057 LDKLevel a_conv = LDKLevel_from_js(a);
18058 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18059 *ret_copy = ErrorAction_ignore_and_log(a_conv);
18060 uint64_t ret_ref = (uint64_t)ret_copy;
18064 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
18065 LDKErrorMessage msg_conv;
18066 msg_conv.inner = (void*)(msg & (~1));
18067 msg_conv.is_owned = (msg & 1) || (msg == 0);
18068 msg_conv = ErrorMessage_clone(&msg_conv);
18069 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18070 *ret_copy = ErrorAction_send_error_message(msg_conv);
18071 uint64_t ret_ref = (uint64_t)ret_copy;
18075 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
18076 LDKLightningError this_obj_conv;
18077 this_obj_conv.inner = (void*)(this_obj & (~1));
18078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18079 LightningError_free(this_obj_conv);
18082 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
18083 LDKLightningError this_ptr_conv;
18084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18085 this_ptr_conv.is_owned = false;
18086 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
18087 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18092 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
18093 LDKLightningError this_ptr_conv;
18094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18095 this_ptr_conv.is_owned = false;
18096 LDKStr val_conv = str_ref_to_owned_c(val);
18097 LightningError_set_err(&this_ptr_conv, val_conv);
18100 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
18101 LDKLightningError this_ptr_conv;
18102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18103 this_ptr_conv.is_owned = false;
18104 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18105 *ret_copy = LightningError_get_action(&this_ptr_conv);
18106 uint64_t ret_ref = (uint64_t)ret_copy;
18110 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
18111 LDKLightningError this_ptr_conv;
18112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18113 this_ptr_conv.is_owned = false;
18114 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
18115 LightningError_set_action(&this_ptr_conv, val_conv);
18118 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
18119 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
18120 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
18121 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
18122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18124 uint64_t ret_ref = (uint64_t)ret_var.inner;
18125 if (ret_var.is_owned) {
18131 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
18132 LDKLightningError orig_conv;
18133 orig_conv.inner = (void*)(orig & (~1));
18134 orig_conv.is_owned = false;
18135 LDKLightningError ret_var = LightningError_clone(&orig_conv);
18136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18138 uint64_t ret_ref = (uint64_t)ret_var.inner;
18139 if (ret_var.is_owned) {
18145 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
18146 LDKCommitmentUpdate this_obj_conv;
18147 this_obj_conv.inner = (void*)(this_obj & (~1));
18148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18149 CommitmentUpdate_free(this_obj_conv);
18152 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
18153 LDKCommitmentUpdate this_ptr_conv;
18154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18155 this_ptr_conv.is_owned = false;
18156 LDKCVec_UpdateAddHTLCZ val_constr;
18157 val_constr.datalen = *((uint32_t*)val);
18158 if (val_constr.datalen > 0)
18159 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18161 val_constr.data = NULL;
18162 uint32_t* val_vals = (uint32_t*)(val + 4);
18163 for (size_t p = 0; p < val_constr.datalen; p++) {
18164 uint32_t val_conv_15 = val_vals[p];
18165 LDKUpdateAddHTLC val_conv_15_conv;
18166 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
18167 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
18168 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
18169 val_constr.data[p] = val_conv_15_conv;
18171 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
18174 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
18175 LDKCommitmentUpdate this_ptr_conv;
18176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18177 this_ptr_conv.is_owned = false;
18178 LDKCVec_UpdateFulfillHTLCZ val_constr;
18179 val_constr.datalen = *((uint32_t*)val);
18180 if (val_constr.datalen > 0)
18181 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18183 val_constr.data = NULL;
18184 uint32_t* val_vals = (uint32_t*)(val + 4);
18185 for (size_t t = 0; t < val_constr.datalen; t++) {
18186 uint32_t val_conv_19 = val_vals[t];
18187 LDKUpdateFulfillHTLC val_conv_19_conv;
18188 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
18189 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
18190 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
18191 val_constr.data[t] = val_conv_19_conv;
18193 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
18196 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
18197 LDKCommitmentUpdate this_ptr_conv;
18198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18199 this_ptr_conv.is_owned = false;
18200 LDKCVec_UpdateFailHTLCZ val_constr;
18201 val_constr.datalen = *((uint32_t*)val);
18202 if (val_constr.datalen > 0)
18203 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18205 val_constr.data = NULL;
18206 uint32_t* val_vals = (uint32_t*)(val + 4);
18207 for (size_t q = 0; q < val_constr.datalen; q++) {
18208 uint32_t val_conv_16 = val_vals[q];
18209 LDKUpdateFailHTLC val_conv_16_conv;
18210 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
18211 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
18212 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
18213 val_constr.data[q] = val_conv_16_conv;
18215 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
18218 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
18219 LDKCommitmentUpdate this_ptr_conv;
18220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18221 this_ptr_conv.is_owned = false;
18222 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
18223 val_constr.datalen = *((uint32_t*)val);
18224 if (val_constr.datalen > 0)
18225 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18227 val_constr.data = NULL;
18228 uint32_t* val_vals = (uint32_t*)(val + 4);
18229 for (size_t z = 0; z < val_constr.datalen; z++) {
18230 uint32_t val_conv_25 = val_vals[z];
18231 LDKUpdateFailMalformedHTLC val_conv_25_conv;
18232 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
18233 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
18234 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
18235 val_constr.data[z] = val_conv_25_conv;
18237 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
18240 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
18241 LDKCommitmentUpdate this_ptr_conv;
18242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18243 this_ptr_conv.is_owned = false;
18244 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
18245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18247 uint64_t ret_ref = (uint64_t)ret_var.inner;
18248 if (ret_var.is_owned) {
18254 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
18255 LDKCommitmentUpdate this_ptr_conv;
18256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18257 this_ptr_conv.is_owned = false;
18258 LDKUpdateFee val_conv;
18259 val_conv.inner = (void*)(val & (~1));
18260 val_conv.is_owned = (val & 1) || (val == 0);
18261 val_conv = UpdateFee_clone(&val_conv);
18262 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
18265 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
18266 LDKCommitmentUpdate this_ptr_conv;
18267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18268 this_ptr_conv.is_owned = false;
18269 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
18270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18272 uint64_t ret_ref = (uint64_t)ret_var.inner;
18273 if (ret_var.is_owned) {
18279 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
18280 LDKCommitmentUpdate this_ptr_conv;
18281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18282 this_ptr_conv.is_owned = false;
18283 LDKCommitmentSigned val_conv;
18284 val_conv.inner = (void*)(val & (~1));
18285 val_conv.is_owned = (val & 1) || (val == 0);
18286 val_conv = CommitmentSigned_clone(&val_conv);
18287 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
18290 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) {
18291 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
18292 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
18293 if (update_add_htlcs_arg_constr.datalen > 0)
18294 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18296 update_add_htlcs_arg_constr.data = NULL;
18297 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
18298 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
18299 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
18300 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
18301 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
18302 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
18303 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
18304 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
18306 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
18307 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
18308 if (update_fulfill_htlcs_arg_constr.datalen > 0)
18309 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18311 update_fulfill_htlcs_arg_constr.data = NULL;
18312 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
18313 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
18314 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
18315 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
18316 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
18317 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
18318 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
18319 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
18321 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
18322 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
18323 if (update_fail_htlcs_arg_constr.datalen > 0)
18324 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18326 update_fail_htlcs_arg_constr.data = NULL;
18327 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
18328 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
18329 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
18330 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
18331 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
18332 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
18333 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
18334 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
18336 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
18337 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
18338 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
18339 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18341 update_fail_malformed_htlcs_arg_constr.data = NULL;
18342 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
18343 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
18344 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
18345 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
18346 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
18347 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);
18348 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
18349 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
18351 LDKUpdateFee update_fee_arg_conv;
18352 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
18353 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
18354 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
18355 LDKCommitmentSigned commitment_signed_arg_conv;
18356 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
18357 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
18358 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
18359 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);
18360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18362 uint64_t ret_ref = (uint64_t)ret_var.inner;
18363 if (ret_var.is_owned) {
18369 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
18370 LDKCommitmentUpdate orig_conv;
18371 orig_conv.inner = (void*)(orig & (~1));
18372 orig_conv.is_owned = false;
18373 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
18374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18376 uint64_t ret_ref = (uint64_t)ret_var.inner;
18377 if (ret_var.is_owned) {
18383 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
18384 if ((this_ptr & 1) != 0) return;
18385 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
18386 FREE((void*)this_ptr);
18387 HTLCFailChannelUpdate_free(this_ptr_conv);
18390 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
18391 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
18392 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18393 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
18394 uint64_t ret_ref = (uint64_t)ret_copy;
18398 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_update_message(uint32_t msg) {
18399 LDKChannelUpdate msg_conv;
18400 msg_conv.inner = (void*)(msg & (~1));
18401 msg_conv.is_owned = (msg & 1) || (msg == 0);
18402 msg_conv = ChannelUpdate_clone(&msg_conv);
18403 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18404 *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
18405 uint64_t ret_ref = (uint64_t)ret_copy;
18409 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
18410 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18411 *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
18412 uint64_t ret_ref = (uint64_t)ret_copy;
18416 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
18417 LDKPublicKey node_id_ref;
18418 CHECK(*((uint32_t*)node_id) == 33);
18419 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
18420 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18421 *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
18422 uint64_t ret_ref = (uint64_t)ret_copy;
18426 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
18427 if ((this_ptr & 1) != 0) return;
18428 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
18429 FREE((void*)this_ptr);
18430 ChannelMessageHandler_free(this_ptr_conv);
18433 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
18434 if ((this_ptr & 1) != 0) return;
18435 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
18436 FREE((void*)this_ptr);
18437 RoutingMessageHandler_free(this_ptr_conv);
18440 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
18441 LDKAcceptChannel obj_conv;
18442 obj_conv.inner = (void*)(obj & (~1));
18443 obj_conv.is_owned = false;
18444 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
18445 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18446 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18447 CVec_u8Z_free(ret_var);
18451 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
18452 LDKu8slice ser_ref;
18453 ser_ref.datalen = *((uint32_t*)ser);
18454 ser_ref.data = (int8_t*)(ser + 4);
18455 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18456 *ret_conv = AcceptChannel_read(ser_ref);
18457 return (uint64_t)ret_conv;
18460 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
18461 LDKAnnouncementSignatures obj_conv;
18462 obj_conv.inner = (void*)(obj & (~1));
18463 obj_conv.is_owned = false;
18464 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
18465 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18466 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18467 CVec_u8Z_free(ret_var);
18471 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
18472 LDKu8slice ser_ref;
18473 ser_ref.datalen = *((uint32_t*)ser);
18474 ser_ref.data = (int8_t*)(ser + 4);
18475 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18476 *ret_conv = AnnouncementSignatures_read(ser_ref);
18477 return (uint64_t)ret_conv;
18480 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
18481 LDKChannelReestablish obj_conv;
18482 obj_conv.inner = (void*)(obj & (~1));
18483 obj_conv.is_owned = false;
18484 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
18485 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18486 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18487 CVec_u8Z_free(ret_var);
18491 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
18492 LDKu8slice ser_ref;
18493 ser_ref.datalen = *((uint32_t*)ser);
18494 ser_ref.data = (int8_t*)(ser + 4);
18495 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18496 *ret_conv = ChannelReestablish_read(ser_ref);
18497 return (uint64_t)ret_conv;
18500 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
18501 LDKClosingSigned obj_conv;
18502 obj_conv.inner = (void*)(obj & (~1));
18503 obj_conv.is_owned = false;
18504 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
18505 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18506 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18507 CVec_u8Z_free(ret_var);
18511 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
18512 LDKu8slice ser_ref;
18513 ser_ref.datalen = *((uint32_t*)ser);
18514 ser_ref.data = (int8_t*)(ser + 4);
18515 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18516 *ret_conv = ClosingSigned_read(ser_ref);
18517 return (uint64_t)ret_conv;
18520 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
18521 LDKCommitmentSigned obj_conv;
18522 obj_conv.inner = (void*)(obj & (~1));
18523 obj_conv.is_owned = false;
18524 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
18525 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18526 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18527 CVec_u8Z_free(ret_var);
18531 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
18532 LDKu8slice ser_ref;
18533 ser_ref.datalen = *((uint32_t*)ser);
18534 ser_ref.data = (int8_t*)(ser + 4);
18535 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18536 *ret_conv = CommitmentSigned_read(ser_ref);
18537 return (uint64_t)ret_conv;
18540 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
18541 LDKFundingCreated obj_conv;
18542 obj_conv.inner = (void*)(obj & (~1));
18543 obj_conv.is_owned = false;
18544 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
18545 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18546 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18547 CVec_u8Z_free(ret_var);
18551 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
18552 LDKu8slice ser_ref;
18553 ser_ref.datalen = *((uint32_t*)ser);
18554 ser_ref.data = (int8_t*)(ser + 4);
18555 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18556 *ret_conv = FundingCreated_read(ser_ref);
18557 return (uint64_t)ret_conv;
18560 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
18561 LDKFundingSigned obj_conv;
18562 obj_conv.inner = (void*)(obj & (~1));
18563 obj_conv.is_owned = false;
18564 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
18565 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18566 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18567 CVec_u8Z_free(ret_var);
18571 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
18572 LDKu8slice ser_ref;
18573 ser_ref.datalen = *((uint32_t*)ser);
18574 ser_ref.data = (int8_t*)(ser + 4);
18575 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18576 *ret_conv = FundingSigned_read(ser_ref);
18577 return (uint64_t)ret_conv;
18580 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
18581 LDKFundingLocked obj_conv;
18582 obj_conv.inner = (void*)(obj & (~1));
18583 obj_conv.is_owned = false;
18584 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
18585 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18586 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18587 CVec_u8Z_free(ret_var);
18591 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
18592 LDKu8slice ser_ref;
18593 ser_ref.datalen = *((uint32_t*)ser);
18594 ser_ref.data = (int8_t*)(ser + 4);
18595 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
18596 *ret_conv = FundingLocked_read(ser_ref);
18597 return (uint64_t)ret_conv;
18600 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
18602 obj_conv.inner = (void*)(obj & (~1));
18603 obj_conv.is_owned = false;
18604 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
18605 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18606 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18607 CVec_u8Z_free(ret_var);
18611 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
18612 LDKu8slice ser_ref;
18613 ser_ref.datalen = *((uint32_t*)ser);
18614 ser_ref.data = (int8_t*)(ser + 4);
18615 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18616 *ret_conv = Init_read(ser_ref);
18617 return (uint64_t)ret_conv;
18620 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
18621 LDKOpenChannel obj_conv;
18622 obj_conv.inner = (void*)(obj & (~1));
18623 obj_conv.is_owned = false;
18624 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
18625 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18626 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18627 CVec_u8Z_free(ret_var);
18631 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
18632 LDKu8slice ser_ref;
18633 ser_ref.datalen = *((uint32_t*)ser);
18634 ser_ref.data = (int8_t*)(ser + 4);
18635 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18636 *ret_conv = OpenChannel_read(ser_ref);
18637 return (uint64_t)ret_conv;
18640 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
18641 LDKRevokeAndACK obj_conv;
18642 obj_conv.inner = (void*)(obj & (~1));
18643 obj_conv.is_owned = false;
18644 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
18645 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18646 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18647 CVec_u8Z_free(ret_var);
18651 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
18652 LDKu8slice ser_ref;
18653 ser_ref.datalen = *((uint32_t*)ser);
18654 ser_ref.data = (int8_t*)(ser + 4);
18655 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18656 *ret_conv = RevokeAndACK_read(ser_ref);
18657 return (uint64_t)ret_conv;
18660 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
18661 LDKShutdown obj_conv;
18662 obj_conv.inner = (void*)(obj & (~1));
18663 obj_conv.is_owned = false;
18664 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
18665 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18666 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18667 CVec_u8Z_free(ret_var);
18671 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
18672 LDKu8slice ser_ref;
18673 ser_ref.datalen = *((uint32_t*)ser);
18674 ser_ref.data = (int8_t*)(ser + 4);
18675 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18676 *ret_conv = Shutdown_read(ser_ref);
18677 return (uint64_t)ret_conv;
18680 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
18681 LDKUpdateFailHTLC obj_conv;
18682 obj_conv.inner = (void*)(obj & (~1));
18683 obj_conv.is_owned = false;
18684 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
18685 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18686 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18687 CVec_u8Z_free(ret_var);
18691 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
18692 LDKu8slice ser_ref;
18693 ser_ref.datalen = *((uint32_t*)ser);
18694 ser_ref.data = (int8_t*)(ser + 4);
18695 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18696 *ret_conv = UpdateFailHTLC_read(ser_ref);
18697 return (uint64_t)ret_conv;
18700 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
18701 LDKUpdateFailMalformedHTLC obj_conv;
18702 obj_conv.inner = (void*)(obj & (~1));
18703 obj_conv.is_owned = false;
18704 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
18705 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18706 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18707 CVec_u8Z_free(ret_var);
18711 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
18712 LDKu8slice ser_ref;
18713 ser_ref.datalen = *((uint32_t*)ser);
18714 ser_ref.data = (int8_t*)(ser + 4);
18715 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18716 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
18717 return (uint64_t)ret_conv;
18720 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
18721 LDKUpdateFee obj_conv;
18722 obj_conv.inner = (void*)(obj & (~1));
18723 obj_conv.is_owned = false;
18724 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
18725 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18726 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18727 CVec_u8Z_free(ret_var);
18731 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
18732 LDKu8slice ser_ref;
18733 ser_ref.datalen = *((uint32_t*)ser);
18734 ser_ref.data = (int8_t*)(ser + 4);
18735 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18736 *ret_conv = UpdateFee_read(ser_ref);
18737 return (uint64_t)ret_conv;
18740 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
18741 LDKUpdateFulfillHTLC obj_conv;
18742 obj_conv.inner = (void*)(obj & (~1));
18743 obj_conv.is_owned = false;
18744 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
18745 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18746 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18747 CVec_u8Z_free(ret_var);
18751 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
18752 LDKu8slice ser_ref;
18753 ser_ref.datalen = *((uint32_t*)ser);
18754 ser_ref.data = (int8_t*)(ser + 4);
18755 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18756 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
18757 return (uint64_t)ret_conv;
18760 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
18761 LDKUpdateAddHTLC obj_conv;
18762 obj_conv.inner = (void*)(obj & (~1));
18763 obj_conv.is_owned = false;
18764 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
18765 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18766 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18767 CVec_u8Z_free(ret_var);
18771 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
18772 LDKu8slice ser_ref;
18773 ser_ref.datalen = *((uint32_t*)ser);
18774 ser_ref.data = (int8_t*)(ser + 4);
18775 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18776 *ret_conv = UpdateAddHTLC_read(ser_ref);
18777 return (uint64_t)ret_conv;
18780 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
18782 obj_conv.inner = (void*)(obj & (~1));
18783 obj_conv.is_owned = false;
18784 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
18785 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18786 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18787 CVec_u8Z_free(ret_var);
18791 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
18792 LDKu8slice ser_ref;
18793 ser_ref.datalen = *((uint32_t*)ser);
18794 ser_ref.data = (int8_t*)(ser + 4);
18795 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18796 *ret_conv = Ping_read(ser_ref);
18797 return (uint64_t)ret_conv;
18800 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
18802 obj_conv.inner = (void*)(obj & (~1));
18803 obj_conv.is_owned = false;
18804 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
18805 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18806 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18807 CVec_u8Z_free(ret_var);
18811 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
18812 LDKu8slice ser_ref;
18813 ser_ref.datalen = *((uint32_t*)ser);
18814 ser_ref.data = (int8_t*)(ser + 4);
18815 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18816 *ret_conv = Pong_read(ser_ref);
18817 return (uint64_t)ret_conv;
18820 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
18821 LDKUnsignedChannelAnnouncement obj_conv;
18822 obj_conv.inner = (void*)(obj & (~1));
18823 obj_conv.is_owned = false;
18824 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
18825 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18826 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18827 CVec_u8Z_free(ret_var);
18831 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
18832 LDKu8slice ser_ref;
18833 ser_ref.datalen = *((uint32_t*)ser);
18834 ser_ref.data = (int8_t*)(ser + 4);
18835 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18836 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
18837 return (uint64_t)ret_conv;
18840 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
18841 LDKChannelAnnouncement obj_conv;
18842 obj_conv.inner = (void*)(obj & (~1));
18843 obj_conv.is_owned = false;
18844 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
18845 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18846 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18847 CVec_u8Z_free(ret_var);
18851 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
18852 LDKu8slice ser_ref;
18853 ser_ref.datalen = *((uint32_t*)ser);
18854 ser_ref.data = (int8_t*)(ser + 4);
18855 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18856 *ret_conv = ChannelAnnouncement_read(ser_ref);
18857 return (uint64_t)ret_conv;
18860 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
18861 LDKUnsignedChannelUpdate obj_conv;
18862 obj_conv.inner = (void*)(obj & (~1));
18863 obj_conv.is_owned = false;
18864 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
18865 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18866 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18867 CVec_u8Z_free(ret_var);
18871 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
18872 LDKu8slice ser_ref;
18873 ser_ref.datalen = *((uint32_t*)ser);
18874 ser_ref.data = (int8_t*)(ser + 4);
18875 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18876 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
18877 return (uint64_t)ret_conv;
18880 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
18881 LDKChannelUpdate obj_conv;
18882 obj_conv.inner = (void*)(obj & (~1));
18883 obj_conv.is_owned = false;
18884 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
18885 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18886 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18887 CVec_u8Z_free(ret_var);
18891 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
18892 LDKu8slice ser_ref;
18893 ser_ref.datalen = *((uint32_t*)ser);
18894 ser_ref.data = (int8_t*)(ser + 4);
18895 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18896 *ret_conv = ChannelUpdate_read(ser_ref);
18897 return (uint64_t)ret_conv;
18900 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
18901 LDKErrorMessage obj_conv;
18902 obj_conv.inner = (void*)(obj & (~1));
18903 obj_conv.is_owned = false;
18904 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
18905 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18906 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18907 CVec_u8Z_free(ret_var);
18911 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
18912 LDKu8slice ser_ref;
18913 ser_ref.datalen = *((uint32_t*)ser);
18914 ser_ref.data = (int8_t*)(ser + 4);
18915 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18916 *ret_conv = ErrorMessage_read(ser_ref);
18917 return (uint64_t)ret_conv;
18920 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
18921 LDKUnsignedNodeAnnouncement obj_conv;
18922 obj_conv.inner = (void*)(obj & (~1));
18923 obj_conv.is_owned = false;
18924 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
18925 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18926 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18927 CVec_u8Z_free(ret_var);
18931 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
18932 LDKu8slice ser_ref;
18933 ser_ref.datalen = *((uint32_t*)ser);
18934 ser_ref.data = (int8_t*)(ser + 4);
18935 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18936 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
18937 return (uint64_t)ret_conv;
18940 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
18941 LDKNodeAnnouncement obj_conv;
18942 obj_conv.inner = (void*)(obj & (~1));
18943 obj_conv.is_owned = false;
18944 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
18945 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18946 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18947 CVec_u8Z_free(ret_var);
18951 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
18952 LDKu8slice ser_ref;
18953 ser_ref.datalen = *((uint32_t*)ser);
18954 ser_ref.data = (int8_t*)(ser + 4);
18955 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18956 *ret_conv = NodeAnnouncement_read(ser_ref);
18957 return (uint64_t)ret_conv;
18960 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
18961 LDKu8slice ser_ref;
18962 ser_ref.datalen = *((uint32_t*)ser);
18963 ser_ref.data = (int8_t*)(ser + 4);
18964 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18965 *ret_conv = QueryShortChannelIds_read(ser_ref);
18966 return (uint64_t)ret_conv;
18969 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
18970 LDKQueryShortChannelIds obj_conv;
18971 obj_conv.inner = (void*)(obj & (~1));
18972 obj_conv.is_owned = false;
18973 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
18974 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18975 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18976 CVec_u8Z_free(ret_var);
18980 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
18981 LDKu8slice ser_ref;
18982 ser_ref.datalen = *((uint32_t*)ser);
18983 ser_ref.data = (int8_t*)(ser + 4);
18984 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18985 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
18986 return (uint64_t)ret_conv;
18989 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
18990 LDKReplyShortChannelIdsEnd obj_conv;
18991 obj_conv.inner = (void*)(obj & (~1));
18992 obj_conv.is_owned = false;
18993 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
18994 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18995 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18996 CVec_u8Z_free(ret_var);
19000 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
19001 LDKQueryChannelRange this_arg_conv;
19002 this_arg_conv.inner = (void*)(this_arg & (~1));
19003 this_arg_conv.is_owned = false;
19004 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
19008 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
19009 LDKu8slice ser_ref;
19010 ser_ref.datalen = *((uint32_t*)ser);
19011 ser_ref.data = (int8_t*)(ser + 4);
19012 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19013 *ret_conv = QueryChannelRange_read(ser_ref);
19014 return (uint64_t)ret_conv;
19017 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
19018 LDKQueryChannelRange obj_conv;
19019 obj_conv.inner = (void*)(obj & (~1));
19020 obj_conv.is_owned = false;
19021 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
19022 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19023 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19024 CVec_u8Z_free(ret_var);
19028 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
19029 LDKu8slice ser_ref;
19030 ser_ref.datalen = *((uint32_t*)ser);
19031 ser_ref.data = (int8_t*)(ser + 4);
19032 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19033 *ret_conv = ReplyChannelRange_read(ser_ref);
19034 return (uint64_t)ret_conv;
19037 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
19038 LDKReplyChannelRange obj_conv;
19039 obj_conv.inner = (void*)(obj & (~1));
19040 obj_conv.is_owned = false;
19041 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
19042 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19043 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19044 CVec_u8Z_free(ret_var);
19048 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
19049 LDKu8slice ser_ref;
19050 ser_ref.datalen = *((uint32_t*)ser);
19051 ser_ref.data = (int8_t*)(ser + 4);
19052 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19053 *ret_conv = GossipTimestampFilter_read(ser_ref);
19054 return (uint64_t)ret_conv;
19057 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
19058 LDKGossipTimestampFilter obj_conv;
19059 obj_conv.inner = (void*)(obj & (~1));
19060 obj_conv.is_owned = false;
19061 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
19062 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19063 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19064 CVec_u8Z_free(ret_var);
19068 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
19069 LDKIgnoringMessageHandler this_obj_conv;
19070 this_obj_conv.inner = (void*)(this_obj & (~1));
19071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19072 IgnoringMessageHandler_free(this_obj_conv);
19075 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
19076 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
19077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19079 uint64_t ret_ref = (uint64_t)ret_var.inner;
19080 if (ret_var.is_owned) {
19086 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19087 LDKIgnoringMessageHandler this_arg_conv;
19088 this_arg_conv.inner = (void*)(this_arg & (~1));
19089 this_arg_conv.is_owned = false;
19090 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19091 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19092 return (uint64_t)ret;
19095 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
19096 LDKIgnoringMessageHandler this_arg_conv;
19097 this_arg_conv.inner = (void*)(this_arg & (~1));
19098 this_arg_conv.is_owned = false;
19099 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19100 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
19101 return (uint64_t)ret;
19104 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
19105 LDKErroringMessageHandler this_obj_conv;
19106 this_obj_conv.inner = (void*)(this_obj & (~1));
19107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19108 ErroringMessageHandler_free(this_obj_conv);
19111 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
19112 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
19113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19115 uint64_t ret_ref = (uint64_t)ret_var.inner;
19116 if (ret_var.is_owned) {
19122 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19123 LDKErroringMessageHandler this_arg_conv;
19124 this_arg_conv.inner = (void*)(this_arg & (~1));
19125 this_arg_conv.is_owned = false;
19126 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19127 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19128 return (uint64_t)ret;
19131 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
19132 LDKErroringMessageHandler this_arg_conv;
19133 this_arg_conv.inner = (void*)(this_arg & (~1));
19134 this_arg_conv.is_owned = false;
19135 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
19136 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
19137 return (uint64_t)ret;
19140 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
19141 LDKMessageHandler this_obj_conv;
19142 this_obj_conv.inner = (void*)(this_obj & (~1));
19143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19144 MessageHandler_free(this_obj_conv);
19147 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
19148 LDKMessageHandler this_ptr_conv;
19149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19150 this_ptr_conv.is_owned = false;
19151 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
19155 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
19156 LDKMessageHandler this_ptr_conv;
19157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19158 this_ptr_conv.is_owned = false;
19159 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
19160 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
19163 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
19164 LDKMessageHandler this_ptr_conv;
19165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19166 this_ptr_conv.is_owned = false;
19167 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
19171 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
19172 LDKMessageHandler this_ptr_conv;
19173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19174 this_ptr_conv.is_owned = false;
19175 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
19176 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
19179 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
19180 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
19181 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
19182 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
19183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19185 uint64_t ret_ref = (uint64_t)ret_var.inner;
19186 if (ret_var.is_owned) {
19192 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
19193 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
19194 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19195 *ret = SocketDescriptor_clone(orig_conv);
19196 return (uint64_t)ret;
19199 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
19200 if ((this_ptr & 1) != 0) return;
19201 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
19202 FREE((void*)this_ptr);
19203 SocketDescriptor_free(this_ptr_conv);
19206 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
19207 LDKPeerHandleError this_obj_conv;
19208 this_obj_conv.inner = (void*)(this_obj & (~1));
19209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19210 PeerHandleError_free(this_obj_conv);
19213 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
19214 LDKPeerHandleError this_ptr_conv;
19215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19216 this_ptr_conv.is_owned = false;
19217 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
19221 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
19222 LDKPeerHandleError this_ptr_conv;
19223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19224 this_ptr_conv.is_owned = false;
19225 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
19228 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
19229 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
19230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19232 uint64_t ret_ref = (uint64_t)ret_var.inner;
19233 if (ret_var.is_owned) {
19239 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
19240 LDKPeerHandleError orig_conv;
19241 orig_conv.inner = (void*)(orig & (~1));
19242 orig_conv.is_owned = false;
19243 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
19244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19246 uint64_t ret_ref = (uint64_t)ret_var.inner;
19247 if (ret_var.is_owned) {
19253 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
19254 LDKPeerManager this_obj_conv;
19255 this_obj_conv.inner = (void*)(this_obj & (~1));
19256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19257 PeerManager_free(this_obj_conv);
19260 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) {
19261 LDKMessageHandler message_handler_conv;
19262 message_handler_conv.inner = (void*)(message_handler & (~1));
19263 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
19264 // Warning: we need a move here but no clone is available for LDKMessageHandler
19265 LDKSecretKey our_node_secret_ref;
19266 CHECK(*((uint32_t*)our_node_secret) == 32);
19267 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
19268 unsigned char ephemeral_random_data_arr[32];
19269 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
19270 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
19271 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
19272 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19273 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
19274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19276 uint64_t ret_ref = (uint64_t)ret_var.inner;
19277 if (ret_var.is_owned) {
19283 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
19284 LDKPeerManager this_arg_conv;
19285 this_arg_conv.inner = (void*)(this_arg & (~1));
19286 this_arg_conv.is_owned = false;
19287 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
19288 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19289 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19290 for (size_t m = 0; m < ret_var.datalen; m++) {
19291 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19292 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
19293 ret_arr_ptr[m] = ret_conv_12_arr;
19295 FREE(ret_var.data);
19299 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
19300 LDKPeerManager this_arg_conv;
19301 this_arg_conv.inner = (void*)(this_arg & (~1));
19302 this_arg_conv.is_owned = false;
19303 LDKPublicKey their_node_id_ref;
19304 CHECK(*((uint32_t*)their_node_id) == 33);
19305 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
19306 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19307 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19308 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
19309 return (uint64_t)ret_conv;
19312 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
19313 LDKPeerManager this_arg_conv;
19314 this_arg_conv.inner = (void*)(this_arg & (~1));
19315 this_arg_conv.is_owned = false;
19316 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19317 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19318 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
19319 return (uint64_t)ret_conv;
19322 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
19323 LDKPeerManager this_arg_conv;
19324 this_arg_conv.inner = (void*)(this_arg & (~1));
19325 this_arg_conv.is_owned = false;
19326 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19327 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19328 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
19329 return (uint64_t)ret_conv;
19332 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
19333 LDKPeerManager this_arg_conv;
19334 this_arg_conv.inner = (void*)(this_arg & (~1));
19335 this_arg_conv.is_owned = false;
19336 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
19337 LDKu8slice data_ref;
19338 data_ref.datalen = *((uint32_t*)data);
19339 data_ref.data = (int8_t*)(data + 4);
19340 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19341 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
19342 return (uint64_t)ret_conv;
19345 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
19346 LDKPeerManager this_arg_conv;
19347 this_arg_conv.inner = (void*)(this_arg & (~1));
19348 this_arg_conv.is_owned = false;
19349 PeerManager_process_events(&this_arg_conv);
19352 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
19353 LDKPeerManager this_arg_conv;
19354 this_arg_conv.inner = (void*)(this_arg & (~1));
19355 this_arg_conv.is_owned = false;
19356 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19357 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
19360 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
19361 LDKPeerManager this_arg_conv;
19362 this_arg_conv.inner = (void*)(this_arg & (~1));
19363 this_arg_conv.is_owned = false;
19364 LDKPublicKey node_id_ref;
19365 CHECK(*((uint32_t*)node_id) == 33);
19366 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
19367 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
19370 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
19371 LDKPeerManager this_arg_conv;
19372 this_arg_conv.inner = (void*)(this_arg & (~1));
19373 this_arg_conv.is_owned = false;
19374 PeerManager_timer_tick_occurred(&this_arg_conv);
19377 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
19378 unsigned char commitment_seed_arr[32];
19379 CHECK(*((uint32_t*)commitment_seed) == 32);
19380 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
19381 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
19382 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19383 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
19387 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
19388 LDKPublicKey per_commitment_point_ref;
19389 CHECK(*((uint32_t*)per_commitment_point) == 33);
19390 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19391 unsigned char base_secret_arr[32];
19392 CHECK(*((uint32_t*)base_secret) == 32);
19393 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
19394 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
19395 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19396 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
19397 return (uint64_t)ret_conv;
19400 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
19401 LDKPublicKey per_commitment_point_ref;
19402 CHECK(*((uint32_t*)per_commitment_point) == 33);
19403 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19404 LDKPublicKey base_point_ref;
19405 CHECK(*((uint32_t*)base_point) == 33);
19406 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
19407 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19408 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
19409 return (uint64_t)ret_conv;
19412 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
19413 unsigned char per_commitment_secret_arr[32];
19414 CHECK(*((uint32_t*)per_commitment_secret) == 32);
19415 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
19416 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
19417 unsigned char countersignatory_revocation_base_secret_arr[32];
19418 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
19419 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
19420 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
19421 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19422 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
19423 return (uint64_t)ret_conv;
19426 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
19427 LDKPublicKey per_commitment_point_ref;
19428 CHECK(*((uint32_t*)per_commitment_point) == 33);
19429 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19430 LDKPublicKey countersignatory_revocation_base_point_ref;
19431 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
19432 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
19433 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19434 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
19435 return (uint64_t)ret_conv;
19438 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
19439 LDKTxCreationKeys this_obj_conv;
19440 this_obj_conv.inner = (void*)(this_obj & (~1));
19441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19442 TxCreationKeys_free(this_obj_conv);
19445 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
19446 LDKTxCreationKeys this_ptr_conv;
19447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19448 this_ptr_conv.is_owned = false;
19449 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19450 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19454 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19455 LDKTxCreationKeys this_ptr_conv;
19456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19457 this_ptr_conv.is_owned = false;
19458 LDKPublicKey val_ref;
19459 CHECK(*((uint32_t*)val) == 33);
19460 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19461 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
19464 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
19465 LDKTxCreationKeys this_ptr_conv;
19466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19467 this_ptr_conv.is_owned = false;
19468 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19469 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
19473 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
19474 LDKTxCreationKeys this_ptr_conv;
19475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19476 this_ptr_conv.is_owned = false;
19477 LDKPublicKey val_ref;
19478 CHECK(*((uint32_t*)val) == 33);
19479 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19480 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
19483 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
19484 LDKTxCreationKeys this_ptr_conv;
19485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19486 this_ptr_conv.is_owned = false;
19487 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19488 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
19492 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
19493 LDKTxCreationKeys this_ptr_conv;
19494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19495 this_ptr_conv.is_owned = false;
19496 LDKPublicKey val_ref;
19497 CHECK(*((uint32_t*)val) == 33);
19498 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19499 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
19502 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
19503 LDKTxCreationKeys this_ptr_conv;
19504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19505 this_ptr_conv.is_owned = false;
19506 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19507 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
19511 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
19512 LDKTxCreationKeys this_ptr_conv;
19513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19514 this_ptr_conv.is_owned = false;
19515 LDKPublicKey val_ref;
19516 CHECK(*((uint32_t*)val) == 33);
19517 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19518 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
19521 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
19522 LDKTxCreationKeys this_ptr_conv;
19523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19524 this_ptr_conv.is_owned = false;
19525 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19526 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
19530 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
19531 LDKTxCreationKeys this_ptr_conv;
19532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19533 this_ptr_conv.is_owned = false;
19534 LDKPublicKey val_ref;
19535 CHECK(*((uint32_t*)val) == 33);
19536 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19537 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
19540 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) {
19541 LDKPublicKey per_commitment_point_arg_ref;
19542 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
19543 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
19544 LDKPublicKey revocation_key_arg_ref;
19545 CHECK(*((uint32_t*)revocation_key_arg) == 33);
19546 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
19547 LDKPublicKey broadcaster_htlc_key_arg_ref;
19548 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
19549 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
19550 LDKPublicKey countersignatory_htlc_key_arg_ref;
19551 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
19552 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
19553 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
19554 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
19555 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
19556 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);
19557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19559 uint64_t ret_ref = (uint64_t)ret_var.inner;
19560 if (ret_var.is_owned) {
19566 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
19567 LDKTxCreationKeys orig_conv;
19568 orig_conv.inner = (void*)(orig & (~1));
19569 orig_conv.is_owned = false;
19570 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
19571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19573 uint64_t ret_ref = (uint64_t)ret_var.inner;
19574 if (ret_var.is_owned) {
19580 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
19581 LDKTxCreationKeys obj_conv;
19582 obj_conv.inner = (void*)(obj & (~1));
19583 obj_conv.is_owned = false;
19584 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
19585 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19586 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19587 CVec_u8Z_free(ret_var);
19591 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
19592 LDKu8slice ser_ref;
19593 ser_ref.datalen = *((uint32_t*)ser);
19594 ser_ref.data = (int8_t*)(ser + 4);
19595 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
19596 *ret_conv = TxCreationKeys_read(ser_ref);
19597 return (uint64_t)ret_conv;
19600 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
19601 LDKChannelPublicKeys this_obj_conv;
19602 this_obj_conv.inner = (void*)(this_obj & (~1));
19603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19604 ChannelPublicKeys_free(this_obj_conv);
19607 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
19608 LDKChannelPublicKeys this_ptr_conv;
19609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19610 this_ptr_conv.is_owned = false;
19611 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19612 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
19616 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
19617 LDKChannelPublicKeys this_ptr_conv;
19618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19619 this_ptr_conv.is_owned = false;
19620 LDKPublicKey val_ref;
19621 CHECK(*((uint32_t*)val) == 33);
19622 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19623 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
19626 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
19627 LDKChannelPublicKeys this_ptr_conv;
19628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19629 this_ptr_conv.is_owned = false;
19630 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19631 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
19635 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
19636 LDKChannelPublicKeys this_ptr_conv;
19637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19638 this_ptr_conv.is_owned = false;
19639 LDKPublicKey val_ref;
19640 CHECK(*((uint32_t*)val) == 33);
19641 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19642 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
19645 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
19646 LDKChannelPublicKeys this_ptr_conv;
19647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19648 this_ptr_conv.is_owned = false;
19649 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19650 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
19654 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
19655 LDKChannelPublicKeys this_ptr_conv;
19656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19657 this_ptr_conv.is_owned = false;
19658 LDKPublicKey val_ref;
19659 CHECK(*((uint32_t*)val) == 33);
19660 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19661 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
19664 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
19665 LDKChannelPublicKeys this_ptr_conv;
19666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19667 this_ptr_conv.is_owned = false;
19668 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19669 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
19673 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
19674 LDKChannelPublicKeys this_ptr_conv;
19675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19676 this_ptr_conv.is_owned = false;
19677 LDKPublicKey val_ref;
19678 CHECK(*((uint32_t*)val) == 33);
19679 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19680 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19683 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
19684 LDKChannelPublicKeys this_ptr_conv;
19685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19686 this_ptr_conv.is_owned = false;
19687 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19688 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
19692 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
19693 LDKChannelPublicKeys this_ptr_conv;
19694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19695 this_ptr_conv.is_owned = false;
19696 LDKPublicKey val_ref;
19697 CHECK(*((uint32_t*)val) == 33);
19698 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19699 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
19702 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) {
19703 LDKPublicKey funding_pubkey_arg_ref;
19704 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
19705 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
19706 LDKPublicKey revocation_basepoint_arg_ref;
19707 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
19708 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
19709 LDKPublicKey payment_point_arg_ref;
19710 CHECK(*((uint32_t*)payment_point_arg) == 33);
19711 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
19712 LDKPublicKey delayed_payment_basepoint_arg_ref;
19713 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
19714 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
19715 LDKPublicKey htlc_basepoint_arg_ref;
19716 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
19717 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
19718 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);
19719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19721 uint64_t ret_ref = (uint64_t)ret_var.inner;
19722 if (ret_var.is_owned) {
19728 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
19729 LDKChannelPublicKeys orig_conv;
19730 orig_conv.inner = (void*)(orig & (~1));
19731 orig_conv.is_owned = false;
19732 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
19733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19735 uint64_t ret_ref = (uint64_t)ret_var.inner;
19736 if (ret_var.is_owned) {
19742 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
19743 LDKChannelPublicKeys obj_conv;
19744 obj_conv.inner = (void*)(obj & (~1));
19745 obj_conv.is_owned = false;
19746 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
19747 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19748 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19749 CVec_u8Z_free(ret_var);
19753 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
19754 LDKu8slice ser_ref;
19755 ser_ref.datalen = *((uint32_t*)ser);
19756 ser_ref.data = (int8_t*)(ser + 4);
19757 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
19758 *ret_conv = ChannelPublicKeys_read(ser_ref);
19759 return (uint64_t)ret_conv;
19762 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) {
19763 LDKPublicKey per_commitment_point_ref;
19764 CHECK(*((uint32_t*)per_commitment_point) == 33);
19765 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19766 LDKPublicKey broadcaster_delayed_payment_base_ref;
19767 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
19768 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
19769 LDKPublicKey broadcaster_htlc_base_ref;
19770 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
19771 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
19772 LDKPublicKey countersignatory_revocation_base_ref;
19773 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
19774 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
19775 LDKPublicKey countersignatory_htlc_base_ref;
19776 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
19777 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
19778 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
19779 *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);
19780 return (uint64_t)ret_conv;
19783 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
19784 LDKPublicKey per_commitment_point_ref;
19785 CHECK(*((uint32_t*)per_commitment_point) == 33);
19786 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19787 LDKChannelPublicKeys broadcaster_keys_conv;
19788 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
19789 broadcaster_keys_conv.is_owned = false;
19790 LDKChannelPublicKeys countersignatory_keys_conv;
19791 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
19792 countersignatory_keys_conv.is_owned = false;
19793 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
19794 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
19795 return (uint64_t)ret_conv;
19798 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
19799 LDKPublicKey revocation_key_ref;
19800 CHECK(*((uint32_t*)revocation_key) == 33);
19801 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
19802 LDKPublicKey broadcaster_delayed_payment_key_ref;
19803 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
19804 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
19805 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
19806 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19807 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19808 CVec_u8Z_free(ret_var);
19812 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
19813 LDKHTLCOutputInCommitment this_obj_conv;
19814 this_obj_conv.inner = (void*)(this_obj & (~1));
19815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19816 HTLCOutputInCommitment_free(this_obj_conv);
19819 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
19820 LDKHTLCOutputInCommitment this_ptr_conv;
19821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19822 this_ptr_conv.is_owned = false;
19823 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
19827 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
19828 LDKHTLCOutputInCommitment this_ptr_conv;
19829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19830 this_ptr_conv.is_owned = false;
19831 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
19834 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
19835 LDKHTLCOutputInCommitment this_ptr_conv;
19836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19837 this_ptr_conv.is_owned = false;
19838 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
19842 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
19843 LDKHTLCOutputInCommitment this_ptr_conv;
19844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19845 this_ptr_conv.is_owned = false;
19846 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
19849 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
19850 LDKHTLCOutputInCommitment this_ptr_conv;
19851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19852 this_ptr_conv.is_owned = false;
19853 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
19857 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
19858 LDKHTLCOutputInCommitment this_ptr_conv;
19859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19860 this_ptr_conv.is_owned = false;
19861 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
19864 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
19865 LDKHTLCOutputInCommitment this_ptr_conv;
19866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19867 this_ptr_conv.is_owned = false;
19868 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19869 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
19873 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
19874 LDKHTLCOutputInCommitment this_ptr_conv;
19875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19876 this_ptr_conv.is_owned = false;
19877 LDKThirtyTwoBytes val_ref;
19878 CHECK(*((uint32_t*)val) == 32);
19879 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19880 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
19883 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
19884 LDKHTLCOutputInCommitment this_ptr_conv;
19885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19886 this_ptr_conv.is_owned = false;
19887 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19888 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
19889 uint64_t ret_ref = (uint64_t)ret_copy;
19893 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
19894 LDKHTLCOutputInCommitment this_ptr_conv;
19895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19896 this_ptr_conv.is_owned = false;
19897 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
19898 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
19901 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) {
19902 LDKThirtyTwoBytes payment_hash_arg_ref;
19903 CHECK(*((uint32_t*)payment_hash_arg) == 32);
19904 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
19905 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
19906 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
19907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19909 uint64_t ret_ref = (uint64_t)ret_var.inner;
19910 if (ret_var.is_owned) {
19916 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
19917 LDKHTLCOutputInCommitment orig_conv;
19918 orig_conv.inner = (void*)(orig & (~1));
19919 orig_conv.is_owned = false;
19920 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
19921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19923 uint64_t ret_ref = (uint64_t)ret_var.inner;
19924 if (ret_var.is_owned) {
19930 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
19931 LDKHTLCOutputInCommitment obj_conv;
19932 obj_conv.inner = (void*)(obj & (~1));
19933 obj_conv.is_owned = false;
19934 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
19935 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19936 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19937 CVec_u8Z_free(ret_var);
19941 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
19942 LDKu8slice ser_ref;
19943 ser_ref.datalen = *((uint32_t*)ser);
19944 ser_ref.data = (int8_t*)(ser + 4);
19945 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
19946 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
19947 return (uint64_t)ret_conv;
19950 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
19951 LDKHTLCOutputInCommitment htlc_conv;
19952 htlc_conv.inner = (void*)(htlc & (~1));
19953 htlc_conv.is_owned = false;
19954 LDKTxCreationKeys keys_conv;
19955 keys_conv.inner = (void*)(keys & (~1));
19956 keys_conv.is_owned = false;
19957 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
19958 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19959 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19960 CVec_u8Z_free(ret_var);
19964 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
19965 LDKPublicKey broadcaster_ref;
19966 CHECK(*((uint32_t*)broadcaster) == 33);
19967 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
19968 LDKPublicKey countersignatory_ref;
19969 CHECK(*((uint32_t*)countersignatory) == 33);
19970 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
19971 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
19972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19974 CVec_u8Z_free(ret_var);
19978 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) {
19979 unsigned char commitment_txid_arr[32];
19980 CHECK(*((uint32_t*)commitment_txid) == 32);
19981 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
19982 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
19983 LDKHTLCOutputInCommitment htlc_conv;
19984 htlc_conv.inner = (void*)(htlc & (~1));
19985 htlc_conv.is_owned = false;
19986 LDKPublicKey broadcaster_delayed_payment_key_ref;
19987 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
19988 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
19989 LDKPublicKey revocation_key_ref;
19990 CHECK(*((uint32_t*)revocation_key) == 33);
19991 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
19992 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
19993 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19994 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19995 Transaction_free(ret_var);
19999 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
20000 LDKChannelTransactionParameters this_obj_conv;
20001 this_obj_conv.inner = (void*)(this_obj & (~1));
20002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20003 ChannelTransactionParameters_free(this_obj_conv);
20006 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
20007 LDKChannelTransactionParameters this_ptr_conv;
20008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20009 this_ptr_conv.is_owned = false;
20010 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
20011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20013 uint64_t ret_ref = (uint64_t)ret_var.inner;
20014 if (ret_var.is_owned) {
20020 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
20021 LDKChannelTransactionParameters this_ptr_conv;
20022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20023 this_ptr_conv.is_owned = false;
20024 LDKChannelPublicKeys val_conv;
20025 val_conv.inner = (void*)(val & (~1));
20026 val_conv.is_owned = (val & 1) || (val == 0);
20027 val_conv = ChannelPublicKeys_clone(&val_conv);
20028 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
20031 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
20032 LDKChannelTransactionParameters this_ptr_conv;
20033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20034 this_ptr_conv.is_owned = false;
20035 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
20039 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20040 LDKChannelTransactionParameters this_ptr_conv;
20041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20042 this_ptr_conv.is_owned = false;
20043 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
20046 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
20047 LDKChannelTransactionParameters this_ptr_conv;
20048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20049 this_ptr_conv.is_owned = false;
20050 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
20054 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
20055 LDKChannelTransactionParameters this_ptr_conv;
20056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20057 this_ptr_conv.is_owned = false;
20058 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
20061 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
20062 LDKChannelTransactionParameters this_ptr_conv;
20063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20064 this_ptr_conv.is_owned = false;
20065 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
20066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20068 uint64_t ret_ref = (uint64_t)ret_var.inner;
20069 if (ret_var.is_owned) {
20075 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
20076 LDKChannelTransactionParameters this_ptr_conv;
20077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20078 this_ptr_conv.is_owned = false;
20079 LDKCounterpartyChannelTransactionParameters val_conv;
20080 val_conv.inner = (void*)(val & (~1));
20081 val_conv.is_owned = (val & 1) || (val == 0);
20082 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
20083 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
20086 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
20087 LDKChannelTransactionParameters this_ptr_conv;
20088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20089 this_ptr_conv.is_owned = false;
20090 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
20091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20093 uint64_t ret_ref = (uint64_t)ret_var.inner;
20094 if (ret_var.is_owned) {
20100 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
20101 LDKChannelTransactionParameters this_ptr_conv;
20102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20103 this_ptr_conv.is_owned = false;
20104 LDKOutPoint val_conv;
20105 val_conv.inner = (void*)(val & (~1));
20106 val_conv.is_owned = (val & 1) || (val == 0);
20107 val_conv = OutPoint_clone(&val_conv);
20108 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
20111 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) {
20112 LDKChannelPublicKeys holder_pubkeys_arg_conv;
20113 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
20114 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
20115 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
20116 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
20117 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
20118 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
20119 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
20120 LDKOutPoint funding_outpoint_arg_conv;
20121 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
20122 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
20123 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
20124 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);
20125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20127 uint64_t ret_ref = (uint64_t)ret_var.inner;
20128 if (ret_var.is_owned) {
20134 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
20135 LDKChannelTransactionParameters orig_conv;
20136 orig_conv.inner = (void*)(orig & (~1));
20137 orig_conv.is_owned = false;
20138 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
20139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20141 uint64_t ret_ref = (uint64_t)ret_var.inner;
20142 if (ret_var.is_owned) {
20148 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
20149 LDKCounterpartyChannelTransactionParameters this_obj_conv;
20150 this_obj_conv.inner = (void*)(this_obj & (~1));
20151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20152 CounterpartyChannelTransactionParameters_free(this_obj_conv);
20155 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
20156 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20158 this_ptr_conv.is_owned = false;
20159 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
20160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20162 uint64_t ret_ref = (uint64_t)ret_var.inner;
20163 if (ret_var.is_owned) {
20169 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
20170 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20172 this_ptr_conv.is_owned = false;
20173 LDKChannelPublicKeys val_conv;
20174 val_conv.inner = (void*)(val & (~1));
20175 val_conv.is_owned = (val & 1) || (val == 0);
20176 val_conv = ChannelPublicKeys_clone(&val_conv);
20177 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
20180 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
20181 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20183 this_ptr_conv.is_owned = false;
20184 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
20188 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20189 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20191 this_ptr_conv.is_owned = false;
20192 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
20195 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
20196 LDKChannelPublicKeys pubkeys_arg_conv;
20197 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
20198 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
20199 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
20200 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
20201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20203 uint64_t ret_ref = (uint64_t)ret_var.inner;
20204 if (ret_var.is_owned) {
20210 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
20211 LDKCounterpartyChannelTransactionParameters orig_conv;
20212 orig_conv.inner = (void*)(orig & (~1));
20213 orig_conv.is_owned = false;
20214 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
20215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20217 uint64_t ret_ref = (uint64_t)ret_var.inner;
20218 if (ret_var.is_owned) {
20224 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
20225 LDKChannelTransactionParameters this_arg_conv;
20226 this_arg_conv.inner = (void*)(this_arg & (~1));
20227 this_arg_conv.is_owned = false;
20228 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
20232 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
20233 LDKChannelTransactionParameters this_arg_conv;
20234 this_arg_conv.inner = (void*)(this_arg & (~1));
20235 this_arg_conv.is_owned = false;
20236 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
20237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20239 uint64_t ret_ref = (uint64_t)ret_var.inner;
20240 if (ret_var.is_owned) {
20246 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
20247 LDKChannelTransactionParameters this_arg_conv;
20248 this_arg_conv.inner = (void*)(this_arg & (~1));
20249 this_arg_conv.is_owned = false;
20250 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
20251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20253 uint64_t ret_ref = (uint64_t)ret_var.inner;
20254 if (ret_var.is_owned) {
20260 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
20261 LDKCounterpartyChannelTransactionParameters obj_conv;
20262 obj_conv.inner = (void*)(obj & (~1));
20263 obj_conv.is_owned = false;
20264 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
20265 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20266 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20267 CVec_u8Z_free(ret_var);
20271 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
20272 LDKu8slice ser_ref;
20273 ser_ref.datalen = *((uint32_t*)ser);
20274 ser_ref.data = (int8_t*)(ser + 4);
20275 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
20276 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
20277 return (uint64_t)ret_conv;
20280 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
20281 LDKChannelTransactionParameters obj_conv;
20282 obj_conv.inner = (void*)(obj & (~1));
20283 obj_conv.is_owned = false;
20284 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
20285 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20286 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20287 CVec_u8Z_free(ret_var);
20291 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
20292 LDKu8slice ser_ref;
20293 ser_ref.datalen = *((uint32_t*)ser);
20294 ser_ref.data = (int8_t*)(ser + 4);
20295 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
20296 *ret_conv = ChannelTransactionParameters_read(ser_ref);
20297 return (uint64_t)ret_conv;
20300 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
20301 LDKDirectedChannelTransactionParameters this_obj_conv;
20302 this_obj_conv.inner = (void*)(this_obj & (~1));
20303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20304 DirectedChannelTransactionParameters_free(this_obj_conv);
20307 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
20308 LDKDirectedChannelTransactionParameters this_arg_conv;
20309 this_arg_conv.inner = (void*)(this_arg & (~1));
20310 this_arg_conv.is_owned = false;
20311 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
20312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20314 uint64_t ret_ref = (uint64_t)ret_var.inner;
20315 if (ret_var.is_owned) {
20321 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
20322 LDKDirectedChannelTransactionParameters this_arg_conv;
20323 this_arg_conv.inner = (void*)(this_arg & (~1));
20324 this_arg_conv.is_owned = false;
20325 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
20326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20328 uint64_t ret_ref = (uint64_t)ret_var.inner;
20329 if (ret_var.is_owned) {
20335 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
20336 LDKDirectedChannelTransactionParameters this_arg_conv;
20337 this_arg_conv.inner = (void*)(this_arg & (~1));
20338 this_arg_conv.is_owned = false;
20339 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
20343 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
20344 LDKDirectedChannelTransactionParameters this_arg_conv;
20345 this_arg_conv.inner = (void*)(this_arg & (~1));
20346 this_arg_conv.is_owned = false;
20347 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
20351 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
20352 LDKDirectedChannelTransactionParameters this_arg_conv;
20353 this_arg_conv.inner = (void*)(this_arg & (~1));
20354 this_arg_conv.is_owned = false;
20355 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
20356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20358 uint64_t ret_ref = (uint64_t)ret_var.inner;
20359 if (ret_var.is_owned) {
20365 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
20366 LDKHolderCommitmentTransaction this_obj_conv;
20367 this_obj_conv.inner = (void*)(this_obj & (~1));
20368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20369 HolderCommitmentTransaction_free(this_obj_conv);
20372 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
20373 LDKHolderCommitmentTransaction this_ptr_conv;
20374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20375 this_ptr_conv.is_owned = false;
20376 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20377 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
20381 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
20382 LDKHolderCommitmentTransaction this_ptr_conv;
20383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20384 this_ptr_conv.is_owned = false;
20385 LDKSignature val_ref;
20386 CHECK(*((uint32_t*)val) == 64);
20387 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20388 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
20391 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
20392 LDKHolderCommitmentTransaction this_ptr_conv;
20393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20394 this_ptr_conv.is_owned = false;
20395 LDKCVec_SignatureZ val_constr;
20396 val_constr.datalen = *((uint32_t*)val);
20397 if (val_constr.datalen > 0)
20398 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20400 val_constr.data = NULL;
20401 int8_tArray* val_vals = (int8_tArray*)(val + 4);
20402 for (size_t m = 0; m < val_constr.datalen; m++) {
20403 int8_tArray val_conv_12 = val_vals[m];
20404 LDKSignature val_conv_12_ref;
20405 CHECK(*((uint32_t*)val_conv_12) == 64);
20406 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
20407 val_constr.data[m] = val_conv_12_ref;
20409 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
20412 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
20413 LDKHolderCommitmentTransaction orig_conv;
20414 orig_conv.inner = (void*)(orig & (~1));
20415 orig_conv.is_owned = false;
20416 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
20417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20419 uint64_t ret_ref = (uint64_t)ret_var.inner;
20420 if (ret_var.is_owned) {
20426 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
20427 LDKHolderCommitmentTransaction obj_conv;
20428 obj_conv.inner = (void*)(obj & (~1));
20429 obj_conv.is_owned = false;
20430 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
20431 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20432 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20433 CVec_u8Z_free(ret_var);
20437 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
20438 LDKu8slice ser_ref;
20439 ser_ref.datalen = *((uint32_t*)ser);
20440 ser_ref.data = (int8_t*)(ser + 4);
20441 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
20442 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
20443 return (uint64_t)ret_conv;
20446 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) {
20447 LDKCommitmentTransaction commitment_tx_conv;
20448 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
20449 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
20450 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
20451 LDKSignature counterparty_sig_ref;
20452 CHECK(*((uint32_t*)counterparty_sig) == 64);
20453 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
20454 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
20455 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
20456 if (counterparty_htlc_sigs_constr.datalen > 0)
20457 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20459 counterparty_htlc_sigs_constr.data = NULL;
20460 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
20461 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
20462 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
20463 LDKSignature counterparty_htlc_sigs_conv_12_ref;
20464 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
20465 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
20466 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
20468 LDKPublicKey holder_funding_key_ref;
20469 CHECK(*((uint32_t*)holder_funding_key) == 33);
20470 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
20471 LDKPublicKey counterparty_funding_key_ref;
20472 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
20473 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
20474 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
20475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20477 uint64_t ret_ref = (uint64_t)ret_var.inner;
20478 if (ret_var.is_owned) {
20484 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
20485 LDKBuiltCommitmentTransaction this_obj_conv;
20486 this_obj_conv.inner = (void*)(this_obj & (~1));
20487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20488 BuiltCommitmentTransaction_free(this_obj_conv);
20491 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
20492 LDKBuiltCommitmentTransaction this_ptr_conv;
20493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20494 this_ptr_conv.is_owned = false;
20495 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
20496 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20497 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20498 Transaction_free(ret_var);
20502 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
20503 LDKBuiltCommitmentTransaction this_ptr_conv;
20504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20505 this_ptr_conv.is_owned = false;
20506 LDKTransaction val_ref;
20507 val_ref.datalen = *((uint32_t*)val);
20508 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
20509 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
20510 val_ref.data_is_owned = true;
20511 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
20514 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
20515 LDKBuiltCommitmentTransaction this_ptr_conv;
20516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20517 this_ptr_conv.is_owned = false;
20518 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20519 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
20523 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
20524 LDKBuiltCommitmentTransaction this_ptr_conv;
20525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20526 this_ptr_conv.is_owned = false;
20527 LDKThirtyTwoBytes val_ref;
20528 CHECK(*((uint32_t*)val) == 32);
20529 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20530 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
20533 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
20534 LDKTransaction transaction_arg_ref;
20535 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
20536 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
20537 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
20538 transaction_arg_ref.data_is_owned = true;
20539 LDKThirtyTwoBytes txid_arg_ref;
20540 CHECK(*((uint32_t*)txid_arg) == 32);
20541 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
20542 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
20543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20545 uint64_t ret_ref = (uint64_t)ret_var.inner;
20546 if (ret_var.is_owned) {
20552 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
20553 LDKBuiltCommitmentTransaction orig_conv;
20554 orig_conv.inner = (void*)(orig & (~1));
20555 orig_conv.is_owned = false;
20556 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
20557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20559 uint64_t ret_ref = (uint64_t)ret_var.inner;
20560 if (ret_var.is_owned) {
20566 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
20567 LDKBuiltCommitmentTransaction obj_conv;
20568 obj_conv.inner = (void*)(obj & (~1));
20569 obj_conv.is_owned = false;
20570 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
20571 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20572 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20573 CVec_u8Z_free(ret_var);
20577 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
20578 LDKu8slice ser_ref;
20579 ser_ref.datalen = *((uint32_t*)ser);
20580 ser_ref.data = (int8_t*)(ser + 4);
20581 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
20582 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
20583 return (uint64_t)ret_conv;
20586 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
20587 LDKBuiltCommitmentTransaction this_arg_conv;
20588 this_arg_conv.inner = (void*)(this_arg & (~1));
20589 this_arg_conv.is_owned = false;
20590 LDKu8slice funding_redeemscript_ref;
20591 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
20592 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
20593 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20594 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
20598 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) {
20599 LDKBuiltCommitmentTransaction this_arg_conv;
20600 this_arg_conv.inner = (void*)(this_arg & (~1));
20601 this_arg_conv.is_owned = false;
20602 unsigned char funding_key_arr[32];
20603 CHECK(*((uint32_t*)funding_key) == 32);
20604 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
20605 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
20606 LDKu8slice funding_redeemscript_ref;
20607 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
20608 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
20609 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20610 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
20614 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
20615 LDKCommitmentTransaction this_obj_conv;
20616 this_obj_conv.inner = (void*)(this_obj & (~1));
20617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20618 CommitmentTransaction_free(this_obj_conv);
20621 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
20622 LDKCommitmentTransaction orig_conv;
20623 orig_conv.inner = (void*)(orig & (~1));
20624 orig_conv.is_owned = false;
20625 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
20626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20628 uint64_t ret_ref = (uint64_t)ret_var.inner;
20629 if (ret_var.is_owned) {
20635 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
20636 LDKCommitmentTransaction obj_conv;
20637 obj_conv.inner = (void*)(obj & (~1));
20638 obj_conv.is_owned = false;
20639 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
20640 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20641 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20642 CVec_u8Z_free(ret_var);
20646 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
20647 LDKu8slice ser_ref;
20648 ser_ref.datalen = *((uint32_t*)ser);
20649 ser_ref.data = (int8_t*)(ser + 4);
20650 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
20651 *ret_conv = CommitmentTransaction_read(ser_ref);
20652 return (uint64_t)ret_conv;
20655 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
20656 LDKCommitmentTransaction this_arg_conv;
20657 this_arg_conv.inner = (void*)(this_arg & (~1));
20658 this_arg_conv.is_owned = false;
20659 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
20663 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
20664 LDKCommitmentTransaction this_arg_conv;
20665 this_arg_conv.inner = (void*)(this_arg & (~1));
20666 this_arg_conv.is_owned = false;
20667 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
20671 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
20672 LDKCommitmentTransaction this_arg_conv;
20673 this_arg_conv.inner = (void*)(this_arg & (~1));
20674 this_arg_conv.is_owned = false;
20675 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
20679 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
20680 LDKCommitmentTransaction this_arg_conv;
20681 this_arg_conv.inner = (void*)(this_arg & (~1));
20682 this_arg_conv.is_owned = false;
20683 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
20687 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
20688 LDKCommitmentTransaction this_arg_conv;
20689 this_arg_conv.inner = (void*)(this_arg & (~1));
20690 this_arg_conv.is_owned = false;
20691 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
20692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20694 uint64_t ret_ref = (uint64_t)ret_var.inner;
20695 if (ret_var.is_owned) {
20701 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
20702 LDKCommitmentTransaction this_arg_conv;
20703 this_arg_conv.inner = (void*)(this_arg & (~1));
20704 this_arg_conv.is_owned = false;
20705 LDKDirectedChannelTransactionParameters channel_parameters_conv;
20706 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
20707 channel_parameters_conv.is_owned = false;
20708 LDKChannelPublicKeys broadcaster_keys_conv;
20709 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
20710 broadcaster_keys_conv.is_owned = false;
20711 LDKChannelPublicKeys countersignatory_keys_conv;
20712 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
20713 countersignatory_keys_conv.is_owned = false;
20714 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
20715 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
20716 return (uint64_t)ret_conv;
20719 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
20720 LDKTrustedCommitmentTransaction this_obj_conv;
20721 this_obj_conv.inner = (void*)(this_obj & (~1));
20722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20723 TrustedCommitmentTransaction_free(this_obj_conv);
20726 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
20727 LDKTrustedCommitmentTransaction this_arg_conv;
20728 this_arg_conv.inner = (void*)(this_arg & (~1));
20729 this_arg_conv.is_owned = false;
20730 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20731 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
20735 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
20736 LDKTrustedCommitmentTransaction this_arg_conv;
20737 this_arg_conv.inner = (void*)(this_arg & (~1));
20738 this_arg_conv.is_owned = false;
20739 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
20740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20742 uint64_t ret_ref = (uint64_t)ret_var.inner;
20743 if (ret_var.is_owned) {
20749 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
20750 LDKTrustedCommitmentTransaction this_arg_conv;
20751 this_arg_conv.inner = (void*)(this_arg & (~1));
20752 this_arg_conv.is_owned = false;
20753 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
20754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20756 uint64_t ret_ref = (uint64_t)ret_var.inner;
20757 if (ret_var.is_owned) {
20763 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
20764 LDKTrustedCommitmentTransaction this_arg_conv;
20765 this_arg_conv.inner = (void*)(this_arg & (~1));
20766 this_arg_conv.is_owned = false;
20767 unsigned char htlc_base_key_arr[32];
20768 CHECK(*((uint32_t*)htlc_base_key) == 32);
20769 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
20770 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
20771 LDKDirectedChannelTransactionParameters channel_parameters_conv;
20772 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
20773 channel_parameters_conv.is_owned = false;
20774 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
20775 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
20776 return (uint64_t)ret_conv;
20779 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) {
20780 LDKPublicKey broadcaster_payment_basepoint_ref;
20781 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
20782 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
20783 LDKPublicKey countersignatory_payment_basepoint_ref;
20784 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
20785 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
20786 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
20790 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
20791 LDKInitFeatures a_conv;
20792 a_conv.inner = (void*)(a & (~1));
20793 a_conv.is_owned = false;
20794 LDKInitFeatures b_conv;
20795 b_conv.inner = (void*)(b & (~1));
20796 b_conv.is_owned = false;
20797 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
20801 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
20802 LDKNodeFeatures a_conv;
20803 a_conv.inner = (void*)(a & (~1));
20804 a_conv.is_owned = false;
20805 LDKNodeFeatures b_conv;
20806 b_conv.inner = (void*)(b & (~1));
20807 b_conv.is_owned = false;
20808 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
20812 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
20813 LDKChannelFeatures a_conv;
20814 a_conv.inner = (void*)(a & (~1));
20815 a_conv.is_owned = false;
20816 LDKChannelFeatures b_conv;
20817 b_conv.inner = (void*)(b & (~1));
20818 b_conv.is_owned = false;
20819 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
20823 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
20824 LDKInvoiceFeatures a_conv;
20825 a_conv.inner = (void*)(a & (~1));
20826 a_conv.is_owned = false;
20827 LDKInvoiceFeatures b_conv;
20828 b_conv.inner = (void*)(b & (~1));
20829 b_conv.is_owned = false;
20830 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
20834 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
20835 LDKInitFeatures orig_conv;
20836 orig_conv.inner = (void*)(orig & (~1));
20837 orig_conv.is_owned = false;
20838 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
20839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20841 uint64_t ret_ref = (uint64_t)ret_var.inner;
20842 if (ret_var.is_owned) {
20848 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
20849 LDKNodeFeatures orig_conv;
20850 orig_conv.inner = (void*)(orig & (~1));
20851 orig_conv.is_owned = false;
20852 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
20853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20855 uint64_t ret_ref = (uint64_t)ret_var.inner;
20856 if (ret_var.is_owned) {
20862 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
20863 LDKChannelFeatures orig_conv;
20864 orig_conv.inner = (void*)(orig & (~1));
20865 orig_conv.is_owned = false;
20866 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
20867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20869 uint64_t ret_ref = (uint64_t)ret_var.inner;
20870 if (ret_var.is_owned) {
20876 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
20877 LDKInvoiceFeatures orig_conv;
20878 orig_conv.inner = (void*)(orig & (~1));
20879 orig_conv.is_owned = false;
20880 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
20881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20883 uint64_t ret_ref = (uint64_t)ret_var.inner;
20884 if (ret_var.is_owned) {
20890 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
20891 LDKInitFeatures this_obj_conv;
20892 this_obj_conv.inner = (void*)(this_obj & (~1));
20893 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20894 InitFeatures_free(this_obj_conv);
20897 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
20898 LDKNodeFeatures this_obj_conv;
20899 this_obj_conv.inner = (void*)(this_obj & (~1));
20900 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20901 NodeFeatures_free(this_obj_conv);
20904 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
20905 LDKChannelFeatures this_obj_conv;
20906 this_obj_conv.inner = (void*)(this_obj & (~1));
20907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20908 ChannelFeatures_free(this_obj_conv);
20911 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
20912 LDKInvoiceFeatures this_obj_conv;
20913 this_obj_conv.inner = (void*)(this_obj & (~1));
20914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20915 InvoiceFeatures_free(this_obj_conv);
20918 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
20919 LDKInitFeatures ret_var = InitFeatures_empty();
20920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20922 uint64_t ret_ref = (uint64_t)ret_var.inner;
20923 if (ret_var.is_owned) {
20929 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
20930 LDKInitFeatures ret_var = InitFeatures_known();
20931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20933 uint64_t ret_ref = (uint64_t)ret_var.inner;
20934 if (ret_var.is_owned) {
20940 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
20941 LDKNodeFeatures ret_var = NodeFeatures_empty();
20942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20944 uint64_t ret_ref = (uint64_t)ret_var.inner;
20945 if (ret_var.is_owned) {
20951 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
20952 LDKNodeFeatures ret_var = NodeFeatures_known();
20953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20955 uint64_t ret_ref = (uint64_t)ret_var.inner;
20956 if (ret_var.is_owned) {
20962 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
20963 LDKChannelFeatures ret_var = ChannelFeatures_empty();
20964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20966 uint64_t ret_ref = (uint64_t)ret_var.inner;
20967 if (ret_var.is_owned) {
20973 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
20974 LDKChannelFeatures ret_var = ChannelFeatures_known();
20975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20977 uint64_t ret_ref = (uint64_t)ret_var.inner;
20978 if (ret_var.is_owned) {
20984 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
20985 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
20986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20988 uint64_t ret_ref = (uint64_t)ret_var.inner;
20989 if (ret_var.is_owned) {
20995 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
20996 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
20997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20999 uint64_t ret_ref = (uint64_t)ret_var.inner;
21000 if (ret_var.is_owned) {
21006 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
21007 LDKInitFeatures this_arg_conv;
21008 this_arg_conv.inner = (void*)(this_arg & (~1));
21009 this_arg_conv.is_owned = false;
21010 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
21014 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
21015 LDKNodeFeatures this_arg_conv;
21016 this_arg_conv.inner = (void*)(this_arg & (~1));
21017 this_arg_conv.is_owned = false;
21018 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
21022 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
21023 LDKInvoiceFeatures this_arg_conv;
21024 this_arg_conv.inner = (void*)(this_arg & (~1));
21025 this_arg_conv.is_owned = false;
21026 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
21030 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
21031 LDKInitFeatures obj_conv;
21032 obj_conv.inner = (void*)(obj & (~1));
21033 obj_conv.is_owned = false;
21034 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
21035 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21036 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21037 CVec_u8Z_free(ret_var);
21041 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
21042 LDKNodeFeatures obj_conv;
21043 obj_conv.inner = (void*)(obj & (~1));
21044 obj_conv.is_owned = false;
21045 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
21046 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21047 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21048 CVec_u8Z_free(ret_var);
21052 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
21053 LDKChannelFeatures obj_conv;
21054 obj_conv.inner = (void*)(obj & (~1));
21055 obj_conv.is_owned = false;
21056 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
21057 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21058 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21059 CVec_u8Z_free(ret_var);
21063 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
21064 LDKInvoiceFeatures obj_conv;
21065 obj_conv.inner = (void*)(obj & (~1));
21066 obj_conv.is_owned = false;
21067 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
21068 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21069 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21070 CVec_u8Z_free(ret_var);
21074 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
21075 LDKu8slice ser_ref;
21076 ser_ref.datalen = *((uint32_t*)ser);
21077 ser_ref.data = (int8_t*)(ser + 4);
21078 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21079 *ret_conv = InitFeatures_read(ser_ref);
21080 return (uint64_t)ret_conv;
21083 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
21084 LDKu8slice ser_ref;
21085 ser_ref.datalen = *((uint32_t*)ser);
21086 ser_ref.data = (int8_t*)(ser + 4);
21087 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21088 *ret_conv = NodeFeatures_read(ser_ref);
21089 return (uint64_t)ret_conv;
21092 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
21093 LDKu8slice ser_ref;
21094 ser_ref.datalen = *((uint32_t*)ser);
21095 ser_ref.data = (int8_t*)(ser + 4);
21096 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21097 *ret_conv = ChannelFeatures_read(ser_ref);
21098 return (uint64_t)ret_conv;
21101 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
21102 LDKu8slice ser_ref;
21103 ser_ref.datalen = *((uint32_t*)ser);
21104 ser_ref.data = (int8_t*)(ser + 4);
21105 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
21106 *ret_conv = InvoiceFeatures_read(ser_ref);
21107 return (uint64_t)ret_conv;
21110 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
21111 LDKRouteHop this_obj_conv;
21112 this_obj_conv.inner = (void*)(this_obj & (~1));
21113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21114 RouteHop_free(this_obj_conv);
21117 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
21118 LDKRouteHop this_ptr_conv;
21119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21120 this_ptr_conv.is_owned = false;
21121 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21122 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
21126 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
21127 LDKRouteHop this_ptr_conv;
21128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21129 this_ptr_conv.is_owned = false;
21130 LDKPublicKey val_ref;
21131 CHECK(*((uint32_t*)val) == 33);
21132 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21133 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
21136 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
21137 LDKRouteHop this_ptr_conv;
21138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21139 this_ptr_conv.is_owned = false;
21140 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
21141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21143 uint64_t ret_ref = (uint64_t)ret_var.inner;
21144 if (ret_var.is_owned) {
21150 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
21151 LDKRouteHop this_ptr_conv;
21152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21153 this_ptr_conv.is_owned = false;
21154 LDKNodeFeatures val_conv;
21155 val_conv.inner = (void*)(val & (~1));
21156 val_conv.is_owned = (val & 1) || (val == 0);
21157 val_conv = NodeFeatures_clone(&val_conv);
21158 RouteHop_set_node_features(&this_ptr_conv, val_conv);
21161 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
21162 LDKRouteHop this_ptr_conv;
21163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21164 this_ptr_conv.is_owned = false;
21165 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
21169 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21170 LDKRouteHop this_ptr_conv;
21171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21172 this_ptr_conv.is_owned = false;
21173 RouteHop_set_short_channel_id(&this_ptr_conv, val);
21176 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
21177 LDKRouteHop this_ptr_conv;
21178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21179 this_ptr_conv.is_owned = false;
21180 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
21181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21183 uint64_t ret_ref = (uint64_t)ret_var.inner;
21184 if (ret_var.is_owned) {
21190 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
21191 LDKRouteHop this_ptr_conv;
21192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21193 this_ptr_conv.is_owned = false;
21194 LDKChannelFeatures val_conv;
21195 val_conv.inner = (void*)(val & (~1));
21196 val_conv.is_owned = (val & 1) || (val == 0);
21197 val_conv = ChannelFeatures_clone(&val_conv);
21198 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
21201 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
21202 LDKRouteHop this_ptr_conv;
21203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21204 this_ptr_conv.is_owned = false;
21205 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
21209 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
21210 LDKRouteHop this_ptr_conv;
21211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21212 this_ptr_conv.is_owned = false;
21213 RouteHop_set_fee_msat(&this_ptr_conv, val);
21216 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
21217 LDKRouteHop this_ptr_conv;
21218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21219 this_ptr_conv.is_owned = false;
21220 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
21224 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
21225 LDKRouteHop this_ptr_conv;
21226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21227 this_ptr_conv.is_owned = false;
21228 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
21231 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) {
21232 LDKPublicKey pubkey_arg_ref;
21233 CHECK(*((uint32_t*)pubkey_arg) == 33);
21234 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
21235 LDKNodeFeatures node_features_arg_conv;
21236 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
21237 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
21238 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
21239 LDKChannelFeatures channel_features_arg_conv;
21240 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
21241 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
21242 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
21243 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);
21244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21246 uint64_t ret_ref = (uint64_t)ret_var.inner;
21247 if (ret_var.is_owned) {
21253 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
21254 LDKRouteHop orig_conv;
21255 orig_conv.inner = (void*)(orig & (~1));
21256 orig_conv.is_owned = false;
21257 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
21258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21260 uint64_t ret_ref = (uint64_t)ret_var.inner;
21261 if (ret_var.is_owned) {
21267 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
21268 LDKRouteHop obj_conv;
21269 obj_conv.inner = (void*)(obj & (~1));
21270 obj_conv.is_owned = false;
21271 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
21272 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21273 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21274 CVec_u8Z_free(ret_var);
21278 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
21279 LDKu8slice ser_ref;
21280 ser_ref.datalen = *((uint32_t*)ser);
21281 ser_ref.data = (int8_t*)(ser + 4);
21282 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21283 *ret_conv = RouteHop_read(ser_ref);
21284 return (uint64_t)ret_conv;
21287 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
21288 LDKRoute this_obj_conv;
21289 this_obj_conv.inner = (void*)(this_obj & (~1));
21290 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21291 Route_free(this_obj_conv);
21294 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
21295 LDKRoute this_ptr_conv;
21296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21297 this_ptr_conv.is_owned = false;
21298 LDKCVec_CVec_RouteHopZZ val_constr;
21299 val_constr.datalen = *((uint32_t*)val);
21300 if (val_constr.datalen > 0)
21301 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21303 val_constr.data = NULL;
21304 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
21305 for (size_t m = 0; m < val_constr.datalen; m++) {
21306 uint32_tArray val_conv_12 = val_vals[m];
21307 LDKCVec_RouteHopZ val_conv_12_constr;
21308 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
21309 if (val_conv_12_constr.datalen > 0)
21310 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21312 val_conv_12_constr.data = NULL;
21313 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
21314 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
21315 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
21316 LDKRouteHop val_conv_12_conv_10_conv;
21317 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
21318 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
21319 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
21320 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
21322 val_constr.data[m] = val_conv_12_constr;
21324 Route_set_paths(&this_ptr_conv, val_constr);
21327 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
21328 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
21329 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
21330 if (paths_arg_constr.datalen > 0)
21331 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21333 paths_arg_constr.data = NULL;
21334 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
21335 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
21336 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
21337 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
21338 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
21339 if (paths_arg_conv_12_constr.datalen > 0)
21340 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21342 paths_arg_conv_12_constr.data = NULL;
21343 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
21344 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
21345 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
21346 LDKRouteHop paths_arg_conv_12_conv_10_conv;
21347 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
21348 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
21349 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
21350 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
21352 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
21354 LDKRoute ret_var = Route_new(paths_arg_constr);
21355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21357 uint64_t ret_ref = (uint64_t)ret_var.inner;
21358 if (ret_var.is_owned) {
21364 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
21365 LDKRoute orig_conv;
21366 orig_conv.inner = (void*)(orig & (~1));
21367 orig_conv.is_owned = false;
21368 LDKRoute ret_var = Route_clone(&orig_conv);
21369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21371 uint64_t ret_ref = (uint64_t)ret_var.inner;
21372 if (ret_var.is_owned) {
21378 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
21380 obj_conv.inner = (void*)(obj & (~1));
21381 obj_conv.is_owned = false;
21382 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
21383 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21384 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21385 CVec_u8Z_free(ret_var);
21389 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
21390 LDKu8slice ser_ref;
21391 ser_ref.datalen = *((uint32_t*)ser);
21392 ser_ref.data = (int8_t*)(ser + 4);
21393 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21394 *ret_conv = Route_read(ser_ref);
21395 return (uint64_t)ret_conv;
21398 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
21399 LDKRouteHint this_obj_conv;
21400 this_obj_conv.inner = (void*)(this_obj & (~1));
21401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21402 RouteHint_free(this_obj_conv);
21405 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
21406 LDKRouteHint a_conv;
21407 a_conv.inner = (void*)(a & (~1));
21408 a_conv.is_owned = false;
21409 LDKRouteHint b_conv;
21410 b_conv.inner = (void*)(b & (~1));
21411 b_conv.is_owned = false;
21412 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
21416 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
21417 LDKRouteHint orig_conv;
21418 orig_conv.inner = (void*)(orig & (~1));
21419 orig_conv.is_owned = false;
21420 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
21421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21423 uint64_t ret_ref = (uint64_t)ret_var.inner;
21424 if (ret_var.is_owned) {
21430 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
21431 LDKRouteHintHop this_obj_conv;
21432 this_obj_conv.inner = (void*)(this_obj & (~1));
21433 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21434 RouteHintHop_free(this_obj_conv);
21437 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
21438 LDKRouteHintHop this_ptr_conv;
21439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21440 this_ptr_conv.is_owned = false;
21441 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21442 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
21446 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
21447 LDKRouteHintHop this_ptr_conv;
21448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21449 this_ptr_conv.is_owned = false;
21450 LDKPublicKey val_ref;
21451 CHECK(*((uint32_t*)val) == 33);
21452 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21453 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
21456 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
21457 LDKRouteHintHop this_ptr_conv;
21458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21459 this_ptr_conv.is_owned = false;
21460 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
21464 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21465 LDKRouteHintHop this_ptr_conv;
21466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21467 this_ptr_conv.is_owned = false;
21468 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
21471 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
21472 LDKRouteHintHop this_ptr_conv;
21473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21474 this_ptr_conv.is_owned = false;
21475 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
21476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21478 uint64_t ret_ref = (uint64_t)ret_var.inner;
21479 if (ret_var.is_owned) {
21485 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
21486 LDKRouteHintHop this_ptr_conv;
21487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21488 this_ptr_conv.is_owned = false;
21489 LDKRoutingFees val_conv;
21490 val_conv.inner = (void*)(val & (~1));
21491 val_conv.is_owned = (val & 1) || (val == 0);
21492 val_conv = RoutingFees_clone(&val_conv);
21493 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
21496 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
21497 LDKRouteHintHop this_ptr_conv;
21498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21499 this_ptr_conv.is_owned = false;
21500 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
21504 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21505 LDKRouteHintHop this_ptr_conv;
21506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21507 this_ptr_conv.is_owned = false;
21508 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
21511 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
21512 LDKRouteHintHop this_ptr_conv;
21513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21514 this_ptr_conv.is_owned = false;
21515 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21516 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
21517 uint64_t ret_ref = (uint64_t)ret_copy;
21521 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
21522 LDKRouteHintHop this_ptr_conv;
21523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21524 this_ptr_conv.is_owned = false;
21525 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21526 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
21529 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
21530 LDKRouteHintHop this_ptr_conv;
21531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21532 this_ptr_conv.is_owned = false;
21533 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21534 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
21535 uint64_t ret_ref = (uint64_t)ret_copy;
21539 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
21540 LDKRouteHintHop this_ptr_conv;
21541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21542 this_ptr_conv.is_owned = false;
21543 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21544 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
21547 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) {
21548 LDKPublicKey src_node_id_arg_ref;
21549 CHECK(*((uint32_t*)src_node_id_arg) == 33);
21550 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
21551 LDKRoutingFees fees_arg_conv;
21552 fees_arg_conv.inner = (void*)(fees_arg & (~1));
21553 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
21554 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
21555 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
21556 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
21557 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);
21558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21560 uint64_t ret_ref = (uint64_t)ret_var.inner;
21561 if (ret_var.is_owned) {
21567 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
21568 LDKRouteHintHop a_conv;
21569 a_conv.inner = (void*)(a & (~1));
21570 a_conv.is_owned = false;
21571 LDKRouteHintHop b_conv;
21572 b_conv.inner = (void*)(b & (~1));
21573 b_conv.is_owned = false;
21574 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
21578 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
21579 LDKRouteHintHop orig_conv;
21580 orig_conv.inner = (void*)(orig & (~1));
21581 orig_conv.is_owned = false;
21582 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
21583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21585 uint64_t ret_ref = (uint64_t)ret_var.inner;
21586 if (ret_var.is_owned) {
21592 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
21593 LDKPublicKey our_node_id_ref;
21594 CHECK(*((uint32_t*)our_node_id) == 33);
21595 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
21596 LDKNetworkGraph network_conv;
21597 network_conv.inner = (void*)(network & (~1));
21598 network_conv.is_owned = false;
21599 LDKPublicKey payee_ref;
21600 CHECK(*((uint32_t*)payee) == 33);
21601 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
21602 LDKInvoiceFeatures payee_features_conv;
21603 payee_features_conv.inner = (void*)(payee_features & (~1));
21604 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
21605 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
21606 LDKCVec_ChannelDetailsZ first_hops_constr;
21607 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
21608 if (first_hops != 0) {
21609 first_hops_constr.datalen = *((uint32_t*)first_hops);
21610 if (first_hops_constr.datalen > 0)
21611 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21613 first_hops_constr.data = NULL;
21614 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
21615 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
21616 uint32_t first_hops_conv_16 = first_hops_vals[q];
21617 LDKChannelDetails first_hops_conv_16_conv;
21618 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
21619 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
21620 first_hops_constr.data[q] = first_hops_conv_16_conv;
21622 first_hops_ptr = &first_hops_constr;
21624 LDKCVec_RouteHintZ last_hops_constr;
21625 last_hops_constr.datalen = *((uint32_t*)last_hops);
21626 if (last_hops_constr.datalen > 0)
21627 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21629 last_hops_constr.data = NULL;
21630 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
21631 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
21632 uint32_t last_hops_conv_11 = last_hops_vals[l];
21633 LDKRouteHint last_hops_conv_11_conv;
21634 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
21635 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
21636 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
21637 last_hops_constr.data[l] = last_hops_conv_11_conv;
21639 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21640 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21641 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
21642 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
21643 return (uint64_t)ret_conv;
21646 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
21647 LDKNetworkGraph this_obj_conv;
21648 this_obj_conv.inner = (void*)(this_obj & (~1));
21649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21650 NetworkGraph_free(this_obj_conv);
21653 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
21654 LDKNetworkGraph orig_conv;
21655 orig_conv.inner = (void*)(orig & (~1));
21656 orig_conv.is_owned = false;
21657 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
21658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21660 uint64_t ret_ref = (uint64_t)ret_var.inner;
21661 if (ret_var.is_owned) {
21667 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
21668 LDKLockedNetworkGraph this_obj_conv;
21669 this_obj_conv.inner = (void*)(this_obj & (~1));
21670 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21671 LockedNetworkGraph_free(this_obj_conv);
21674 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
21675 LDKNetGraphMsgHandler this_obj_conv;
21676 this_obj_conv.inner = (void*)(this_obj & (~1));
21677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21678 NetGraphMsgHandler_free(this_obj_conv);
21681 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
21682 LDKThirtyTwoBytes genesis_hash_ref;
21683 CHECK(*((uint32_t*)genesis_hash) == 32);
21684 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
21685 LDKAccess *chain_access_conv_ptr = NULL;
21686 if (chain_access != 0) {
21687 LDKAccess chain_access_conv;
21688 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21689 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21690 *chain_access_conv_ptr = chain_access_conv;
21692 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21693 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
21694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21696 uint64_t ret_ref = (uint64_t)ret_var.inner;
21697 if (ret_var.is_owned) {
21703 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
21704 LDKAccess *chain_access_conv_ptr = NULL;
21705 if (chain_access != 0) {
21706 LDKAccess chain_access_conv;
21707 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21708 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21709 *chain_access_conv_ptr = chain_access_conv;
21711 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21712 LDKNetworkGraph network_graph_conv;
21713 network_graph_conv.inner = (void*)(network_graph & (~1));
21714 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
21715 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
21716 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
21717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21719 uint64_t ret_ref = (uint64_t)ret_var.inner;
21720 if (ret_var.is_owned) {
21726 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
21727 LDKNetGraphMsgHandler this_arg_conv;
21728 this_arg_conv.inner = (void*)(this_arg & (~1));
21729 this_arg_conv.is_owned = false;
21730 LDKAccess *chain_access_conv_ptr = NULL;
21731 if (chain_access != 0) {
21732 LDKAccess chain_access_conv;
21733 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
21734 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
21735 *chain_access_conv_ptr = chain_access_conv;
21737 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
21740 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
21741 LDKNetGraphMsgHandler this_arg_conv;
21742 this_arg_conv.inner = (void*)(this_arg & (~1));
21743 this_arg_conv.is_owned = false;
21744 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
21745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21747 uint64_t ret_ref = (uint64_t)ret_var.inner;
21748 if (ret_var.is_owned) {
21754 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
21755 LDKLockedNetworkGraph this_arg_conv;
21756 this_arg_conv.inner = (void*)(this_arg & (~1));
21757 this_arg_conv.is_owned = false;
21758 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
21759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21761 uint64_t ret_ref = (uint64_t)ret_var.inner;
21762 if (ret_var.is_owned) {
21768 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
21769 LDKNetGraphMsgHandler this_arg_conv;
21770 this_arg_conv.inner = (void*)(this_arg & (~1));
21771 this_arg_conv.is_owned = false;
21772 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21773 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
21774 return (uint64_t)ret;
21777 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
21778 LDKNetGraphMsgHandler this_arg_conv;
21779 this_arg_conv.inner = (void*)(this_arg & (~1));
21780 this_arg_conv.is_owned = false;
21781 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21782 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
21783 return (uint64_t)ret;
21786 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
21787 LDKDirectionalChannelInfo this_obj_conv;
21788 this_obj_conv.inner = (void*)(this_obj & (~1));
21789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21790 DirectionalChannelInfo_free(this_obj_conv);
21793 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
21794 LDKDirectionalChannelInfo this_ptr_conv;
21795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21796 this_ptr_conv.is_owned = false;
21797 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
21801 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
21802 LDKDirectionalChannelInfo this_ptr_conv;
21803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21804 this_ptr_conv.is_owned = false;
21805 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
21808 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
21809 LDKDirectionalChannelInfo this_ptr_conv;
21810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21811 this_ptr_conv.is_owned = false;
21812 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
21816 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
21817 LDKDirectionalChannelInfo this_ptr_conv;
21818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21819 this_ptr_conv.is_owned = false;
21820 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
21823 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
21824 LDKDirectionalChannelInfo this_ptr_conv;
21825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21826 this_ptr_conv.is_owned = false;
21827 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
21831 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21832 LDKDirectionalChannelInfo this_ptr_conv;
21833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21834 this_ptr_conv.is_owned = false;
21835 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
21838 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
21839 LDKDirectionalChannelInfo this_ptr_conv;
21840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21841 this_ptr_conv.is_owned = false;
21842 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
21846 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
21847 LDKDirectionalChannelInfo this_ptr_conv;
21848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21849 this_ptr_conv.is_owned = false;
21850 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
21853 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
21854 LDKDirectionalChannelInfo this_ptr_conv;
21855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21856 this_ptr_conv.is_owned = false;
21857 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21858 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
21859 uint64_t ret_ref = (uint64_t)ret_copy;
21863 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
21864 LDKDirectionalChannelInfo this_ptr_conv;
21865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21866 this_ptr_conv.is_owned = false;
21867 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
21868 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
21871 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
21872 LDKDirectionalChannelInfo this_ptr_conv;
21873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21874 this_ptr_conv.is_owned = false;
21875 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
21876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21878 uint64_t ret_ref = (uint64_t)ret_var.inner;
21879 if (ret_var.is_owned) {
21885 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
21886 LDKDirectionalChannelInfo this_ptr_conv;
21887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21888 this_ptr_conv.is_owned = false;
21889 LDKRoutingFees val_conv;
21890 val_conv.inner = (void*)(val & (~1));
21891 val_conv.is_owned = (val & 1) || (val == 0);
21892 val_conv = RoutingFees_clone(&val_conv);
21893 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
21896 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
21897 LDKDirectionalChannelInfo this_ptr_conv;
21898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21899 this_ptr_conv.is_owned = false;
21900 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
21901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21903 uint64_t ret_ref = (uint64_t)ret_var.inner;
21904 if (ret_var.is_owned) {
21910 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
21911 LDKDirectionalChannelInfo this_ptr_conv;
21912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21913 this_ptr_conv.is_owned = false;
21914 LDKChannelUpdate val_conv;
21915 val_conv.inner = (void*)(val & (~1));
21916 val_conv.is_owned = (val & 1) || (val == 0);
21917 val_conv = ChannelUpdate_clone(&val_conv);
21918 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
21921 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) {
21922 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
21923 LDKRoutingFees fees_arg_conv;
21924 fees_arg_conv.inner = (void*)(fees_arg & (~1));
21925 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
21926 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
21927 LDKChannelUpdate last_update_message_arg_conv;
21928 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
21929 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
21930 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
21931 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);
21932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21934 uint64_t ret_ref = (uint64_t)ret_var.inner;
21935 if (ret_var.is_owned) {
21941 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
21942 LDKDirectionalChannelInfo orig_conv;
21943 orig_conv.inner = (void*)(orig & (~1));
21944 orig_conv.is_owned = false;
21945 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
21946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21948 uint64_t ret_ref = (uint64_t)ret_var.inner;
21949 if (ret_var.is_owned) {
21955 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
21956 LDKDirectionalChannelInfo obj_conv;
21957 obj_conv.inner = (void*)(obj & (~1));
21958 obj_conv.is_owned = false;
21959 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
21960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21962 CVec_u8Z_free(ret_var);
21966 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
21967 LDKu8slice ser_ref;
21968 ser_ref.datalen = *((uint32_t*)ser);
21969 ser_ref.data = (int8_t*)(ser + 4);
21970 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
21971 *ret_conv = DirectionalChannelInfo_read(ser_ref);
21972 return (uint64_t)ret_conv;
21975 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
21976 LDKChannelInfo this_obj_conv;
21977 this_obj_conv.inner = (void*)(this_obj & (~1));
21978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21979 ChannelInfo_free(this_obj_conv);
21982 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
21983 LDKChannelInfo this_ptr_conv;
21984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21985 this_ptr_conv.is_owned = false;
21986 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
21987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21989 uint64_t ret_ref = (uint64_t)ret_var.inner;
21990 if (ret_var.is_owned) {
21996 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
21997 LDKChannelInfo this_ptr_conv;
21998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21999 this_ptr_conv.is_owned = false;
22000 LDKChannelFeatures val_conv;
22001 val_conv.inner = (void*)(val & (~1));
22002 val_conv.is_owned = (val & 1) || (val == 0);
22003 val_conv = ChannelFeatures_clone(&val_conv);
22004 ChannelInfo_set_features(&this_ptr_conv, val_conv);
22007 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
22008 LDKChannelInfo this_ptr_conv;
22009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22010 this_ptr_conv.is_owned = false;
22011 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22012 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
22016 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
22017 LDKChannelInfo this_ptr_conv;
22018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22019 this_ptr_conv.is_owned = false;
22020 LDKPublicKey val_ref;
22021 CHECK(*((uint32_t*)val) == 33);
22022 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22023 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
22026 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
22027 LDKChannelInfo this_ptr_conv;
22028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22029 this_ptr_conv.is_owned = false;
22030 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
22031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22033 uint64_t ret_ref = (uint64_t)ret_var.inner;
22034 if (ret_var.is_owned) {
22040 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
22041 LDKChannelInfo this_ptr_conv;
22042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22043 this_ptr_conv.is_owned = false;
22044 LDKDirectionalChannelInfo val_conv;
22045 val_conv.inner = (void*)(val & (~1));
22046 val_conv.is_owned = (val & 1) || (val == 0);
22047 val_conv = DirectionalChannelInfo_clone(&val_conv);
22048 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
22051 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
22052 LDKChannelInfo this_ptr_conv;
22053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22054 this_ptr_conv.is_owned = false;
22055 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22056 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
22060 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
22061 LDKChannelInfo this_ptr_conv;
22062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22063 this_ptr_conv.is_owned = false;
22064 LDKPublicKey val_ref;
22065 CHECK(*((uint32_t*)val) == 33);
22066 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22067 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
22070 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
22071 LDKChannelInfo this_ptr_conv;
22072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22073 this_ptr_conv.is_owned = false;
22074 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
22075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22077 uint64_t ret_ref = (uint64_t)ret_var.inner;
22078 if (ret_var.is_owned) {
22084 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
22085 LDKChannelInfo this_ptr_conv;
22086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22087 this_ptr_conv.is_owned = false;
22088 LDKDirectionalChannelInfo val_conv;
22089 val_conv.inner = (void*)(val & (~1));
22090 val_conv.is_owned = (val & 1) || (val == 0);
22091 val_conv = DirectionalChannelInfo_clone(&val_conv);
22092 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
22095 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
22096 LDKChannelInfo this_ptr_conv;
22097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22098 this_ptr_conv.is_owned = false;
22099 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22100 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
22101 uint64_t ret_ref = (uint64_t)ret_copy;
22105 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
22106 LDKChannelInfo this_ptr_conv;
22107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22108 this_ptr_conv.is_owned = false;
22109 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22110 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
22113 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
22114 LDKChannelInfo this_ptr_conv;
22115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22116 this_ptr_conv.is_owned = false;
22117 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
22118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22120 uint64_t ret_ref = (uint64_t)ret_var.inner;
22121 if (ret_var.is_owned) {
22127 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
22128 LDKChannelInfo this_ptr_conv;
22129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22130 this_ptr_conv.is_owned = false;
22131 LDKChannelAnnouncement val_conv;
22132 val_conv.inner = (void*)(val & (~1));
22133 val_conv.is_owned = (val & 1) || (val == 0);
22134 val_conv = ChannelAnnouncement_clone(&val_conv);
22135 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
22138 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
22139 LDKChannelFeatures features_arg_conv;
22140 features_arg_conv.inner = (void*)(features_arg & (~1));
22141 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22142 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
22143 LDKPublicKey node_one_arg_ref;
22144 CHECK(*((uint32_t*)node_one_arg) == 33);
22145 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
22146 LDKDirectionalChannelInfo one_to_two_arg_conv;
22147 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
22148 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
22149 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
22150 LDKPublicKey node_two_arg_ref;
22151 CHECK(*((uint32_t*)node_two_arg) == 33);
22152 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
22153 LDKDirectionalChannelInfo two_to_one_arg_conv;
22154 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
22155 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
22156 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
22157 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
22158 LDKChannelAnnouncement announcement_message_arg_conv;
22159 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
22160 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
22161 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
22162 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
22163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22165 uint64_t ret_ref = (uint64_t)ret_var.inner;
22166 if (ret_var.is_owned) {
22172 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
22173 LDKChannelInfo orig_conv;
22174 orig_conv.inner = (void*)(orig & (~1));
22175 orig_conv.is_owned = false;
22176 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
22177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22179 uint64_t ret_ref = (uint64_t)ret_var.inner;
22180 if (ret_var.is_owned) {
22186 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
22187 LDKChannelInfo obj_conv;
22188 obj_conv.inner = (void*)(obj & (~1));
22189 obj_conv.is_owned = false;
22190 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
22191 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22192 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22193 CVec_u8Z_free(ret_var);
22197 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
22198 LDKu8slice ser_ref;
22199 ser_ref.datalen = *((uint32_t*)ser);
22200 ser_ref.data = (int8_t*)(ser + 4);
22201 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
22202 *ret_conv = ChannelInfo_read(ser_ref);
22203 return (uint64_t)ret_conv;
22206 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
22207 LDKRoutingFees this_obj_conv;
22208 this_obj_conv.inner = (void*)(this_obj & (~1));
22209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22210 RoutingFees_free(this_obj_conv);
22213 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
22214 LDKRoutingFees this_ptr_conv;
22215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22216 this_ptr_conv.is_owned = false;
22217 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
22221 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
22222 LDKRoutingFees this_ptr_conv;
22223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22224 this_ptr_conv.is_owned = false;
22225 RoutingFees_set_base_msat(&this_ptr_conv, val);
22228 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
22229 LDKRoutingFees this_ptr_conv;
22230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22231 this_ptr_conv.is_owned = false;
22232 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
22236 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
22237 LDKRoutingFees this_ptr_conv;
22238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22239 this_ptr_conv.is_owned = false;
22240 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
22243 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
22244 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
22245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22247 uint64_t ret_ref = (uint64_t)ret_var.inner;
22248 if (ret_var.is_owned) {
22254 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
22255 LDKRoutingFees a_conv;
22256 a_conv.inner = (void*)(a & (~1));
22257 a_conv.is_owned = false;
22258 LDKRoutingFees b_conv;
22259 b_conv.inner = (void*)(b & (~1));
22260 b_conv.is_owned = false;
22261 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
22265 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
22266 LDKRoutingFees orig_conv;
22267 orig_conv.inner = (void*)(orig & (~1));
22268 orig_conv.is_owned = false;
22269 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
22270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22272 uint64_t ret_ref = (uint64_t)ret_var.inner;
22273 if (ret_var.is_owned) {
22279 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
22280 LDKRoutingFees obj_conv;
22281 obj_conv.inner = (void*)(obj & (~1));
22282 obj_conv.is_owned = false;
22283 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
22284 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22285 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22286 CVec_u8Z_free(ret_var);
22290 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
22291 LDKu8slice ser_ref;
22292 ser_ref.datalen = *((uint32_t*)ser);
22293 ser_ref.data = (int8_t*)(ser + 4);
22294 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
22295 *ret_conv = RoutingFees_read(ser_ref);
22296 return (uint64_t)ret_conv;
22299 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
22300 LDKNodeAnnouncementInfo this_obj_conv;
22301 this_obj_conv.inner = (void*)(this_obj & (~1));
22302 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22303 NodeAnnouncementInfo_free(this_obj_conv);
22306 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
22307 LDKNodeAnnouncementInfo this_ptr_conv;
22308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22309 this_ptr_conv.is_owned = false;
22310 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
22311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22313 uint64_t ret_ref = (uint64_t)ret_var.inner;
22314 if (ret_var.is_owned) {
22320 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
22321 LDKNodeAnnouncementInfo this_ptr_conv;
22322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22323 this_ptr_conv.is_owned = false;
22324 LDKNodeFeatures val_conv;
22325 val_conv.inner = (void*)(val & (~1));
22326 val_conv.is_owned = (val & 1) || (val == 0);
22327 val_conv = NodeFeatures_clone(&val_conv);
22328 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
22331 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
22332 LDKNodeAnnouncementInfo this_ptr_conv;
22333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22334 this_ptr_conv.is_owned = false;
22335 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
22339 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
22340 LDKNodeAnnouncementInfo this_ptr_conv;
22341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22342 this_ptr_conv.is_owned = false;
22343 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
22346 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
22347 LDKNodeAnnouncementInfo this_ptr_conv;
22348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22349 this_ptr_conv.is_owned = false;
22350 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
22351 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
22355 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
22356 LDKNodeAnnouncementInfo this_ptr_conv;
22357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22358 this_ptr_conv.is_owned = false;
22359 LDKThreeBytes val_ref;
22360 CHECK(*((uint32_t*)val) == 3);
22361 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
22362 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
22365 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
22366 LDKNodeAnnouncementInfo this_ptr_conv;
22367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22368 this_ptr_conv.is_owned = false;
22369 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22370 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
22374 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
22375 LDKNodeAnnouncementInfo this_ptr_conv;
22376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22377 this_ptr_conv.is_owned = false;
22378 LDKThirtyTwoBytes val_ref;
22379 CHECK(*((uint32_t*)val) == 32);
22380 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22381 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
22384 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
22385 LDKNodeAnnouncementInfo this_ptr_conv;
22386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22387 this_ptr_conv.is_owned = false;
22388 LDKCVec_NetAddressZ val_constr;
22389 val_constr.datalen = *((uint32_t*)val);
22390 if (val_constr.datalen > 0)
22391 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22393 val_constr.data = NULL;
22394 uint32_t* val_vals = (uint32_t*)(val + 4);
22395 for (size_t m = 0; m < val_constr.datalen; m++) {
22396 uint32_t val_conv_12 = val_vals[m];
22397 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
22398 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
22399 val_constr.data[m] = val_conv_12_conv;
22401 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
22404 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
22405 LDKNodeAnnouncementInfo this_ptr_conv;
22406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22407 this_ptr_conv.is_owned = false;
22408 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
22409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22411 uint64_t ret_ref = (uint64_t)ret_var.inner;
22412 if (ret_var.is_owned) {
22418 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
22419 LDKNodeAnnouncementInfo this_ptr_conv;
22420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22421 this_ptr_conv.is_owned = false;
22422 LDKNodeAnnouncement val_conv;
22423 val_conv.inner = (void*)(val & (~1));
22424 val_conv.is_owned = (val & 1) || (val == 0);
22425 val_conv = NodeAnnouncement_clone(&val_conv);
22426 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
22429 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) {
22430 LDKNodeFeatures features_arg_conv;
22431 features_arg_conv.inner = (void*)(features_arg & (~1));
22432 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22433 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
22434 LDKThreeBytes rgb_arg_ref;
22435 CHECK(*((uint32_t*)rgb_arg) == 3);
22436 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
22437 LDKThirtyTwoBytes alias_arg_ref;
22438 CHECK(*((uint32_t*)alias_arg) == 32);
22439 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
22440 LDKCVec_NetAddressZ addresses_arg_constr;
22441 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
22442 if (addresses_arg_constr.datalen > 0)
22443 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22445 addresses_arg_constr.data = NULL;
22446 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
22447 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
22448 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
22449 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
22450 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
22452 LDKNodeAnnouncement announcement_message_arg_conv;
22453 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
22454 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
22455 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
22456 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
22457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22459 uint64_t ret_ref = (uint64_t)ret_var.inner;
22460 if (ret_var.is_owned) {
22466 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
22467 LDKNodeAnnouncementInfo orig_conv;
22468 orig_conv.inner = (void*)(orig & (~1));
22469 orig_conv.is_owned = false;
22470 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
22471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22473 uint64_t ret_ref = (uint64_t)ret_var.inner;
22474 if (ret_var.is_owned) {
22480 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
22481 LDKNodeAnnouncementInfo obj_conv;
22482 obj_conv.inner = (void*)(obj & (~1));
22483 obj_conv.is_owned = false;
22484 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
22485 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22486 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22487 CVec_u8Z_free(ret_var);
22491 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
22492 LDKu8slice ser_ref;
22493 ser_ref.datalen = *((uint32_t*)ser);
22494 ser_ref.data = (int8_t*)(ser + 4);
22495 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
22496 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
22497 return (uint64_t)ret_conv;
22500 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
22501 LDKNodeInfo this_obj_conv;
22502 this_obj_conv.inner = (void*)(this_obj & (~1));
22503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22504 NodeInfo_free(this_obj_conv);
22507 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
22508 LDKNodeInfo this_ptr_conv;
22509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22510 this_ptr_conv.is_owned = false;
22511 LDKCVec_u64Z val_constr;
22512 val_constr.datalen = *((uint32_t*)val);
22513 if (val_constr.datalen > 0)
22514 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22516 val_constr.data = NULL;
22517 int64_t* val_vals = (int64_t*)(val + 4);
22518 for (size_t i = 0; i < val_constr.datalen; i++) {
22519 int64_t val_conv_8 = val_vals[i];
22520 val_constr.data[i] = val_conv_8;
22522 NodeInfo_set_channels(&this_ptr_conv, val_constr);
22525 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
22526 LDKNodeInfo this_ptr_conv;
22527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22528 this_ptr_conv.is_owned = false;
22529 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
22530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22532 uint64_t ret_ref = (uint64_t)ret_var.inner;
22533 if (ret_var.is_owned) {
22539 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
22540 LDKNodeInfo this_ptr_conv;
22541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22542 this_ptr_conv.is_owned = false;
22543 LDKRoutingFees val_conv;
22544 val_conv.inner = (void*)(val & (~1));
22545 val_conv.is_owned = (val & 1) || (val == 0);
22546 val_conv = RoutingFees_clone(&val_conv);
22547 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
22550 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
22551 LDKNodeInfo this_ptr_conv;
22552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22553 this_ptr_conv.is_owned = false;
22554 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
22558 if (ret_var.is_owned) {
22564 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
22565 LDKNodeInfo this_ptr_conv;
22566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22567 this_ptr_conv.is_owned = false;
22568 LDKNodeAnnouncementInfo val_conv;
22569 val_conv.inner = (void*)(val & (~1));
22570 val_conv.is_owned = (val & 1) || (val == 0);
22571 val_conv = NodeAnnouncementInfo_clone(&val_conv);
22572 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
22575 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
22576 LDKCVec_u64Z channels_arg_constr;
22577 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
22578 if (channels_arg_constr.datalen > 0)
22579 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22581 channels_arg_constr.data = NULL;
22582 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
22583 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
22584 int64_t channels_arg_conv_8 = channels_arg_vals[i];
22585 channels_arg_constr.data[i] = channels_arg_conv_8;
22587 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
22588 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
22589 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
22590 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
22591 LDKNodeAnnouncementInfo announcement_info_arg_conv;
22592 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
22593 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
22594 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
22595 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
22596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22598 uint64_t ret_ref = (uint64_t)ret_var.inner;
22599 if (ret_var.is_owned) {
22605 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
22606 LDKNodeInfo orig_conv;
22607 orig_conv.inner = (void*)(orig & (~1));
22608 orig_conv.is_owned = false;
22609 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
22610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22612 uint64_t ret_ref = (uint64_t)ret_var.inner;
22613 if (ret_var.is_owned) {
22619 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
22620 LDKNodeInfo obj_conv;
22621 obj_conv.inner = (void*)(obj & (~1));
22622 obj_conv.is_owned = false;
22623 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
22624 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22625 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22626 CVec_u8Z_free(ret_var);
22630 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
22631 LDKu8slice ser_ref;
22632 ser_ref.datalen = *((uint32_t*)ser);
22633 ser_ref.data = (int8_t*)(ser + 4);
22634 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
22635 *ret_conv = NodeInfo_read(ser_ref);
22636 return (uint64_t)ret_conv;
22639 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
22640 LDKNetworkGraph obj_conv;
22641 obj_conv.inner = (void*)(obj & (~1));
22642 obj_conv.is_owned = false;
22643 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
22644 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22645 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22646 CVec_u8Z_free(ret_var);
22650 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
22651 LDKu8slice ser_ref;
22652 ser_ref.datalen = *((uint32_t*)ser);
22653 ser_ref.data = (int8_t*)(ser + 4);
22654 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
22655 *ret_conv = NetworkGraph_read(ser_ref);
22656 return (uint64_t)ret_conv;
22659 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
22660 LDKThirtyTwoBytes genesis_hash_ref;
22661 CHECK(*((uint32_t*)genesis_hash) == 32);
22662 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
22663 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
22664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22666 uint64_t ret_ref = (uint64_t)ret_var.inner;
22667 if (ret_var.is_owned) {
22673 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
22674 LDKNetworkGraph this_arg_conv;
22675 this_arg_conv.inner = (void*)(this_arg & (~1));
22676 this_arg_conv.is_owned = false;
22677 LDKNodeAnnouncement msg_conv;
22678 msg_conv.inner = (void*)(msg & (~1));
22679 msg_conv.is_owned = false;
22680 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22681 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
22682 return (uint64_t)ret_conv;
22685 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
22686 LDKNetworkGraph this_arg_conv;
22687 this_arg_conv.inner = (void*)(this_arg & (~1));
22688 this_arg_conv.is_owned = false;
22689 LDKUnsignedNodeAnnouncement msg_conv;
22690 msg_conv.inner = (void*)(msg & (~1));
22691 msg_conv.is_owned = false;
22692 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22693 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
22694 return (uint64_t)ret_conv;
22697 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
22698 LDKNetworkGraph this_arg_conv;
22699 this_arg_conv.inner = (void*)(this_arg & (~1));
22700 this_arg_conv.is_owned = false;
22701 LDKChannelAnnouncement msg_conv;
22702 msg_conv.inner = (void*)(msg & (~1));
22703 msg_conv.is_owned = false;
22704 LDKAccess *chain_access_conv_ptr = NULL;
22705 if (chain_access != 0) {
22706 LDKAccess chain_access_conv;
22707 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22708 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22709 *chain_access_conv_ptr = chain_access_conv;
22711 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22712 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
22713 return (uint64_t)ret_conv;
22716 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
22717 LDKNetworkGraph this_arg_conv;
22718 this_arg_conv.inner = (void*)(this_arg & (~1));
22719 this_arg_conv.is_owned = false;
22720 LDKUnsignedChannelAnnouncement msg_conv;
22721 msg_conv.inner = (void*)(msg & (~1));
22722 msg_conv.is_owned = false;
22723 LDKAccess *chain_access_conv_ptr = NULL;
22724 if (chain_access != 0) {
22725 LDKAccess chain_access_conv;
22726 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22727 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22728 *chain_access_conv_ptr = chain_access_conv;
22730 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22731 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
22732 return (uint64_t)ret_conv;
22735 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
22736 LDKNetworkGraph this_arg_conv;
22737 this_arg_conv.inner = (void*)(this_arg & (~1));
22738 this_arg_conv.is_owned = false;
22739 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
22742 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
22743 LDKNetworkGraph this_arg_conv;
22744 this_arg_conv.inner = (void*)(this_arg & (~1));
22745 this_arg_conv.is_owned = false;
22746 LDKChannelUpdate msg_conv;
22747 msg_conv.inner = (void*)(msg & (~1));
22748 msg_conv.is_owned = false;
22749 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22750 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
22751 return (uint64_t)ret_conv;
22754 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
22755 LDKNetworkGraph this_arg_conv;
22756 this_arg_conv.inner = (void*)(this_arg & (~1));
22757 this_arg_conv.is_owned = false;
22758 LDKUnsignedChannelUpdate msg_conv;
22759 msg_conv.inner = (void*)(msg & (~1));
22760 msg_conv.is_owned = false;
22761 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22762 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
22763 return (uint64_t)ret_conv;
22766 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
22767 LDKFilesystemPersister this_obj_conv;
22768 this_obj_conv.inner = (void*)(this_obj & (~1));
22769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22770 FilesystemPersister_free(this_obj_conv);
22773 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
22774 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
22775 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
22776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22778 uint64_t ret_ref = (uint64_t)ret_var.inner;
22779 if (ret_var.is_owned) {
22785 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
22786 LDKFilesystemPersister this_arg_conv;
22787 this_arg_conv.inner = (void*)(this_arg & (~1));
22788 this_arg_conv.is_owned = false;
22789 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
22790 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22795 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
22796 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
22797 LDKChannelManager manager_conv;
22798 manager_conv.inner = (void*)(manager & (~1));
22799 manager_conv.is_owned = false;
22800 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
22801 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
22802 return (uint64_t)ret_conv;
22805 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
22806 LDKFilesystemPersister this_arg_conv;
22807 this_arg_conv.inner = (void*)(this_arg & (~1));
22808 this_arg_conv.is_owned = false;
22809 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
22810 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
22811 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
22812 return (uint64_t)ret_conv;
22815 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
22816 LDKFilesystemPersister this_arg_conv;
22817 this_arg_conv.inner = (void*)(this_arg & (~1));
22818 this_arg_conv.is_owned = false;
22819 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
22820 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
22821 return (uint64_t)ret;
22824 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
22825 LDKBackgroundProcessor this_obj_conv;
22826 this_obj_conv.inner = (void*)(this_obj & (~1));
22827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22828 BackgroundProcessor_free(this_obj_conv);
22831 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
22832 if ((this_ptr & 1) != 0) return;
22833 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
22834 FREE((void*)this_ptr);
22835 ChannelManagerPersister_free(this_ptr_conv);
22838 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t peer_manager, uint32_t logger) {
22839 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
22840 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
22841 LDKChainMonitor chain_monitor_conv;
22842 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
22843 chain_monitor_conv.is_owned = false;
22844 LDKChannelManager channel_manager_conv;
22845 channel_manager_conv.inner = (void*)(channel_manager & (~1));
22846 channel_manager_conv.is_owned = false;
22847 LDKPeerManager peer_manager_conv;
22848 peer_manager_conv.inner = (void*)(peer_manager & (~1));
22849 peer_manager_conv.is_owned = false;
22850 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22851 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
22852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22854 uint64_t ret_ref = (uint64_t)ret_var.inner;
22855 if (ret_var.is_owned) {
22861 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
22862 LDKBackgroundProcessor this_arg_conv;
22863 this_arg_conv.inner = (void*)(this_arg & (~1));
22864 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
22865 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
22866 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
22867 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
22868 return (uint64_t)ret_conv;
22871 void __attribute__((visibility("default"))) TS_check_platform() {
22875 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
22876 LDKInvoice this_obj_conv;
22877 this_obj_conv.inner = (void*)(this_obj & (~1));
22878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22879 Invoice_free(this_obj_conv);
22882 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
22884 a_conv.inner = (void*)(a & (~1));
22885 a_conv.is_owned = false;
22887 b_conv.inner = (void*)(b & (~1));
22888 b_conv.is_owned = false;
22889 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
22893 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
22894 LDKInvoice orig_conv;
22895 orig_conv.inner = (void*)(orig & (~1));
22896 orig_conv.is_owned = false;
22897 LDKInvoice ret_var = Invoice_clone(&orig_conv);
22898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22900 uint64_t ret_ref = (uint64_t)ret_var.inner;
22901 if (ret_var.is_owned) {
22907 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
22908 LDKSignedRawInvoice this_obj_conv;
22909 this_obj_conv.inner = (void*)(this_obj & (~1));
22910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22911 SignedRawInvoice_free(this_obj_conv);
22914 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
22915 LDKSignedRawInvoice a_conv;
22916 a_conv.inner = (void*)(a & (~1));
22917 a_conv.is_owned = false;
22918 LDKSignedRawInvoice b_conv;
22919 b_conv.inner = (void*)(b & (~1));
22920 b_conv.is_owned = false;
22921 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
22925 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
22926 LDKSignedRawInvoice orig_conv;
22927 orig_conv.inner = (void*)(orig & (~1));
22928 orig_conv.is_owned = false;
22929 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
22930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22932 uint64_t ret_ref = (uint64_t)ret_var.inner;
22933 if (ret_var.is_owned) {
22939 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
22940 LDKRawInvoice this_obj_conv;
22941 this_obj_conv.inner = (void*)(this_obj & (~1));
22942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22943 RawInvoice_free(this_obj_conv);
22946 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
22947 LDKRawInvoice this_ptr_conv;
22948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22949 this_ptr_conv.is_owned = false;
22950 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
22951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22953 uint64_t ret_ref = (uint64_t)ret_var.inner;
22954 if (ret_var.is_owned) {
22960 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
22961 LDKRawInvoice this_ptr_conv;
22962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22963 this_ptr_conv.is_owned = false;
22964 LDKRawDataPart val_conv;
22965 val_conv.inner = (void*)(val & (~1));
22966 val_conv.is_owned = (val & 1) || (val == 0);
22967 val_conv = RawDataPart_clone(&val_conv);
22968 RawInvoice_set_data(&this_ptr_conv, val_conv);
22971 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
22972 LDKRawInvoice a_conv;
22973 a_conv.inner = (void*)(a & (~1));
22974 a_conv.is_owned = false;
22975 LDKRawInvoice b_conv;
22976 b_conv.inner = (void*)(b & (~1));
22977 b_conv.is_owned = false;
22978 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
22982 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
22983 LDKRawInvoice orig_conv;
22984 orig_conv.inner = (void*)(orig & (~1));
22985 orig_conv.is_owned = false;
22986 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
22987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22989 uint64_t ret_ref = (uint64_t)ret_var.inner;
22990 if (ret_var.is_owned) {
22996 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
22997 LDKRawDataPart this_obj_conv;
22998 this_obj_conv.inner = (void*)(this_obj & (~1));
22999 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23000 RawDataPart_free(this_obj_conv);
23003 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
23004 LDKRawDataPart this_ptr_conv;
23005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23006 this_ptr_conv.is_owned = false;
23007 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
23008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23010 uint64_t ret_ref = (uint64_t)ret_var.inner;
23011 if (ret_var.is_owned) {
23017 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
23018 LDKRawDataPart this_ptr_conv;
23019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23020 this_ptr_conv.is_owned = false;
23021 LDKPositiveTimestamp val_conv;
23022 val_conv.inner = (void*)(val & (~1));
23023 val_conv.is_owned = (val & 1) || (val == 0);
23024 val_conv = PositiveTimestamp_clone(&val_conv);
23025 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
23028 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
23029 LDKRawDataPart a_conv;
23030 a_conv.inner = (void*)(a & (~1));
23031 a_conv.is_owned = false;
23032 LDKRawDataPart b_conv;
23033 b_conv.inner = (void*)(b & (~1));
23034 b_conv.is_owned = false;
23035 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
23039 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
23040 LDKRawDataPart orig_conv;
23041 orig_conv.inner = (void*)(orig & (~1));
23042 orig_conv.is_owned = false;
23043 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
23044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23046 uint64_t ret_ref = (uint64_t)ret_var.inner;
23047 if (ret_var.is_owned) {
23053 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
23054 LDKPositiveTimestamp this_obj_conv;
23055 this_obj_conv.inner = (void*)(this_obj & (~1));
23056 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23057 PositiveTimestamp_free(this_obj_conv);
23060 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
23061 LDKPositiveTimestamp a_conv;
23062 a_conv.inner = (void*)(a & (~1));
23063 a_conv.is_owned = false;
23064 LDKPositiveTimestamp b_conv;
23065 b_conv.inner = (void*)(b & (~1));
23066 b_conv.is_owned = false;
23067 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
23071 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
23072 LDKPositiveTimestamp orig_conv;
23073 orig_conv.inner = (void*)(orig & (~1));
23074 orig_conv.is_owned = false;
23075 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
23076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23078 uint64_t ret_ref = (uint64_t)ret_var.inner;
23079 if (ret_var.is_owned) {
23085 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
23086 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
23087 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
23091 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
23092 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
23096 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
23097 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
23101 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
23102 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
23106 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
23107 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
23111 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
23112 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
23113 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
23114 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
23118 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
23119 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
23120 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
23124 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
23125 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
23126 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
23130 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
23131 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
23135 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
23136 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
23140 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
23141 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
23145 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
23146 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
23150 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
23151 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
23155 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
23156 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
23157 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
23158 jboolean ret_val = Currency_eq(a_conv, b_conv);
23162 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
23163 LDKSha256 this_obj_conv;
23164 this_obj_conv.inner = (void*)(this_obj & (~1));
23165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23166 Sha256_free(this_obj_conv);
23169 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
23171 a_conv.inner = (void*)(a & (~1));
23172 a_conv.is_owned = false;
23174 b_conv.inner = (void*)(b & (~1));
23175 b_conv.is_owned = false;
23176 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
23180 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
23181 LDKSha256 orig_conv;
23182 orig_conv.inner = (void*)(orig & (~1));
23183 orig_conv.is_owned = false;
23184 LDKSha256 ret_var = Sha256_clone(&orig_conv);
23185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23187 uint64_t ret_ref = (uint64_t)ret_var.inner;
23188 if (ret_var.is_owned) {
23194 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
23195 LDKDescription this_obj_conv;
23196 this_obj_conv.inner = (void*)(this_obj & (~1));
23197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23198 Description_free(this_obj_conv);
23201 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
23202 LDKDescription a_conv;
23203 a_conv.inner = (void*)(a & (~1));
23204 a_conv.is_owned = false;
23205 LDKDescription b_conv;
23206 b_conv.inner = (void*)(b & (~1));
23207 b_conv.is_owned = false;
23208 jboolean ret_val = Description_eq(&a_conv, &b_conv);
23212 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
23213 LDKDescription orig_conv;
23214 orig_conv.inner = (void*)(orig & (~1));
23215 orig_conv.is_owned = false;
23216 LDKDescription ret_var = Description_clone(&orig_conv);
23217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23219 uint64_t ret_ref = (uint64_t)ret_var.inner;
23220 if (ret_var.is_owned) {
23226 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
23227 LDKPayeePubKey this_obj_conv;
23228 this_obj_conv.inner = (void*)(this_obj & (~1));
23229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23230 PayeePubKey_free(this_obj_conv);
23233 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
23234 LDKPayeePubKey a_conv;
23235 a_conv.inner = (void*)(a & (~1));
23236 a_conv.is_owned = false;
23237 LDKPayeePubKey b_conv;
23238 b_conv.inner = (void*)(b & (~1));
23239 b_conv.is_owned = false;
23240 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
23244 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
23245 LDKPayeePubKey orig_conv;
23246 orig_conv.inner = (void*)(orig & (~1));
23247 orig_conv.is_owned = false;
23248 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
23249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23251 uint64_t ret_ref = (uint64_t)ret_var.inner;
23252 if (ret_var.is_owned) {
23258 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
23259 LDKExpiryTime this_obj_conv;
23260 this_obj_conv.inner = (void*)(this_obj & (~1));
23261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23262 ExpiryTime_free(this_obj_conv);
23265 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
23266 LDKExpiryTime a_conv;
23267 a_conv.inner = (void*)(a & (~1));
23268 a_conv.is_owned = false;
23269 LDKExpiryTime b_conv;
23270 b_conv.inner = (void*)(b & (~1));
23271 b_conv.is_owned = false;
23272 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
23276 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
23277 LDKExpiryTime orig_conv;
23278 orig_conv.inner = (void*)(orig & (~1));
23279 orig_conv.is_owned = false;
23280 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
23281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23283 uint64_t ret_ref = (uint64_t)ret_var.inner;
23284 if (ret_var.is_owned) {
23290 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
23291 LDKMinFinalCltvExpiry this_obj_conv;
23292 this_obj_conv.inner = (void*)(this_obj & (~1));
23293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23294 MinFinalCltvExpiry_free(this_obj_conv);
23297 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
23298 LDKMinFinalCltvExpiry a_conv;
23299 a_conv.inner = (void*)(a & (~1));
23300 a_conv.is_owned = false;
23301 LDKMinFinalCltvExpiry b_conv;
23302 b_conv.inner = (void*)(b & (~1));
23303 b_conv.is_owned = false;
23304 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
23308 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
23309 LDKMinFinalCltvExpiry orig_conv;
23310 orig_conv.inner = (void*)(orig & (~1));
23311 orig_conv.is_owned = false;
23312 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
23313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23315 uint64_t ret_ref = (uint64_t)ret_var.inner;
23316 if (ret_var.is_owned) {
23322 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
23323 if ((this_ptr & 1) != 0) return;
23324 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
23325 FREE((void*)this_ptr);
23326 Fallback_free(this_ptr_conv);
23329 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
23330 LDKFallback* orig_conv = (LDKFallback*)orig;
23331 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23332 *ret_copy = Fallback_clone(orig_conv);
23333 uint64_t ret_ref = (uint64_t)ret_copy;
23337 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
23339 LDKCVec_u8Z program_ref;
23340 program_ref.datalen = *((uint32_t*)program);
23341 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
23342 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
23343 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23344 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
23345 uint64_t ret_ref = (uint64_t)ret_copy;
23349 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
23350 LDKTwentyBytes a_ref;
23351 CHECK(*((uint32_t*)a) == 20);
23352 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
23353 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23354 *ret_copy = Fallback_pub_key_hash(a_ref);
23355 uint64_t ret_ref = (uint64_t)ret_copy;
23359 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
23360 LDKTwentyBytes a_ref;
23361 CHECK(*((uint32_t*)a) == 20);
23362 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
23363 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
23364 *ret_copy = Fallback_script_hash(a_ref);
23365 uint64_t ret_ref = (uint64_t)ret_copy;
23369 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
23370 LDKFallback* a_conv = (LDKFallback*)a;
23371 LDKFallback* b_conv = (LDKFallback*)b;
23372 jboolean ret_val = Fallback_eq(a_conv, b_conv);
23376 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
23377 LDKInvoiceSignature this_obj_conv;
23378 this_obj_conv.inner = (void*)(this_obj & (~1));
23379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23380 InvoiceSignature_free(this_obj_conv);
23383 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
23384 LDKInvoiceSignature a_conv;
23385 a_conv.inner = (void*)(a & (~1));
23386 a_conv.is_owned = false;
23387 LDKInvoiceSignature b_conv;
23388 b_conv.inner = (void*)(b & (~1));
23389 b_conv.is_owned = false;
23390 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
23394 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
23395 LDKInvoiceSignature orig_conv;
23396 orig_conv.inner = (void*)(orig & (~1));
23397 orig_conv.is_owned = false;
23398 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
23399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23401 uint64_t ret_ref = (uint64_t)ret_var.inner;
23402 if (ret_var.is_owned) {
23408 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
23409 LDKPrivateRoute this_obj_conv;
23410 this_obj_conv.inner = (void*)(this_obj & (~1));
23411 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23412 PrivateRoute_free(this_obj_conv);
23415 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
23416 LDKPrivateRoute a_conv;
23417 a_conv.inner = (void*)(a & (~1));
23418 a_conv.is_owned = false;
23419 LDKPrivateRoute b_conv;
23420 b_conv.inner = (void*)(b & (~1));
23421 b_conv.is_owned = false;
23422 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
23426 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
23427 LDKPrivateRoute orig_conv;
23428 orig_conv.inner = (void*)(orig & (~1));
23429 orig_conv.is_owned = false;
23430 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
23431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23433 uint64_t ret_ref = (uint64_t)ret_var.inner;
23434 if (ret_var.is_owned) {
23440 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
23441 LDKSignedRawInvoice this_arg_conv;
23442 this_arg_conv.inner = (void*)(this_arg & (~1));
23443 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23444 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
23445 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
23446 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
23447 return (uint64_t)ret_ref;
23450 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
23451 LDKSignedRawInvoice this_arg_conv;
23452 this_arg_conv.inner = (void*)(this_arg & (~1));
23453 this_arg_conv.is_owned = false;
23454 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
23455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23457 uint64_t ret_ref = (uint64_t)ret_var.inner;
23458 if (ret_var.is_owned) {
23464 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
23465 LDKSignedRawInvoice this_arg_conv;
23466 this_arg_conv.inner = (void*)(this_arg & (~1));
23467 this_arg_conv.is_owned = false;
23468 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23469 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
23473 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
23474 LDKSignedRawInvoice this_arg_conv;
23475 this_arg_conv.inner = (void*)(this_arg & (~1));
23476 this_arg_conv.is_owned = false;
23477 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
23478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23480 uint64_t ret_ref = (uint64_t)ret_var.inner;
23481 if (ret_var.is_owned) {
23487 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
23488 LDKSignedRawInvoice this_arg_conv;
23489 this_arg_conv.inner = (void*)(this_arg & (~1));
23490 this_arg_conv.is_owned = false;
23491 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23492 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
23493 return (uint64_t)ret_conv;
23496 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
23497 LDKSignedRawInvoice this_arg_conv;
23498 this_arg_conv.inner = (void*)(this_arg & (~1));
23499 this_arg_conv.is_owned = false;
23500 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
23504 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
23505 LDKRawInvoice this_arg_conv;
23506 this_arg_conv.inner = (void*)(this_arg & (~1));
23507 this_arg_conv.is_owned = false;
23508 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23509 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
23513 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
23514 LDKRawInvoice this_arg_conv;
23515 this_arg_conv.inner = (void*)(this_arg & (~1));
23516 this_arg_conv.is_owned = false;
23517 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
23521 if (ret_var.is_owned) {
23527 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
23528 LDKRawInvoice this_arg_conv;
23529 this_arg_conv.inner = (void*)(this_arg & (~1));
23530 this_arg_conv.is_owned = false;
23531 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
23532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23534 uint64_t ret_ref = (uint64_t)ret_var.inner;
23535 if (ret_var.is_owned) {
23541 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
23542 LDKRawInvoice this_arg_conv;
23543 this_arg_conv.inner = (void*)(this_arg & (~1));
23544 this_arg_conv.is_owned = false;
23545 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
23546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23548 uint64_t ret_ref = (uint64_t)ret_var.inner;
23549 if (ret_var.is_owned) {
23555 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
23556 LDKRawInvoice this_arg_conv;
23557 this_arg_conv.inner = (void*)(this_arg & (~1));
23558 this_arg_conv.is_owned = false;
23559 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
23560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23562 uint64_t ret_ref = (uint64_t)ret_var.inner;
23563 if (ret_var.is_owned) {
23569 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
23570 LDKRawInvoice this_arg_conv;
23571 this_arg_conv.inner = (void*)(this_arg & (~1));
23572 this_arg_conv.is_owned = false;
23573 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
23574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23576 uint64_t ret_ref = (uint64_t)ret_var.inner;
23577 if (ret_var.is_owned) {
23583 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
23584 LDKRawInvoice this_arg_conv;
23585 this_arg_conv.inner = (void*)(this_arg & (~1));
23586 this_arg_conv.is_owned = false;
23587 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
23588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23590 uint64_t ret_ref = (uint64_t)ret_var.inner;
23591 if (ret_var.is_owned) {
23597 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
23598 LDKRawInvoice this_arg_conv;
23599 this_arg_conv.inner = (void*)(this_arg & (~1));
23600 this_arg_conv.is_owned = false;
23601 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23602 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
23606 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
23607 LDKRawInvoice this_arg_conv;
23608 this_arg_conv.inner = (void*)(this_arg & (~1));
23609 this_arg_conv.is_owned = false;
23610 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
23611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23613 uint64_t ret_ref = (uint64_t)ret_var.inner;
23614 if (ret_var.is_owned) {
23620 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
23621 LDKRawInvoice this_arg_conv;
23622 this_arg_conv.inner = (void*)(this_arg & (~1));
23623 this_arg_conv.is_owned = false;
23624 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
23625 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23626 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23627 for (size_t o = 0; o < ret_var.datalen; o++) {
23628 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
23629 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23630 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23631 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
23632 if (ret_conv_14_var.is_owned) {
23633 ret_conv_14_ref |= 1;
23635 ret_arr_ptr[o] = ret_conv_14_ref;
23637 FREE(ret_var.data);
23641 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
23642 LDKRawInvoice this_arg_conv;
23643 this_arg_conv.inner = (void*)(this_arg & (~1));
23644 this_arg_conv.is_owned = false;
23645 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23646 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
23647 uint64_t ret_ref = (uint64_t)ret_copy;
23651 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
23652 LDKRawInvoice this_arg_conv;
23653 this_arg_conv.inner = (void*)(this_arg & (~1));
23654 this_arg_conv.is_owned = false;
23655 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
23659 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
23660 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23661 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
23662 return (uint64_t)ret_conv;
23665 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
23666 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23667 *ret_conv = PositiveTimestamp_from_system_time(time);
23668 return (uint64_t)ret_conv;
23671 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
23672 LDKPositiveTimestamp this_arg_conv;
23673 this_arg_conv.inner = (void*)(this_arg & (~1));
23674 this_arg_conv.is_owned = false;
23675 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
23679 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
23680 LDKPositiveTimestamp this_arg_conv;
23681 this_arg_conv.inner = (void*)(this_arg & (~1));
23682 this_arg_conv.is_owned = false;
23683 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
23687 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
23688 LDKInvoice this_arg_conv;
23689 this_arg_conv.inner = (void*)(this_arg & (~1));
23690 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23691 this_arg_conv = Invoice_clone(&this_arg_conv);
23692 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
23693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23695 uint64_t ret_ref = (uint64_t)ret_var.inner;
23696 if (ret_var.is_owned) {
23702 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
23703 LDKInvoice this_arg_conv;
23704 this_arg_conv.inner = (void*)(this_arg & (~1));
23705 this_arg_conv.is_owned = false;
23706 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23707 *ret_conv = Invoice_check_signature(&this_arg_conv);
23708 return (uint64_t)ret_conv;
23711 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
23712 LDKSignedRawInvoice signed_invoice_conv;
23713 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
23714 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
23715 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
23716 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23717 *ret_conv = Invoice_from_signed(signed_invoice_conv);
23718 return (uint64_t)ret_conv;
23721 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
23722 LDKInvoice this_arg_conv;
23723 this_arg_conv.inner = (void*)(this_arg & (~1));
23724 this_arg_conv.is_owned = false;
23725 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
23729 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
23730 LDKInvoice this_arg_conv;
23731 this_arg_conv.inner = (void*)(this_arg & (~1));
23732 this_arg_conv.is_owned = false;
23733 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23734 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
23738 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
23739 LDKInvoice this_arg_conv;
23740 this_arg_conv.inner = (void*)(this_arg & (~1));
23741 this_arg_conv.is_owned = false;
23742 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23743 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
23747 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
23748 LDKInvoice this_arg_conv;
23749 this_arg_conv.inner = (void*)(this_arg & (~1));
23750 this_arg_conv.is_owned = false;
23751 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23752 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
23756 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
23757 LDKInvoice this_arg_conv;
23758 this_arg_conv.inner = (void*)(this_arg & (~1));
23759 this_arg_conv.is_owned = false;
23760 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
23761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23763 uint64_t ret_ref = (uint64_t)ret_var.inner;
23764 if (ret_var.is_owned) {
23770 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
23771 LDKInvoice this_arg_conv;
23772 this_arg_conv.inner = (void*)(this_arg & (~1));
23773 this_arg_conv.is_owned = false;
23774 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23775 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
23779 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
23780 LDKInvoice this_arg_conv;
23781 this_arg_conv.inner = (void*)(this_arg & (~1));
23782 this_arg_conv.is_owned = false;
23783 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
23787 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
23788 LDKInvoice this_arg_conv;
23789 this_arg_conv.inner = (void*)(this_arg & (~1));
23790 this_arg_conv.is_owned = false;
23791 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
23795 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
23796 LDKInvoice this_arg_conv;
23797 this_arg_conv.inner = (void*)(this_arg & (~1));
23798 this_arg_conv.is_owned = false;
23799 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
23800 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23801 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23802 for (size_t o = 0; o < ret_var.datalen; o++) {
23803 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
23804 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23805 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23806 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
23807 if (ret_conv_14_var.is_owned) {
23808 ret_conv_14_ref |= 1;
23810 ret_arr_ptr[o] = ret_conv_14_ref;
23812 FREE(ret_var.data);
23816 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
23817 LDKInvoice this_arg_conv;
23818 this_arg_conv.inner = (void*)(this_arg & (~1));
23819 this_arg_conv.is_owned = false;
23820 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
23821 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23822 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
23823 for (size_t l = 0; l < ret_var.datalen; l++) {
23824 LDKRouteHint ret_conv_11_var = ret_var.data[l];
23825 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23826 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23827 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
23828 if (ret_conv_11_var.is_owned) {
23829 ret_conv_11_ref |= 1;
23831 ret_arr_ptr[l] = ret_conv_11_ref;
23833 FREE(ret_var.data);
23837 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
23838 LDKInvoice this_arg_conv;
23839 this_arg_conv.inner = (void*)(this_arg & (~1));
23840 this_arg_conv.is_owned = false;
23841 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
23845 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
23846 LDKInvoice this_arg_conv;
23847 this_arg_conv.inner = (void*)(this_arg & (~1));
23848 this_arg_conv.is_owned = false;
23849 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23850 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
23851 uint64_t ret_ref = (uint64_t)ret_copy;
23855 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
23856 LDKStr description_conv = str_ref_to_owned_c(description);
23857 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23858 *ret_conv = Description_new(description_conv);
23859 return (uint64_t)ret_conv;
23862 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
23863 LDKDescription this_arg_conv;
23864 this_arg_conv.inner = (void*)(this_arg & (~1));
23865 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23866 this_arg_conv = Description_clone(&this_arg_conv);
23867 LDKStr ret_str = Description_into_inner(this_arg_conv);
23868 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23873 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
23874 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
23875 *ret_conv = ExpiryTime_from_seconds(seconds);
23876 return (uint64_t)ret_conv;
23879 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
23880 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
23881 *ret_conv = ExpiryTime_from_duration(duration);
23882 return (uint64_t)ret_conv;
23885 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
23886 LDKExpiryTime this_arg_conv;
23887 this_arg_conv.inner = (void*)(this_arg & (~1));
23888 this_arg_conv.is_owned = false;
23889 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
23893 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
23894 LDKExpiryTime this_arg_conv;
23895 this_arg_conv.inner = (void*)(this_arg & (~1));
23896 this_arg_conv.is_owned = false;
23897 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
23901 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
23902 LDKRouteHint hops_conv;
23903 hops_conv.inner = (void*)(hops & (~1));
23904 hops_conv.is_owned = (hops & 1) || (hops == 0);
23905 hops_conv = RouteHint_clone(&hops_conv);
23906 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23907 *ret_conv = PrivateRoute_new(hops_conv);
23908 return (uint64_t)ret_conv;
23911 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
23912 LDKPrivateRoute this_arg_conv;
23913 this_arg_conv.inner = (void*)(this_arg & (~1));
23914 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23915 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
23916 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
23917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23919 uint64_t ret_ref = (uint64_t)ret_var.inner;
23920 if (ret_var.is_owned) {
23926 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
23927 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
23928 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
23932 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
23933 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
23937 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
23938 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
23942 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
23943 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
23947 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
23948 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
23952 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
23953 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
23954 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
23955 jboolean ret_val = CreationError_eq(a_conv, b_conv);
23959 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
23960 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
23961 LDKStr ret_str = CreationError_to_str(o_conv);
23962 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23967 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
23968 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
23969 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
23973 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
23974 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
23978 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
23979 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
23983 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
23984 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
23988 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
23989 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
23993 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
23994 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
23998 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
23999 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
24003 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
24004 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
24008 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
24009 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
24013 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
24014 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
24015 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
24016 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
24020 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
24021 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
24022 LDKStr ret_str = SemanticError_to_str(o_conv);
24023 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24028 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
24029 if ((this_ptr & 1) != 0) return;
24030 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
24031 FREE((void*)this_ptr);
24032 SignOrCreationError_free(this_ptr_conv);
24035 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
24036 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
24037 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24038 *ret_copy = SignOrCreationError_clone(orig_conv);
24039 uint64_t ret_ref = (uint64_t)ret_copy;
24043 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
24044 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24045 *ret_copy = SignOrCreationError_sign_error();
24046 uint64_t ret_ref = (uint64_t)ret_copy;
24050 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
24051 LDKCreationError a_conv = LDKCreationError_from_js(a);
24052 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24053 *ret_copy = SignOrCreationError_creation_error(a_conv);
24054 uint64_t ret_ref = (uint64_t)ret_copy;
24058 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
24059 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
24060 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
24061 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
24065 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
24066 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
24067 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
24068 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24073 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) {
24074 LDKChannelManager channelmanager_conv;
24075 channelmanager_conv.inner = (void*)(channelmanager & (~1));
24076 channelmanager_conv.is_owned = false;
24077 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24078 LDKCurrency network_conv = LDKCurrency_from_js(network);
24079 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
24080 LDKStr description_conv = str_ref_to_owned_c(description);
24081 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24082 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
24083 return (uint64_t)ret_conv;
24086 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
24087 LDKStr s_conv = str_ref_to_owned_c(s);
24088 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
24089 *ret_conv = SiPrefix_from_str(s_conv);
24090 return (uint64_t)ret_conv;
24093 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
24094 LDKStr s_conv = str_ref_to_owned_c(s);
24095 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
24096 *ret_conv = Invoice_from_str(s_conv);
24097 return (uint64_t)ret_conv;
24100 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
24101 LDKStr s_conv = str_ref_to_owned_c(s);
24102 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
24103 *ret_conv = SignedRawInvoice_from_str(s_conv);
24104 return (uint64_t)ret_conv;
24107 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
24109 o_conv.inner = (void*)(o & (~1));
24110 o_conv.is_owned = false;
24111 LDKStr ret_str = Invoice_to_str(&o_conv);
24112 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24117 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
24118 LDKSignedRawInvoice o_conv;
24119 o_conv.inner = (void*)(o & (~1));
24120 o_conv.is_owned = false;
24121 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
24122 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24127 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
24128 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
24129 LDKStr ret_str = Currency_to_str(o_conv);
24130 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24135 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
24136 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
24137 LDKStr ret_str = SiPrefix_to_str(o_conv);
24138 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);