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_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
611 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
613 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
614 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
615 CHECK(val->result_ok);
616 LDKShutdownScript res_var = (*val->contents.result);
617 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
618 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
619 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
622 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
623 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
624 CHECK(!val->result_ok);
625 LDKDecodeError err_var = (*val->contents.err);
626 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
627 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
628 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
631 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
632 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
634 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
635 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
636 CHECK(val->result_ok);
637 LDKShutdownScript res_var = (*val->contents.result);
638 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
639 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
640 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
643 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
644 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
645 CHECK(!val->result_ok);
646 LDKInvalidShutdownScript err_var = (*val->contents.err);
647 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
648 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
649 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
652 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
653 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
655 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
656 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
657 CHECK(val->result_ok);
658 return *val->contents.result;
660 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
661 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
662 CHECK(!val->result_ok);
663 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
666 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
667 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
669 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
670 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
671 CHECK(val->result_ok);
672 LDKRouteHop res_var = (*val->contents.result);
673 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
674 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
675 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
678 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
679 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
680 CHECK(!val->result_ok);
681 LDKDecodeError err_var = (*val->contents.err);
682 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
683 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
684 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
687 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
688 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
689 ret->datalen = *((uint32_t*)elems);
690 if (ret->datalen == 0) {
693 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
694 uint32_t *java_elems = (uint32_t*)(elems + 4);
695 for (size_t i = 0; i < ret->datalen; i++) {
696 uint32_t arr_elem = java_elems[i];
697 LDKRouteHop arr_elem_conv;
698 arr_elem_conv.inner = (void*)(arr_elem & (~1));
699 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
700 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
701 ret->data[i] = arr_elem_conv;
704 return (uint64_t)ret;
706 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
707 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
708 for (size_t i = 0; i < ret.datalen; i++) {
709 ret.data[i] = RouteHop_clone(&orig->data[i]);
713 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
714 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
715 for (size_t i = 0; i < ret.datalen; i++) {
716 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
720 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
721 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
723 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
724 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
725 CHECK(val->result_ok);
726 LDKRoute res_var = (*val->contents.result);
727 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
728 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
729 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
732 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
733 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
734 CHECK(!val->result_ok);
735 LDKDecodeError err_var = (*val->contents.err);
736 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
737 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
738 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
741 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
742 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
744 case LDKCOption_u64Z_Some: {
745 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
747 case LDKCOption_u64Z_None: {
748 return 0 /* LDKCOption_u64Z - None */;
753 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
754 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
755 ret->datalen = *((uint32_t*)elems);
756 if (ret->datalen == 0) {
759 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
760 uint32_t *java_elems = (uint32_t*)(elems + 4);
761 for (size_t i = 0; i < ret->datalen; i++) {
762 uint32_t arr_elem = java_elems[i];
763 LDKChannelDetails arr_elem_conv;
764 arr_elem_conv.inner = (void*)(arr_elem & (~1));
765 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
766 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
767 ret->data[i] = arr_elem_conv;
770 return (uint64_t)ret;
772 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
773 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
774 for (size_t i = 0; i < ret.datalen; i++) {
775 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
779 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
780 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
781 ret->datalen = *((uint32_t*)elems);
782 if (ret->datalen == 0) {
785 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
786 uint32_t *java_elems = (uint32_t*)(elems + 4);
787 for (size_t i = 0; i < ret->datalen; i++) {
788 uint32_t arr_elem = java_elems[i];
789 LDKRouteHint arr_elem_conv;
790 arr_elem_conv.inner = (void*)(arr_elem & (~1));
791 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
792 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
793 ret->data[i] = arr_elem_conv;
796 return (uint64_t)ret;
798 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
799 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
800 for (size_t i = 0; i < ret.datalen; i++) {
801 ret.data[i] = RouteHint_clone(&orig->data[i]);
805 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
806 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
808 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
809 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
810 CHECK(val->result_ok);
811 LDKRoute res_var = (*val->contents.result);
812 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
813 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
814 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
817 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
818 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
819 CHECK(!val->result_ok);
820 LDKLightningError err_var = (*val->contents.err);
821 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
822 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
823 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
826 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
827 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
829 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
830 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
831 CHECK(val->result_ok);
832 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
833 return (uint64_t)res_ref;
835 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
836 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
837 CHECK(!val->result_ok);
838 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
841 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
842 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
844 LDKTransaction b_ref;
845 b_ref.datalen = *((uint32_t*)b);
846 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
847 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
848 b_ref.data_is_owned = false;
850 return (uint64_t)ret;
852 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
853 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
856 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
857 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
858 LDKTransaction b_var = tuple->b;
859 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
860 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
863 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
864 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
865 ret->datalen = *((uint32_t*)elems);
866 if (ret->datalen == 0) {
869 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
870 uint32_t *java_elems = (uint32_t*)(elems + 4);
871 for (size_t i = 0; i < ret->datalen; i++) {
872 uint32_t arr_elem = java_elems[i];
873 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
874 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
875 ret->data[i] = arr_elem_conv;
878 return (uint64_t)ret;
880 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
881 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
882 for (size_t i = 0; i < ret.datalen; i++) {
883 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
887 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
888 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
889 for (size_t i = 0; i < ret.datalen; i++) {
890 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
894 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
895 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
897 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
898 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
899 CHECK(val->result_ok);
900 return *val->contents.result;
902 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
903 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
904 CHECK(!val->result_ok);
905 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
908 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
909 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
911 case LDKMonitorEvent_HTLCEvent: {
912 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
913 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
914 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
915 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
916 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
918 case LDKMonitorEvent_CommitmentTxBroadcasted: {
919 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
920 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
921 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
922 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
923 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
928 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
929 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
930 ret->datalen = *((uint32_t*)elems);
931 if (ret->datalen == 0) {
934 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
935 uint32_t *java_elems = (uint32_t*)(elems + 4);
936 for (size_t i = 0; i < ret->datalen; i++) {
937 uint32_t arr_elem = java_elems[i];
938 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
939 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
940 ret->data[i] = arr_elem_conv;
943 return (uint64_t)ret;
945 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
946 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
947 for (size_t i = 0; i < ret.datalen; i++) {
948 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
952 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
953 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
955 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
956 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
957 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
959 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
960 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
965 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
966 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
968 case LDKSpendableOutputDescriptor_StaticOutput: {
969 LDKOutPoint outpoint_var = obj->static_output.outpoint;
970 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
973 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
974 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
976 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
977 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
978 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
979 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
980 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
981 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
983 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
984 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
985 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
986 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
987 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
988 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
993 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
994 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
995 ret->datalen = *((uint32_t*)elems);
996 if (ret->datalen == 0) {
999 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1000 uint32_t *java_elems = (uint32_t*)(elems + 4);
1001 for (size_t i = 0; i < ret->datalen; i++) {
1002 uint32_t arr_elem = java_elems[i];
1003 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1004 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1005 ret->data[i] = arr_elem_conv;
1008 return (uint64_t)ret;
1010 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1011 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1012 for (size_t i = 0; i < ret.datalen; i++) {
1013 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1017 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1018 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1020 case LDKErrorAction_DisconnectPeer: {
1021 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1022 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1023 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1024 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1025 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1027 case LDKErrorAction_IgnoreError: {
1028 return 0 /* LDKErrorAction - IgnoreError */;
1030 case LDKErrorAction_IgnoreAndLog: {
1031 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1032 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1034 case LDKErrorAction_SendErrorMessage: {
1035 LDKErrorMessage msg_var = obj->send_error_message.msg;
1036 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1037 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1038 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1039 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1044 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
1045 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1047 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1048 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1049 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1050 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1051 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1052 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
1054 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1055 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1057 case LDKHTLCFailChannelUpdate_NodeFailure: {
1058 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1059 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1060 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1065 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1066 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1068 case LDKMessageSendEvent_SendAcceptChannel: {
1069 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1070 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1071 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1072 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1073 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1074 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1075 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1077 case LDKMessageSendEvent_SendOpenChannel: {
1078 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1079 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1080 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1081 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1082 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1083 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1084 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1086 case LDKMessageSendEvent_SendFundingCreated: {
1087 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1088 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1089 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1090 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1091 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1092 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1093 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1095 case LDKMessageSendEvent_SendFundingSigned: {
1096 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1097 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1098 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1099 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1100 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1101 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1102 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1104 case LDKMessageSendEvent_SendFundingLocked: {
1105 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1106 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1107 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1108 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1111 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1113 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1114 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1115 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1116 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1117 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1118 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1119 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1120 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1122 case LDKMessageSendEvent_UpdateHTLCs: {
1123 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1124 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1125 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1126 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1129 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1131 case LDKMessageSendEvent_SendRevokeAndACK: {
1132 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1133 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1134 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1135 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1136 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1137 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1138 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1140 case LDKMessageSendEvent_SendClosingSigned: {
1141 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1142 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1143 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1144 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1147 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1149 case LDKMessageSendEvent_SendShutdown: {
1150 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1151 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1152 LDKShutdown msg_var = obj->send_shutdown.msg;
1153 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1154 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1155 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1156 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1158 case LDKMessageSendEvent_SendChannelReestablish: {
1159 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1160 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1161 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1162 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1164 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1165 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1167 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1168 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1169 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1170 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1171 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1172 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1173 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1174 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1175 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1176 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1178 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1179 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1180 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1182 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1183 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1185 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1186 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1187 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1188 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1189 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1190 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1192 case LDKMessageSendEvent_SendChannelUpdate: {
1193 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1194 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1195 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1196 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1197 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1198 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1199 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1201 case LDKMessageSendEvent_HandleError: {
1202 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1203 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1204 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1205 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1207 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1208 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1209 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
1211 case LDKMessageSendEvent_SendChannelRangeQuery: {
1212 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1213 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1214 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1215 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1216 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1218 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1220 case LDKMessageSendEvent_SendShortIdsQuery: {
1221 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1222 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1223 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1224 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1226 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1227 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1229 case LDKMessageSendEvent_SendReplyChannelRange: {
1230 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1231 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1232 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1233 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1236 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1241 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1242 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1243 ret->datalen = *((uint32_t*)elems);
1244 if (ret->datalen == 0) {
1247 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1248 uint32_t *java_elems = (uint32_t*)(elems + 4);
1249 for (size_t i = 0; i < ret->datalen; i++) {
1250 uint32_t arr_elem = java_elems[i];
1251 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1252 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1253 ret->data[i] = arr_elem_conv;
1256 return (uint64_t)ret;
1258 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1259 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1260 for (size_t i = 0; i < ret.datalen; i++) {
1261 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1265 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1266 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1268 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1269 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1270 CHECK(val->result_ok);
1271 LDKInitFeatures 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_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1278 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(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_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1287 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1289 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1290 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1291 CHECK(val->result_ok);
1292 LDKNodeFeatures 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_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1299 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(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_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1308 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1311 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1312 CHECK(val->result_ok);
1313 LDKChannelFeatures 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_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1320 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(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_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1329 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1331 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1332 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1333 CHECK(val->result_ok);
1334 LDKInvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1341 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(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_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1350 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1353 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1354 CHECK(val->result_ok);
1355 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1356 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1362 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1363 CHECK(!val->result_ok);
1364 LDKDecodeError err_var = (*val->contents.err);
1365 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1370 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1371 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1374 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1375 CHECK(val->result_ok);
1376 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1377 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1383 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1384 CHECK(!val->result_ok);
1385 LDKDecodeError err_var = (*val->contents.err);
1386 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1391 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1392 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1395 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1396 CHECK(val->result_ok);
1397 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1401 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1402 CHECK(!val->result_ok);
1403 LDKDecodeError err_var = (*val->contents.err);
1404 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1405 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1406 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1409 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1410 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1412 CHECK(*((uint32_t*)a) == 64);
1413 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1415 LDKCVec_SignatureZ b_constr;
1416 b_constr.datalen = *((uint32_t*)b);
1417 if (b_constr.datalen > 0)
1418 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1420 b_constr.data = NULL;
1421 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1422 for (size_t m = 0; m < b_constr.datalen; m++) {
1423 int8_tArray b_conv_12 = b_vals[m];
1424 LDKSignature b_conv_12_ref;
1425 CHECK(*((uint32_t*)b_conv_12) == 64);
1426 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1427 b_constr.data[m] = b_conv_12_ref;
1430 return (uint64_t)ret;
1432 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1433 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1434 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1435 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1438 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1439 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1440 LDKCVec_SignatureZ b_var = tuple->b;
1441 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1442 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1443 for (size_t m = 0; m < b_var.datalen; m++) {
1444 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1445 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1446 b_arr_ptr[m] = b_conv_12_arr;
1450 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1451 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1454 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1455 CHECK(val->result_ok);
1456 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
1459 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1460 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1461 CHECK(!val->result_ok);
1462 return *val->contents.err;
1464 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1465 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1467 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1468 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1469 CHECK(val->result_ok);
1470 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1471 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1474 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1475 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1476 CHECK(!val->result_ok);
1477 return *val->contents.err;
1479 typedef struct LDKBaseSign_JCalls {
1480 atomic_size_t refcnt;
1481 uint32_t get_per_commitment_point_meth;
1482 uint32_t release_commitment_secret_meth;
1483 uint32_t channel_keys_id_meth;
1484 uint32_t sign_counterparty_commitment_meth;
1485 uint32_t sign_holder_commitment_and_htlcs_meth;
1486 uint32_t sign_justice_revoked_output_meth;
1487 uint32_t sign_justice_revoked_htlc_meth;
1488 uint32_t sign_counterparty_htlc_transaction_meth;
1489 uint32_t sign_closing_transaction_meth;
1490 uint32_t sign_channel_announcement_meth;
1491 uint32_t ready_channel_meth;
1492 } LDKBaseSign_JCalls;
1493 static void LDKBaseSign_JCalls_free(void* this_arg) {
1494 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1495 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1496 js_free(j_calls->get_per_commitment_point_meth);
1497 js_free(j_calls->release_commitment_secret_meth);
1498 js_free(j_calls->channel_keys_id_meth);
1499 js_free(j_calls->sign_counterparty_commitment_meth);
1500 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1501 js_free(j_calls->sign_justice_revoked_output_meth);
1502 js_free(j_calls->sign_justice_revoked_htlc_meth);
1503 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1504 js_free(j_calls->sign_closing_transaction_meth);
1505 js_free(j_calls->sign_channel_announcement_meth);
1506 js_free(j_calls->ready_channel_meth);
1510 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1511 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1512 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1513 LDKPublicKey ret_ref;
1514 CHECK(*((uint32_t*)ret) == 33);
1515 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1518 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1519 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1520 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1521 LDKThirtyTwoBytes ret_ref;
1522 CHECK(*((uint32_t*)ret) == 32);
1523 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1526 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1527 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1528 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1529 LDKThirtyTwoBytes ret_ref;
1530 CHECK(*((uint32_t*)ret) == 32);
1531 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1534 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1535 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1536 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1537 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1538 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1539 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1540 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1541 if (commitment_tx_var.is_owned) {
1542 commitment_tx_ref |= 1;
1544 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1545 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1546 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1549 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1550 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1551 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1552 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1553 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1554 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1555 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1556 if (commitment_tx_var.is_owned) {
1557 commitment_tx_ref |= 1;
1559 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1560 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1561 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1564 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]) {
1565 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1566 LDKTransaction justice_tx_var = justice_tx;
1567 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1568 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1569 Transaction_free(justice_tx_var);
1570 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1571 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1572 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
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_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) {
1578 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1579 LDKTransaction justice_tx_var = justice_tx;
1580 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1581 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1582 Transaction_free(justice_tx_var);
1583 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1584 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1585 LDKHTLCOutputInCommitment htlc_var = *htlc;
1586 htlc_var = HTLCOutputInCommitment_clone(htlc);
1587 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1588 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1589 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1590 if (htlc_var.is_owned) {
1593 uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1594 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1595 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1598 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) {
1599 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1600 LDKTransaction htlc_tx_var = htlc_tx;
1601 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1602 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1603 Transaction_free(htlc_tx_var);
1604 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1605 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1606 LDKHTLCOutputInCommitment htlc_var = *htlc;
1607 htlc_var = HTLCOutputInCommitment_clone(htlc);
1608 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1609 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1610 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1611 if (htlc_var.is_owned) {
1614 uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1615 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1616 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1619 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1620 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1621 LDKTransaction closing_tx_var = closing_tx;
1622 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1623 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1624 Transaction_free(closing_tx_var);
1625 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1626 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1627 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1630 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1631 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1632 LDKUnsignedChannelAnnouncement msg_var = *msg;
1633 msg_var = UnsignedChannelAnnouncement_clone(msg);
1634 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1635 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1636 uint64_t msg_ref = (uint64_t)msg_var.inner;
1637 if (msg_var.is_owned) {
1640 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1641 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1642 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1645 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1646 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1647 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1648 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1649 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1650 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1651 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1652 if (channel_parameters_var.is_owned) {
1653 channel_parameters_ref |= 1;
1655 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1657 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1658 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1659 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1661 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1662 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1663 atomic_init(&calls->refcnt, 1);
1664 //TODO: Assign calls->o from o
1666 LDKChannelPublicKeys pubkeys_conv;
1667 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1668 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1669 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1672 .this_arg = (void*) calls,
1673 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1674 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1675 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1676 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1677 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1678 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1679 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1680 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1681 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1682 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1683 .ready_channel = ready_channel_LDKBaseSign_jcall,
1684 .free = LDKBaseSign_JCalls_free,
1685 .pubkeys = pubkeys_conv,
1686 .set_pubkeys = NULL,
1690 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1691 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1692 *res_ptr = LDKBaseSign_init(o, pubkeys);
1693 return (long)res_ptr;
1695 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1696 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1697 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1698 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1702 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1703 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1704 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1705 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1709 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1710 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1711 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1712 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1716 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1717 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1718 LDKCommitmentTransaction commitment_tx_conv;
1719 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1720 commitment_tx_conv.is_owned = false;
1721 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1722 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1723 return (uint64_t)ret_conv;
1726 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1727 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1728 LDKHolderCommitmentTransaction commitment_tx_conv;
1729 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1730 commitment_tx_conv.is_owned = false;
1731 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1732 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1733 return (uint64_t)ret_conv;
1736 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) {
1737 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1738 LDKTransaction justice_tx_ref;
1739 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1740 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1741 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1742 justice_tx_ref.data_is_owned = true;
1743 unsigned char per_commitment_key_arr[32];
1744 CHECK(*((uint32_t*)per_commitment_key) == 32);
1745 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1746 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1747 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1748 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1749 return (uint64_t)ret_conv;
1752 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) {
1753 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1754 LDKTransaction justice_tx_ref;
1755 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1756 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1757 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1758 justice_tx_ref.data_is_owned = true;
1759 unsigned char per_commitment_key_arr[32];
1760 CHECK(*((uint32_t*)per_commitment_key) == 32);
1761 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1762 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1763 LDKHTLCOutputInCommitment htlc_conv;
1764 htlc_conv.inner = (void*)(htlc & (~1));
1765 htlc_conv.is_owned = false;
1766 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1767 *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);
1768 return (uint64_t)ret_conv;
1771 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) {
1772 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1773 LDKTransaction htlc_tx_ref;
1774 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1775 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1776 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1777 htlc_tx_ref.data_is_owned = true;
1778 LDKPublicKey per_commitment_point_ref;
1779 CHECK(*((uint32_t*)per_commitment_point) == 33);
1780 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1781 LDKHTLCOutputInCommitment htlc_conv;
1782 htlc_conv.inner = (void*)(htlc & (~1));
1783 htlc_conv.is_owned = false;
1784 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1785 *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);
1786 return (uint64_t)ret_conv;
1789 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1790 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1791 LDKTransaction closing_tx_ref;
1792 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1793 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1794 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1795 closing_tx_ref.data_is_owned = true;
1796 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1797 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1798 return (uint64_t)ret_conv;
1801 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1802 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1803 LDKUnsignedChannelAnnouncement msg_conv;
1804 msg_conv.inner = (void*)(msg & (~1));
1805 msg_conv.is_owned = false;
1806 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1807 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1808 return (uint64_t)ret_conv;
1811 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1812 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1813 LDKChannelTransactionParameters channel_parameters_conv;
1814 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1815 channel_parameters_conv.is_owned = false;
1816 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1819 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1820 if (this_arg->set_pubkeys != NULL)
1821 this_arg->set_pubkeys(this_arg);
1822 return this_arg->pubkeys;
1824 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1825 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1826 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1829 uint64_t ret_ref = (uint64_t)ret_var.inner;
1830 if (ret_var.is_owned) {
1836 typedef struct LDKSign_JCalls {
1837 atomic_size_t refcnt;
1838 LDKBaseSign_JCalls* BaseSign;
1839 uint32_t write_meth;
1841 static void LDKSign_JCalls_free(void* this_arg) {
1842 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1843 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1844 js_free(j_calls->write_meth);
1848 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1849 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1850 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1851 LDKCVec_u8Z ret_ref;
1852 ret_ref.datalen = *((uint32_t*)ret);
1853 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1854 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1857 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1858 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1859 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1860 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1862 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1863 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1864 atomic_init(&calls->refcnt, 1);
1865 //TODO: Assign calls->o from o
1867 LDKChannelPublicKeys pubkeys_conv;
1868 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1869 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1870 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1873 .this_arg = (void*) calls,
1874 .write = write_LDKSign_jcall,
1875 .cloned = LDKSign_JCalls_cloned,
1876 .free = LDKSign_JCalls_free,
1877 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1879 calls->BaseSign = ret.BaseSign.this_arg;
1882 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1883 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1884 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1885 return (long)res_ptr;
1887 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1888 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1889 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1890 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1891 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1892 CVec_u8Z_free(ret_var);
1896 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
1897 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
1899 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
1900 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1901 CHECK(val->result_ok);
1902 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
1903 *ret = Sign_clone(&(*val->contents.result));
1904 return (uint64_t)ret;
1906 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
1907 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1908 CHECK(!val->result_ok);
1909 LDKDecodeError err_var = (*val->contents.err);
1910 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1915 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
1916 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
1918 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
1919 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1920 CHECK(val->result_ok);
1921 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
1922 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
1925 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
1926 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
1927 CHECK(!val->result_ok);
1928 return *val->contents.err;
1930 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
1931 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
1932 for (size_t i = 0; i < ret.datalen; i++) {
1933 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
1937 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
1938 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
1940 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
1941 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1942 CHECK(val->result_ok);
1943 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
1944 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1945 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
1946 for (size_t m = 0; m < res_var.datalen; m++) {
1947 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
1948 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1949 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
1950 res_arr_ptr[m] = res_conv_12_arr;
1954 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
1955 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
1956 CHECK(!val->result_ok);
1957 return *val->contents.err;
1959 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
1960 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
1962 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
1963 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1964 CHECK(val->result_ok);
1965 LDKInMemorySigner res_var = (*val->contents.result);
1966 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1971 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
1972 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
1973 CHECK(!val->result_ok);
1974 LDKDecodeError err_var = (*val->contents.err);
1975 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1980 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
1981 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
1982 ret->datalen = *((uint32_t*)elems);
1983 if (ret->datalen == 0) {
1986 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
1987 uint32_t *java_elems = (uint32_t*)(elems + 4);
1988 for (size_t i = 0; i < ret->datalen; i++) {
1989 uint32_t arr_elem = java_elems[i];
1990 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
1991 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
1992 ret->data[i] = arr_elem_conv;
1995 return (uint64_t)ret;
1997 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1998 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1999 for (size_t i = 0; i < ret.datalen; i++) {
2000 ret.data[i] = TxOut_clone(&orig->data[i]);
2004 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2005 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2007 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2008 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2009 CHECK(val->result_ok);
2010 LDKTransaction res_var = (*val->contents.result);
2011 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2012 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2015 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2016 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2017 CHECK(!val->result_ok);
2018 return *val->contents.err;
2020 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2021 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2022 LDKThirtyTwoBytes a_ref;
2023 CHECK(*((uint32_t*)a) == 32);
2024 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2026 LDKChannelMonitor b_conv;
2027 b_conv.inner = (void*)(b & (~1));
2028 b_conv.is_owned = (b & 1) || (b == 0);
2029 b_conv = ChannelMonitor_clone(&b_conv);
2031 return (uint64_t)ret;
2033 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2034 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2035 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2036 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2039 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2040 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2041 LDKChannelMonitor b_var = tuple->b;
2042 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2043 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2044 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2047 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2048 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2049 ret->datalen = *((uint32_t*)elems);
2050 if (ret->datalen == 0) {
2053 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2054 uint32_t *java_elems = (uint32_t*)(elems + 4);
2055 for (size_t i = 0; i < ret->datalen; i++) {
2056 uint32_t arr_elem = java_elems[i];
2057 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2058 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2059 ret->data[i] = arr_elem_conv;
2062 return (uint64_t)ret;
2064 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2065 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2067 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2068 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2069 CHECK(val->result_ok);
2070 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2071 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2072 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2073 for (size_t m = 0; m < res_var.datalen; m++) {
2074 uint64_t res_conv_38_ref = (uint64_t)(&res_var.data[m]) | 1;
2075 res_arr_ptr[m] = res_conv_38_ref;
2079 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2080 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2081 CHECK(!val->result_ok);
2082 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2085 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2086 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2088 case LDKCOption_u16Z_Some: {
2089 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2091 case LDKCOption_u16Z_None: {
2092 return 0 /* LDKCOption_u16Z - None */;
2097 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2098 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2100 case LDKAPIError_APIMisuseError: {
2101 LDKStr err_str = obj->api_misuse_error.err;
2102 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2103 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2105 case LDKAPIError_FeeRateTooHigh: {
2106 LDKStr err_str = obj->fee_rate_too_high.err;
2107 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2108 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2110 case LDKAPIError_RouteError: {
2111 LDKStr err_str = obj->route_error.err;
2112 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2113 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2115 case LDKAPIError_ChannelUnavailable: {
2116 LDKStr err_str = obj->channel_unavailable.err;
2117 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2118 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2120 case LDKAPIError_MonitorUpdateFailed: {
2121 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2123 case LDKAPIError_IncompatibleShutdownScript: {
2124 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2125 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2126 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2127 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2128 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2133 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2134 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2136 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2137 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2138 CHECK(val->result_ok);
2139 return *val->contents.result;
2141 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2142 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2143 CHECK(!val->result_ok);
2144 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2147 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2148 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2149 ret->datalen = *((uint32_t*)elems);
2150 if (ret->datalen == 0) {
2153 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2154 uint32_t *java_elems = (uint32_t*)(elems + 4);
2155 for (size_t i = 0; i < ret->datalen; i++) {
2156 uint32_t arr_elem = java_elems[i];
2157 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2158 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2159 ret->data[i] = arr_elem_conv;
2162 return (uint64_t)ret;
2164 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2165 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2166 for (size_t i = 0; i < ret.datalen; i++) {
2167 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2171 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2172 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2173 ret->datalen = *((uint32_t*)elems);
2174 if (ret->datalen == 0) {
2177 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2178 uint32_t *java_elems = (uint32_t*)(elems + 4);
2179 for (size_t i = 0; i < ret->datalen; i++) {
2180 uint32_t arr_elem = java_elems[i];
2181 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2182 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2183 ret->data[i] = arr_elem_conv;
2186 return (uint64_t)ret;
2188 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2189 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2190 for (size_t i = 0; i < ret.datalen; i++) {
2191 ret.data[i] = APIError_clone(&orig->data[i]);
2195 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2196 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2198 case LDKPaymentSendFailure_ParameterError: {
2199 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2200 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2202 case LDKPaymentSendFailure_PathParameterError: {
2203 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2204 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2205 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2206 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2207 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2208 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2209 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2210 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2212 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2214 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2215 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2216 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2217 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2218 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2219 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2220 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2222 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2224 case LDKPaymentSendFailure_PartialFailure: {
2225 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2226 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2227 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2228 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2229 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2230 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2231 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2232 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2234 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2239 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2240 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2242 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2243 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2244 CHECK(val->result_ok);
2245 return *val->contents.result;
2247 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2248 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2249 CHECK(!val->result_ok);
2250 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2253 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
2254 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
2256 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
2257 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2258 CHECK(val->result_ok);
2259 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2260 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2263 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
2264 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2265 CHECK(!val->result_ok);
2266 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2269 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2270 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2272 case LDKNetAddress_IPv4: {
2273 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2274 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2275 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2277 case LDKNetAddress_IPv6: {
2278 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2279 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2280 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2282 case LDKNetAddress_OnionV2: {
2283 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2284 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2285 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2287 case LDKNetAddress_OnionV3: {
2288 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2289 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2290 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2295 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2296 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2297 ret->datalen = *((uint32_t*)elems);
2298 if (ret->datalen == 0) {
2301 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2302 uint32_t *java_elems = (uint32_t*)(elems + 4);
2303 for (size_t i = 0; i < ret->datalen; i++) {
2304 uint32_t arr_elem = java_elems[i];
2305 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2306 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2307 ret->data[i] = arr_elem_conv;
2310 return (uint64_t)ret;
2312 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2313 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2314 for (size_t i = 0; i < ret.datalen; i++) {
2315 ret.data[i] = NetAddress_clone(&orig->data[i]);
2319 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2320 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2321 LDKThirtyTwoBytes a_ref;
2322 CHECK(*((uint32_t*)a) == 32);
2323 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2325 LDKThirtyTwoBytes b_ref;
2326 CHECK(*((uint32_t*)b) == 32);
2327 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2329 return (uint64_t)ret;
2331 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t ptr) {
2332 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2333 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2334 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2337 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t ptr) {
2338 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2339 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2340 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2343 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2344 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2346 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2347 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2348 CHECK(val->result_ok);
2349 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2350 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2353 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2354 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2355 CHECK(!val->result_ok);
2356 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2359 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2360 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2361 ret->datalen = *((uint32_t*)elems);
2362 if (ret->datalen == 0) {
2365 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2366 uint32_t *java_elems = (uint32_t*)(elems + 4);
2367 for (size_t i = 0; i < ret->datalen; i++) {
2368 uint32_t arr_elem = java_elems[i];
2369 LDKChannelMonitor arr_elem_conv;
2370 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2371 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2372 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2373 ret->data[i] = arr_elem_conv;
2376 return (uint64_t)ret;
2378 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2379 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2380 for (size_t i = 0; i < ret.datalen; i++) {
2381 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2385 typedef struct LDKWatch_JCalls {
2386 atomic_size_t refcnt;
2387 uint32_t watch_channel_meth;
2388 uint32_t update_channel_meth;
2389 uint32_t release_pending_monitor_events_meth;
2391 static void LDKWatch_JCalls_free(void* this_arg) {
2392 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2393 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2394 js_free(j_calls->watch_channel_meth);
2395 js_free(j_calls->update_channel_meth);
2396 js_free(j_calls->release_pending_monitor_events_meth);
2400 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2401 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2402 LDKOutPoint funding_txo_var = funding_txo;
2403 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2404 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2405 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2406 if (funding_txo_var.is_owned) {
2407 funding_txo_ref |= 1;
2409 LDKChannelMonitor monitor_var = monitor;
2410 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2411 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2412 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2413 if (monitor_var.is_owned) {
2416 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2417 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2418 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2421 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2422 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2423 LDKOutPoint funding_txo_var = funding_txo;
2424 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2425 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2426 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2427 if (funding_txo_var.is_owned) {
2428 funding_txo_ref |= 1;
2430 LDKChannelMonitorUpdate update_var = update;
2431 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2432 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2433 uint64_t update_ref = (uint64_t)update_var.inner;
2434 if (update_var.is_owned) {
2437 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2438 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2439 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2442 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2443 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2444 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2445 LDKCVec_MonitorEventZ ret_constr;
2446 ret_constr.datalen = *((uint32_t*)ret);
2447 if (ret_constr.datalen > 0)
2448 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2450 ret_constr.data = NULL;
2451 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2452 for (size_t o = 0; o < ret_constr.datalen; o++) {
2453 uint32_t ret_conv_14 = ret_vals[o];
2454 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2455 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2456 ret_constr.data[o] = ret_conv_14_conv;
2460 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2461 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2462 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2464 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2465 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2466 atomic_init(&calls->refcnt, 1);
2467 //TODO: Assign calls->o from o
2470 .this_arg = (void*) calls,
2471 .watch_channel = watch_channel_LDKWatch_jcall,
2472 .update_channel = update_channel_LDKWatch_jcall,
2473 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2474 .free = LDKWatch_JCalls_free,
2478 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2479 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2480 *res_ptr = LDKWatch_init(o);
2481 return (long)res_ptr;
2483 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2484 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2485 LDKOutPoint funding_txo_conv;
2486 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2487 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2488 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2489 LDKChannelMonitor monitor_conv;
2490 monitor_conv.inner = (void*)(monitor & (~1));
2491 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2492 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2493 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2494 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2495 return (uint64_t)ret_conv;
2498 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2499 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2500 LDKOutPoint funding_txo_conv;
2501 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2502 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2503 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2504 LDKChannelMonitorUpdate update_conv;
2505 update_conv.inner = (void*)(update & (~1));
2506 update_conv.is_owned = (update & 1) || (update == 0);
2507 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2508 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2509 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2510 return (uint64_t)ret_conv;
2513 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2514 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2515 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2516 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2517 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2518 for (size_t o = 0; o < ret_var.datalen; o++) {
2519 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2520 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2521 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2522 ret_arr_ptr[o] = ret_conv_14_ref;
2528 typedef struct LDKBroadcasterInterface_JCalls {
2529 atomic_size_t refcnt;
2530 uint32_t broadcast_transaction_meth;
2531 } LDKBroadcasterInterface_JCalls;
2532 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2533 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2534 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2535 js_free(j_calls->broadcast_transaction_meth);
2539 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2540 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2541 LDKTransaction tx_var = tx;
2542 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2543 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2544 Transaction_free(tx_var);
2545 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2547 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2548 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2549 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2551 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2552 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2553 atomic_init(&calls->refcnt, 1);
2554 //TODO: Assign calls->o from o
2556 LDKBroadcasterInterface ret = {
2557 .this_arg = (void*) calls,
2558 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2559 .free = LDKBroadcasterInterface_JCalls_free,
2563 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2564 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2565 *res_ptr = LDKBroadcasterInterface_init(o);
2566 return (long)res_ptr;
2568 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2569 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2570 LDKTransaction tx_ref;
2571 tx_ref.datalen = *((uint32_t*)tx);
2572 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2573 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2574 tx_ref.data_is_owned = true;
2575 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2578 typedef struct LDKKeysInterface_JCalls {
2579 atomic_size_t refcnt;
2580 uint32_t get_node_secret_meth;
2581 uint32_t get_destination_script_meth;
2582 uint32_t get_shutdown_scriptpubkey_meth;
2583 uint32_t get_channel_signer_meth;
2584 uint32_t get_secure_random_bytes_meth;
2585 uint32_t read_chan_signer_meth;
2586 uint32_t sign_invoice_meth;
2587 } LDKKeysInterface_JCalls;
2588 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2589 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2590 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2591 js_free(j_calls->get_node_secret_meth);
2592 js_free(j_calls->get_destination_script_meth);
2593 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2594 js_free(j_calls->get_channel_signer_meth);
2595 js_free(j_calls->get_secure_random_bytes_meth);
2596 js_free(j_calls->read_chan_signer_meth);
2597 js_free(j_calls->sign_invoice_meth);
2601 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2602 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2603 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2604 LDKSecretKey ret_ref;
2605 CHECK(*((uint32_t*)ret) == 32);
2606 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2609 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2610 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2611 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2612 LDKCVec_u8Z ret_ref;
2613 ret_ref.datalen = *((uint32_t*)ret);
2614 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2615 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2618 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2619 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2620 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2621 LDKShutdownScript ret_conv;
2622 ret_conv.inner = (void*)(ret & (~1));
2623 ret_conv.is_owned = (ret & 1) || (ret == 0);
2624 ret_conv = ShutdownScript_clone(&ret_conv);
2627 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2628 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2629 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2630 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2631 ret_conv = Sign_clone(&ret_conv);
2634 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2635 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2636 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2637 LDKThirtyTwoBytes ret_ref;
2638 CHECK(*((uint32_t*)ret) == 32);
2639 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2642 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2643 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2644 LDKu8slice reader_var = reader;
2645 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2646 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2647 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2648 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2649 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2652 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2653 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2654 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2655 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2656 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2657 CVec_u8Z_free(invoice_preimage_var);
2658 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2659 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2660 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2663 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2664 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2665 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2667 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2668 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2669 atomic_init(&calls->refcnt, 1);
2670 //TODO: Assign calls->o from o
2672 LDKKeysInterface ret = {
2673 .this_arg = (void*) calls,
2674 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2675 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2676 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2677 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2678 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2679 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2680 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2681 .free = LDKKeysInterface_JCalls_free,
2685 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2686 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2687 *res_ptr = LDKKeysInterface_init(o);
2688 return (long)res_ptr;
2690 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2691 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2692 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2693 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2697 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2698 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2699 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2700 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2701 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2702 CVec_u8Z_free(ret_var);
2706 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2707 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2708 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2711 uint64_t ret_ref = (uint64_t)ret_var.inner;
2712 if (ret_var.is_owned) {
2718 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2719 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2720 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2721 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2722 return (uint64_t)ret;
2725 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2726 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2727 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2728 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2732 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2733 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2734 LDKu8slice reader_ref;
2735 reader_ref.datalen = *((uint32_t*)reader);
2736 reader_ref.data = (int8_t*)(reader + 4);
2737 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2738 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2739 return (uint64_t)ret_conv;
2742 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2743 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2744 LDKCVec_u8Z invoice_preimage_ref;
2745 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2746 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2747 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2748 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2749 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2750 return (uint64_t)ret_conv;
2753 typedef struct LDKFeeEstimator_JCalls {
2754 atomic_size_t refcnt;
2755 uint32_t get_est_sat_per_1000_weight_meth;
2756 } LDKFeeEstimator_JCalls;
2757 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2758 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2759 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2760 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2764 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2765 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2766 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2767 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2769 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2770 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2771 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2773 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2774 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2775 atomic_init(&calls->refcnt, 1);
2776 //TODO: Assign calls->o from o
2778 LDKFeeEstimator ret = {
2779 .this_arg = (void*) calls,
2780 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2781 .free = LDKFeeEstimator_JCalls_free,
2785 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2786 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2787 *res_ptr = LDKFeeEstimator_init(o);
2788 return (long)res_ptr;
2790 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2791 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2792 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2793 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2797 typedef struct LDKLogger_JCalls {
2798 atomic_size_t refcnt;
2801 static void LDKLogger_JCalls_free(void* this_arg) {
2802 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2803 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2804 js_free(j_calls->log_meth);
2808 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2809 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2810 const char* record_str = record;
2811 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2812 js_invoke_function_1(j_calls->log_meth, record_conv);
2814 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2815 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2816 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2818 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2819 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2820 atomic_init(&calls->refcnt, 1);
2821 //TODO: Assign calls->o from o
2824 .this_arg = (void*) calls,
2825 .log = log_LDKLogger_jcall,
2826 .free = LDKLogger_JCalls_free,
2830 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2831 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2832 *res_ptr = LDKLogger_init(o);
2833 return (long)res_ptr;
2835 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2836 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2837 LDKThirtyTwoBytes a_ref;
2838 CHECK(*((uint32_t*)a) == 32);
2839 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2841 LDKChannelManager b_conv;
2842 b_conv.inner = (void*)(b & (~1));
2843 b_conv.is_owned = (b & 1) || (b == 0);
2844 // Warning: we need a move here but no clone is available for LDKChannelManager
2846 return (uint64_t)ret;
2848 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2849 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2850 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2851 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2854 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2855 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2856 LDKChannelManager b_var = tuple->b;
2857 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2858 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2859 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2862 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2863 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2865 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2866 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2867 CHECK(val->result_ok);
2868 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2871 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2872 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2873 CHECK(!val->result_ok);
2874 LDKDecodeError err_var = (*val->contents.err);
2875 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2880 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
2881 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
2883 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
2884 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2885 CHECK(val->result_ok);
2886 LDKChannelConfig res_var = (*val->contents.result);
2887 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2888 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2889 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2892 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
2893 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2894 CHECK(!val->result_ok);
2895 LDKDecodeError err_var = (*val->contents.err);
2896 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2897 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2898 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2901 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
2902 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
2904 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
2905 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2906 CHECK(val->result_ok);
2907 LDKOutPoint res_var = (*val->contents.result);
2908 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2909 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2910 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2913 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
2914 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
2915 CHECK(!val->result_ok);
2916 LDKDecodeError err_var = (*val->contents.err);
2917 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2918 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2919 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2922 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
2923 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
2925 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
2926 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2927 CHECK(val->result_ok);
2928 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
2931 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
2932 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
2933 CHECK(!val->result_ok);
2934 return *val->contents.err;
2936 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
2937 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
2939 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
2940 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2941 CHECK(val->result_ok);
2942 LDKInvoice res_var = (*val->contents.result);
2943 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2944 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2945 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2948 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
2949 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
2950 CHECK(!val->result_ok);
2951 return *val->contents.err;
2953 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
2954 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
2956 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
2957 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2958 CHECK(val->result_ok);
2959 LDKSignedRawInvoice res_var = (*val->contents.result);
2960 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2961 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2962 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2965 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
2966 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
2967 CHECK(!val->result_ok);
2968 return *val->contents.err;
2970 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
2971 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
2972 LDKRawInvoice a_conv;
2973 a_conv.inner = (void*)(a & (~1));
2974 a_conv.is_owned = (a & 1) || (a == 0);
2975 a_conv = RawInvoice_clone(&a_conv);
2977 LDKThirtyTwoBytes b_ref;
2978 CHECK(*((uint32_t*)b) == 32);
2979 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2981 LDKInvoiceSignature c_conv;
2982 c_conv.inner = (void*)(c & (~1));
2983 c_conv.is_owned = (c & 1) || (c == 0);
2984 c_conv = InvoiceSignature_clone(&c_conv);
2986 return (uint64_t)ret;
2988 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t ptr) {
2989 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2990 LDKRawInvoice a_var = tuple->a;
2991 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2992 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2993 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
2996 int8_tArray __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t ptr) {
2997 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
2998 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2999 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
3002 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t ptr) {
3003 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3004 LDKInvoiceSignature c_var = tuple->c;
3005 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3006 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3007 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3010 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3011 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3013 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3014 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3015 CHECK(val->result_ok);
3016 LDKPayeePubKey res_var = (*val->contents.result);
3017 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3018 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3019 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3022 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3023 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3024 CHECK(!val->result_ok);
3025 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3028 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3029 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3030 ret->datalen = *((uint32_t*)elems);
3031 if (ret->datalen == 0) {
3034 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3035 uint32_t *java_elems = (uint32_t*)(elems + 4);
3036 for (size_t i = 0; i < ret->datalen; i++) {
3037 uint32_t arr_elem = java_elems[i];
3038 LDKPrivateRoute arr_elem_conv;
3039 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3040 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3041 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3042 ret->data[i] = arr_elem_conv;
3045 return (uint64_t)ret;
3047 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3048 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3049 for (size_t i = 0; i < ret.datalen; i++) {
3050 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3054 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3055 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3057 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3058 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3059 CHECK(val->result_ok);
3060 LDKPositiveTimestamp res_var = (*val->contents.result);
3061 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3062 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3063 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3066 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3067 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3068 CHECK(!val->result_ok);
3069 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3072 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3073 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3075 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3076 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3077 CHECK(val->result_ok);
3078 return *val->contents.result;
3080 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3081 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3082 CHECK(!val->result_ok);
3083 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3086 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3087 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3089 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3090 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3091 CHECK(val->result_ok);
3092 LDKInvoice res_var = (*val->contents.result);
3093 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3094 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3095 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3098 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3099 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3100 CHECK(!val->result_ok);
3101 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3104 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3105 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3107 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3108 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3109 CHECK(val->result_ok);
3110 LDKDescription res_var = (*val->contents.result);
3111 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3112 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3113 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3116 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3117 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3118 CHECK(!val->result_ok);
3119 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3122 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3123 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3125 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3126 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3127 CHECK(val->result_ok);
3128 LDKExpiryTime res_var = (*val->contents.result);
3129 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3130 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3131 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3135 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3136 CHECK(!val->result_ok);
3137 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3140 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3141 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3143 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3144 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3145 CHECK(val->result_ok);
3146 LDKPrivateRoute res_var = (*val->contents.result);
3147 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3148 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3149 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3152 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3153 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3154 CHECK(!val->result_ok);
3155 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3158 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3159 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3161 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3162 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3163 CHECK(val->result_ok);
3164 LDKStr res_str = (*val->contents.result);
3165 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3168 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3169 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3170 CHECK(!val->result_ok);
3171 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3174 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3175 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3177 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3178 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3179 CHECK(val->result_ok);
3180 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3181 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3182 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3183 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3186 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3187 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3188 CHECK(!val->result_ok);
3189 LDKDecodeError err_var = (*val->contents.err);
3190 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3195 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3196 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3198 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3199 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3200 CHECK(val->result_ok);
3201 LDKHTLCUpdate res_var = (*val->contents.result);
3202 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3203 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3204 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3207 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3208 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3209 CHECK(!val->result_ok);
3210 LDKDecodeError err_var = (*val->contents.err);
3211 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3212 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3213 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3216 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3217 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3219 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3220 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3221 CHECK(val->result_ok);
3222 return *val->contents.result;
3224 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3225 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3226 CHECK(!val->result_ok);
3227 LDKMonitorUpdateError err_var = (*val->contents.err);
3228 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3229 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3230 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3233 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3234 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3236 a_conv.inner = (void*)(a & (~1));
3237 a_conv.is_owned = (a & 1) || (a == 0);
3238 a_conv = OutPoint_clone(&a_conv);
3241 b_ref.datalen = *((uint32_t*)b);
3242 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3243 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3245 return (uint64_t)ret;
3247 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
3248 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3249 LDKOutPoint a_var = tuple->a;
3250 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3251 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3252 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3255 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
3256 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3257 LDKCVec_u8Z b_var = tuple->b;
3258 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3259 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3262 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3263 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3266 b_ref.datalen = *((uint32_t*)b);
3267 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3268 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3270 return (uint64_t)ret;
3272 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
3273 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3276 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
3277 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3278 LDKCVec_u8Z b_var = tuple->b;
3279 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3280 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3283 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3284 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3285 ret->datalen = *((uint32_t*)elems);
3286 if (ret->datalen == 0) {
3289 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3290 uint32_t *java_elems = (uint32_t*)(elems + 4);
3291 for (size_t i = 0; i < ret->datalen; i++) {
3292 uint32_t arr_elem = java_elems[i];
3293 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3294 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3295 ret->data[i] = arr_elem_conv;
3298 return (uint64_t)ret;
3300 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3301 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3302 for (size_t i = 0; i < ret.datalen; i++) {
3303 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3307 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3308 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3309 LDKThirtyTwoBytes a_ref;
3310 CHECK(*((uint32_t*)a) == 32);
3311 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3313 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3314 b_constr.datalen = *((uint32_t*)b);
3315 if (b_constr.datalen > 0)
3316 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3318 b_constr.data = NULL;
3319 uint32_t* b_vals = (uint32_t*)(b + 4);
3320 for (size_t e = 0; e < b_constr.datalen; e++) {
3321 uint32_t b_conv_30 = b_vals[e];
3322 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
3323 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
3324 b_constr.data[e] = b_conv_30_conv;
3327 return (uint64_t)ret;
3329 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
3330 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3331 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3332 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3335 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
3336 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3337 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
3338 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3339 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3340 for (size_t e = 0; e < b_var.datalen; e++) {
3341 uint64_t b_conv_30_ref = (uint64_t)(&b_var.data[e]) | 1;
3342 b_arr_ptr[e] = b_conv_30_ref;
3346 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3347 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3348 ret->datalen = *((uint32_t*)elems);
3349 if (ret->datalen == 0) {
3352 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3353 uint32_t *java_elems = (uint32_t*)(elems + 4);
3354 for (size_t i = 0; i < ret->datalen; i++) {
3355 uint32_t arr_elem = java_elems[i];
3356 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3357 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3358 ret->data[i] = arr_elem_conv;
3361 return (uint64_t)ret;
3363 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3364 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 };
3365 for (size_t i = 0; i < ret.datalen; i++) {
3366 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3370 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3371 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3373 case LDKPaymentPurpose_InvoicePayment: {
3374 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3375 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3376 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3377 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3378 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3380 case LDKPaymentPurpose_SpontaneousPayment: {
3381 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3382 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3383 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3388 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3389 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3391 case LDKEvent_FundingGenerationReady: {
3392 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3393 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3394 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3395 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3396 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3397 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;
3399 case LDKEvent_PaymentReceived: {
3400 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3401 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3402 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3403 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3405 case LDKEvent_PaymentSent: {
3406 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3407 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3408 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3410 case LDKEvent_PaymentFailed: {
3411 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3412 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
3413 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
3415 case LDKEvent_PendingHTLCsForwardable: {
3416 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3418 case LDKEvent_SpendableOutputs: {
3419 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3420 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3421 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3422 for (size_t b = 0; b < outputs_var.datalen; b++) {
3423 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3424 outputs_arr_ptr[b] = outputs_conv_27_ref;
3426 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3428 case LDKEvent_PaymentForwarded: {
3429 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3430 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3435 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3436 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3437 ret->datalen = *((uint32_t*)elems);
3438 if (ret->datalen == 0) {
3441 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3442 uint32_t *java_elems = (uint32_t*)(elems + 4);
3443 for (size_t i = 0; i < ret->datalen; i++) {
3444 uint32_t arr_elem = java_elems[i];
3445 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3446 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3447 ret->data[i] = arr_elem_conv;
3450 return (uint64_t)ret;
3452 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3453 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3454 for (size_t i = 0; i < ret.datalen; i++) {
3455 ret.data[i] = Event_clone(&orig->data[i]);
3459 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3460 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3462 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3463 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3465 return (uint64_t)ret;
3467 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
3468 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3471 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
3472 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3473 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
3474 return (uint64_t)b_ref;
3476 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3477 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3478 ret->datalen = *((uint32_t*)elems);
3479 if (ret->datalen == 0) {
3482 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3483 uint32_t *java_elems = (uint32_t*)(elems + 4);
3484 for (size_t i = 0; i < ret->datalen; i++) {
3485 uint32_t arr_elem = java_elems[i];
3486 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3487 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3488 ret->data[i] = arr_elem_conv;
3491 return (uint64_t)ret;
3493 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3494 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3495 for (size_t i = 0; i < ret.datalen; i++) {
3496 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3500 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3501 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3502 LDKThirtyTwoBytes a_ref;
3503 CHECK(*((uint32_t*)a) == 32);
3504 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3506 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3507 b_constr.datalen = *((uint32_t*)b);
3508 if (b_constr.datalen > 0)
3509 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3511 b_constr.data = NULL;
3512 uint32_t* b_vals = (uint32_t*)(b + 4);
3513 for (size_t z = 0; z < b_constr.datalen; z++) {
3514 uint32_t b_conv_25 = b_vals[z];
3515 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
3516 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
3517 b_constr.data[z] = b_conv_25_conv;
3520 return (uint64_t)ret;
3522 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
3523 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3524 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3525 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3528 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
3529 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3530 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
3531 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3532 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3533 for (size_t z = 0; z < b_var.datalen; z++) {
3534 uint64_t b_conv_25_ref = (uint64_t)(&b_var.data[z]) | 1;
3535 b_arr_ptr[z] = b_conv_25_ref;
3539 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3540 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3541 ret->datalen = *((uint32_t*)elems);
3542 if (ret->datalen == 0) {
3545 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3546 uint32_t *java_elems = (uint32_t*)(elems + 4);
3547 for (size_t i = 0; i < ret->datalen; i++) {
3548 uint32_t arr_elem = java_elems[i];
3549 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3550 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3551 ret->data[i] = arr_elem_conv;
3554 return (uint64_t)ret;
3556 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3557 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 };
3558 for (size_t i = 0; i < ret.datalen; i++) {
3559 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3563 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3564 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3566 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3567 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3568 CHECK(val->result_ok);
3569 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3572 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
3573 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3574 CHECK(!val->result_ok);
3575 LDKDecodeError err_var = (*val->contents.err);
3576 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3577 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3578 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3581 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
3582 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3584 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
3585 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3586 CHECK(val->result_ok);
3587 return *val->contents.result;
3589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
3590 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3591 CHECK(!val->result_ok);
3592 LDKLightningError err_var = (*val->contents.err);
3593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3595 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3598 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
3599 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3600 LDKChannelAnnouncement a_conv;
3601 a_conv.inner = (void*)(a & (~1));
3602 a_conv.is_owned = (a & 1) || (a == 0);
3603 a_conv = ChannelAnnouncement_clone(&a_conv);
3605 LDKChannelUpdate b_conv;
3606 b_conv.inner = (void*)(b & (~1));
3607 b_conv.is_owned = (b & 1) || (b == 0);
3608 b_conv = ChannelUpdate_clone(&b_conv);
3610 LDKChannelUpdate c_conv;
3611 c_conv.inner = (void*)(c & (~1));
3612 c_conv.is_owned = (c & 1) || (c == 0);
3613 c_conv = ChannelUpdate_clone(&c_conv);
3615 return (uint64_t)ret;
3617 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
3618 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3619 LDKChannelAnnouncement a_var = tuple->a;
3620 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3621 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3622 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3625 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
3626 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3627 LDKChannelUpdate b_var = tuple->b;
3628 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3629 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3630 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3633 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
3634 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3635 LDKChannelUpdate c_var = tuple->c;
3636 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3637 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3638 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3641 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
3642 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3643 ret->datalen = *((uint32_t*)elems);
3644 if (ret->datalen == 0) {
3647 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3648 uint32_t *java_elems = (uint32_t*)(elems + 4);
3649 for (size_t i = 0; i < ret->datalen; i++) {
3650 uint32_t arr_elem = java_elems[i];
3651 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
3652 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
3653 ret->data[i] = arr_elem_conv;
3656 return (uint64_t)ret;
3658 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3659 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3660 for (size_t i = 0; i < ret.datalen; i++) {
3661 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3665 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
3666 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3667 ret->datalen = *((uint32_t*)elems);
3668 if (ret->datalen == 0) {
3671 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3672 uint32_t *java_elems = (uint32_t*)(elems + 4);
3673 for (size_t i = 0; i < ret->datalen; i++) {
3674 uint32_t arr_elem = java_elems[i];
3675 LDKNodeAnnouncement arr_elem_conv;
3676 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3677 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3678 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3679 ret->data[i] = arr_elem_conv;
3682 return (uint64_t)ret;
3684 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3685 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3686 for (size_t i = 0; i < ret.datalen; i++) {
3687 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3691 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
3692 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3694 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
3695 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3696 CHECK(val->result_ok);
3697 return *val->contents.result;
3699 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
3700 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3701 CHECK(!val->result_ok);
3702 LDKLightningError err_var = (*val->contents.err);
3703 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3704 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3705 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3708 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
3709 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3711 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
3712 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3713 CHECK(val->result_ok);
3714 LDKCVec_u8Z res_var = (*val->contents.result);
3715 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3716 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3719 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
3720 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3721 CHECK(!val->result_ok);
3722 LDKPeerHandleError err_var = (*val->contents.err);
3723 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3724 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3725 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3728 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
3729 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3731 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
3732 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3733 CHECK(val->result_ok);
3734 return *val->contents.result;
3736 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
3737 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3738 CHECK(!val->result_ok);
3739 LDKPeerHandleError err_var = (*val->contents.err);
3740 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3741 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3742 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3745 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
3746 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3748 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
3749 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3750 CHECK(val->result_ok);
3751 return *val->contents.result;
3753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
3754 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3755 CHECK(!val->result_ok);
3756 LDKPeerHandleError err_var = (*val->contents.err);
3757 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3758 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3759 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3762 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3763 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
3765 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3766 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3767 CHECK(val->result_ok);
3768 LDKDirectionalChannelInfo res_var = (*val->contents.result);
3769 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3770 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3771 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3774 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3775 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
3776 CHECK(!val->result_ok);
3777 LDKDecodeError err_var = (*val->contents.err);
3778 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3779 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3780 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3783 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
3784 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
3786 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
3787 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3788 CHECK(val->result_ok);
3789 LDKChannelInfo res_var = (*val->contents.result);
3790 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3791 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3792 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
3796 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
3797 CHECK(!val->result_ok);
3798 LDKDecodeError err_var = (*val->contents.err);
3799 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3800 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3801 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3804 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
3805 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3807 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
3808 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3809 CHECK(val->result_ok);
3810 LDKRoutingFees res_var = (*val->contents.result);
3811 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3812 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3813 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3816 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
3817 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3818 CHECK(!val->result_ok);
3819 LDKDecodeError err_var = (*val->contents.err);
3820 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3821 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3822 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3825 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
3826 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3828 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
3829 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3830 CHECK(val->result_ok);
3831 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3832 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3833 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3834 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3837 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
3838 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3839 CHECK(!val->result_ok);
3840 LDKDecodeError err_var = (*val->contents.err);
3841 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3842 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3843 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3846 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
3847 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
3848 ret->datalen = *((uint32_t*)elems);
3849 if (ret->datalen == 0) {
3852 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
3853 int64_t *java_elems = (int64_t*)(elems + 4);
3854 for (size_t i = 0; i < ret->datalen; i++) {
3855 ret->data[i] = java_elems[i];
3858 return (uint64_t)ret;
3860 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3861 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3862 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3865 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
3866 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3868 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
3869 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3870 CHECK(val->result_ok);
3871 LDKNodeInfo res_var = (*val->contents.result);
3872 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3873 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3874 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3877 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
3878 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3879 CHECK(!val->result_ok);
3880 LDKDecodeError err_var = (*val->contents.err);
3881 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3882 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3883 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3886 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
3887 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3889 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
3890 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3891 CHECK(val->result_ok);
3892 LDKNetworkGraph res_var = (*val->contents.result);
3893 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3894 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3895 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3898 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
3899 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3900 CHECK(!val->result_ok);
3901 LDKDecodeError err_var = (*val->contents.err);
3902 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3903 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3904 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3907 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
3908 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3910 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
3911 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3912 CHECK(val->result_ok);
3913 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3916 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
3917 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3918 CHECK(!val->result_ok);
3919 return *val->contents.err;
3921 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
3922 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3924 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
3925 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3926 CHECK(val->result_ok);
3927 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3928 *res_conv = (*val->contents.result);
3929 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3930 return (uint64_t)res_conv;
3932 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3933 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3934 CHECK(!val->result_ok);
3935 LDKDecodeError err_var = (*val->contents.err);
3936 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3937 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3938 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3941 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
3942 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
3944 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
3945 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3946 CHECK(val->result_ok);
3947 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3950 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
3951 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
3952 CHECK(!val->result_ok);
3953 LDKDecodeError err_var = (*val->contents.err);
3954 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3955 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3956 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3959 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3960 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3961 ret->datalen = *((uint32_t*)elems);
3962 if (ret->datalen == 0) {
3965 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3966 uint32_t *java_elems = (uint32_t*)(elems + 4);
3967 for (size_t i = 0; i < ret->datalen; i++) {
3968 uint32_t arr_elem = java_elems[i];
3969 LDKUpdateAddHTLC arr_elem_conv;
3970 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3971 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3972 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3973 ret->data[i] = arr_elem_conv;
3976 return (uint64_t)ret;
3978 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3979 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3980 for (size_t i = 0; i < ret.datalen; i++) {
3981 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3985 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3986 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3987 ret->datalen = *((uint32_t*)elems);
3988 if (ret->datalen == 0) {
3991 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3992 uint32_t *java_elems = (uint32_t*)(elems + 4);
3993 for (size_t i = 0; i < ret->datalen; i++) {
3994 uint32_t arr_elem = java_elems[i];
3995 LDKUpdateFulfillHTLC arr_elem_conv;
3996 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3997 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3998 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3999 ret->data[i] = arr_elem_conv;
4002 return (uint64_t)ret;
4004 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4005 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4006 for (size_t i = 0; i < ret.datalen; i++) {
4007 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4011 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4012 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4013 ret->datalen = *((uint32_t*)elems);
4014 if (ret->datalen == 0) {
4017 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4018 uint32_t *java_elems = (uint32_t*)(elems + 4);
4019 for (size_t i = 0; i < ret->datalen; i++) {
4020 uint32_t arr_elem = java_elems[i];
4021 LDKUpdateFailHTLC arr_elem_conv;
4022 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4023 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4024 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4025 ret->data[i] = arr_elem_conv;
4028 return (uint64_t)ret;
4030 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4031 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4032 for (size_t i = 0; i < ret.datalen; i++) {
4033 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4037 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4038 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4039 ret->datalen = *((uint32_t*)elems);
4040 if (ret->datalen == 0) {
4043 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4044 uint32_t *java_elems = (uint32_t*)(elems + 4);
4045 for (size_t i = 0; i < ret->datalen; i++) {
4046 uint32_t arr_elem = java_elems[i];
4047 LDKUpdateFailMalformedHTLC arr_elem_conv;
4048 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4049 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4050 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4051 ret->data[i] = arr_elem_conv;
4054 return (uint64_t)ret;
4056 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4057 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4058 for (size_t i = 0; i < ret.datalen; i++) {
4059 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4063 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4064 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4066 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4067 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4068 CHECK(val->result_ok);
4069 LDKAcceptChannel res_var = (*val->contents.result);
4070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4075 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4076 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4077 CHECK(!val->result_ok);
4078 LDKDecodeError err_var = (*val->contents.err);
4079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4084 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4085 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4087 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4088 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4089 CHECK(val->result_ok);
4090 LDKAnnouncementSignatures res_var = (*val->contents.result);
4091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4096 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4097 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4098 CHECK(!val->result_ok);
4099 LDKDecodeError err_var = (*val->contents.err);
4100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4105 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4106 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4108 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4109 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4110 CHECK(val->result_ok);
4111 LDKChannelReestablish res_var = (*val->contents.result);
4112 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4113 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4114 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4117 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4118 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4119 CHECK(!val->result_ok);
4120 LDKDecodeError err_var = (*val->contents.err);
4121 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4122 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4123 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4126 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4127 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4129 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4130 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4131 CHECK(val->result_ok);
4132 LDKClosingSigned res_var = (*val->contents.result);
4133 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4134 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4135 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4138 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4139 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4140 CHECK(!val->result_ok);
4141 LDKDecodeError err_var = (*val->contents.err);
4142 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4143 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4144 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4147 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4148 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4150 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4151 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4152 CHECK(val->result_ok);
4153 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4154 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4155 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4156 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4159 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4160 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4161 CHECK(!val->result_ok);
4162 LDKDecodeError err_var = (*val->contents.err);
4163 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4164 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4165 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4168 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4169 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4171 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4172 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4173 CHECK(val->result_ok);
4174 LDKCommitmentSigned res_var = (*val->contents.result);
4175 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4176 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4177 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4180 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4181 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4182 CHECK(!val->result_ok);
4183 LDKDecodeError err_var = (*val->contents.err);
4184 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4185 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4186 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4189 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4190 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4192 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4193 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4194 CHECK(val->result_ok);
4195 LDKFundingCreated res_var = (*val->contents.result);
4196 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4201 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4202 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4203 CHECK(!val->result_ok);
4204 LDKDecodeError err_var = (*val->contents.err);
4205 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4206 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4207 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4210 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4211 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4213 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4214 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4215 CHECK(val->result_ok);
4216 LDKFundingSigned res_var = (*val->contents.result);
4217 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4218 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4219 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4222 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4223 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4224 CHECK(!val->result_ok);
4225 LDKDecodeError err_var = (*val->contents.err);
4226 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4227 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4228 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4231 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4232 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4234 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4235 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4236 CHECK(val->result_ok);
4237 LDKFundingLocked res_var = (*val->contents.result);
4238 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4239 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4240 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4243 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4244 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4245 CHECK(!val->result_ok);
4246 LDKDecodeError err_var = (*val->contents.err);
4247 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4248 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4249 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4252 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4253 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4255 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4256 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4257 CHECK(val->result_ok);
4258 LDKInit res_var = (*val->contents.result);
4259 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4260 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4261 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4264 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4265 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4266 CHECK(!val->result_ok);
4267 LDKDecodeError err_var = (*val->contents.err);
4268 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4269 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4270 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4273 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4274 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4276 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4277 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4278 CHECK(val->result_ok);
4279 LDKOpenChannel res_var = (*val->contents.result);
4280 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4281 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4282 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4285 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4286 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4287 CHECK(!val->result_ok);
4288 LDKDecodeError err_var = (*val->contents.err);
4289 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4290 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4291 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4294 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4295 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4297 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4298 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4299 CHECK(val->result_ok);
4300 LDKRevokeAndACK res_var = (*val->contents.result);
4301 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4302 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4303 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4307 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4308 CHECK(!val->result_ok);
4309 LDKDecodeError err_var = (*val->contents.err);
4310 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4311 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4312 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4315 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4316 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4318 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4319 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4320 CHECK(val->result_ok);
4321 LDKShutdown res_var = (*val->contents.result);
4322 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4323 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4324 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4327 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4328 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4329 CHECK(!val->result_ok);
4330 LDKDecodeError err_var = (*val->contents.err);
4331 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4332 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4333 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4336 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4337 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4340 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4341 CHECK(val->result_ok);
4342 LDKUpdateFailHTLC res_var = (*val->contents.result);
4343 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4344 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4345 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4349 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4350 CHECK(!val->result_ok);
4351 LDKDecodeError err_var = (*val->contents.err);
4352 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4353 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4354 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4357 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4358 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4361 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4362 CHECK(val->result_ok);
4363 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4364 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4365 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4366 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4369 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4370 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4371 CHECK(!val->result_ok);
4372 LDKDecodeError err_var = (*val->contents.err);
4373 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4374 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4375 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4379 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4382 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4383 CHECK(val->result_ok);
4384 LDKUpdateFee res_var = (*val->contents.result);
4385 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4386 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4387 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4391 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4392 CHECK(!val->result_ok);
4393 LDKDecodeError err_var = (*val->contents.err);
4394 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4395 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4396 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4400 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4403 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4404 CHECK(val->result_ok);
4405 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4406 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4407 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4408 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4412 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4413 CHECK(!val->result_ok);
4414 LDKDecodeError err_var = (*val->contents.err);
4415 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4416 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4417 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4420 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4421 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4424 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4425 CHECK(val->result_ok);
4426 LDKUpdateAddHTLC res_var = (*val->contents.result);
4427 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4428 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4429 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4433 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4434 CHECK(!val->result_ok);
4435 LDKDecodeError err_var = (*val->contents.err);
4436 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4437 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4438 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4441 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
4442 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4444 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4445 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4446 CHECK(val->result_ok);
4447 LDKPing res_var = (*val->contents.result);
4448 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4449 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4450 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4454 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4455 CHECK(!val->result_ok);
4456 LDKDecodeError err_var = (*val->contents.err);
4457 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4458 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4459 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4462 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
4463 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4465 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4466 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4467 CHECK(val->result_ok);
4468 LDKPong res_var = (*val->contents.result);
4469 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4470 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4471 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4474 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4475 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4476 CHECK(!val->result_ok);
4477 LDKDecodeError err_var = (*val->contents.err);
4478 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4479 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4480 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4483 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4484 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4486 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4487 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4488 CHECK(val->result_ok);
4489 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4490 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4491 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4492 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4496 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4497 CHECK(!val->result_ok);
4498 LDKDecodeError err_var = (*val->contents.err);
4499 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4504 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4505 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4508 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4509 CHECK(val->result_ok);
4510 LDKChannelAnnouncement res_var = (*val->contents.result);
4511 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4512 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4513 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4517 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4518 CHECK(!val->result_ok);
4519 LDKDecodeError err_var = (*val->contents.err);
4520 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4521 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4522 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4525 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4526 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4528 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4529 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4530 CHECK(val->result_ok);
4531 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4532 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4533 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4534 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4537 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4538 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4539 CHECK(!val->result_ok);
4540 LDKDecodeError err_var = (*val->contents.err);
4541 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4542 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4543 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4546 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4547 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4549 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4550 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4551 CHECK(val->result_ok);
4552 LDKChannelUpdate res_var = (*val->contents.result);
4553 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4554 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4555 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4559 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4560 CHECK(!val->result_ok);
4561 LDKDecodeError err_var = (*val->contents.err);
4562 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4563 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4564 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4567 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
4568 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4570 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
4571 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4572 CHECK(val->result_ok);
4573 LDKErrorMessage res_var = (*val->contents.result);
4574 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4575 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4576 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4579 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
4580 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4581 CHECK(!val->result_ok);
4582 LDKDecodeError err_var = (*val->contents.err);
4583 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4584 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4585 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4588 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4589 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4591 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4592 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4593 CHECK(val->result_ok);
4594 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4595 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4596 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4597 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4600 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4601 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4602 CHECK(!val->result_ok);
4603 LDKDecodeError err_var = (*val->contents.err);
4604 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4605 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4606 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4609 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4610 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4612 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4613 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4614 CHECK(val->result_ok);
4615 LDKNodeAnnouncement res_var = (*val->contents.result);
4616 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4617 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4618 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4621 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4622 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4623 CHECK(!val->result_ok);
4624 LDKDecodeError err_var = (*val->contents.err);
4625 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4626 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4627 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4630 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
4631 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4633 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
4634 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4635 CHECK(val->result_ok);
4636 LDKQueryShortChannelIds res_var = (*val->contents.result);
4637 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4638 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4639 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4642 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
4643 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4644 CHECK(!val->result_ok);
4645 LDKDecodeError err_var = (*val->contents.err);
4646 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4647 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4648 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4651 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
4652 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4654 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
4655 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4656 CHECK(val->result_ok);
4657 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4658 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4659 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4660 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4663 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
4664 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4665 CHECK(!val->result_ok);
4666 LDKDecodeError err_var = (*val->contents.err);
4667 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4668 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4669 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4672 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4673 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4675 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4676 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4677 CHECK(val->result_ok);
4678 LDKQueryChannelRange res_var = (*val->contents.result);
4679 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4680 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4681 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4684 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4685 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4686 CHECK(!val->result_ok);
4687 LDKDecodeError err_var = (*val->contents.err);
4688 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4689 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4690 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4693 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
4694 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4696 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
4697 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4698 CHECK(val->result_ok);
4699 LDKReplyChannelRange res_var = (*val->contents.result);
4700 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4701 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4702 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4705 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
4706 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4707 CHECK(!val->result_ok);
4708 LDKDecodeError err_var = (*val->contents.err);
4709 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4710 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4711 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4714 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
4715 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4717 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
4718 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4719 CHECK(val->result_ok);
4720 LDKGossipTimestampFilter res_var = (*val->contents.result);
4721 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4722 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4723 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4726 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
4727 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4728 CHECK(!val->result_ok);
4729 LDKDecodeError err_var = (*val->contents.err);
4730 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4731 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4732 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4735 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
4736 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
4738 case LDKSignOrCreationError_SignError: {
4739 return 0 /* LDKSignOrCreationError - SignError */;
4741 case LDKSignOrCreationError_CreationError: {
4742 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
4743 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
4748 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
4749 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
4751 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
4752 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4753 CHECK(val->result_ok);
4754 LDKInvoice res_var = (*val->contents.result);
4755 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4756 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4757 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4760 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
4761 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
4762 CHECK(!val->result_ok);
4763 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
4766 typedef struct LDKMessageSendEventsProvider_JCalls {
4767 atomic_size_t refcnt;
4768 uint32_t get_and_clear_pending_msg_events_meth;
4769 } LDKMessageSendEventsProvider_JCalls;
4770 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4771 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4772 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4773 js_free(j_calls->get_and_clear_pending_msg_events_meth);
4777 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4778 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4779 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
4780 LDKCVec_MessageSendEventZ ret_constr;
4781 ret_constr.datalen = *((uint32_t*)ret);
4782 if (ret_constr.datalen > 0)
4783 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4785 ret_constr.data = NULL;
4786 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4787 for (size_t s = 0; s < ret_constr.datalen; s++) {
4788 uint32_t ret_conv_18 = ret_vals[s];
4789 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4790 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
4791 ret_constr.data[s] = ret_conv_18_conv;
4795 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
4796 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
4797 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4799 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4800 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4801 atomic_init(&calls->refcnt, 1);
4802 //TODO: Assign calls->o from o
4804 LDKMessageSendEventsProvider ret = {
4805 .this_arg = (void*) calls,
4806 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4807 .free = LDKMessageSendEventsProvider_JCalls_free,
4811 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4812 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4813 *res_ptr = LDKMessageSendEventsProvider_init(o);
4814 return (long)res_ptr;
4816 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
4817 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4818 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4819 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4820 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4821 for (size_t s = 0; s < ret_var.datalen; s++) {
4822 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4823 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4824 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
4825 ret_arr_ptr[s] = ret_conv_18_ref;
4831 typedef struct LDKEventHandler_JCalls {
4832 atomic_size_t refcnt;
4833 uint32_t handle_event_meth;
4834 } LDKEventHandler_JCalls;
4835 static void LDKEventHandler_JCalls_free(void* this_arg) {
4836 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4837 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4838 js_free(j_calls->handle_event_meth);
4842 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
4843 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
4844 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4845 *event_copy = event;
4846 uint64_t event_ref = (uint64_t)event_copy;
4847 js_invoke_function_1(j_calls->handle_event_meth, event_ref);
4849 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
4850 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
4851 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4853 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
4854 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
4855 atomic_init(&calls->refcnt, 1);
4856 //TODO: Assign calls->o from o
4858 LDKEventHandler ret = {
4859 .this_arg = (void*) calls,
4860 .handle_event = handle_event_LDKEventHandler_jcall,
4861 .free = LDKEventHandler_JCalls_free,
4865 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
4866 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4867 *res_ptr = LDKEventHandler_init(o);
4868 return (long)res_ptr;
4870 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
4871 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
4872 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
4873 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
4876 typedef struct LDKEventsProvider_JCalls {
4877 atomic_size_t refcnt;
4878 uint32_t process_pending_events_meth;
4879 } LDKEventsProvider_JCalls;
4880 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4881 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4882 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4883 js_free(j_calls->process_pending_events_meth);
4887 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
4888 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4889 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
4891 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)ret);
4893 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
4894 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
4895 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4897 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
4898 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4899 atomic_init(&calls->refcnt, 1);
4900 //TODO: Assign calls->o from o
4902 LDKEventsProvider ret = {
4903 .this_arg = (void*) calls,
4904 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
4905 .free = LDKEventsProvider_JCalls_free,
4909 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4910 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4911 *res_ptr = LDKEventsProvider_init(o);
4912 return (long)res_ptr;
4914 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
4915 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4916 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
4917 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
4920 typedef struct LDKAccess_JCalls {
4921 atomic_size_t refcnt;
4922 uint32_t get_utxo_meth;
4924 static void LDKAccess_JCalls_free(void* this_arg) {
4925 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4926 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4927 js_free(j_calls->get_utxo_meth);
4931 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4932 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4933 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4934 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4935 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4936 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4937 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4940 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4941 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4942 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4944 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4945 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4946 atomic_init(&calls->refcnt, 1);
4947 //TODO: Assign calls->o from o
4950 .this_arg = (void*) calls,
4951 .get_utxo = get_utxo_LDKAccess_jcall,
4952 .free = LDKAccess_JCalls_free,
4956 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4957 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4958 *res_ptr = LDKAccess_init(o);
4959 return (long)res_ptr;
4961 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4962 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4963 unsigned char genesis_hash_arr[32];
4964 CHECK(*((uint32_t*)genesis_hash) == 32);
4965 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4966 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4967 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4968 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4969 return (uint64_t)ret_conv;
4972 typedef struct LDKListen_JCalls {
4973 atomic_size_t refcnt;
4974 uint32_t block_connected_meth;
4975 uint32_t block_disconnected_meth;
4977 static void LDKListen_JCalls_free(void* this_arg) {
4978 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4979 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4980 js_free(j_calls->block_connected_meth);
4981 js_free(j_calls->block_disconnected_meth);
4985 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4986 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4987 LDKu8slice block_var = block;
4988 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4989 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4990 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4992 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4993 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4994 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4995 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4996 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4998 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
4999 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5000 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5002 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5003 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5004 atomic_init(&calls->refcnt, 1);
5005 //TODO: Assign calls->o from o
5008 .this_arg = (void*) calls,
5009 .block_connected = block_connected_LDKListen_jcall,
5010 .block_disconnected = block_disconnected_LDKListen_jcall,
5011 .free = LDKListen_JCalls_free,
5015 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5016 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5017 *res_ptr = LDKListen_init(o);
5018 return (long)res_ptr;
5020 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5021 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5022 LDKu8slice block_ref;
5023 block_ref.datalen = *((uint32_t*)block);
5024 block_ref.data = (int8_t*)(block + 4);
5025 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5028 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5029 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5030 unsigned char header_arr[80];
5031 CHECK(*((uint32_t*)header) == 80);
5032 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5033 unsigned char (*header_ref)[80] = &header_arr;
5034 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5037 typedef struct LDKConfirm_JCalls {
5038 atomic_size_t refcnt;
5039 uint32_t transactions_confirmed_meth;
5040 uint32_t transaction_unconfirmed_meth;
5041 uint32_t best_block_updated_meth;
5042 uint32_t get_relevant_txids_meth;
5043 } LDKConfirm_JCalls;
5044 static void LDKConfirm_JCalls_free(void* this_arg) {
5045 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5046 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5047 js_free(j_calls->transactions_confirmed_meth);
5048 js_free(j_calls->transaction_unconfirmed_meth);
5049 js_free(j_calls->best_block_updated_meth);
5050 js_free(j_calls->get_relevant_txids_meth);
5054 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5055 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5056 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5057 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5058 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5059 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5060 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5061 for (size_t e = 0; e < txdata_var.datalen; e++) {
5062 LDKC2Tuple_usizeTransactionZ* txdata_conv_30_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5063 *txdata_conv_30_ref = txdata_var.data[e];
5064 txdata_arr_ptr[e] = (uint64_t)txdata_conv_30_ref;
5066 FREE(txdata_var.data);
5067 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5069 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5070 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5071 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5072 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5073 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5075 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5076 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5077 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5078 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5079 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5081 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5082 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5083 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5084 LDKCVec_TxidZ ret_constr;
5085 ret_constr.datalen = *((uint32_t*)ret);
5086 if (ret_constr.datalen > 0)
5087 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5089 ret_constr.data = NULL;
5090 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5091 for (size_t m = 0; m < ret_constr.datalen; m++) {
5092 int8_tArray ret_conv_12 = ret_vals[m];
5093 LDKThirtyTwoBytes ret_conv_12_ref;
5094 CHECK(*((uint32_t*)ret_conv_12) == 32);
5095 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5096 ret_constr.data[m] = ret_conv_12_ref;
5100 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5101 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5102 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5104 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5105 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5106 atomic_init(&calls->refcnt, 1);
5107 //TODO: Assign calls->o from o
5110 .this_arg = (void*) calls,
5111 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5112 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5113 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5114 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5115 .free = LDKConfirm_JCalls_free,
5119 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5120 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5121 *res_ptr = LDKConfirm_init(o);
5122 return (long)res_ptr;
5124 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5125 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5126 unsigned char header_arr[80];
5127 CHECK(*((uint32_t*)header) == 80);
5128 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5129 unsigned char (*header_ref)[80] = &header_arr;
5130 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5131 txdata_constr.datalen = *((uint32_t*)txdata);
5132 if (txdata_constr.datalen > 0)
5133 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5135 txdata_constr.data = NULL;
5136 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5137 for (size_t e = 0; e < txdata_constr.datalen; e++) {
5138 uint32_t txdata_conv_30 = txdata_vals[e];
5139 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
5140 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
5141 txdata_constr.data[e] = txdata_conv_30_conv;
5143 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5146 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5147 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5148 unsigned char txid_arr[32];
5149 CHECK(*((uint32_t*)txid) == 32);
5150 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5151 unsigned char (*txid_ref)[32] = &txid_arr;
5152 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5155 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5156 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5157 unsigned char header_arr[80];
5158 CHECK(*((uint32_t*)header) == 80);
5159 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5160 unsigned char (*header_ref)[80] = &header_arr;
5161 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5164 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5165 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5166 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5167 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5168 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5169 for (size_t m = 0; m < ret_var.datalen; m++) {
5170 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5171 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5172 ret_arr_ptr[m] = ret_conv_12_arr;
5178 typedef struct LDKFilter_JCalls {
5179 atomic_size_t refcnt;
5180 uint32_t register_tx_meth;
5181 uint32_t register_output_meth;
5183 static void LDKFilter_JCalls_free(void* this_arg) {
5184 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5185 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5186 js_free(j_calls->register_tx_meth);
5187 js_free(j_calls->register_output_meth);
5191 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5192 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5193 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5194 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5195 LDKu8slice script_pubkey_var = script_pubkey;
5196 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5197 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5198 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5200 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5201 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5202 LDKWatchedOutput output_var = output;
5203 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5204 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5205 uint64_t output_ref = (uint64_t)output_var.inner;
5206 if (output_var.is_owned) {
5209 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5210 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5211 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5214 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5215 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5216 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5218 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5219 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5220 atomic_init(&calls->refcnt, 1);
5221 //TODO: Assign calls->o from o
5224 .this_arg = (void*) calls,
5225 .register_tx = register_tx_LDKFilter_jcall,
5226 .register_output = register_output_LDKFilter_jcall,
5227 .free = LDKFilter_JCalls_free,
5231 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5232 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5233 *res_ptr = LDKFilter_init(o);
5234 return (long)res_ptr;
5236 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5237 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5238 unsigned char txid_arr[32];
5239 CHECK(*((uint32_t*)txid) == 32);
5240 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5241 unsigned char (*txid_ref)[32] = &txid_arr;
5242 LDKu8slice script_pubkey_ref;
5243 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5244 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5245 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5248 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5249 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5250 LDKWatchedOutput output_conv;
5251 output_conv.inner = (void*)(output & (~1));
5252 output_conv.is_owned = (output & 1) || (output == 0);
5253 output_conv = WatchedOutput_clone(&output_conv);
5254 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5255 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5256 uint64_t ret_ref = (uint64_t)ret_copy;
5260 typedef struct LDKPersist_JCalls {
5261 atomic_size_t refcnt;
5262 uint32_t persist_new_channel_meth;
5263 uint32_t update_persisted_channel_meth;
5264 } LDKPersist_JCalls;
5265 static void LDKPersist_JCalls_free(void* this_arg) {
5266 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5267 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5268 js_free(j_calls->persist_new_channel_meth);
5269 js_free(j_calls->update_persisted_channel_meth);
5273 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5274 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5275 LDKOutPoint id_var = id;
5276 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5277 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5278 uint64_t id_ref = (uint64_t)id_var.inner;
5279 if (id_var.is_owned) {
5282 LDKChannelMonitor data_var = *data;
5283 data_var = ChannelMonitor_clone(data);
5284 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5285 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5286 uint64_t data_ref = (uint64_t)data_var.inner;
5287 if (data_var.is_owned) {
5290 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5291 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5292 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5295 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5296 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5297 LDKOutPoint id_var = id;
5298 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5299 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5300 uint64_t id_ref = (uint64_t)id_var.inner;
5301 if (id_var.is_owned) {
5304 LDKChannelMonitorUpdate update_var = *update;
5305 update_var = ChannelMonitorUpdate_clone(update);
5306 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5307 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5308 uint64_t update_ref = (uint64_t)update_var.inner;
5309 if (update_var.is_owned) {
5312 LDKChannelMonitor data_var = *data;
5313 data_var = ChannelMonitor_clone(data);
5314 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5315 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5316 uint64_t data_ref = (uint64_t)data_var.inner;
5317 if (data_var.is_owned) {
5320 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5321 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5322 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5325 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5326 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5327 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5329 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5330 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5331 atomic_init(&calls->refcnt, 1);
5332 //TODO: Assign calls->o from o
5335 .this_arg = (void*) calls,
5336 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5337 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5338 .free = LDKPersist_JCalls_free,
5342 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5343 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5344 *res_ptr = LDKPersist_init(o);
5345 return (long)res_ptr;
5347 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5348 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5349 LDKOutPoint id_conv;
5350 id_conv.inner = (void*)(id & (~1));
5351 id_conv.is_owned = (id & 1) || (id == 0);
5352 id_conv = OutPoint_clone(&id_conv);
5353 LDKChannelMonitor data_conv;
5354 data_conv.inner = (void*)(data & (~1));
5355 data_conv.is_owned = false;
5356 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5357 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5358 return (uint64_t)ret_conv;
5361 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5362 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5363 LDKOutPoint id_conv;
5364 id_conv.inner = (void*)(id & (~1));
5365 id_conv.is_owned = (id & 1) || (id == 0);
5366 id_conv = OutPoint_clone(&id_conv);
5367 LDKChannelMonitorUpdate update_conv;
5368 update_conv.inner = (void*)(update & (~1));
5369 update_conv.is_owned = false;
5370 LDKChannelMonitor data_conv;
5371 data_conv.inner = (void*)(data & (~1));
5372 data_conv.is_owned = false;
5373 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5374 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5375 return (uint64_t)ret_conv;
5378 typedef struct LDKChannelMessageHandler_JCalls {
5379 atomic_size_t refcnt;
5380 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5381 uint32_t handle_open_channel_meth;
5382 uint32_t handle_accept_channel_meth;
5383 uint32_t handle_funding_created_meth;
5384 uint32_t handle_funding_signed_meth;
5385 uint32_t handle_funding_locked_meth;
5386 uint32_t handle_shutdown_meth;
5387 uint32_t handle_closing_signed_meth;
5388 uint32_t handle_update_add_htlc_meth;
5389 uint32_t handle_update_fulfill_htlc_meth;
5390 uint32_t handle_update_fail_htlc_meth;
5391 uint32_t handle_update_fail_malformed_htlc_meth;
5392 uint32_t handle_commitment_signed_meth;
5393 uint32_t handle_revoke_and_ack_meth;
5394 uint32_t handle_update_fee_meth;
5395 uint32_t handle_announcement_signatures_meth;
5396 uint32_t peer_disconnected_meth;
5397 uint32_t peer_connected_meth;
5398 uint32_t handle_channel_reestablish_meth;
5399 uint32_t handle_channel_update_meth;
5400 uint32_t handle_error_meth;
5401 } LDKChannelMessageHandler_JCalls;
5402 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5403 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5404 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5405 js_free(j_calls->handle_open_channel_meth);
5406 js_free(j_calls->handle_accept_channel_meth);
5407 js_free(j_calls->handle_funding_created_meth);
5408 js_free(j_calls->handle_funding_signed_meth);
5409 js_free(j_calls->handle_funding_locked_meth);
5410 js_free(j_calls->handle_shutdown_meth);
5411 js_free(j_calls->handle_closing_signed_meth);
5412 js_free(j_calls->handle_update_add_htlc_meth);
5413 js_free(j_calls->handle_update_fulfill_htlc_meth);
5414 js_free(j_calls->handle_update_fail_htlc_meth);
5415 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5416 js_free(j_calls->handle_commitment_signed_meth);
5417 js_free(j_calls->handle_revoke_and_ack_meth);
5418 js_free(j_calls->handle_update_fee_meth);
5419 js_free(j_calls->handle_announcement_signatures_meth);
5420 js_free(j_calls->peer_disconnected_meth);
5421 js_free(j_calls->peer_connected_meth);
5422 js_free(j_calls->handle_channel_reestablish_meth);
5423 js_free(j_calls->handle_channel_update_meth);
5424 js_free(j_calls->handle_error_meth);
5428 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5429 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5430 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5431 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5432 LDKInitFeatures their_features_var = their_features;
5433 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5434 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5435 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5436 if (their_features_var.is_owned) {
5437 their_features_ref |= 1;
5439 LDKOpenChannel msg_var = *msg;
5440 msg_var = OpenChannel_clone(msg);
5441 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5442 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5443 uint64_t msg_ref = (uint64_t)msg_var.inner;
5444 if (msg_var.is_owned) {
5447 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5449 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5450 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5451 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5452 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5453 LDKInitFeatures their_features_var = their_features;
5454 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5455 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5456 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5457 if (their_features_var.is_owned) {
5458 their_features_ref |= 1;
5460 LDKAcceptChannel msg_var = *msg;
5461 msg_var = AcceptChannel_clone(msg);
5462 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5463 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5464 uint64_t msg_ref = (uint64_t)msg_var.inner;
5465 if (msg_var.is_owned) {
5468 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5470 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5471 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5472 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5473 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5474 LDKFundingCreated msg_var = *msg;
5475 msg_var = FundingCreated_clone(msg);
5476 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5477 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5478 uint64_t msg_ref = (uint64_t)msg_var.inner;
5479 if (msg_var.is_owned) {
5482 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5484 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5485 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5486 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5487 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5488 LDKFundingSigned msg_var = *msg;
5489 msg_var = FundingSigned_clone(msg);
5490 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5491 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5492 uint64_t msg_ref = (uint64_t)msg_var.inner;
5493 if (msg_var.is_owned) {
5496 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5498 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5499 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5500 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5501 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5502 LDKFundingLocked msg_var = *msg;
5503 msg_var = FundingLocked_clone(msg);
5504 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5505 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5506 uint64_t msg_ref = (uint64_t)msg_var.inner;
5507 if (msg_var.is_owned) {
5510 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5512 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5513 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5514 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5515 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5516 LDKInitFeatures their_features_var = *their_features;
5517 their_features_var = InitFeatures_clone(their_features);
5518 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5519 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5520 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5521 if (their_features_var.is_owned) {
5522 their_features_ref |= 1;
5524 LDKShutdown msg_var = *msg;
5525 msg_var = Shutdown_clone(msg);
5526 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5527 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5528 uint64_t msg_ref = (uint64_t)msg_var.inner;
5529 if (msg_var.is_owned) {
5532 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5534 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5535 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5536 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5537 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5538 LDKClosingSigned msg_var = *msg;
5539 msg_var = ClosingSigned_clone(msg);
5540 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5541 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5542 uint64_t msg_ref = (uint64_t)msg_var.inner;
5543 if (msg_var.is_owned) {
5546 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5548 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5549 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5550 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5551 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5552 LDKUpdateAddHTLC msg_var = *msg;
5553 msg_var = UpdateAddHTLC_clone(msg);
5554 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5555 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5556 uint64_t msg_ref = (uint64_t)msg_var.inner;
5557 if (msg_var.is_owned) {
5560 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5562 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5563 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5564 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5565 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5566 LDKUpdateFulfillHTLC msg_var = *msg;
5567 msg_var = UpdateFulfillHTLC_clone(msg);
5568 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5569 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5570 uint64_t msg_ref = (uint64_t)msg_var.inner;
5571 if (msg_var.is_owned) {
5574 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5576 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5577 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5578 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5579 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5580 LDKUpdateFailHTLC msg_var = *msg;
5581 msg_var = UpdateFailHTLC_clone(msg);
5582 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5583 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5584 uint64_t msg_ref = (uint64_t)msg_var.inner;
5585 if (msg_var.is_owned) {
5588 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5590 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5591 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5592 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5593 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5594 LDKUpdateFailMalformedHTLC msg_var = *msg;
5595 msg_var = UpdateFailMalformedHTLC_clone(msg);
5596 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5597 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5598 uint64_t msg_ref = (uint64_t)msg_var.inner;
5599 if (msg_var.is_owned) {
5602 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5604 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5605 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5606 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5607 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5608 LDKCommitmentSigned msg_var = *msg;
5609 msg_var = CommitmentSigned_clone(msg);
5610 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5611 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5612 uint64_t msg_ref = (uint64_t)msg_var.inner;
5613 if (msg_var.is_owned) {
5616 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5618 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5619 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5620 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5621 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5622 LDKRevokeAndACK msg_var = *msg;
5623 msg_var = RevokeAndACK_clone(msg);
5624 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5625 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5626 uint64_t msg_ref = (uint64_t)msg_var.inner;
5627 if (msg_var.is_owned) {
5630 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5632 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5633 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5634 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5635 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5636 LDKUpdateFee msg_var = *msg;
5637 msg_var = UpdateFee_clone(msg);
5638 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5639 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5640 uint64_t msg_ref = (uint64_t)msg_var.inner;
5641 if (msg_var.is_owned) {
5644 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5646 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5647 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5648 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5649 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5650 LDKAnnouncementSignatures msg_var = *msg;
5651 msg_var = AnnouncementSignatures_clone(msg);
5652 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5653 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5654 uint64_t msg_ref = (uint64_t)msg_var.inner;
5655 if (msg_var.is_owned) {
5658 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5660 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5661 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5662 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5663 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5664 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5666 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5667 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5668 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5669 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5670 LDKInit msg_var = *msg;
5671 msg_var = Init_clone(msg);
5672 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5673 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5674 uint64_t msg_ref = (uint64_t)msg_var.inner;
5675 if (msg_var.is_owned) {
5678 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5680 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5681 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5682 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5683 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5684 LDKChannelReestablish msg_var = *msg;
5685 msg_var = ChannelReestablish_clone(msg);
5686 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5687 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5688 uint64_t msg_ref = (uint64_t)msg_var.inner;
5689 if (msg_var.is_owned) {
5692 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5694 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
5695 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5696 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5697 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5698 LDKChannelUpdate msg_var = *msg;
5699 msg_var = ChannelUpdate_clone(msg);
5700 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5701 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5702 uint64_t msg_ref = (uint64_t)msg_var.inner;
5703 if (msg_var.is_owned) {
5706 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
5708 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5709 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5710 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5711 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5712 LDKErrorMessage msg_var = *msg;
5713 msg_var = ErrorMessage_clone(msg);
5714 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5715 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5716 uint64_t msg_ref = (uint64_t)msg_var.inner;
5717 if (msg_var.is_owned) {
5720 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5722 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
5723 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
5724 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5725 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5727 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5728 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5729 atomic_init(&calls->refcnt, 1);
5730 //TODO: Assign calls->o from o
5732 LDKChannelMessageHandler ret = {
5733 .this_arg = (void*) calls,
5734 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
5735 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
5736 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
5737 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
5738 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
5739 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
5740 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
5741 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
5742 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
5743 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
5744 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
5745 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
5746 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
5747 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
5748 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
5749 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
5750 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
5751 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
5752 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
5753 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
5754 .free = LDKChannelMessageHandler_JCalls_free,
5755 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5757 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5760 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5761 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5762 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
5763 return (long)res_ptr;
5765 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) {
5766 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5767 LDKPublicKey their_node_id_ref;
5768 CHECK(*((uint32_t*)their_node_id) == 33);
5769 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5770 LDKInitFeatures their_features_conv;
5771 their_features_conv.inner = (void*)(their_features & (~1));
5772 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5773 their_features_conv = InitFeatures_clone(&their_features_conv);
5774 LDKOpenChannel msg_conv;
5775 msg_conv.inner = (void*)(msg & (~1));
5776 msg_conv.is_owned = false;
5777 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5780 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) {
5781 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5782 LDKPublicKey their_node_id_ref;
5783 CHECK(*((uint32_t*)their_node_id) == 33);
5784 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5785 LDKInitFeatures their_features_conv;
5786 their_features_conv.inner = (void*)(their_features & (~1));
5787 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5788 their_features_conv = InitFeatures_clone(&their_features_conv);
5789 LDKAcceptChannel msg_conv;
5790 msg_conv.inner = (void*)(msg & (~1));
5791 msg_conv.is_owned = false;
5792 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5795 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5796 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5797 LDKPublicKey their_node_id_ref;
5798 CHECK(*((uint32_t*)their_node_id) == 33);
5799 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5800 LDKFundingCreated msg_conv;
5801 msg_conv.inner = (void*)(msg & (~1));
5802 msg_conv.is_owned = false;
5803 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5806 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5807 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5808 LDKPublicKey their_node_id_ref;
5809 CHECK(*((uint32_t*)their_node_id) == 33);
5810 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5811 LDKFundingSigned msg_conv;
5812 msg_conv.inner = (void*)(msg & (~1));
5813 msg_conv.is_owned = false;
5814 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5817 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5818 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5819 LDKPublicKey their_node_id_ref;
5820 CHECK(*((uint32_t*)their_node_id) == 33);
5821 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5822 LDKFundingLocked msg_conv;
5823 msg_conv.inner = (void*)(msg & (~1));
5824 msg_conv.is_owned = false;
5825 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5828 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
5829 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5830 LDKPublicKey their_node_id_ref;
5831 CHECK(*((uint32_t*)their_node_id) == 33);
5832 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5833 LDKInitFeatures their_features_conv;
5834 their_features_conv.inner = (void*)(their_features & (~1));
5835 their_features_conv.is_owned = false;
5836 LDKShutdown msg_conv;
5837 msg_conv.inner = (void*)(msg & (~1));
5838 msg_conv.is_owned = false;
5839 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5842 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5843 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5844 LDKPublicKey their_node_id_ref;
5845 CHECK(*((uint32_t*)their_node_id) == 33);
5846 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5847 LDKClosingSigned msg_conv;
5848 msg_conv.inner = (void*)(msg & (~1));
5849 msg_conv.is_owned = false;
5850 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5853 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5854 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5855 LDKPublicKey their_node_id_ref;
5856 CHECK(*((uint32_t*)their_node_id) == 33);
5857 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5858 LDKUpdateAddHTLC msg_conv;
5859 msg_conv.inner = (void*)(msg & (~1));
5860 msg_conv.is_owned = false;
5861 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5864 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5865 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5866 LDKPublicKey their_node_id_ref;
5867 CHECK(*((uint32_t*)their_node_id) == 33);
5868 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5869 LDKUpdateFulfillHTLC msg_conv;
5870 msg_conv.inner = (void*)(msg & (~1));
5871 msg_conv.is_owned = false;
5872 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5875 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5876 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5877 LDKPublicKey their_node_id_ref;
5878 CHECK(*((uint32_t*)their_node_id) == 33);
5879 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5880 LDKUpdateFailHTLC msg_conv;
5881 msg_conv.inner = (void*)(msg & (~1));
5882 msg_conv.is_owned = false;
5883 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5886 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5887 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5888 LDKPublicKey their_node_id_ref;
5889 CHECK(*((uint32_t*)their_node_id) == 33);
5890 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5891 LDKUpdateFailMalformedHTLC msg_conv;
5892 msg_conv.inner = (void*)(msg & (~1));
5893 msg_conv.is_owned = false;
5894 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5897 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5898 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5899 LDKPublicKey their_node_id_ref;
5900 CHECK(*((uint32_t*)their_node_id) == 33);
5901 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5902 LDKCommitmentSigned msg_conv;
5903 msg_conv.inner = (void*)(msg & (~1));
5904 msg_conv.is_owned = false;
5905 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5908 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5909 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5910 LDKPublicKey their_node_id_ref;
5911 CHECK(*((uint32_t*)their_node_id) == 33);
5912 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5913 LDKRevokeAndACK msg_conv;
5914 msg_conv.inner = (void*)(msg & (~1));
5915 msg_conv.is_owned = false;
5916 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5919 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5920 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5921 LDKPublicKey their_node_id_ref;
5922 CHECK(*((uint32_t*)their_node_id) == 33);
5923 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5924 LDKUpdateFee msg_conv;
5925 msg_conv.inner = (void*)(msg & (~1));
5926 msg_conv.is_owned = false;
5927 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5930 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5931 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5932 LDKPublicKey their_node_id_ref;
5933 CHECK(*((uint32_t*)their_node_id) == 33);
5934 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5935 LDKAnnouncementSignatures msg_conv;
5936 msg_conv.inner = (void*)(msg & (~1));
5937 msg_conv.is_owned = false;
5938 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5941 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5942 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5943 LDKPublicKey their_node_id_ref;
5944 CHECK(*((uint32_t*)their_node_id) == 33);
5945 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5946 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5949 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5950 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5951 LDKPublicKey their_node_id_ref;
5952 CHECK(*((uint32_t*)their_node_id) == 33);
5953 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5955 msg_conv.inner = (void*)(msg & (~1));
5956 msg_conv.is_owned = false;
5957 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5960 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5961 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5962 LDKPublicKey their_node_id_ref;
5963 CHECK(*((uint32_t*)their_node_id) == 33);
5964 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5965 LDKChannelReestablish msg_conv;
5966 msg_conv.inner = (void*)(msg & (~1));
5967 msg_conv.is_owned = false;
5968 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5971 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5972 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5973 LDKPublicKey their_node_id_ref;
5974 CHECK(*((uint32_t*)their_node_id) == 33);
5975 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5976 LDKChannelUpdate msg_conv;
5977 msg_conv.inner = (void*)(msg & (~1));
5978 msg_conv.is_owned = false;
5979 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5982 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5983 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5984 LDKPublicKey their_node_id_ref;
5985 CHECK(*((uint32_t*)their_node_id) == 33);
5986 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5987 LDKErrorMessage msg_conv;
5988 msg_conv.inner = (void*)(msg & (~1));
5989 msg_conv.is_owned = false;
5990 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5993 typedef struct LDKRoutingMessageHandler_JCalls {
5994 atomic_size_t refcnt;
5995 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5996 uint32_t handle_node_announcement_meth;
5997 uint32_t handle_channel_announcement_meth;
5998 uint32_t handle_channel_update_meth;
5999 uint32_t handle_htlc_fail_channel_update_meth;
6000 uint32_t get_next_channel_announcements_meth;
6001 uint32_t get_next_node_announcements_meth;
6002 uint32_t sync_routing_table_meth;
6003 uint32_t handle_reply_channel_range_meth;
6004 uint32_t handle_reply_short_channel_ids_end_meth;
6005 uint32_t handle_query_channel_range_meth;
6006 uint32_t handle_query_short_channel_ids_meth;
6007 } LDKRoutingMessageHandler_JCalls;
6008 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6009 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6010 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6011 js_free(j_calls->handle_node_announcement_meth);
6012 js_free(j_calls->handle_channel_announcement_meth);
6013 js_free(j_calls->handle_channel_update_meth);
6014 js_free(j_calls->handle_htlc_fail_channel_update_meth);
6015 js_free(j_calls->get_next_channel_announcements_meth);
6016 js_free(j_calls->get_next_node_announcements_meth);
6017 js_free(j_calls->sync_routing_table_meth);
6018 js_free(j_calls->handle_reply_channel_range_meth);
6019 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6020 js_free(j_calls->handle_query_channel_range_meth);
6021 js_free(j_calls->handle_query_short_channel_ids_meth);
6025 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6026 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6027 LDKNodeAnnouncement msg_var = *msg;
6028 msg_var = NodeAnnouncement_clone(msg);
6029 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6030 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6031 uint64_t msg_ref = (uint64_t)msg_var.inner;
6032 if (msg_var.is_owned) {
6035 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6036 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6037 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6040 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6041 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6042 LDKChannelAnnouncement msg_var = *msg;
6043 msg_var = ChannelAnnouncement_clone(msg);
6044 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6045 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6046 uint64_t msg_ref = (uint64_t)msg_var.inner;
6047 if (msg_var.is_owned) {
6050 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6051 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6052 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6055 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6056 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6057 LDKChannelUpdate msg_var = *msg;
6058 msg_var = ChannelUpdate_clone(msg);
6059 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6060 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6061 uint64_t msg_ref = (uint64_t)msg_var.inner;
6062 if (msg_var.is_owned) {
6065 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6066 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6067 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6070 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
6071 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6072 uint64_t ret_update = (uint64_t)update;
6073 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
6075 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6076 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6077 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6078 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6079 ret_constr.datalen = *((uint32_t*)ret);
6080 if (ret_constr.datalen > 0)
6081 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6083 ret_constr.data = NULL;
6084 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6085 for (size_t l = 0; l < ret_constr.datalen; l++) {
6086 uint32_t ret_conv_63 = ret_vals[l];
6087 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
6088 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
6089 ret_constr.data[l] = ret_conv_63_conv;
6093 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6094 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6095 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6096 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6097 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6098 LDKCVec_NodeAnnouncementZ ret_constr;
6099 ret_constr.datalen = *((uint32_t*)ret);
6100 if (ret_constr.datalen > 0)
6101 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6103 ret_constr.data = NULL;
6104 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6105 for (size_t s = 0; s < ret_constr.datalen; s++) {
6106 uint32_t ret_conv_18 = ret_vals[s];
6107 LDKNodeAnnouncement ret_conv_18_conv;
6108 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6109 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6110 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6111 ret_constr.data[s] = ret_conv_18_conv;
6115 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6116 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6117 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6118 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6119 LDKInit init_var = *init;
6120 init_var = Init_clone(init);
6121 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6122 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6123 uint64_t init_ref = (uint64_t)init_var.inner;
6124 if (init_var.is_owned) {
6127 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6129 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6130 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6131 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6132 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6133 LDKReplyChannelRange msg_var = msg;
6134 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6135 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6136 uint64_t msg_ref = (uint64_t)msg_var.inner;
6137 if (msg_var.is_owned) {
6140 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6141 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6142 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6145 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6146 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6147 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6148 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6149 LDKReplyShortChannelIdsEnd msg_var = msg;
6150 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6151 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6152 uint64_t msg_ref = (uint64_t)msg_var.inner;
6153 if (msg_var.is_owned) {
6156 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6157 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6158 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6161 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6162 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6163 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6164 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6165 LDKQueryChannelRange msg_var = msg;
6166 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6167 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6168 uint64_t msg_ref = (uint64_t)msg_var.inner;
6169 if (msg_var.is_owned) {
6172 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6173 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6174 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6177 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6178 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6179 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6180 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6181 LDKQueryShortChannelIds msg_var = msg;
6182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6184 uint64_t msg_ref = (uint64_t)msg_var.inner;
6185 if (msg_var.is_owned) {
6188 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6189 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6190 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6193 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6194 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6195 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6196 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6198 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6199 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6200 atomic_init(&calls->refcnt, 1);
6201 //TODO: Assign calls->o from o
6203 LDKRoutingMessageHandler ret = {
6204 .this_arg = (void*) calls,
6205 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6206 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6207 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6208 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
6209 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6210 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6211 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6212 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6213 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6214 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6215 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6216 .free = LDKRoutingMessageHandler_JCalls_free,
6217 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6219 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6222 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6223 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6224 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6225 return (long)res_ptr;
6227 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6228 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6229 LDKNodeAnnouncement msg_conv;
6230 msg_conv.inner = (void*)(msg & (~1));
6231 msg_conv.is_owned = false;
6232 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6233 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6234 return (uint64_t)ret_conv;
6237 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6238 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6239 LDKChannelAnnouncement msg_conv;
6240 msg_conv.inner = (void*)(msg & (~1));
6241 msg_conv.is_owned = false;
6242 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6243 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6244 return (uint64_t)ret_conv;
6247 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6248 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6249 LDKChannelUpdate msg_conv;
6250 msg_conv.inner = (void*)(msg & (~1));
6251 msg_conv.is_owned = false;
6252 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6253 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6254 return (uint64_t)ret_conv;
6257 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
6258 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6259 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6260 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6263 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6264 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6265 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6266 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6267 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6268 for (size_t l = 0; l < ret_var.datalen; l++) {
6269 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6270 *ret_conv_63_ref = ret_var.data[l];
6271 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
6277 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6278 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6279 LDKPublicKey starting_point_ref;
6280 CHECK(*((uint32_t*)starting_point) == 33);
6281 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6282 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6283 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6284 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6285 for (size_t s = 0; s < ret_var.datalen; s++) {
6286 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6287 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6288 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6289 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6290 if (ret_conv_18_var.is_owned) {
6291 ret_conv_18_ref |= 1;
6293 ret_arr_ptr[s] = ret_conv_18_ref;
6299 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6300 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6301 LDKPublicKey their_node_id_ref;
6302 CHECK(*((uint32_t*)their_node_id) == 33);
6303 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6305 init_conv.inner = (void*)(init & (~1));
6306 init_conv.is_owned = false;
6307 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6310 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6311 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6312 LDKPublicKey their_node_id_ref;
6313 CHECK(*((uint32_t*)their_node_id) == 33);
6314 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6315 LDKReplyChannelRange msg_conv;
6316 msg_conv.inner = (void*)(msg & (~1));
6317 msg_conv.is_owned = (msg & 1) || (msg == 0);
6318 msg_conv = ReplyChannelRange_clone(&msg_conv);
6319 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6320 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6321 return (uint64_t)ret_conv;
6324 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) {
6325 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6326 LDKPublicKey their_node_id_ref;
6327 CHECK(*((uint32_t*)their_node_id) == 33);
6328 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6329 LDKReplyShortChannelIdsEnd msg_conv;
6330 msg_conv.inner = (void*)(msg & (~1));
6331 msg_conv.is_owned = (msg & 1) || (msg == 0);
6332 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6333 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6334 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6335 return (uint64_t)ret_conv;
6338 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6339 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6340 LDKPublicKey their_node_id_ref;
6341 CHECK(*((uint32_t*)their_node_id) == 33);
6342 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6343 LDKQueryChannelRange msg_conv;
6344 msg_conv.inner = (void*)(msg & (~1));
6345 msg_conv.is_owned = (msg & 1) || (msg == 0);
6346 msg_conv = QueryChannelRange_clone(&msg_conv);
6347 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6348 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6349 return (uint64_t)ret_conv;
6352 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6353 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6354 LDKPublicKey their_node_id_ref;
6355 CHECK(*((uint32_t*)their_node_id) == 33);
6356 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6357 LDKQueryShortChannelIds msg_conv;
6358 msg_conv.inner = (void*)(msg & (~1));
6359 msg_conv.is_owned = (msg & 1) || (msg == 0);
6360 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6361 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6362 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6363 return (uint64_t)ret_conv;
6366 typedef struct LDKSocketDescriptor_JCalls {
6367 atomic_size_t refcnt;
6368 uint32_t send_data_meth;
6369 uint32_t disconnect_socket_meth;
6372 } LDKSocketDescriptor_JCalls;
6373 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6374 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6375 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6376 js_free(j_calls->send_data_meth);
6377 js_free(j_calls->disconnect_socket_meth);
6378 js_free(j_calls->eq_meth);
6379 js_free(j_calls->hash_meth);
6383 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6384 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6385 LDKu8slice data_var = data;
6386 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6387 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
6388 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
6390 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6391 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6392 js_invoke_function_0(j_calls->disconnect_socket_meth);
6394 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6395 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6396 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6397 *other_arg_clone = SocketDescriptor_clone(other_arg);
6398 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
6400 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6401 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6402 return js_invoke_function_0(j_calls->hash_meth);
6404 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
6405 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
6406 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6408 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
6409 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6410 atomic_init(&calls->refcnt, 1);
6411 //TODO: Assign calls->o from o
6413 LDKSocketDescriptor ret = {
6414 .this_arg = (void*) calls,
6415 .send_data = send_data_LDKSocketDescriptor_jcall,
6416 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6417 .eq = eq_LDKSocketDescriptor_jcall,
6418 .hash = hash_LDKSocketDescriptor_jcall,
6419 .cloned = LDKSocketDescriptor_JCalls_cloned,
6420 .free = LDKSocketDescriptor_JCalls_free,
6424 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
6425 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6426 *res_ptr = LDKSocketDescriptor_init(o);
6427 return (long)res_ptr;
6429 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
6430 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6431 LDKu8slice data_ref;
6432 data_ref.datalen = *((uint32_t*)data);
6433 data_ref.data = (int8_t*)(data + 4);
6434 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6438 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
6439 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6440 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6443 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
6444 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6445 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6449 typedef struct LDKChannelManagerPersister_JCalls {
6450 atomic_size_t refcnt;
6451 uint32_t persist_manager_meth;
6452 } LDKChannelManagerPersister_JCalls;
6453 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
6454 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6455 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6456 js_free(j_calls->persist_manager_meth);
6460 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
6461 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6462 LDKChannelManager channel_manager_var = *channel_manager;
6463 // Warning: we may need a move here but no clone is available for LDKChannelManager
6464 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6465 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6466 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
6467 if (channel_manager_var.is_owned) {
6468 channel_manager_ref |= 1;
6470 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
6471 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
6472 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
6475 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
6476 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
6477 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6479 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
6480 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
6481 atomic_init(&calls->refcnt, 1);
6482 //TODO: Assign calls->o from o
6484 LDKChannelManagerPersister ret = {
6485 .this_arg = (void*) calls,
6486 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
6487 .free = LDKChannelManagerPersister_JCalls_free,
6491 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
6492 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
6493 *res_ptr = LDKChannelManagerPersister_init(o);
6494 return (long)res_ptr;
6496 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
6497 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
6498 LDKChannelManager channel_manager_conv;
6499 channel_manager_conv.inner = (void*)(channel_manager & (~1));
6500 channel_manager_conv.is_owned = false;
6501 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
6502 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
6503 return (uint64_t)ret_conv;
6506 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
6507 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
6509 case LDKFallback_SegWitProgram: {
6510 uint8_t version_val = obj->seg_wit_program.version._0;
6511 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
6512 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6513 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
6514 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
6516 case LDKFallback_PubKeyHash: {
6517 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6518 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
6519 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
6521 case LDKFallback_ScriptHash: {
6522 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
6523 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
6524 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
6529 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
6530 LDKStr ret_str = _ldk_get_compiled_version();
6531 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6536 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
6537 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
6538 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6543 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
6544 LDKTransaction _res_ref;
6545 _res_ref.datalen = *((uint32_t*)_res);
6546 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6547 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6548 _res_ref.data_is_owned = true;
6549 Transaction_free(_res_ref);
6552 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
6553 LDKCVec_u8Z script_pubkey_ref;
6554 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
6555 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
6556 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
6557 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6558 *ret_ref = TxOut_new(script_pubkey_ref, value);
6559 return (uint64_t)ret_ref;
6562 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
6563 if ((_res & 1) != 0) return;
6564 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6566 TxOut_free(_res_conv);
6569 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
6570 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6571 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6572 *ret_ref = TxOut_clone(orig_conv);
6573 return (uint64_t)ret_ref;
6576 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
6577 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
6581 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
6583 CHECK(*((uint32_t*)o) == 32);
6584 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
6585 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6586 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6587 return (uint64_t)ret_conv;
6590 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
6591 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6592 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6593 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6594 return (uint64_t)ret_conv;
6597 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
6598 if ((_res & 1) != 0) return;
6599 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6601 CResult_SecretKeyErrorZ_free(_res_conv);
6604 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
6606 CHECK(*((uint32_t*)o) == 33);
6607 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
6608 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6609 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6610 return (uint64_t)ret_conv;
6613 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
6614 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6615 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6616 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6617 return (uint64_t)ret_conv;
6620 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
6621 if ((_res & 1) != 0) return;
6622 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6624 CResult_PublicKeyErrorZ_free(_res_conv);
6627 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
6628 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
6629 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6630 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
6631 return (uint64_t)ret_conv;
6634 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
6635 LDKTxCreationKeys o_conv;
6636 o_conv.inner = (void*)(o & (~1));
6637 o_conv.is_owned = (o & 1) || (o == 0);
6638 o_conv = TxCreationKeys_clone(&o_conv);
6639 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6640 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6641 return (uint64_t)ret_conv;
6644 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
6645 LDKDecodeError e_conv;
6646 e_conv.inner = (void*)(e & (~1));
6647 e_conv.is_owned = (e & 1) || (e == 0);
6648 e_conv = DecodeError_clone(&e_conv);
6649 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6650 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6651 return (uint64_t)ret_conv;
6654 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
6655 if ((_res & 1) != 0) return;
6656 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6658 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6661 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
6662 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6663 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6664 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6665 return (uint64_t)ret_conv;
6668 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
6669 LDKChannelPublicKeys o_conv;
6670 o_conv.inner = (void*)(o & (~1));
6671 o_conv.is_owned = (o & 1) || (o == 0);
6672 o_conv = ChannelPublicKeys_clone(&o_conv);
6673 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6674 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6675 return (uint64_t)ret_conv;
6678 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
6679 LDKDecodeError e_conv;
6680 e_conv.inner = (void*)(e & (~1));
6681 e_conv.is_owned = (e & 1) || (e == 0);
6682 e_conv = DecodeError_clone(&e_conv);
6683 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6684 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6685 return (uint64_t)ret_conv;
6688 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
6689 if ((_res & 1) != 0) return;
6690 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6692 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6695 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
6696 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6697 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6698 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6699 return (uint64_t)ret_conv;
6702 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
6703 LDKTxCreationKeys o_conv;
6704 o_conv.inner = (void*)(o & (~1));
6705 o_conv.is_owned = (o & 1) || (o == 0);
6706 o_conv = TxCreationKeys_clone(&o_conv);
6707 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6708 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6709 return (uint64_t)ret_conv;
6712 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
6713 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
6714 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6715 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6716 return (uint64_t)ret_conv;
6719 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
6720 if ((_res & 1) != 0) return;
6721 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6723 CResult_TxCreationKeysErrorZ_free(_res_conv);
6726 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
6727 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
6728 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6729 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
6730 return (uint64_t)ret_conv;
6733 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
6734 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6735 *ret_copy = COption_u32Z_some(o);
6736 uint64_t ret_ref = (uint64_t)ret_copy;
6740 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
6741 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6742 *ret_copy = COption_u32Z_none();
6743 uint64_t ret_ref = (uint64_t)ret_copy;
6747 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
6748 if ((_res & 1) != 0) return;
6749 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
6751 COption_u32Z_free(_res_conv);
6754 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
6755 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
6756 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6757 *ret_copy = COption_u32Z_clone(orig_conv);
6758 uint64_t ret_ref = (uint64_t)ret_copy;
6762 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
6763 LDKHTLCOutputInCommitment o_conv;
6764 o_conv.inner = (void*)(o & (~1));
6765 o_conv.is_owned = (o & 1) || (o == 0);
6766 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6767 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6768 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6769 return (uint64_t)ret_conv;
6772 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
6773 LDKDecodeError e_conv;
6774 e_conv.inner = (void*)(e & (~1));
6775 e_conv.is_owned = (e & 1) || (e == 0);
6776 e_conv = DecodeError_clone(&e_conv);
6777 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6778 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6779 return (uint64_t)ret_conv;
6782 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
6783 if ((_res & 1) != 0) return;
6784 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6786 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6789 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
6790 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6791 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6792 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6793 return (uint64_t)ret_conv;
6796 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6797 LDKCounterpartyChannelTransactionParameters o_conv;
6798 o_conv.inner = (void*)(o & (~1));
6799 o_conv.is_owned = (o & 1) || (o == 0);
6800 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6801 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6802 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6803 return (uint64_t)ret_conv;
6806 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6807 LDKDecodeError e_conv;
6808 e_conv.inner = (void*)(e & (~1));
6809 e_conv.is_owned = (e & 1) || (e == 0);
6810 e_conv = DecodeError_clone(&e_conv);
6811 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6812 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6813 return (uint64_t)ret_conv;
6816 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6817 if ((_res & 1) != 0) return;
6818 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6820 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6823 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6824 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6825 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6826 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6827 return (uint64_t)ret_conv;
6830 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
6831 LDKChannelTransactionParameters o_conv;
6832 o_conv.inner = (void*)(o & (~1));
6833 o_conv.is_owned = (o & 1) || (o == 0);
6834 o_conv = ChannelTransactionParameters_clone(&o_conv);
6835 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6836 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6837 return (uint64_t)ret_conv;
6840 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
6841 LDKDecodeError e_conv;
6842 e_conv.inner = (void*)(e & (~1));
6843 e_conv.is_owned = (e & 1) || (e == 0);
6844 e_conv = DecodeError_clone(&e_conv);
6845 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6846 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6847 return (uint64_t)ret_conv;
6850 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
6851 if ((_res & 1) != 0) return;
6852 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6854 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6857 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
6858 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6859 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6860 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6861 return (uint64_t)ret_conv;
6864 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
6865 LDKCVec_SignatureZ _res_constr;
6866 _res_constr.datalen = *((uint32_t*)_res);
6867 if (_res_constr.datalen > 0)
6868 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6870 _res_constr.data = NULL;
6871 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6872 for (size_t m = 0; m < _res_constr.datalen; m++) {
6873 int8_tArray _res_conv_12 = _res_vals[m];
6874 LDKSignature _res_conv_12_ref;
6875 CHECK(*((uint32_t*)_res_conv_12) == 64);
6876 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
6877 _res_constr.data[m] = _res_conv_12_ref;
6879 CVec_SignatureZ_free(_res_constr);
6882 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6883 LDKHolderCommitmentTransaction o_conv;
6884 o_conv.inner = (void*)(o & (~1));
6885 o_conv.is_owned = (o & 1) || (o == 0);
6886 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6887 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6888 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6889 return (uint64_t)ret_conv;
6892 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6893 LDKDecodeError e_conv;
6894 e_conv.inner = (void*)(e & (~1));
6895 e_conv.is_owned = (e & 1) || (e == 0);
6896 e_conv = DecodeError_clone(&e_conv);
6897 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6898 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6899 return (uint64_t)ret_conv;
6902 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6903 if ((_res & 1) != 0) return;
6904 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6906 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6909 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6910 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6911 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6912 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6913 return (uint64_t)ret_conv;
6916 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6917 LDKBuiltCommitmentTransaction o_conv;
6918 o_conv.inner = (void*)(o & (~1));
6919 o_conv.is_owned = (o & 1) || (o == 0);
6920 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6921 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6922 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6923 return (uint64_t)ret_conv;
6926 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6927 LDKDecodeError e_conv;
6928 e_conv.inner = (void*)(e & (~1));
6929 e_conv.is_owned = (e & 1) || (e == 0);
6930 e_conv = DecodeError_clone(&e_conv);
6931 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6932 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6933 return (uint64_t)ret_conv;
6936 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6937 if ((_res & 1) != 0) return;
6938 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6940 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6943 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6944 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6945 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6946 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6947 return (uint64_t)ret_conv;
6950 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
6951 LDKCommitmentTransaction o_conv;
6952 o_conv.inner = (void*)(o & (~1));
6953 o_conv.is_owned = (o & 1) || (o == 0);
6954 o_conv = CommitmentTransaction_clone(&o_conv);
6955 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6956 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6957 return (uint64_t)ret_conv;
6960 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
6961 LDKDecodeError e_conv;
6962 e_conv.inner = (void*)(e & (~1));
6963 e_conv.is_owned = (e & 1) || (e == 0);
6964 e_conv = DecodeError_clone(&e_conv);
6965 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6966 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6967 return (uint64_t)ret_conv;
6970 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
6971 if ((_res & 1) != 0) return;
6972 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6974 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6977 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
6978 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6979 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6980 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6981 return (uint64_t)ret_conv;
6984 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
6985 LDKTrustedCommitmentTransaction o_conv;
6986 o_conv.inner = (void*)(o & (~1));
6987 o_conv.is_owned = (o & 1) || (o == 0);
6988 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6989 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6990 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6991 return (uint64_t)ret_conv;
6994 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
6995 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6996 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6997 return (uint64_t)ret_conv;
7000 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
7001 if ((_res & 1) != 0) return;
7002 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7004 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7007 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
7008 LDKCVec_SignatureZ o_constr;
7009 o_constr.datalen = *((uint32_t*)o);
7010 if (o_constr.datalen > 0)
7011 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7013 o_constr.data = NULL;
7014 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7015 for (size_t m = 0; m < o_constr.datalen; m++) {
7016 int8_tArray o_conv_12 = o_vals[m];
7017 LDKSignature o_conv_12_ref;
7018 CHECK(*((uint32_t*)o_conv_12) == 64);
7019 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
7020 o_constr.data[m] = o_conv_12_ref;
7022 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7023 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7024 return (uint64_t)ret_conv;
7027 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
7028 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7029 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7030 return (uint64_t)ret_conv;
7033 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
7034 if ((_res & 1) != 0) return;
7035 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7037 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7040 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
7041 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7042 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7043 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7044 return (uint64_t)ret_conv;
7047 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
7048 LDKShutdownScript o_conv;
7049 o_conv.inner = (void*)(o & (~1));
7050 o_conv.is_owned = (o & 1) || (o == 0);
7051 o_conv = ShutdownScript_clone(&o_conv);
7052 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7053 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
7054 return (uint64_t)ret_conv;
7057 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
7058 LDKDecodeError e_conv;
7059 e_conv.inner = (void*)(e & (~1));
7060 e_conv.is_owned = (e & 1) || (e == 0);
7061 e_conv = DecodeError_clone(&e_conv);
7062 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7063 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
7064 return (uint64_t)ret_conv;
7067 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
7068 if ((_res & 1) != 0) return;
7069 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
7071 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
7074 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
7075 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
7076 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7077 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
7078 return (uint64_t)ret_conv;
7081 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
7082 LDKShutdownScript o_conv;
7083 o_conv.inner = (void*)(o & (~1));
7084 o_conv.is_owned = (o & 1) || (o == 0);
7085 o_conv = ShutdownScript_clone(&o_conv);
7086 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7087 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
7088 return (uint64_t)ret_conv;
7091 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
7092 LDKInvalidShutdownScript e_conv;
7093 e_conv.inner = (void*)(e & (~1));
7094 e_conv.is_owned = (e & 1) || (e == 0);
7095 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
7096 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7097 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
7098 return (uint64_t)ret_conv;
7101 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
7102 if ((_res & 1) != 0) return;
7103 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
7105 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
7108 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
7109 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7110 *ret_conv = CResult_NoneErrorZ_ok();
7111 return (uint64_t)ret_conv;
7114 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
7115 LDKIOError e_conv = LDKIOError_from_js(e);
7116 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7117 *ret_conv = CResult_NoneErrorZ_err(e_conv);
7118 return (uint64_t)ret_conv;
7121 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
7122 if ((_res & 1) != 0) return;
7123 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
7125 CResult_NoneErrorZ_free(_res_conv);
7128 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
7129 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
7130 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7131 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
7132 return (uint64_t)ret_conv;
7135 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
7137 o_conv.inner = (void*)(o & (~1));
7138 o_conv.is_owned = (o & 1) || (o == 0);
7139 o_conv = RouteHop_clone(&o_conv);
7140 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7141 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
7142 return (uint64_t)ret_conv;
7145 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
7146 LDKDecodeError e_conv;
7147 e_conv.inner = (void*)(e & (~1));
7148 e_conv.is_owned = (e & 1) || (e == 0);
7149 e_conv = DecodeError_clone(&e_conv);
7150 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7151 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
7152 return (uint64_t)ret_conv;
7155 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
7156 if ((_res & 1) != 0) return;
7157 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
7159 CResult_RouteHopDecodeErrorZ_free(_res_conv);
7162 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
7163 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
7164 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7165 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
7166 return (uint64_t)ret_conv;
7169 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7170 LDKCVec_RouteHopZ _res_constr;
7171 _res_constr.datalen = *((uint32_t*)_res);
7172 if (_res_constr.datalen > 0)
7173 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7175 _res_constr.data = NULL;
7176 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7177 for (size_t k = 0; k < _res_constr.datalen; k++) {
7178 uint32_t _res_conv_10 = _res_vals[k];
7179 LDKRouteHop _res_conv_10_conv;
7180 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7181 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7182 _res_constr.data[k] = _res_conv_10_conv;
7184 CVec_RouteHopZ_free(_res_constr);
7187 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7188 LDKCVec_CVec_RouteHopZZ _res_constr;
7189 _res_constr.datalen = *((uint32_t*)_res);
7190 if (_res_constr.datalen > 0)
7191 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7193 _res_constr.data = NULL;
7194 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7195 for (size_t m = 0; m < _res_constr.datalen; m++) {
7196 uint32_tArray _res_conv_12 = _res_vals[m];
7197 LDKCVec_RouteHopZ _res_conv_12_constr;
7198 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7199 if (_res_conv_12_constr.datalen > 0)
7200 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7202 _res_conv_12_constr.data = NULL;
7203 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7204 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7205 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7206 LDKRouteHop _res_conv_12_conv_10_conv;
7207 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7208 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7209 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7211 _res_constr.data[m] = _res_conv_12_constr;
7213 CVec_CVec_RouteHopZZ_free(_res_constr);
7216 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7218 o_conv.inner = (void*)(o & (~1));
7219 o_conv.is_owned = (o & 1) || (o == 0);
7220 o_conv = Route_clone(&o_conv);
7221 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7222 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7223 return (uint64_t)ret_conv;
7226 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7227 LDKDecodeError e_conv;
7228 e_conv.inner = (void*)(e & (~1));
7229 e_conv.is_owned = (e & 1) || (e == 0);
7230 e_conv = DecodeError_clone(&e_conv);
7231 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7232 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7233 return (uint64_t)ret_conv;
7236 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7237 if ((_res & 1) != 0) return;
7238 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7240 CResult_RouteDecodeErrorZ_free(_res_conv);
7243 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7244 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7245 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7246 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7247 return (uint64_t)ret_conv;
7250 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7251 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7252 *ret_copy = COption_u64Z_some(o);
7253 uint64_t ret_ref = (uint64_t)ret_copy;
7257 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7258 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7259 *ret_copy = COption_u64Z_none();
7260 uint64_t ret_ref = (uint64_t)ret_copy;
7264 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7265 if ((_res & 1) != 0) return;
7266 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7268 COption_u64Z_free(_res_conv);
7271 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7272 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7273 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7274 *ret_copy = COption_u64Z_clone(orig_conv);
7275 uint64_t ret_ref = (uint64_t)ret_copy;
7279 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7280 LDKCVec_ChannelDetailsZ _res_constr;
7281 _res_constr.datalen = *((uint32_t*)_res);
7282 if (_res_constr.datalen > 0)
7283 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7285 _res_constr.data = NULL;
7286 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7287 for (size_t q = 0; q < _res_constr.datalen; q++) {
7288 uint32_t _res_conv_16 = _res_vals[q];
7289 LDKChannelDetails _res_conv_16_conv;
7290 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7291 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7292 _res_constr.data[q] = _res_conv_16_conv;
7294 CVec_ChannelDetailsZ_free(_res_constr);
7297 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7298 LDKCVec_RouteHintZ _res_constr;
7299 _res_constr.datalen = *((uint32_t*)_res);
7300 if (_res_constr.datalen > 0)
7301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7303 _res_constr.data = NULL;
7304 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7305 for (size_t l = 0; l < _res_constr.datalen; l++) {
7306 uint32_t _res_conv_11 = _res_vals[l];
7307 LDKRouteHint _res_conv_11_conv;
7308 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7309 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7310 _res_constr.data[l] = _res_conv_11_conv;
7312 CVec_RouteHintZ_free(_res_constr);
7315 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7317 o_conv.inner = (void*)(o & (~1));
7318 o_conv.is_owned = (o & 1) || (o == 0);
7319 o_conv = Route_clone(&o_conv);
7320 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7321 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7322 return (uint64_t)ret_conv;
7325 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7326 LDKLightningError e_conv;
7327 e_conv.inner = (void*)(e & (~1));
7328 e_conv.is_owned = (e & 1) || (e == 0);
7329 e_conv = LightningError_clone(&e_conv);
7330 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7331 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7332 return (uint64_t)ret_conv;
7335 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7336 if ((_res & 1) != 0) return;
7337 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7339 CResult_RouteLightningErrorZ_free(_res_conv);
7342 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7343 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7344 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7345 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7346 return (uint64_t)ret_conv;
7349 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7350 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7351 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7352 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7353 return (uint64_t)ret_conv;
7356 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7357 LDKAccessError e_conv = LDKAccessError_from_js(e);
7358 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7359 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7360 return (uint64_t)ret_conv;
7363 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7364 if ((_res & 1) != 0) return;
7365 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7367 CResult_TxOutAccessErrorZ_free(_res_conv);
7370 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7371 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7372 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7373 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7374 return (uint64_t)ret_conv;
7377 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
7378 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
7379 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7380 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
7381 return (uint64_t)ret_ref;
7384 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
7385 LDKTransaction b_ref;
7386 b_ref.datalen = *((uint32_t*)b);
7387 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7388 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
7389 b_ref.data_is_owned = true;
7390 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7391 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7392 return (uint64_t)ret_ref;
7395 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
7396 if ((_res & 1) != 0) return;
7397 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7399 C2Tuple_usizeTransactionZ_free(_res_conv);
7402 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
7403 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7404 _res_constr.datalen = *((uint32_t*)_res);
7405 if (_res_constr.datalen > 0)
7406 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7408 _res_constr.data = NULL;
7409 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7410 for (size_t e = 0; e < _res_constr.datalen; e++) {
7411 uint32_t _res_conv_30 = _res_vals[e];
7412 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
7413 FREE((void*)_res_conv_30);
7414 _res_constr.data[e] = _res_conv_30_conv;
7416 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7419 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
7420 LDKCVec_TxidZ _res_constr;
7421 _res_constr.datalen = *((uint32_t*)_res);
7422 if (_res_constr.datalen > 0)
7423 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7425 _res_constr.data = NULL;
7426 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7427 for (size_t m = 0; m < _res_constr.datalen; m++) {
7428 int8_tArray _res_conv_12 = _res_vals[m];
7429 LDKThirtyTwoBytes _res_conv_12_ref;
7430 CHECK(*((uint32_t*)_res_conv_12) == 32);
7431 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
7432 _res_constr.data[m] = _res_conv_12_ref;
7434 CVec_TxidZ_free(_res_constr);
7437 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
7438 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7439 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7440 return (uint64_t)ret_conv;
7443 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
7444 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
7445 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7446 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7447 return (uint64_t)ret_conv;
7450 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
7451 if ((_res & 1) != 0) return;
7452 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7454 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7457 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
7458 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7459 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7460 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7461 return (uint64_t)ret_conv;
7464 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
7465 LDKCVec_MonitorEventZ _res_constr;
7466 _res_constr.datalen = *((uint32_t*)_res);
7467 if (_res_constr.datalen > 0)
7468 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7470 _res_constr.data = NULL;
7471 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7472 for (size_t o = 0; o < _res_constr.datalen; o++) {
7473 uint32_t _res_conv_14 = _res_vals[o];
7474 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7475 FREE((void*)_res_conv_14);
7476 _res_constr.data[o] = _res_conv_14_conv;
7478 CVec_MonitorEventZ_free(_res_constr);
7481 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7482 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7483 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7484 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7485 uint64_t ret_ref = (uint64_t)ret_copy;
7489 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7490 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7491 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7492 uint64_t ret_ref = (uint64_t)ret_copy;
7496 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7497 if ((_res & 1) != 0) return;
7498 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7500 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7503 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
7504 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
7505 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7506 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
7507 uint64_t ret_ref = (uint64_t)ret_copy;
7511 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7512 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7513 _res_constr.datalen = *((uint32_t*)_res);
7514 if (_res_constr.datalen > 0)
7515 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7517 _res_constr.data = NULL;
7518 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7519 for (size_t b = 0; b < _res_constr.datalen; b++) {
7520 uint32_t _res_conv_27 = _res_vals[b];
7521 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7522 FREE((void*)_res_conv_27);
7523 _res_constr.data[b] = _res_conv_27_conv;
7525 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7528 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
7529 LDKCVec_MessageSendEventZ _res_constr;
7530 _res_constr.datalen = *((uint32_t*)_res);
7531 if (_res_constr.datalen > 0)
7532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7534 _res_constr.data = NULL;
7535 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7536 for (size_t s = 0; s < _res_constr.datalen; s++) {
7537 uint32_t _res_conv_18 = _res_vals[s];
7538 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
7539 FREE((void*)_res_conv_18);
7540 _res_constr.data[s] = _res_conv_18_conv;
7542 CVec_MessageSendEventZ_free(_res_constr);
7545 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
7546 LDKInitFeatures o_conv;
7547 o_conv.inner = (void*)(o & (~1));
7548 o_conv.is_owned = (o & 1) || (o == 0);
7549 o_conv = InitFeatures_clone(&o_conv);
7550 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7551 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7552 return (uint64_t)ret_conv;
7555 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
7556 LDKDecodeError e_conv;
7557 e_conv.inner = (void*)(e & (~1));
7558 e_conv.is_owned = (e & 1) || (e == 0);
7559 e_conv = DecodeError_clone(&e_conv);
7560 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7561 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7562 return (uint64_t)ret_conv;
7565 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
7566 if ((_res & 1) != 0) return;
7567 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7569 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7572 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
7573 LDKNodeFeatures o_conv;
7574 o_conv.inner = (void*)(o & (~1));
7575 o_conv.is_owned = (o & 1) || (o == 0);
7576 o_conv = NodeFeatures_clone(&o_conv);
7577 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7578 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7579 return (uint64_t)ret_conv;
7582 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
7583 LDKDecodeError e_conv;
7584 e_conv.inner = (void*)(e & (~1));
7585 e_conv.is_owned = (e & 1) || (e == 0);
7586 e_conv = DecodeError_clone(&e_conv);
7587 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7588 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7589 return (uint64_t)ret_conv;
7592 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
7593 if ((_res & 1) != 0) return;
7594 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7596 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7599 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
7600 LDKChannelFeatures o_conv;
7601 o_conv.inner = (void*)(o & (~1));
7602 o_conv.is_owned = (o & 1) || (o == 0);
7603 o_conv = ChannelFeatures_clone(&o_conv);
7604 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7605 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7606 return (uint64_t)ret_conv;
7609 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
7610 LDKDecodeError e_conv;
7611 e_conv.inner = (void*)(e & (~1));
7612 e_conv.is_owned = (e & 1) || (e == 0);
7613 e_conv = DecodeError_clone(&e_conv);
7614 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7615 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7616 return (uint64_t)ret_conv;
7619 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
7620 if ((_res & 1) != 0) return;
7621 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7623 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7626 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
7627 LDKInvoiceFeatures o_conv;
7628 o_conv.inner = (void*)(o & (~1));
7629 o_conv.is_owned = (o & 1) || (o == 0);
7630 o_conv = InvoiceFeatures_clone(&o_conv);
7631 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7632 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7633 return (uint64_t)ret_conv;
7636 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
7637 LDKDecodeError e_conv;
7638 e_conv.inner = (void*)(e & (~1));
7639 e_conv.is_owned = (e & 1) || (e == 0);
7640 e_conv = DecodeError_clone(&e_conv);
7641 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7642 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7643 return (uint64_t)ret_conv;
7646 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
7647 if ((_res & 1) != 0) return;
7648 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7650 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7653 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7654 LDKDelayedPaymentOutputDescriptor o_conv;
7655 o_conv.inner = (void*)(o & (~1));
7656 o_conv.is_owned = (o & 1) || (o == 0);
7657 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
7658 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7659 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7660 return (uint64_t)ret_conv;
7663 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7664 LDKDecodeError e_conv;
7665 e_conv.inner = (void*)(e & (~1));
7666 e_conv.is_owned = (e & 1) || (e == 0);
7667 e_conv = DecodeError_clone(&e_conv);
7668 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7669 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7670 return (uint64_t)ret_conv;
7673 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7674 if ((_res & 1) != 0) return;
7675 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7677 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7680 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7681 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7682 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
7683 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7684 return (uint64_t)ret_conv;
7687 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7688 LDKStaticPaymentOutputDescriptor o_conv;
7689 o_conv.inner = (void*)(o & (~1));
7690 o_conv.is_owned = (o & 1) || (o == 0);
7691 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
7692 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7693 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
7694 return (uint64_t)ret_conv;
7697 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7698 LDKDecodeError e_conv;
7699 e_conv.inner = (void*)(e & (~1));
7700 e_conv.is_owned = (e & 1) || (e == 0);
7701 e_conv = DecodeError_clone(&e_conv);
7702 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7703 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
7704 return (uint64_t)ret_conv;
7707 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7708 if ((_res & 1) != 0) return;
7709 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7711 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
7714 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7715 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
7716 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
7717 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
7718 return (uint64_t)ret_conv;
7721 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7722 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7723 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7724 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7725 return (uint64_t)ret_conv;
7728 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7729 LDKDecodeError e_conv;
7730 e_conv.inner = (void*)(e & (~1));
7731 e_conv.is_owned = (e & 1) || (e == 0);
7732 e_conv = DecodeError_clone(&e_conv);
7733 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7734 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7735 return (uint64_t)ret_conv;
7738 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7739 if ((_res & 1) != 0) return;
7740 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7742 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7745 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7746 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7747 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7748 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7749 return (uint64_t)ret_conv;
7752 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
7753 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7754 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7755 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7756 return (uint64_t)ret_ref;
7759 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
7761 CHECK(*((uint32_t*)a) == 64);
7762 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
7763 LDKCVec_SignatureZ b_constr;
7764 b_constr.datalen = *((uint32_t*)b);
7765 if (b_constr.datalen > 0)
7766 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7768 b_constr.data = NULL;
7769 int8_tArray* b_vals = (int8_tArray*)(b + 4);
7770 for (size_t m = 0; m < b_constr.datalen; m++) {
7771 int8_tArray b_conv_12 = b_vals[m];
7772 LDKSignature b_conv_12_ref;
7773 CHECK(*((uint32_t*)b_conv_12) == 64);
7774 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7775 b_constr.data[m] = b_conv_12_ref;
7777 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7778 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7779 return (uint64_t)ret_ref;
7782 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7783 if ((_res & 1) != 0) return;
7784 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7786 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7789 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7790 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7791 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7792 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7793 return (uint64_t)ret_conv;
7796 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7797 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7798 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7799 return (uint64_t)ret_conv;
7802 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7803 if ((_res & 1) != 0) return;
7804 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7806 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7809 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7810 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7811 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7812 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7813 return (uint64_t)ret_conv;
7816 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7818 CHECK(*((uint32_t*)o) == 64);
7819 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7820 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7821 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7822 return (uint64_t)ret_conv;
7825 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7826 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7827 *ret_conv = CResult_SignatureNoneZ_err();
7828 return (uint64_t)ret_conv;
7831 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7832 if ((_res & 1) != 0) return;
7833 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7835 CResult_SignatureNoneZ_free(_res_conv);
7838 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7839 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7840 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7841 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7842 return (uint64_t)ret_conv;
7845 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7846 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7847 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7848 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7849 return (uint64_t)ret_conv;
7852 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7853 LDKDecodeError e_conv;
7854 e_conv.inner = (void*)(e & (~1));
7855 e_conv.is_owned = (e & 1) || (e == 0);
7856 e_conv = DecodeError_clone(&e_conv);
7857 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7858 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7859 return (uint64_t)ret_conv;
7862 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7863 if ((_res & 1) != 0) return;
7864 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7866 CResult_SignDecodeErrorZ_free(_res_conv);
7869 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7870 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7871 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7872 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7873 return (uint64_t)ret_conv;
7876 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
7877 LDKCVec_u8Z _res_ref;
7878 _res_ref.datalen = *((uint32_t*)_res);
7879 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
7880 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7881 CVec_u8Z_free(_res_ref);
7884 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
7885 LDKRecoverableSignature arg_ref;
7886 CHECK(*((uint32_t*)arg) == 68);
7887 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
7888 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7889 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
7890 return (uint64_t)ret_conv;
7893 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
7894 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7895 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
7896 return (uint64_t)ret_conv;
7899 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
7900 if ((_res & 1) != 0) return;
7901 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
7903 CResult_RecoverableSignatureNoneZ_free(_res_conv);
7906 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
7907 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
7908 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7909 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
7910 return (uint64_t)ret_conv;
7913 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7914 LDKCVec_CVec_u8ZZ _res_constr;
7915 _res_constr.datalen = *((uint32_t*)_res);
7916 if (_res_constr.datalen > 0)
7917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7919 _res_constr.data = NULL;
7920 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7921 for (size_t m = 0; m < _res_constr.datalen; m++) {
7922 int8_tArray _res_conv_12 = _res_vals[m];
7923 LDKCVec_u8Z _res_conv_12_ref;
7924 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7925 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7926 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7927 _res_constr.data[m] = _res_conv_12_ref;
7929 CVec_CVec_u8ZZ_free(_res_constr);
7932 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7933 LDKCVec_CVec_u8ZZ o_constr;
7934 o_constr.datalen = *((uint32_t*)o);
7935 if (o_constr.datalen > 0)
7936 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7938 o_constr.data = NULL;
7939 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7940 for (size_t m = 0; m < o_constr.datalen; m++) {
7941 int8_tArray o_conv_12 = o_vals[m];
7942 LDKCVec_u8Z o_conv_12_ref;
7943 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7944 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7945 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7946 o_constr.data[m] = o_conv_12_ref;
7948 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7949 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7950 return (uint64_t)ret_conv;
7953 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7954 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7955 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7956 return (uint64_t)ret_conv;
7959 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7960 if ((_res & 1) != 0) return;
7961 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7963 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7966 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7967 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7968 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7969 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7970 return (uint64_t)ret_conv;
7973 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7974 LDKInMemorySigner o_conv;
7975 o_conv.inner = (void*)(o & (~1));
7976 o_conv.is_owned = (o & 1) || (o == 0);
7977 o_conv = InMemorySigner_clone(&o_conv);
7978 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7979 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7980 return (uint64_t)ret_conv;
7983 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7984 LDKDecodeError e_conv;
7985 e_conv.inner = (void*)(e & (~1));
7986 e_conv.is_owned = (e & 1) || (e == 0);
7987 e_conv = DecodeError_clone(&e_conv);
7988 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7989 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7990 return (uint64_t)ret_conv;
7993 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7994 if ((_res & 1) != 0) return;
7995 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7997 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8000 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8001 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8002 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8003 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8004 return (uint64_t)ret_conv;
8007 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8008 LDKCVec_TxOutZ _res_constr;
8009 _res_constr.datalen = *((uint32_t*)_res);
8010 if (_res_constr.datalen > 0)
8011 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8013 _res_constr.data = NULL;
8014 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8015 for (size_t h = 0; h < _res_constr.datalen; h++) {
8016 uint32_t _res_conv_7 = _res_vals[h];
8017 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8018 FREE((void*)_res_conv_7);
8019 _res_constr.data[h] = _res_conv_7_conv;
8021 CVec_TxOutZ_free(_res_constr);
8024 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8025 LDKTransaction o_ref;
8026 o_ref.datalen = *((uint32_t*)o);
8027 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8028 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8029 o_ref.data_is_owned = true;
8030 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8031 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8032 return (uint64_t)ret_conv;
8035 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8036 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8037 *ret_conv = CResult_TransactionNoneZ_err();
8038 return (uint64_t)ret_conv;
8041 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8042 if ((_res & 1) != 0) return;
8043 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8045 CResult_TransactionNoneZ_free(_res_conv);
8048 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
8049 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
8050 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8051 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
8052 return (uint64_t)ret_conv;
8055 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
8056 LDKThirtyTwoBytes a_ref;
8057 CHECK(*((uint32_t*)a) == 32);
8058 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8059 LDKChannelMonitor b_conv;
8060 b_conv.inner = (void*)(b & (~1));
8061 b_conv.is_owned = (b & 1) || (b == 0);
8062 b_conv = ChannelMonitor_clone(&b_conv);
8063 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8064 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
8065 return (uint64_t)ret_ref;
8068 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
8069 if ((_res & 1) != 0) return;
8070 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
8072 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
8075 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8076 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8077 _res_constr.datalen = *((uint32_t*)_res);
8078 if (_res_constr.datalen > 0)
8079 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8081 _res_constr.data = NULL;
8082 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8083 for (size_t m = 0; m < _res_constr.datalen; m++) {
8084 uint32_t _res_conv_38 = _res_vals[m];
8085 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
8086 FREE((void*)_res_conv_38);
8087 _res_constr.data[m] = _res_conv_38_conv;
8089 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8092 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8093 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8094 o_constr.datalen = *((uint32_t*)o);
8095 if (o_constr.datalen > 0)
8096 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8098 o_constr.data = NULL;
8099 uint32_t* o_vals = (uint32_t*)(o + 4);
8100 for (size_t m = 0; m < o_constr.datalen; m++) {
8101 uint32_t o_conv_38 = o_vals[m];
8102 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
8103 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
8104 o_constr.data[m] = o_conv_38_conv;
8106 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8107 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8108 return (uint64_t)ret_conv;
8111 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8112 LDKIOError e_conv = LDKIOError_from_js(e);
8113 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8114 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8115 return (uint64_t)ret_conv;
8118 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8119 if ((_res & 1) != 0) return;
8120 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8122 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8125 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
8126 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8127 *ret_copy = COption_u16Z_some(o);
8128 uint64_t ret_ref = (uint64_t)ret_copy;
8132 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
8133 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8134 *ret_copy = COption_u16Z_none();
8135 uint64_t ret_ref = (uint64_t)ret_copy;
8139 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
8140 if ((_res & 1) != 0) return;
8141 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
8143 COption_u16Z_free(_res_conv);
8146 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
8147 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
8148 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8149 *ret_copy = COption_u16Z_clone(orig_conv);
8150 uint64_t ret_ref = (uint64_t)ret_copy;
8154 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8155 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8156 *ret_conv = CResult_NoneAPIErrorZ_ok();
8157 return (uint64_t)ret_conv;
8160 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8161 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8162 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8163 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8164 return (uint64_t)ret_conv;
8167 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8168 if ((_res & 1) != 0) return;
8169 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8171 CResult_NoneAPIErrorZ_free(_res_conv);
8174 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8175 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8176 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8177 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8178 return (uint64_t)ret_conv;
8181 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8182 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8183 _res_constr.datalen = *((uint32_t*)_res);
8184 if (_res_constr.datalen > 0)
8185 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8187 _res_constr.data = NULL;
8188 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8189 for (size_t w = 0; w < _res_constr.datalen; w++) {
8190 uint32_t _res_conv_22 = _res_vals[w];
8191 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8192 FREE((void*)_res_conv_22);
8193 _res_constr.data[w] = _res_conv_22_conv;
8195 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8198 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8199 LDKCVec_APIErrorZ _res_constr;
8200 _res_constr.datalen = *((uint32_t*)_res);
8201 if (_res_constr.datalen > 0)
8202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8204 _res_constr.data = NULL;
8205 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8206 for (size_t k = 0; k < _res_constr.datalen; k++) {
8207 uint32_t _res_conv_10 = _res_vals[k];
8208 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8209 FREE((void*)_res_conv_10);
8210 _res_constr.data[k] = _res_conv_10_conv;
8212 CVec_APIErrorZ_free(_res_constr);
8215 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8216 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8217 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8218 return (uint64_t)ret_conv;
8221 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8222 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8223 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8224 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8225 return (uint64_t)ret_conv;
8228 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8229 if ((_res & 1) != 0) return;
8230 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8232 CResult_NonePaymentSendFailureZ_free(_res_conv);
8235 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
8236 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8237 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8238 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8239 return (uint64_t)ret_conv;
8242 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
8243 LDKThirtyTwoBytes o_ref;
8244 CHECK(*((uint32_t*)o) == 32);
8245 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8246 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8247 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
8248 return (uint64_t)ret_conv;
8251 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
8252 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8253 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8254 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
8255 return (uint64_t)ret_conv;
8258 void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
8259 if ((_res & 1) != 0) return;
8260 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8262 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
8265 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
8266 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
8267 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8268 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
8269 return (uint64_t)ret_conv;
8272 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
8273 LDKCVec_NetAddressZ _res_constr;
8274 _res_constr.datalen = *((uint32_t*)_res);
8275 if (_res_constr.datalen > 0)
8276 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8278 _res_constr.data = NULL;
8279 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8280 for (size_t m = 0; m < _res_constr.datalen; m++) {
8281 uint32_t _res_conv_12 = _res_vals[m];
8282 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
8283 FREE((void*)_res_conv_12);
8284 _res_constr.data[m] = _res_conv_12_conv;
8286 CVec_NetAddressZ_free(_res_constr);
8289 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
8290 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
8291 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8292 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
8293 return (uint64_t)ret_ref;
8296 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
8297 LDKThirtyTwoBytes a_ref;
8298 CHECK(*((uint32_t*)a) == 32);
8299 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8300 LDKThirtyTwoBytes b_ref;
8301 CHECK(*((uint32_t*)b) == 32);
8302 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8303 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8304 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
8305 return (uint64_t)ret_ref;
8308 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
8309 if ((_res & 1) != 0) return;
8310 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
8312 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
8315 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
8316 LDKThirtyTwoBytes o_ref;
8317 CHECK(*((uint32_t*)o) == 32);
8318 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8319 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8320 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
8321 return (uint64_t)ret_conv;
8324 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
8325 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8326 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8327 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
8328 return (uint64_t)ret_conv;
8331 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
8332 if ((_res & 1) != 0) return;
8333 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
8335 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
8338 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
8339 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
8340 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8341 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
8342 return (uint64_t)ret_conv;
8345 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
8346 LDKCVec_ChannelMonitorZ _res_constr;
8347 _res_constr.datalen = *((uint32_t*)_res);
8348 if (_res_constr.datalen > 0)
8349 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8351 _res_constr.data = NULL;
8352 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8353 for (size_t q = 0; q < _res_constr.datalen; q++) {
8354 uint32_t _res_conv_16 = _res_vals[q];
8355 LDKChannelMonitor _res_conv_16_conv;
8356 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8357 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8358 _res_constr.data[q] = _res_conv_16_conv;
8360 CVec_ChannelMonitorZ_free(_res_constr);
8363 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
8364 LDKThirtyTwoBytes a_ref;
8365 CHECK(*((uint32_t*)a) == 32);
8366 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8367 LDKChannelManager b_conv;
8368 b_conv.inner = (void*)(b & (~1));
8369 b_conv.is_owned = (b & 1) || (b == 0);
8370 // Warning: we need a move here but no clone is available for LDKChannelManager
8371 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8372 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8373 return (uint64_t)ret_ref;
8376 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
8377 if ((_res & 1) != 0) return;
8378 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8380 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8383 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
8384 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8385 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8386 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8387 return (uint64_t)ret_conv;
8390 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
8391 LDKDecodeError e_conv;
8392 e_conv.inner = (void*)(e & (~1));
8393 e_conv.is_owned = (e & 1) || (e == 0);
8394 e_conv = DecodeError_clone(&e_conv);
8395 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8396 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8397 return (uint64_t)ret_conv;
8400 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
8401 if ((_res & 1) != 0) return;
8402 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8404 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8407 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8408 LDKChannelConfig o_conv;
8409 o_conv.inner = (void*)(o & (~1));
8410 o_conv.is_owned = (o & 1) || (o == 0);
8411 o_conv = ChannelConfig_clone(&o_conv);
8412 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8413 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8414 return (uint64_t)ret_conv;
8417 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8418 LDKDecodeError e_conv;
8419 e_conv.inner = (void*)(e & (~1));
8420 e_conv.is_owned = (e & 1) || (e == 0);
8421 e_conv = DecodeError_clone(&e_conv);
8422 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8423 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8424 return (uint64_t)ret_conv;
8427 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
8428 if ((_res & 1) != 0) return;
8429 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
8431 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
8434 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
8435 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
8436 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8437 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
8438 return (uint64_t)ret_conv;
8441 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
8443 o_conv.inner = (void*)(o & (~1));
8444 o_conv.is_owned = (o & 1) || (o == 0);
8445 o_conv = OutPoint_clone(&o_conv);
8446 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8447 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
8448 return (uint64_t)ret_conv;
8451 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
8452 LDKDecodeError e_conv;
8453 e_conv.inner = (void*)(e & (~1));
8454 e_conv.is_owned = (e & 1) || (e == 0);
8455 e_conv = DecodeError_clone(&e_conv);
8456 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8457 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
8458 return (uint64_t)ret_conv;
8461 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
8462 if ((_res & 1) != 0) return;
8463 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
8465 CResult_OutPointDecodeErrorZ_free(_res_conv);
8468 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
8469 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
8470 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8471 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
8472 return (uint64_t)ret_conv;
8475 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
8476 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
8477 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8478 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
8479 return (uint64_t)ret_conv;
8482 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
8483 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8484 *ret_conv = CResult_SiPrefixNoneZ_err();
8485 return (uint64_t)ret_conv;
8488 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
8489 if ((_res & 1) != 0) return;
8490 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
8492 CResult_SiPrefixNoneZ_free(_res_conv);
8495 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
8496 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
8497 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
8498 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
8499 return (uint64_t)ret_conv;
8502 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
8504 o_conv.inner = (void*)(o & (~1));
8505 o_conv.is_owned = (o & 1) || (o == 0);
8506 o_conv = Invoice_clone(&o_conv);
8507 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8508 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
8509 return (uint64_t)ret_conv;
8512 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
8513 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8514 *ret_conv = CResult_InvoiceNoneZ_err();
8515 return (uint64_t)ret_conv;
8518 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
8519 if ((_res & 1) != 0) return;
8520 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
8522 CResult_InvoiceNoneZ_free(_res_conv);
8525 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
8526 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
8527 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
8528 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
8529 return (uint64_t)ret_conv;
8532 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
8533 LDKSignedRawInvoice o_conv;
8534 o_conv.inner = (void*)(o & (~1));
8535 o_conv.is_owned = (o & 1) || (o == 0);
8536 o_conv = SignedRawInvoice_clone(&o_conv);
8537 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8538 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
8539 return (uint64_t)ret_conv;
8542 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
8543 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8544 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
8545 return (uint64_t)ret_conv;
8548 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
8549 if ((_res & 1) != 0) return;
8550 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
8552 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
8555 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
8556 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
8557 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
8558 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
8559 return (uint64_t)ret_conv;
8562 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
8563 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
8564 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8565 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
8566 return (uint64_t)ret_ref;
8569 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
8570 LDKRawInvoice a_conv;
8571 a_conv.inner = (void*)(a & (~1));
8572 a_conv.is_owned = (a & 1) || (a == 0);
8573 a_conv = RawInvoice_clone(&a_conv);
8574 LDKThirtyTwoBytes b_ref;
8575 CHECK(*((uint32_t*)b) == 32);
8576 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8577 LDKInvoiceSignature c_conv;
8578 c_conv.inner = (void*)(c & (~1));
8579 c_conv.is_owned = (c & 1) || (c == 0);
8580 c_conv = InvoiceSignature_clone(&c_conv);
8581 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
8582 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
8583 return (uint64_t)ret_ref;
8586 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
8587 if ((_res & 1) != 0) return;
8588 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
8590 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
8593 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
8594 LDKPayeePubKey o_conv;
8595 o_conv.inner = (void*)(o & (~1));
8596 o_conv.is_owned = (o & 1) || (o == 0);
8597 o_conv = PayeePubKey_clone(&o_conv);
8598 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8599 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
8600 return (uint64_t)ret_conv;
8603 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
8604 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8605 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8606 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
8607 return (uint64_t)ret_conv;
8610 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
8611 if ((_res & 1) != 0) return;
8612 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
8614 CResult_PayeePubKeyErrorZ_free(_res_conv);
8617 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
8618 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
8619 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
8620 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
8621 return (uint64_t)ret_conv;
8624 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
8625 LDKCVec_PrivateRouteZ _res_constr;
8626 _res_constr.datalen = *((uint32_t*)_res);
8627 if (_res_constr.datalen > 0)
8628 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
8630 _res_constr.data = NULL;
8631 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8632 for (size_t o = 0; o < _res_constr.datalen; o++) {
8633 uint32_t _res_conv_14 = _res_vals[o];
8634 LDKPrivateRoute _res_conv_14_conv;
8635 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
8636 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
8637 _res_constr.data[o] = _res_conv_14_conv;
8639 CVec_PrivateRouteZ_free(_res_constr);
8642 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
8643 LDKPositiveTimestamp o_conv;
8644 o_conv.inner = (void*)(o & (~1));
8645 o_conv.is_owned = (o & 1) || (o == 0);
8646 o_conv = PositiveTimestamp_clone(&o_conv);
8647 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8648 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
8649 return (uint64_t)ret_conv;
8652 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
8653 LDKCreationError e_conv = LDKCreationError_from_js(e);
8654 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8655 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
8656 return (uint64_t)ret_conv;
8659 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
8660 if ((_res & 1) != 0) return;
8661 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
8663 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
8666 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
8667 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
8668 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
8669 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
8670 return (uint64_t)ret_conv;
8673 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
8674 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8675 *ret_conv = CResult_NoneSemanticErrorZ_ok();
8676 return (uint64_t)ret_conv;
8679 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
8680 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8681 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8682 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
8683 return (uint64_t)ret_conv;
8686 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
8687 if ((_res & 1) != 0) return;
8688 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
8690 CResult_NoneSemanticErrorZ_free(_res_conv);
8693 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
8694 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
8695 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
8696 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
8697 return (uint64_t)ret_conv;
8700 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
8702 o_conv.inner = (void*)(o & (~1));
8703 o_conv.is_owned = (o & 1) || (o == 0);
8704 o_conv = Invoice_clone(&o_conv);
8705 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8706 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
8707 return (uint64_t)ret_conv;
8710 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
8711 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
8712 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8713 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
8714 return (uint64_t)ret_conv;
8717 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
8718 if ((_res & 1) != 0) return;
8719 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
8721 CResult_InvoiceSemanticErrorZ_free(_res_conv);
8724 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
8725 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
8726 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
8727 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
8728 return (uint64_t)ret_conv;
8731 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
8732 LDKDescription o_conv;
8733 o_conv.inner = (void*)(o & (~1));
8734 o_conv.is_owned = (o & 1) || (o == 0);
8735 o_conv = Description_clone(&o_conv);
8736 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8737 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
8738 return (uint64_t)ret_conv;
8741 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
8742 LDKCreationError e_conv = LDKCreationError_from_js(e);
8743 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8744 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
8745 return (uint64_t)ret_conv;
8748 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
8749 if ((_res & 1) != 0) return;
8750 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
8752 CResult_DescriptionCreationErrorZ_free(_res_conv);
8755 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
8756 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
8757 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
8758 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
8759 return (uint64_t)ret_conv;
8762 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
8763 LDKExpiryTime o_conv;
8764 o_conv.inner = (void*)(o & (~1));
8765 o_conv.is_owned = (o & 1) || (o == 0);
8766 o_conv = ExpiryTime_clone(&o_conv);
8767 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8768 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
8769 return (uint64_t)ret_conv;
8772 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
8773 LDKCreationError e_conv = LDKCreationError_from_js(e);
8774 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8775 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
8776 return (uint64_t)ret_conv;
8779 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
8780 if ((_res & 1) != 0) return;
8781 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
8783 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
8786 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
8787 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
8788 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
8789 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
8790 return (uint64_t)ret_conv;
8793 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
8794 LDKPrivateRoute o_conv;
8795 o_conv.inner = (void*)(o & (~1));
8796 o_conv.is_owned = (o & 1) || (o == 0);
8797 o_conv = PrivateRoute_clone(&o_conv);
8798 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8799 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
8800 return (uint64_t)ret_conv;
8803 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
8804 LDKCreationError e_conv = LDKCreationError_from_js(e);
8805 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8806 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
8807 return (uint64_t)ret_conv;
8810 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
8811 if ((_res & 1) != 0) return;
8812 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
8814 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
8817 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
8818 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
8819 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
8820 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
8821 return (uint64_t)ret_conv;
8824 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
8825 LDKStr o_conv = str_ref_to_owned_c(o);
8826 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8827 *ret_conv = CResult_StringErrorZ_ok(o_conv);
8828 return (uint64_t)ret_conv;
8831 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
8832 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8833 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
8834 *ret_conv = CResult_StringErrorZ_err(e_conv);
8835 return (uint64_t)ret_conv;
8838 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
8839 if ((_res & 1) != 0) return;
8840 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
8842 CResult_StringErrorZ_free(_res_conv);
8845 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
8846 LDKChannelMonitorUpdate o_conv;
8847 o_conv.inner = (void*)(o & (~1));
8848 o_conv.is_owned = (o & 1) || (o == 0);
8849 o_conv = ChannelMonitorUpdate_clone(&o_conv);
8850 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8851 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
8852 return (uint64_t)ret_conv;
8855 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
8856 LDKDecodeError e_conv;
8857 e_conv.inner = (void*)(e & (~1));
8858 e_conv.is_owned = (e & 1) || (e == 0);
8859 e_conv = DecodeError_clone(&e_conv);
8860 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8861 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
8862 return (uint64_t)ret_conv;
8865 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
8866 if ((_res & 1) != 0) return;
8867 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8869 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
8872 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
8873 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
8874 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8875 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
8876 return (uint64_t)ret_conv;
8879 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
8880 LDKHTLCUpdate o_conv;
8881 o_conv.inner = (void*)(o & (~1));
8882 o_conv.is_owned = (o & 1) || (o == 0);
8883 o_conv = HTLCUpdate_clone(&o_conv);
8884 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8885 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
8886 return (uint64_t)ret_conv;
8889 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
8890 LDKDecodeError e_conv;
8891 e_conv.inner = (void*)(e & (~1));
8892 e_conv.is_owned = (e & 1) || (e == 0);
8893 e_conv = DecodeError_clone(&e_conv);
8894 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8895 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
8896 return (uint64_t)ret_conv;
8899 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
8900 if ((_res & 1) != 0) return;
8901 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8903 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
8906 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
8907 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
8908 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
8909 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
8910 return (uint64_t)ret_conv;
8913 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
8914 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8915 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
8916 return (uint64_t)ret_conv;
8919 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
8920 LDKMonitorUpdateError e_conv;
8921 e_conv.inner = (void*)(e & (~1));
8922 e_conv.is_owned = (e & 1) || (e == 0);
8923 e_conv = MonitorUpdateError_clone(&e_conv);
8924 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8925 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
8926 return (uint64_t)ret_conv;
8929 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
8930 if ((_res & 1) != 0) return;
8931 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
8933 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
8936 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
8937 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
8938 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8939 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
8940 return (uint64_t)ret_conv;
8943 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
8944 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
8945 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8946 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
8947 return (uint64_t)ret_ref;
8950 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
8952 a_conv.inner = (void*)(a & (~1));
8953 a_conv.is_owned = (a & 1) || (a == 0);
8954 a_conv = OutPoint_clone(&a_conv);
8956 b_ref.datalen = *((uint32_t*)b);
8957 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8958 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8959 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8960 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
8961 return (uint64_t)ret_ref;
8964 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
8965 if ((_res & 1) != 0) return;
8966 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
8968 C2Tuple_OutPointScriptZ_free(_res_conv);
8971 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
8972 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
8973 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8974 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
8975 return (uint64_t)ret_ref;
8978 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
8980 b_ref.datalen = *((uint32_t*)b);
8981 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
8982 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8983 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8984 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
8985 return (uint64_t)ret_ref;
8988 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
8989 if ((_res & 1) != 0) return;
8990 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
8992 C2Tuple_u32ScriptZ_free(_res_conv);
8995 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
8996 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
8997 _res_constr.datalen = *((uint32_t*)_res);
8998 if (_res_constr.datalen > 0)
8999 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9001 _res_constr.data = NULL;
9002 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9003 for (size_t e = 0; e < _res_constr.datalen; e++) {
9004 uint32_t _res_conv_30 = _res_vals[e];
9005 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
9006 FREE((void*)_res_conv_30);
9007 _res_constr.data[e] = _res_conv_30_conv;
9009 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
9012 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
9013 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
9014 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9015 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
9016 return (uint64_t)ret_ref;
9019 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
9020 LDKThirtyTwoBytes a_ref;
9021 CHECK(*((uint32_t*)a) == 32);
9022 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9023 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
9024 b_constr.datalen = *((uint32_t*)b);
9025 if (b_constr.datalen > 0)
9026 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9028 b_constr.data = NULL;
9029 uint32_t* b_vals = (uint32_t*)(b + 4);
9030 for (size_t e = 0; e < b_constr.datalen; e++) {
9031 uint32_t b_conv_30 = b_vals[e];
9032 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
9033 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
9034 b_constr.data[e] = b_conv_30_conv;
9036 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9037 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
9038 return (uint64_t)ret_ref;
9041 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
9042 if ((_res & 1) != 0) return;
9043 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
9045 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
9048 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
9049 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
9050 _res_constr.datalen = *((uint32_t*)_res);
9051 if (_res_constr.datalen > 0)
9052 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
9054 _res_constr.data = NULL;
9055 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9056 for (size_t c = 0; c < _res_constr.datalen; c++) {
9057 uint32_t _res_conv_54 = _res_vals[c];
9058 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
9059 FREE((void*)_res_conv_54);
9060 _res_constr.data[c] = _res_conv_54_conv;
9062 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
9065 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
9066 LDKCVec_EventZ _res_constr;
9067 _res_constr.datalen = *((uint32_t*)_res);
9068 if (_res_constr.datalen > 0)
9069 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
9071 _res_constr.data = NULL;
9072 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9073 for (size_t h = 0; h < _res_constr.datalen; h++) {
9074 uint32_t _res_conv_7 = _res_vals[h];
9075 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
9076 FREE((void*)_res_conv_7);
9077 _res_constr.data[h] = _res_conv_7_conv;
9079 CVec_EventZ_free(_res_constr);
9082 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
9083 LDKCVec_TransactionZ _res_constr;
9084 _res_constr.datalen = *((uint32_t*)_res);
9085 if (_res_constr.datalen > 0)
9086 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9088 _res_constr.data = NULL;
9089 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9090 for (size_t m = 0; m < _res_constr.datalen; m++) {
9091 int8_tArray _res_conv_12 = _res_vals[m];
9092 LDKTransaction _res_conv_12_ref;
9093 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9094 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
9095 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9096 _res_conv_12_ref.data_is_owned = true;
9097 _res_constr.data[m] = _res_conv_12_ref;
9099 CVec_TransactionZ_free(_res_constr);
9102 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
9103 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
9104 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9105 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
9106 return (uint64_t)ret_ref;
9109 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
9110 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
9111 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9112 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
9113 return (uint64_t)ret_ref;
9116 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
9117 if ((_res & 1) != 0) return;
9118 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
9120 C2Tuple_u32TxOutZ_free(_res_conv);
9123 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
9124 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
9125 _res_constr.datalen = *((uint32_t*)_res);
9126 if (_res_constr.datalen > 0)
9127 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9129 _res_constr.data = NULL;
9130 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9131 for (size_t z = 0; z < _res_constr.datalen; z++) {
9132 uint32_t _res_conv_25 = _res_vals[z];
9133 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
9134 FREE((void*)_res_conv_25);
9135 _res_constr.data[z] = _res_conv_25_conv;
9137 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
9140 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
9141 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
9142 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9143 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
9144 return (uint64_t)ret_ref;
9147 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
9148 LDKThirtyTwoBytes a_ref;
9149 CHECK(*((uint32_t*)a) == 32);
9150 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9151 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
9152 b_constr.datalen = *((uint32_t*)b);
9153 if (b_constr.datalen > 0)
9154 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9156 b_constr.data = NULL;
9157 uint32_t* b_vals = (uint32_t*)(b + 4);
9158 for (size_t z = 0; z < b_constr.datalen; z++) {
9159 uint32_t b_conv_25 = b_vals[z];
9160 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
9161 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
9162 b_constr.data[z] = b_conv_25_conv;
9164 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9165 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
9166 return (uint64_t)ret_ref;
9169 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
9170 if ((_res & 1) != 0) return;
9171 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
9173 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
9176 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
9177 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
9178 _res_constr.datalen = *((uint32_t*)_res);
9179 if (_res_constr.datalen > 0)
9180 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
9182 _res_constr.data = NULL;
9183 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9184 for (size_t x = 0; x < _res_constr.datalen; x++) {
9185 uint32_t _res_conv_49 = _res_vals[x];
9186 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
9187 FREE((void*)_res_conv_49);
9188 _res_constr.data[x] = _res_conv_49_conv;
9190 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
9193 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
9194 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
9195 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9196 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
9197 return (uint64_t)ret_conv;
9200 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
9201 LDKDecodeError e_conv;
9202 e_conv.inner = (void*)(e & (~1));
9203 e_conv.is_owned = (e & 1) || (e == 0);
9204 e_conv = DecodeError_clone(&e_conv);
9205 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9206 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
9207 return (uint64_t)ret_conv;
9210 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
9211 if ((_res & 1) != 0) return;
9212 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9214 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
9217 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
9218 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9219 *ret_conv = CResult_boolLightningErrorZ_ok(o);
9220 return (uint64_t)ret_conv;
9223 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
9224 LDKLightningError e_conv;
9225 e_conv.inner = (void*)(e & (~1));
9226 e_conv.is_owned = (e & 1) || (e == 0);
9227 e_conv = LightningError_clone(&e_conv);
9228 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9229 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
9230 return (uint64_t)ret_conv;
9233 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
9234 if ((_res & 1) != 0) return;
9235 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
9237 CResult_boolLightningErrorZ_free(_res_conv);
9240 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
9241 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
9242 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9243 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
9244 return (uint64_t)ret_conv;
9247 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
9248 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
9249 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9250 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
9251 return (uint64_t)ret_ref;
9254 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
9255 LDKChannelAnnouncement a_conv;
9256 a_conv.inner = (void*)(a & (~1));
9257 a_conv.is_owned = (a & 1) || (a == 0);
9258 a_conv = ChannelAnnouncement_clone(&a_conv);
9259 LDKChannelUpdate b_conv;
9260 b_conv.inner = (void*)(b & (~1));
9261 b_conv.is_owned = (b & 1) || (b == 0);
9262 b_conv = ChannelUpdate_clone(&b_conv);
9263 LDKChannelUpdate c_conv;
9264 c_conv.inner = (void*)(c & (~1));
9265 c_conv.is_owned = (c & 1) || (c == 0);
9266 c_conv = ChannelUpdate_clone(&c_conv);
9267 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9268 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
9269 return (uint64_t)ret_ref;
9272 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
9273 if ((_res & 1) != 0) return;
9274 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
9276 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
9279 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
9280 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
9281 _res_constr.datalen = *((uint32_t*)_res);
9282 if (_res_constr.datalen > 0)
9283 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9285 _res_constr.data = NULL;
9286 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9287 for (size_t l = 0; l < _res_constr.datalen; l++) {
9288 uint32_t _res_conv_63 = _res_vals[l];
9289 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
9290 FREE((void*)_res_conv_63);
9291 _res_constr.data[l] = _res_conv_63_conv;
9293 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
9296 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
9297 LDKCVec_NodeAnnouncementZ _res_constr;
9298 _res_constr.datalen = *((uint32_t*)_res);
9299 if (_res_constr.datalen > 0)
9300 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9302 _res_constr.data = NULL;
9303 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9304 for (size_t s = 0; s < _res_constr.datalen; s++) {
9305 uint32_t _res_conv_18 = _res_vals[s];
9306 LDKNodeAnnouncement _res_conv_18_conv;
9307 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
9308 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
9309 _res_constr.data[s] = _res_conv_18_conv;
9311 CVec_NodeAnnouncementZ_free(_res_constr);
9314 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
9315 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9316 *ret_conv = CResult_NoneLightningErrorZ_ok();
9317 return (uint64_t)ret_conv;
9320 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
9321 LDKLightningError e_conv;
9322 e_conv.inner = (void*)(e & (~1));
9323 e_conv.is_owned = (e & 1) || (e == 0);
9324 e_conv = LightningError_clone(&e_conv);
9325 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9326 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
9327 return (uint64_t)ret_conv;
9330 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
9331 if ((_res & 1) != 0) return;
9332 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
9334 CResult_NoneLightningErrorZ_free(_res_conv);
9337 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
9338 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
9339 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9340 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
9341 return (uint64_t)ret_conv;
9344 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
9345 LDKCVec_PublicKeyZ _res_constr;
9346 _res_constr.datalen = *((uint32_t*)_res);
9347 if (_res_constr.datalen > 0)
9348 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9350 _res_constr.data = NULL;
9351 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9352 for (size_t m = 0; m < _res_constr.datalen; m++) {
9353 int8_tArray _res_conv_12 = _res_vals[m];
9354 LDKPublicKey _res_conv_12_ref;
9355 CHECK(*((uint32_t*)_res_conv_12) == 33);
9356 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
9357 _res_constr.data[m] = _res_conv_12_ref;
9359 CVec_PublicKeyZ_free(_res_constr);
9362 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
9364 o_ref.datalen = *((uint32_t*)o);
9365 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
9366 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9367 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9368 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
9369 return (uint64_t)ret_conv;
9372 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
9373 LDKPeerHandleError e_conv;
9374 e_conv.inner = (void*)(e & (~1));
9375 e_conv.is_owned = (e & 1) || (e == 0);
9376 e_conv = PeerHandleError_clone(&e_conv);
9377 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9378 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
9379 return (uint64_t)ret_conv;
9382 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
9383 if ((_res & 1) != 0) return;
9384 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9386 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
9389 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
9390 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
9391 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9392 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
9393 return (uint64_t)ret_conv;
9396 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
9397 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9398 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
9399 return (uint64_t)ret_conv;
9402 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
9403 LDKPeerHandleError e_conv;
9404 e_conv.inner = (void*)(e & (~1));
9405 e_conv.is_owned = (e & 1) || (e == 0);
9406 e_conv = PeerHandleError_clone(&e_conv);
9407 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9408 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
9409 return (uint64_t)ret_conv;
9412 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
9413 if ((_res & 1) != 0) return;
9414 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9416 CResult_NonePeerHandleErrorZ_free(_res_conv);
9419 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
9420 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
9421 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9422 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
9423 return (uint64_t)ret_conv;
9426 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
9427 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9428 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
9429 return (uint64_t)ret_conv;
9432 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
9433 LDKPeerHandleError e_conv;
9434 e_conv.inner = (void*)(e & (~1));
9435 e_conv.is_owned = (e & 1) || (e == 0);
9436 e_conv = PeerHandleError_clone(&e_conv);
9437 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9438 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
9439 return (uint64_t)ret_conv;
9442 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
9443 if ((_res & 1) != 0) return;
9444 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
9446 CResult_boolPeerHandleErrorZ_free(_res_conv);
9449 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
9450 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
9451 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9452 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
9453 return (uint64_t)ret_conv;
9456 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
9457 LDKDirectionalChannelInfo o_conv;
9458 o_conv.inner = (void*)(o & (~1));
9459 o_conv.is_owned = (o & 1) || (o == 0);
9460 o_conv = DirectionalChannelInfo_clone(&o_conv);
9461 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9462 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
9463 return (uint64_t)ret_conv;
9466 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
9467 LDKDecodeError e_conv;
9468 e_conv.inner = (void*)(e & (~1));
9469 e_conv.is_owned = (e & 1) || (e == 0);
9470 e_conv = DecodeError_clone(&e_conv);
9471 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9472 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
9473 return (uint64_t)ret_conv;
9476 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
9477 if ((_res & 1) != 0) return;
9478 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9480 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
9483 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9484 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
9485 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
9486 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
9487 return (uint64_t)ret_conv;
9490 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
9491 LDKChannelInfo o_conv;
9492 o_conv.inner = (void*)(o & (~1));
9493 o_conv.is_owned = (o & 1) || (o == 0);
9494 o_conv = ChannelInfo_clone(&o_conv);
9495 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9496 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
9497 return (uint64_t)ret_conv;
9500 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
9501 LDKDecodeError e_conv;
9502 e_conv.inner = (void*)(e & (~1));
9503 e_conv.is_owned = (e & 1) || (e == 0);
9504 e_conv = DecodeError_clone(&e_conv);
9505 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9506 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
9507 return (uint64_t)ret_conv;
9510 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
9511 if ((_res & 1) != 0) return;
9512 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9514 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
9517 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
9518 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
9519 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
9520 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
9521 return (uint64_t)ret_conv;
9524 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
9525 LDKRoutingFees o_conv;
9526 o_conv.inner = (void*)(o & (~1));
9527 o_conv.is_owned = (o & 1) || (o == 0);
9528 o_conv = RoutingFees_clone(&o_conv);
9529 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9530 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
9531 return (uint64_t)ret_conv;
9534 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
9535 LDKDecodeError e_conv;
9536 e_conv.inner = (void*)(e & (~1));
9537 e_conv.is_owned = (e & 1) || (e == 0);
9538 e_conv = DecodeError_clone(&e_conv);
9539 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9540 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
9541 return (uint64_t)ret_conv;
9544 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
9545 if ((_res & 1) != 0) return;
9546 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9548 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
9551 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
9552 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
9553 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
9554 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
9555 return (uint64_t)ret_conv;
9558 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
9559 LDKNodeAnnouncementInfo o_conv;
9560 o_conv.inner = (void*)(o & (~1));
9561 o_conv.is_owned = (o & 1) || (o == 0);
9562 o_conv = NodeAnnouncementInfo_clone(&o_conv);
9563 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9564 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
9565 return (uint64_t)ret_conv;
9568 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
9569 LDKDecodeError e_conv;
9570 e_conv.inner = (void*)(e & (~1));
9571 e_conv.is_owned = (e & 1) || (e == 0);
9572 e_conv = DecodeError_clone(&e_conv);
9573 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9574 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
9575 return (uint64_t)ret_conv;
9578 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
9579 if ((_res & 1) != 0) return;
9580 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9582 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
9585 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
9586 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
9587 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
9588 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
9589 return (uint64_t)ret_conv;
9592 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
9593 LDKCVec_u64Z _res_constr;
9594 _res_constr.datalen = *((uint32_t*)_res);
9595 if (_res_constr.datalen > 0)
9596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
9598 _res_constr.data = NULL;
9599 int64_t* _res_vals = (int64_t*)(_res + 4);
9600 for (size_t i = 0; i < _res_constr.datalen; i++) {
9601 int64_t _res_conv_8 = _res_vals[i];
9602 _res_constr.data[i] = _res_conv_8;
9604 CVec_u64Z_free(_res_constr);
9607 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
9609 o_conv.inner = (void*)(o & (~1));
9610 o_conv.is_owned = (o & 1) || (o == 0);
9611 o_conv = NodeInfo_clone(&o_conv);
9612 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9613 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
9614 return (uint64_t)ret_conv;
9617 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
9618 LDKDecodeError e_conv;
9619 e_conv.inner = (void*)(e & (~1));
9620 e_conv.is_owned = (e & 1) || (e == 0);
9621 e_conv = DecodeError_clone(&e_conv);
9622 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9623 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
9624 return (uint64_t)ret_conv;
9627 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
9628 if ((_res & 1) != 0) return;
9629 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
9631 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
9634 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
9635 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
9636 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
9637 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
9638 return (uint64_t)ret_conv;
9641 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
9642 LDKNetworkGraph o_conv;
9643 o_conv.inner = (void*)(o & (~1));
9644 o_conv.is_owned = (o & 1) || (o == 0);
9645 o_conv = NetworkGraph_clone(&o_conv);
9646 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9647 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
9648 return (uint64_t)ret_conv;
9651 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
9652 LDKDecodeError e_conv;
9653 e_conv.inner = (void*)(e & (~1));
9654 e_conv.is_owned = (e & 1) || (e == 0);
9655 e_conv = DecodeError_clone(&e_conv);
9656 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9657 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
9658 return (uint64_t)ret_conv;
9661 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
9662 if ((_res & 1) != 0) return;
9663 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
9665 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
9668 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
9669 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
9670 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
9671 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
9672 return (uint64_t)ret_conv;
9675 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
9676 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9677 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9678 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
9679 return (uint64_t)ret_conv;
9682 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
9683 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9684 *ret_conv = CResult_NetAddressu8Z_err(e);
9685 return (uint64_t)ret_conv;
9688 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
9689 if ((_res & 1) != 0) return;
9690 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
9692 CResult_NetAddressu8Z_free(_res_conv);
9695 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
9696 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
9697 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
9698 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
9699 return (uint64_t)ret_conv;
9702 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
9703 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
9704 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9705 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
9706 return (uint64_t)ret_conv;
9709 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
9710 LDKDecodeError e_conv;
9711 e_conv.inner = (void*)(e & (~1));
9712 e_conv.is_owned = (e & 1) || (e == 0);
9713 e_conv = DecodeError_clone(&e_conv);
9714 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9715 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
9716 return (uint64_t)ret_conv;
9719 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
9720 if ((_res & 1) != 0) return;
9721 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9723 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
9726 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
9727 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
9728 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9729 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
9730 return (uint64_t)ret_conv;
9733 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
9734 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
9735 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9736 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
9737 return (uint64_t)ret_conv;
9740 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
9741 LDKDecodeError e_conv;
9742 e_conv.inner = (void*)(e & (~1));
9743 e_conv.is_owned = (e & 1) || (e == 0);
9744 e_conv = DecodeError_clone(&e_conv);
9745 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9746 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
9747 return (uint64_t)ret_conv;
9750 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
9751 if ((_res & 1) != 0) return;
9752 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
9754 CResult_NetAddressDecodeErrorZ_free(_res_conv);
9757 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
9758 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
9759 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
9760 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
9761 return (uint64_t)ret_conv;
9764 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
9765 LDKCVec_UpdateAddHTLCZ _res_constr;
9766 _res_constr.datalen = *((uint32_t*)_res);
9767 if (_res_constr.datalen > 0)
9768 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
9770 _res_constr.data = NULL;
9771 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9772 for (size_t p = 0; p < _res_constr.datalen; p++) {
9773 uint32_t _res_conv_15 = _res_vals[p];
9774 LDKUpdateAddHTLC _res_conv_15_conv;
9775 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
9776 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
9777 _res_constr.data[p] = _res_conv_15_conv;
9779 CVec_UpdateAddHTLCZ_free(_res_constr);
9782 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
9783 LDKCVec_UpdateFulfillHTLCZ _res_constr;
9784 _res_constr.datalen = *((uint32_t*)_res);
9785 if (_res_constr.datalen > 0)
9786 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
9788 _res_constr.data = NULL;
9789 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9790 for (size_t t = 0; t < _res_constr.datalen; t++) {
9791 uint32_t _res_conv_19 = _res_vals[t];
9792 LDKUpdateFulfillHTLC _res_conv_19_conv;
9793 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
9794 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
9795 _res_constr.data[t] = _res_conv_19_conv;
9797 CVec_UpdateFulfillHTLCZ_free(_res_constr);
9800 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
9801 LDKCVec_UpdateFailHTLCZ _res_constr;
9802 _res_constr.datalen = *((uint32_t*)_res);
9803 if (_res_constr.datalen > 0)
9804 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
9806 _res_constr.data = NULL;
9807 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9808 for (size_t q = 0; q < _res_constr.datalen; q++) {
9809 uint32_t _res_conv_16 = _res_vals[q];
9810 LDKUpdateFailHTLC _res_conv_16_conv;
9811 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9812 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9813 _res_constr.data[q] = _res_conv_16_conv;
9815 CVec_UpdateFailHTLCZ_free(_res_constr);
9818 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
9819 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
9820 _res_constr.datalen = *((uint32_t*)_res);
9821 if (_res_constr.datalen > 0)
9822 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
9824 _res_constr.data = NULL;
9825 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9826 for (size_t z = 0; z < _res_constr.datalen; z++) {
9827 uint32_t _res_conv_25 = _res_vals[z];
9828 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
9829 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
9830 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
9831 _res_constr.data[z] = _res_conv_25_conv;
9833 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
9836 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
9837 LDKAcceptChannel o_conv;
9838 o_conv.inner = (void*)(o & (~1));
9839 o_conv.is_owned = (o & 1) || (o == 0);
9840 o_conv = AcceptChannel_clone(&o_conv);
9841 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9842 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
9843 return (uint64_t)ret_conv;
9846 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
9847 LDKDecodeError e_conv;
9848 e_conv.inner = (void*)(e & (~1));
9849 e_conv.is_owned = (e & 1) || (e == 0);
9850 e_conv = DecodeError_clone(&e_conv);
9851 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9852 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
9853 return (uint64_t)ret_conv;
9856 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
9857 if ((_res & 1) != 0) return;
9858 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9860 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
9863 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
9864 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
9865 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9866 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
9867 return (uint64_t)ret_conv;
9870 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
9871 LDKAnnouncementSignatures o_conv;
9872 o_conv.inner = (void*)(o & (~1));
9873 o_conv.is_owned = (o & 1) || (o == 0);
9874 o_conv = AnnouncementSignatures_clone(&o_conv);
9875 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9876 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
9877 return (uint64_t)ret_conv;
9880 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
9881 LDKDecodeError e_conv;
9882 e_conv.inner = (void*)(e & (~1));
9883 e_conv.is_owned = (e & 1) || (e == 0);
9884 e_conv = DecodeError_clone(&e_conv);
9885 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9886 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
9887 return (uint64_t)ret_conv;
9890 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
9891 if ((_res & 1) != 0) return;
9892 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9894 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
9897 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
9898 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
9899 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9900 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
9901 return (uint64_t)ret_conv;
9904 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
9905 LDKChannelReestablish o_conv;
9906 o_conv.inner = (void*)(o & (~1));
9907 o_conv.is_owned = (o & 1) || (o == 0);
9908 o_conv = ChannelReestablish_clone(&o_conv);
9909 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9910 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
9911 return (uint64_t)ret_conv;
9914 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
9915 LDKDecodeError e_conv;
9916 e_conv.inner = (void*)(e & (~1));
9917 e_conv.is_owned = (e & 1) || (e == 0);
9918 e_conv = DecodeError_clone(&e_conv);
9919 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9920 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
9921 return (uint64_t)ret_conv;
9924 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
9925 if ((_res & 1) != 0) return;
9926 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
9928 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
9931 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
9932 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
9933 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9934 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
9935 return (uint64_t)ret_conv;
9938 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
9939 LDKClosingSigned o_conv;
9940 o_conv.inner = (void*)(o & (~1));
9941 o_conv.is_owned = (o & 1) || (o == 0);
9942 o_conv = ClosingSigned_clone(&o_conv);
9943 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9944 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
9945 return (uint64_t)ret_conv;
9948 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
9949 LDKDecodeError e_conv;
9950 e_conv.inner = (void*)(e & (~1));
9951 e_conv.is_owned = (e & 1) || (e == 0);
9952 e_conv = DecodeError_clone(&e_conv);
9953 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9954 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
9955 return (uint64_t)ret_conv;
9958 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
9959 if ((_res & 1) != 0) return;
9960 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9962 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
9965 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
9966 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
9967 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9968 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
9969 return (uint64_t)ret_conv;
9972 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
9973 LDKClosingSignedFeeRange o_conv;
9974 o_conv.inner = (void*)(o & (~1));
9975 o_conv.is_owned = (o & 1) || (o == 0);
9976 o_conv = ClosingSignedFeeRange_clone(&o_conv);
9977 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
9978 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
9979 return (uint64_t)ret_conv;
9982 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
9983 LDKDecodeError e_conv;
9984 e_conv.inner = (void*)(e & (~1));
9985 e_conv.is_owned = (e & 1) || (e == 0);
9986 e_conv = DecodeError_clone(&e_conv);
9987 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
9988 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
9989 return (uint64_t)ret_conv;
9992 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
9993 if ((_res & 1) != 0) return;
9994 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9996 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
9999 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
10000 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
10001 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10002 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
10003 return (uint64_t)ret_conv;
10006 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
10007 LDKCommitmentSigned o_conv;
10008 o_conv.inner = (void*)(o & (~1));
10009 o_conv.is_owned = (o & 1) || (o == 0);
10010 o_conv = CommitmentSigned_clone(&o_conv);
10011 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10012 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
10013 return (uint64_t)ret_conv;
10016 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
10017 LDKDecodeError e_conv;
10018 e_conv.inner = (void*)(e & (~1));
10019 e_conv.is_owned = (e & 1) || (e == 0);
10020 e_conv = DecodeError_clone(&e_conv);
10021 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10022 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
10023 return (uint64_t)ret_conv;
10026 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
10027 if ((_res & 1) != 0) return;
10028 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10030 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
10033 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
10034 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
10035 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10036 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
10037 return (uint64_t)ret_conv;
10040 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
10041 LDKFundingCreated o_conv;
10042 o_conv.inner = (void*)(o & (~1));
10043 o_conv.is_owned = (o & 1) || (o == 0);
10044 o_conv = FundingCreated_clone(&o_conv);
10045 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10046 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
10047 return (uint64_t)ret_conv;
10050 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
10051 LDKDecodeError e_conv;
10052 e_conv.inner = (void*)(e & (~1));
10053 e_conv.is_owned = (e & 1) || (e == 0);
10054 e_conv = DecodeError_clone(&e_conv);
10055 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10056 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
10057 return (uint64_t)ret_conv;
10060 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
10061 if ((_res & 1) != 0) return;
10062 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10064 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
10067 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
10068 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
10069 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10070 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
10071 return (uint64_t)ret_conv;
10074 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
10075 LDKFundingSigned o_conv;
10076 o_conv.inner = (void*)(o & (~1));
10077 o_conv.is_owned = (o & 1) || (o == 0);
10078 o_conv = FundingSigned_clone(&o_conv);
10079 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10080 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
10081 return (uint64_t)ret_conv;
10084 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
10085 LDKDecodeError e_conv;
10086 e_conv.inner = (void*)(e & (~1));
10087 e_conv.is_owned = (e & 1) || (e == 0);
10088 e_conv = DecodeError_clone(&e_conv);
10089 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10090 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
10091 return (uint64_t)ret_conv;
10094 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
10095 if ((_res & 1) != 0) return;
10096 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10098 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
10101 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
10102 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
10103 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10104 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
10105 return (uint64_t)ret_conv;
10108 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
10109 LDKFundingLocked o_conv;
10110 o_conv.inner = (void*)(o & (~1));
10111 o_conv.is_owned = (o & 1) || (o == 0);
10112 o_conv = FundingLocked_clone(&o_conv);
10113 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10114 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
10115 return (uint64_t)ret_conv;
10118 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
10119 LDKDecodeError e_conv;
10120 e_conv.inner = (void*)(e & (~1));
10121 e_conv.is_owned = (e & 1) || (e == 0);
10122 e_conv = DecodeError_clone(&e_conv);
10123 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10124 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
10125 return (uint64_t)ret_conv;
10128 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
10129 if ((_res & 1) != 0) return;
10130 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10132 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
10135 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
10136 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
10137 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10138 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
10139 return (uint64_t)ret_conv;
10142 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
10144 o_conv.inner = (void*)(o & (~1));
10145 o_conv.is_owned = (o & 1) || (o == 0);
10146 o_conv = Init_clone(&o_conv);
10147 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10148 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
10149 return (uint64_t)ret_conv;
10152 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
10153 LDKDecodeError e_conv;
10154 e_conv.inner = (void*)(e & (~1));
10155 e_conv.is_owned = (e & 1) || (e == 0);
10156 e_conv = DecodeError_clone(&e_conv);
10157 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10158 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
10159 return (uint64_t)ret_conv;
10162 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
10163 if ((_res & 1) != 0) return;
10164 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
10166 CResult_InitDecodeErrorZ_free(_res_conv);
10169 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
10170 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
10171 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10172 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
10173 return (uint64_t)ret_conv;
10176 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
10177 LDKOpenChannel o_conv;
10178 o_conv.inner = (void*)(o & (~1));
10179 o_conv.is_owned = (o & 1) || (o == 0);
10180 o_conv = OpenChannel_clone(&o_conv);
10181 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10182 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
10183 return (uint64_t)ret_conv;
10186 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
10187 LDKDecodeError e_conv;
10188 e_conv.inner = (void*)(e & (~1));
10189 e_conv.is_owned = (e & 1) || (e == 0);
10190 e_conv = DecodeError_clone(&e_conv);
10191 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10192 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
10193 return (uint64_t)ret_conv;
10196 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
10197 if ((_res & 1) != 0) return;
10198 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10200 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
10203 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
10204 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
10205 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10206 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
10207 return (uint64_t)ret_conv;
10210 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
10211 LDKRevokeAndACK o_conv;
10212 o_conv.inner = (void*)(o & (~1));
10213 o_conv.is_owned = (o & 1) || (o == 0);
10214 o_conv = RevokeAndACK_clone(&o_conv);
10215 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10216 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
10217 return (uint64_t)ret_conv;
10220 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
10221 LDKDecodeError e_conv;
10222 e_conv.inner = (void*)(e & (~1));
10223 e_conv.is_owned = (e & 1) || (e == 0);
10224 e_conv = DecodeError_clone(&e_conv);
10225 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10226 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
10227 return (uint64_t)ret_conv;
10230 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
10231 if ((_res & 1) != 0) return;
10232 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
10234 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
10237 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
10238 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
10239 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10240 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
10241 return (uint64_t)ret_conv;
10244 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
10245 LDKShutdown o_conv;
10246 o_conv.inner = (void*)(o & (~1));
10247 o_conv.is_owned = (o & 1) || (o == 0);
10248 o_conv = Shutdown_clone(&o_conv);
10249 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10250 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
10251 return (uint64_t)ret_conv;
10254 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
10255 LDKDecodeError e_conv;
10256 e_conv.inner = (void*)(e & (~1));
10257 e_conv.is_owned = (e & 1) || (e == 0);
10258 e_conv = DecodeError_clone(&e_conv);
10259 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10260 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
10261 return (uint64_t)ret_conv;
10264 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
10265 if ((_res & 1) != 0) return;
10266 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
10268 CResult_ShutdownDecodeErrorZ_free(_res_conv);
10271 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
10272 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
10273 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10274 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
10275 return (uint64_t)ret_conv;
10278 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
10279 LDKUpdateFailHTLC o_conv;
10280 o_conv.inner = (void*)(o & (~1));
10281 o_conv.is_owned = (o & 1) || (o == 0);
10282 o_conv = UpdateFailHTLC_clone(&o_conv);
10283 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10284 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
10285 return (uint64_t)ret_conv;
10288 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
10289 LDKDecodeError e_conv;
10290 e_conv.inner = (void*)(e & (~1));
10291 e_conv.is_owned = (e & 1) || (e == 0);
10292 e_conv = DecodeError_clone(&e_conv);
10293 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10294 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
10295 return (uint64_t)ret_conv;
10298 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
10299 if ((_res & 1) != 0) return;
10300 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10302 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
10305 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
10306 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
10307 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
10308 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
10309 return (uint64_t)ret_conv;
10312 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
10313 LDKUpdateFailMalformedHTLC o_conv;
10314 o_conv.inner = (void*)(o & (~1));
10315 o_conv.is_owned = (o & 1) || (o == 0);
10316 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
10317 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10318 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
10319 return (uint64_t)ret_conv;
10322 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
10323 LDKDecodeError e_conv;
10324 e_conv.inner = (void*)(e & (~1));
10325 e_conv.is_owned = (e & 1) || (e == 0);
10326 e_conv = DecodeError_clone(&e_conv);
10327 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10328 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
10329 return (uint64_t)ret_conv;
10332 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
10333 if ((_res & 1) != 0) return;
10334 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10336 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
10339 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
10340 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
10341 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
10342 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
10343 return (uint64_t)ret_conv;
10346 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
10347 LDKUpdateFee o_conv;
10348 o_conv.inner = (void*)(o & (~1));
10349 o_conv.is_owned = (o & 1) || (o == 0);
10350 o_conv = UpdateFee_clone(&o_conv);
10351 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10352 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
10353 return (uint64_t)ret_conv;
10356 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
10357 LDKDecodeError e_conv;
10358 e_conv.inner = (void*)(e & (~1));
10359 e_conv.is_owned = (e & 1) || (e == 0);
10360 e_conv = DecodeError_clone(&e_conv);
10361 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10362 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
10363 return (uint64_t)ret_conv;
10366 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
10367 if ((_res & 1) != 0) return;
10368 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10370 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
10373 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
10374 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
10375 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
10376 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
10377 return (uint64_t)ret_conv;
10380 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
10381 LDKUpdateFulfillHTLC o_conv;
10382 o_conv.inner = (void*)(o & (~1));
10383 o_conv.is_owned = (o & 1) || (o == 0);
10384 o_conv = UpdateFulfillHTLC_clone(&o_conv);
10385 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10386 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
10387 return (uint64_t)ret_conv;
10390 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
10391 LDKDecodeError e_conv;
10392 e_conv.inner = (void*)(e & (~1));
10393 e_conv.is_owned = (e & 1) || (e == 0);
10394 e_conv = DecodeError_clone(&e_conv);
10395 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10396 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
10397 return (uint64_t)ret_conv;
10400 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
10401 if ((_res & 1) != 0) return;
10402 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10404 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
10407 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
10408 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
10409 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
10410 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
10411 return (uint64_t)ret_conv;
10414 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
10415 LDKUpdateAddHTLC o_conv;
10416 o_conv.inner = (void*)(o & (~1));
10417 o_conv.is_owned = (o & 1) || (o == 0);
10418 o_conv = UpdateAddHTLC_clone(&o_conv);
10419 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10420 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
10421 return (uint64_t)ret_conv;
10424 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
10425 LDKDecodeError e_conv;
10426 e_conv.inner = (void*)(e & (~1));
10427 e_conv.is_owned = (e & 1) || (e == 0);
10428 e_conv = DecodeError_clone(&e_conv);
10429 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10430 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
10431 return (uint64_t)ret_conv;
10434 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
10435 if ((_res & 1) != 0) return;
10436 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
10438 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
10441 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
10442 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
10443 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
10444 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
10445 return (uint64_t)ret_conv;
10448 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
10450 o_conv.inner = (void*)(o & (~1));
10451 o_conv.is_owned = (o & 1) || (o == 0);
10452 o_conv = Ping_clone(&o_conv);
10453 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10454 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
10455 return (uint64_t)ret_conv;
10458 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
10459 LDKDecodeError e_conv;
10460 e_conv.inner = (void*)(e & (~1));
10461 e_conv.is_owned = (e & 1) || (e == 0);
10462 e_conv = DecodeError_clone(&e_conv);
10463 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10464 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
10465 return (uint64_t)ret_conv;
10468 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
10469 if ((_res & 1) != 0) return;
10470 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
10472 CResult_PingDecodeErrorZ_free(_res_conv);
10475 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
10476 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
10477 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
10478 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
10479 return (uint64_t)ret_conv;
10482 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
10484 o_conv.inner = (void*)(o & (~1));
10485 o_conv.is_owned = (o & 1) || (o == 0);
10486 o_conv = Pong_clone(&o_conv);
10487 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10488 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
10489 return (uint64_t)ret_conv;
10492 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
10493 LDKDecodeError e_conv;
10494 e_conv.inner = (void*)(e & (~1));
10495 e_conv.is_owned = (e & 1) || (e == 0);
10496 e_conv = DecodeError_clone(&e_conv);
10497 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10498 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
10499 return (uint64_t)ret_conv;
10502 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
10503 if ((_res & 1) != 0) return;
10504 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
10506 CResult_PongDecodeErrorZ_free(_res_conv);
10509 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
10510 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
10511 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
10512 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
10513 return (uint64_t)ret_conv;
10516 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10517 LDKUnsignedChannelAnnouncement o_conv;
10518 o_conv.inner = (void*)(o & (~1));
10519 o_conv.is_owned = (o & 1) || (o == 0);
10520 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
10521 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10522 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
10523 return (uint64_t)ret_conv;
10526 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10527 LDKDecodeError e_conv;
10528 e_conv.inner = (void*)(e & (~1));
10529 e_conv.is_owned = (e & 1) || (e == 0);
10530 e_conv = DecodeError_clone(&e_conv);
10531 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10532 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
10533 return (uint64_t)ret_conv;
10536 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10537 if ((_res & 1) != 0) return;
10538 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10540 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
10543 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10544 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10545 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
10546 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10547 return (uint64_t)ret_conv;
10550 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
10551 LDKChannelAnnouncement o_conv;
10552 o_conv.inner = (void*)(o & (~1));
10553 o_conv.is_owned = (o & 1) || (o == 0);
10554 o_conv = ChannelAnnouncement_clone(&o_conv);
10555 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10556 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
10557 return (uint64_t)ret_conv;
10560 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
10561 LDKDecodeError e_conv;
10562 e_conv.inner = (void*)(e & (~1));
10563 e_conv.is_owned = (e & 1) || (e == 0);
10564 e_conv = DecodeError_clone(&e_conv);
10565 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10566 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
10567 return (uint64_t)ret_conv;
10570 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
10571 if ((_res & 1) != 0) return;
10572 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10574 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
10577 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10578 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
10579 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
10580 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
10581 return (uint64_t)ret_conv;
10584 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10585 LDKUnsignedChannelUpdate o_conv;
10586 o_conv.inner = (void*)(o & (~1));
10587 o_conv.is_owned = (o & 1) || (o == 0);
10588 o_conv = UnsignedChannelUpdate_clone(&o_conv);
10589 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10590 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
10591 return (uint64_t)ret_conv;
10594 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
10595 LDKDecodeError e_conv;
10596 e_conv.inner = (void*)(e & (~1));
10597 e_conv.is_owned = (e & 1) || (e == 0);
10598 e_conv = DecodeError_clone(&e_conv);
10599 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10600 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
10601 return (uint64_t)ret_conv;
10604 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10605 if ((_res & 1) != 0) return;
10606 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10608 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
10611 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10612 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
10613 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
10614 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
10615 return (uint64_t)ret_conv;
10618 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
10619 LDKChannelUpdate o_conv;
10620 o_conv.inner = (void*)(o & (~1));
10621 o_conv.is_owned = (o & 1) || (o == 0);
10622 o_conv = ChannelUpdate_clone(&o_conv);
10623 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10624 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
10625 return (uint64_t)ret_conv;
10628 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
10629 LDKDecodeError e_conv;
10630 e_conv.inner = (void*)(e & (~1));
10631 e_conv.is_owned = (e & 1) || (e == 0);
10632 e_conv = DecodeError_clone(&e_conv);
10633 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10634 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
10635 return (uint64_t)ret_conv;
10638 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
10639 if ((_res & 1) != 0) return;
10640 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10642 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
10645 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
10646 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
10647 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
10648 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
10649 return (uint64_t)ret_conv;
10652 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
10653 LDKErrorMessage o_conv;
10654 o_conv.inner = (void*)(o & (~1));
10655 o_conv.is_owned = (o & 1) || (o == 0);
10656 o_conv = ErrorMessage_clone(&o_conv);
10657 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10658 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
10659 return (uint64_t)ret_conv;
10662 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
10663 LDKDecodeError e_conv;
10664 e_conv.inner = (void*)(e & (~1));
10665 e_conv.is_owned = (e & 1) || (e == 0);
10666 e_conv = DecodeError_clone(&e_conv);
10667 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10668 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
10669 return (uint64_t)ret_conv;
10672 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
10673 if ((_res & 1) != 0) return;
10674 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
10676 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
10679 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
10680 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
10681 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
10682 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
10683 return (uint64_t)ret_conv;
10686 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10687 LDKUnsignedNodeAnnouncement o_conv;
10688 o_conv.inner = (void*)(o & (~1));
10689 o_conv.is_owned = (o & 1) || (o == 0);
10690 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
10691 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10692 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
10693 return (uint64_t)ret_conv;
10696 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10697 LDKDecodeError e_conv;
10698 e_conv.inner = (void*)(e & (~1));
10699 e_conv.is_owned = (e & 1) || (e == 0);
10700 e_conv = DecodeError_clone(&e_conv);
10701 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10702 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
10703 return (uint64_t)ret_conv;
10706 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10707 if ((_res & 1) != 0) return;
10708 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10710 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
10713 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10714 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
10715 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
10716 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
10717 return (uint64_t)ret_conv;
10720 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
10721 LDKNodeAnnouncement o_conv;
10722 o_conv.inner = (void*)(o & (~1));
10723 o_conv.is_owned = (o & 1) || (o == 0);
10724 o_conv = NodeAnnouncement_clone(&o_conv);
10725 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10726 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
10727 return (uint64_t)ret_conv;
10730 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
10731 LDKDecodeError e_conv;
10732 e_conv.inner = (void*)(e & (~1));
10733 e_conv.is_owned = (e & 1) || (e == 0);
10734 e_conv = DecodeError_clone(&e_conv);
10735 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10736 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
10737 return (uint64_t)ret_conv;
10740 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
10741 if ((_res & 1) != 0) return;
10742 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
10744 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
10747 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
10748 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
10749 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
10750 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
10751 return (uint64_t)ret_conv;
10754 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
10755 LDKQueryShortChannelIds o_conv;
10756 o_conv.inner = (void*)(o & (~1));
10757 o_conv.is_owned = (o & 1) || (o == 0);
10758 o_conv = QueryShortChannelIds_clone(&o_conv);
10759 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10760 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
10761 return (uint64_t)ret_conv;
10764 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
10765 LDKDecodeError e_conv;
10766 e_conv.inner = (void*)(e & (~1));
10767 e_conv.is_owned = (e & 1) || (e == 0);
10768 e_conv = DecodeError_clone(&e_conv);
10769 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10770 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
10771 return (uint64_t)ret_conv;
10774 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
10775 if ((_res & 1) != 0) return;
10776 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
10778 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
10781 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
10782 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
10783 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
10784 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
10785 return (uint64_t)ret_conv;
10788 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
10789 LDKReplyShortChannelIdsEnd o_conv;
10790 o_conv.inner = (void*)(o & (~1));
10791 o_conv.is_owned = (o & 1) || (o == 0);
10792 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
10793 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10794 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
10795 return (uint64_t)ret_conv;
10798 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
10799 LDKDecodeError e_conv;
10800 e_conv.inner = (void*)(e & (~1));
10801 e_conv.is_owned = (e & 1) || (e == 0);
10802 e_conv = DecodeError_clone(&e_conv);
10803 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10804 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
10805 return (uint64_t)ret_conv;
10808 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
10809 if ((_res & 1) != 0) return;
10810 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
10812 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
10815 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
10816 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
10817 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
10818 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
10819 return (uint64_t)ret_conv;
10822 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
10823 LDKQueryChannelRange o_conv;
10824 o_conv.inner = (void*)(o & (~1));
10825 o_conv.is_owned = (o & 1) || (o == 0);
10826 o_conv = QueryChannelRange_clone(&o_conv);
10827 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10828 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
10829 return (uint64_t)ret_conv;
10832 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
10833 LDKDecodeError e_conv;
10834 e_conv.inner = (void*)(e & (~1));
10835 e_conv.is_owned = (e & 1) || (e == 0);
10836 e_conv = DecodeError_clone(&e_conv);
10837 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10838 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
10839 return (uint64_t)ret_conv;
10842 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
10843 if ((_res & 1) != 0) return;
10844 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10846 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
10849 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10850 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
10851 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
10852 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
10853 return (uint64_t)ret_conv;
10856 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
10857 LDKReplyChannelRange o_conv;
10858 o_conv.inner = (void*)(o & (~1));
10859 o_conv.is_owned = (o & 1) || (o == 0);
10860 o_conv = ReplyChannelRange_clone(&o_conv);
10861 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10862 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
10863 return (uint64_t)ret_conv;
10866 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
10867 LDKDecodeError e_conv;
10868 e_conv.inner = (void*)(e & (~1));
10869 e_conv.is_owned = (e & 1) || (e == 0);
10870 e_conv = DecodeError_clone(&e_conv);
10871 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10872 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
10873 return (uint64_t)ret_conv;
10876 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
10877 if ((_res & 1) != 0) return;
10878 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10880 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
10883 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
10884 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
10885 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10886 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
10887 return (uint64_t)ret_conv;
10890 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
10891 LDKGossipTimestampFilter o_conv;
10892 o_conv.inner = (void*)(o & (~1));
10893 o_conv.is_owned = (o & 1) || (o == 0);
10894 o_conv = GossipTimestampFilter_clone(&o_conv);
10895 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10896 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
10897 return (uint64_t)ret_conv;
10900 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
10901 LDKDecodeError e_conv;
10902 e_conv.inner = (void*)(e & (~1));
10903 e_conv.is_owned = (e & 1) || (e == 0);
10904 e_conv = DecodeError_clone(&e_conv);
10905 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10906 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
10907 return (uint64_t)ret_conv;
10910 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
10911 if ((_res & 1) != 0) return;
10912 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
10914 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
10917 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
10918 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
10919 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10920 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
10921 return (uint64_t)ret_conv;
10924 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
10926 o_conv.inner = (void*)(o & (~1));
10927 o_conv.is_owned = (o & 1) || (o == 0);
10928 o_conv = Invoice_clone(&o_conv);
10929 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10930 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
10931 return (uint64_t)ret_conv;
10934 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
10935 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
10936 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10937 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
10938 return (uint64_t)ret_conv;
10941 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
10942 if ((_res & 1) != 0) return;
10943 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
10945 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
10948 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
10949 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
10950 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
10951 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
10952 return (uint64_t)ret_conv;
10955 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
10956 if ((this_ptr & 1) != 0) return;
10957 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
10958 FREE((void*)this_ptr);
10959 PaymentPurpose_free(this_ptr_conv);
10962 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
10963 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
10964 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10965 *ret_copy = PaymentPurpose_clone(orig_conv);
10966 uint64_t ret_ref = (uint64_t)ret_copy;
10970 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
10971 LDKThirtyTwoBytes payment_preimage_ref;
10972 CHECK(*((uint32_t*)payment_preimage) == 32);
10973 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10974 LDKThirtyTwoBytes payment_secret_ref;
10975 CHECK(*((uint32_t*)payment_secret) == 32);
10976 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10977 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10978 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
10979 uint64_t ret_ref = (uint64_t)ret_copy;
10983 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
10984 LDKThirtyTwoBytes a_ref;
10985 CHECK(*((uint32_t*)a) == 32);
10986 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10987 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10988 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
10989 uint64_t ret_ref = (uint64_t)ret_copy;
10993 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
10994 if ((this_ptr & 1) != 0) return;
10995 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
10996 FREE((void*)this_ptr);
10997 Event_free(this_ptr_conv);
11000 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
11001 LDKEvent* orig_conv = (LDKEvent*)orig;
11002 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11003 *ret_copy = Event_clone(orig_conv);
11004 uint64_t ret_ref = (uint64_t)ret_copy;
11008 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) {
11009 LDKThirtyTwoBytes temporary_channel_id_ref;
11010 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11011 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
11012 LDKCVec_u8Z output_script_ref;
11013 output_script_ref.datalen = *((uint32_t*)output_script);
11014 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
11015 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
11016 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11017 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
11018 uint64_t ret_ref = (uint64_t)ret_copy;
11022 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
11023 LDKThirtyTwoBytes payment_hash_ref;
11024 CHECK(*((uint32_t*)payment_hash) == 32);
11025 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11026 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
11027 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11028 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
11029 uint64_t ret_ref = (uint64_t)ret_copy;
11033 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
11034 LDKThirtyTwoBytes payment_preimage_ref;
11035 CHECK(*((uint32_t*)payment_preimage) == 32);
11036 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11037 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11038 *ret_copy = Event_payment_sent(payment_preimage_ref);
11039 uint64_t ret_ref = (uint64_t)ret_copy;
11043 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_hash, jboolean rejected_by_dest) {
11044 LDKThirtyTwoBytes payment_hash_ref;
11045 CHECK(*((uint32_t*)payment_hash) == 32);
11046 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11047 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11048 *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
11049 uint64_t ret_ref = (uint64_t)ret_copy;
11053 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
11054 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11055 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
11056 uint64_t ret_ref = (uint64_t)ret_copy;
11060 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
11061 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
11062 outputs_constr.datalen = *((uint32_t*)outputs);
11063 if (outputs_constr.datalen > 0)
11064 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11066 outputs_constr.data = NULL;
11067 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
11068 for (size_t b = 0; b < outputs_constr.datalen; b++) {
11069 uint32_t outputs_conv_27 = outputs_vals[b];
11070 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
11071 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
11072 outputs_constr.data[b] = outputs_conv_27_conv;
11074 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11075 *ret_copy = Event_spendable_outputs(outputs_constr);
11076 uint64_t ret_ref = (uint64_t)ret_copy;
11080 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
11081 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
11082 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11083 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
11084 uint64_t ret_ref = (uint64_t)ret_copy;
11088 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
11089 LDKEvent* obj_conv = (LDKEvent*)obj;
11090 LDKCVec_u8Z ret_var = Event_write(obj_conv);
11091 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11092 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11093 CVec_u8Z_free(ret_var);
11097 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
11098 if ((this_ptr & 1) != 0) return;
11099 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
11100 FREE((void*)this_ptr);
11101 MessageSendEvent_free(this_ptr_conv);
11104 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
11105 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
11106 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11107 *ret_copy = MessageSendEvent_clone(orig_conv);
11108 uint64_t ret_ref = (uint64_t)ret_copy;
11112 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
11113 LDKPublicKey node_id_ref;
11114 CHECK(*((uint32_t*)node_id) == 33);
11115 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11116 LDKAcceptChannel msg_conv;
11117 msg_conv.inner = (void*)(msg & (~1));
11118 msg_conv.is_owned = (msg & 1) || (msg == 0);
11119 msg_conv = AcceptChannel_clone(&msg_conv);
11120 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11121 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
11122 uint64_t ret_ref = (uint64_t)ret_copy;
11126 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
11127 LDKPublicKey node_id_ref;
11128 CHECK(*((uint32_t*)node_id) == 33);
11129 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11130 LDKOpenChannel msg_conv;
11131 msg_conv.inner = (void*)(msg & (~1));
11132 msg_conv.is_owned = (msg & 1) || (msg == 0);
11133 msg_conv = OpenChannel_clone(&msg_conv);
11134 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11135 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
11136 uint64_t ret_ref = (uint64_t)ret_copy;
11140 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
11141 LDKPublicKey node_id_ref;
11142 CHECK(*((uint32_t*)node_id) == 33);
11143 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11144 LDKFundingCreated msg_conv;
11145 msg_conv.inner = (void*)(msg & (~1));
11146 msg_conv.is_owned = (msg & 1) || (msg == 0);
11147 msg_conv = FundingCreated_clone(&msg_conv);
11148 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11149 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
11150 uint64_t ret_ref = (uint64_t)ret_copy;
11154 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
11155 LDKPublicKey node_id_ref;
11156 CHECK(*((uint32_t*)node_id) == 33);
11157 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11158 LDKFundingSigned msg_conv;
11159 msg_conv.inner = (void*)(msg & (~1));
11160 msg_conv.is_owned = (msg & 1) || (msg == 0);
11161 msg_conv = FundingSigned_clone(&msg_conv);
11162 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11163 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
11164 uint64_t ret_ref = (uint64_t)ret_copy;
11168 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
11169 LDKPublicKey node_id_ref;
11170 CHECK(*((uint32_t*)node_id) == 33);
11171 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11172 LDKFundingLocked msg_conv;
11173 msg_conv.inner = (void*)(msg & (~1));
11174 msg_conv.is_owned = (msg & 1) || (msg == 0);
11175 msg_conv = FundingLocked_clone(&msg_conv);
11176 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11177 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
11178 uint64_t ret_ref = (uint64_t)ret_copy;
11182 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
11183 LDKPublicKey node_id_ref;
11184 CHECK(*((uint32_t*)node_id) == 33);
11185 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11186 LDKAnnouncementSignatures msg_conv;
11187 msg_conv.inner = (void*)(msg & (~1));
11188 msg_conv.is_owned = (msg & 1) || (msg == 0);
11189 msg_conv = AnnouncementSignatures_clone(&msg_conv);
11190 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11191 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
11192 uint64_t ret_ref = (uint64_t)ret_copy;
11196 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
11197 LDKPublicKey node_id_ref;
11198 CHECK(*((uint32_t*)node_id) == 33);
11199 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11200 LDKCommitmentUpdate updates_conv;
11201 updates_conv.inner = (void*)(updates & (~1));
11202 updates_conv.is_owned = (updates & 1) || (updates == 0);
11203 updates_conv = CommitmentUpdate_clone(&updates_conv);
11204 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11205 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
11206 uint64_t ret_ref = (uint64_t)ret_copy;
11210 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
11211 LDKPublicKey node_id_ref;
11212 CHECK(*((uint32_t*)node_id) == 33);
11213 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11214 LDKRevokeAndACK msg_conv;
11215 msg_conv.inner = (void*)(msg & (~1));
11216 msg_conv.is_owned = (msg & 1) || (msg == 0);
11217 msg_conv = RevokeAndACK_clone(&msg_conv);
11218 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11219 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
11220 uint64_t ret_ref = (uint64_t)ret_copy;
11224 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
11225 LDKPublicKey node_id_ref;
11226 CHECK(*((uint32_t*)node_id) == 33);
11227 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11228 LDKClosingSigned msg_conv;
11229 msg_conv.inner = (void*)(msg & (~1));
11230 msg_conv.is_owned = (msg & 1) || (msg == 0);
11231 msg_conv = ClosingSigned_clone(&msg_conv);
11232 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11233 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
11234 uint64_t ret_ref = (uint64_t)ret_copy;
11238 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
11239 LDKPublicKey node_id_ref;
11240 CHECK(*((uint32_t*)node_id) == 33);
11241 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11242 LDKShutdown msg_conv;
11243 msg_conv.inner = (void*)(msg & (~1));
11244 msg_conv.is_owned = (msg & 1) || (msg == 0);
11245 msg_conv = Shutdown_clone(&msg_conv);
11246 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11247 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
11248 uint64_t ret_ref = (uint64_t)ret_copy;
11252 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
11253 LDKPublicKey node_id_ref;
11254 CHECK(*((uint32_t*)node_id) == 33);
11255 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11256 LDKChannelReestablish msg_conv;
11257 msg_conv.inner = (void*)(msg & (~1));
11258 msg_conv.is_owned = (msg & 1) || (msg == 0);
11259 msg_conv = ChannelReestablish_clone(&msg_conv);
11260 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11261 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
11262 uint64_t ret_ref = (uint64_t)ret_copy;
11266 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
11267 LDKChannelAnnouncement msg_conv;
11268 msg_conv.inner = (void*)(msg & (~1));
11269 msg_conv.is_owned = (msg & 1) || (msg == 0);
11270 msg_conv = ChannelAnnouncement_clone(&msg_conv);
11271 LDKChannelUpdate update_msg_conv;
11272 update_msg_conv.inner = (void*)(update_msg & (~1));
11273 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
11274 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
11275 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11276 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
11277 uint64_t ret_ref = (uint64_t)ret_copy;
11281 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
11282 LDKNodeAnnouncement msg_conv;
11283 msg_conv.inner = (void*)(msg & (~1));
11284 msg_conv.is_owned = (msg & 1) || (msg == 0);
11285 msg_conv = NodeAnnouncement_clone(&msg_conv);
11286 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11287 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
11288 uint64_t ret_ref = (uint64_t)ret_copy;
11292 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
11293 LDKChannelUpdate msg_conv;
11294 msg_conv.inner = (void*)(msg & (~1));
11295 msg_conv.is_owned = (msg & 1) || (msg == 0);
11296 msg_conv = ChannelUpdate_clone(&msg_conv);
11297 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11298 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
11299 uint64_t ret_ref = (uint64_t)ret_copy;
11303 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
11304 LDKPublicKey node_id_ref;
11305 CHECK(*((uint32_t*)node_id) == 33);
11306 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11307 LDKChannelUpdate msg_conv;
11308 msg_conv.inner = (void*)(msg & (~1));
11309 msg_conv.is_owned = (msg & 1) || (msg == 0);
11310 msg_conv = ChannelUpdate_clone(&msg_conv);
11311 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11312 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
11313 uint64_t ret_ref = (uint64_t)ret_copy;
11317 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
11318 LDKPublicKey node_id_ref;
11319 CHECK(*((uint32_t*)node_id) == 33);
11320 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11321 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
11322 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11323 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
11324 uint64_t ret_ref = (uint64_t)ret_copy;
11328 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_payment_failure_network_update(uint32_t update) {
11329 LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
11330 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11331 *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
11332 uint64_t ret_ref = (uint64_t)ret_copy;
11336 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
11337 LDKPublicKey node_id_ref;
11338 CHECK(*((uint32_t*)node_id) == 33);
11339 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11340 LDKQueryChannelRange msg_conv;
11341 msg_conv.inner = (void*)(msg & (~1));
11342 msg_conv.is_owned = (msg & 1) || (msg == 0);
11343 msg_conv = QueryChannelRange_clone(&msg_conv);
11344 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11345 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
11346 uint64_t ret_ref = (uint64_t)ret_copy;
11350 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
11351 LDKPublicKey node_id_ref;
11352 CHECK(*((uint32_t*)node_id) == 33);
11353 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11354 LDKQueryShortChannelIds msg_conv;
11355 msg_conv.inner = (void*)(msg & (~1));
11356 msg_conv.is_owned = (msg & 1) || (msg == 0);
11357 msg_conv = QueryShortChannelIds_clone(&msg_conv);
11358 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11359 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
11360 uint64_t ret_ref = (uint64_t)ret_copy;
11364 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
11365 LDKPublicKey node_id_ref;
11366 CHECK(*((uint32_t*)node_id) == 33);
11367 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11368 LDKReplyChannelRange msg_conv;
11369 msg_conv.inner = (void*)(msg & (~1));
11370 msg_conv.is_owned = (msg & 1) || (msg == 0);
11371 msg_conv = ReplyChannelRange_clone(&msg_conv);
11372 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11373 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
11374 uint64_t ret_ref = (uint64_t)ret_copy;
11378 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
11379 if ((this_ptr & 1) != 0) return;
11380 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
11381 FREE((void*)this_ptr);
11382 MessageSendEventsProvider_free(this_ptr_conv);
11385 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
11386 if ((this_ptr & 1) != 0) return;
11387 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
11388 FREE((void*)this_ptr);
11389 EventsProvider_free(this_ptr_conv);
11392 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
11393 if ((this_ptr & 1) != 0) return;
11394 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
11395 FREE((void*)this_ptr);
11396 EventHandler_free(this_ptr_conv);
11399 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
11400 if ((this_ptr & 1) != 0) return;
11401 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
11402 FREE((void*)this_ptr);
11403 APIError_free(this_ptr_conv);
11406 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
11407 LDKAPIError* orig_conv = (LDKAPIError*)orig;
11408 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11409 *ret_copy = APIError_clone(orig_conv);
11410 uint64_t ret_ref = (uint64_t)ret_copy;
11414 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
11415 LDKStr err_conv = str_ref_to_owned_c(err);
11416 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11417 *ret_copy = APIError_apimisuse_error(err_conv);
11418 uint64_t ret_ref = (uint64_t)ret_copy;
11422 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
11423 LDKStr err_conv = str_ref_to_owned_c(err);
11424 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11425 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
11426 uint64_t ret_ref = (uint64_t)ret_copy;
11430 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
11431 LDKStr err_conv = str_ref_to_owned_c(err);
11432 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11433 *ret_copy = APIError_route_error(err_conv);
11434 uint64_t ret_ref = (uint64_t)ret_copy;
11438 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
11439 LDKStr err_conv = str_ref_to_owned_c(err);
11440 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11441 *ret_copy = APIError_channel_unavailable(err_conv);
11442 uint64_t ret_ref = (uint64_t)ret_copy;
11446 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
11447 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11448 *ret_copy = APIError_monitor_update_failed();
11449 uint64_t ret_ref = (uint64_t)ret_copy;
11453 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
11454 LDKShutdownScript script_conv;
11455 script_conv.inner = (void*)(script & (~1));
11456 script_conv.is_owned = (script & 1) || (script == 0);
11457 script_conv = ShutdownScript_clone(&script_conv);
11458 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
11459 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
11460 uint64_t ret_ref = (uint64_t)ret_copy;
11464 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
11465 LDKu8slice msg_ref;
11466 msg_ref.datalen = *((uint32_t*)msg);
11467 msg_ref.data = (int8_t*)(msg + 4);
11468 unsigned char sk_arr[32];
11469 CHECK(*((uint32_t*)sk) == 32);
11470 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
11471 unsigned char (*sk_ref)[32] = &sk_arr;
11472 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11473 *ret_conv = sign(msg_ref, sk_ref);
11474 return (uint64_t)ret_conv;
11477 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
11478 LDKu8slice msg_ref;
11479 msg_ref.datalen = *((uint32_t*)msg);
11480 msg_ref.data = (int8_t*)(msg + 4);
11481 LDKStr sig_conv = str_ref_to_owned_c(sig);
11482 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11483 *ret_conv = recover_pk(msg_ref, sig_conv);
11484 return (uint64_t)ret_conv;
11487 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
11488 LDKu8slice msg_ref;
11489 msg_ref.datalen = *((uint32_t*)msg);
11490 msg_ref.data = (int8_t*)(msg + 4);
11491 LDKStr sig_conv = str_ref_to_owned_c(sig);
11492 LDKPublicKey pk_ref;
11493 CHECK(*((uint32_t*)pk) == 33);
11494 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
11495 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
11499 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
11500 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
11501 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
11505 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
11506 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
11510 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
11511 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
11515 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
11516 uint32_t ret_conv = LDKLevel_to_js(Level_info());
11520 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
11521 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
11525 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
11526 uint32_t ret_conv = LDKLevel_to_js(Level_error());
11530 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
11531 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
11532 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
11533 jboolean ret_val = Level_eq(a_conv, b_conv);
11537 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
11538 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
11539 int64_t ret_val = Level_hash(o_conv);
11543 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
11544 uint32_t ret_conv = LDKLevel_to_js(Level_max());
11548 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
11549 if ((this_ptr & 1) != 0) return;
11550 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
11551 FREE((void*)this_ptr);
11552 Logger_free(this_ptr_conv);
11555 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
11556 LDKChannelHandshakeConfig this_obj_conv;
11557 this_obj_conv.inner = (void*)(this_obj & (~1));
11558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11559 ChannelHandshakeConfig_free(this_obj_conv);
11562 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
11563 LDKChannelHandshakeConfig this_ptr_conv;
11564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11565 this_ptr_conv.is_owned = false;
11566 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
11570 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
11571 LDKChannelHandshakeConfig this_ptr_conv;
11572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11573 this_ptr_conv.is_owned = false;
11574 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
11577 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
11578 LDKChannelHandshakeConfig this_ptr_conv;
11579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11580 this_ptr_conv.is_owned = false;
11581 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
11585 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
11586 LDKChannelHandshakeConfig this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = false;
11589 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
11592 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
11593 LDKChannelHandshakeConfig this_ptr_conv;
11594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11595 this_ptr_conv.is_owned = false;
11596 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
11600 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11601 LDKChannelHandshakeConfig this_ptr_conv;
11602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11603 this_ptr_conv.is_owned = false;
11604 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
11607 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) {
11608 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
11609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11611 uint64_t ret_ref = (uint64_t)ret_var.inner;
11612 if (ret_var.is_owned) {
11618 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
11619 LDKChannelHandshakeConfig orig_conv;
11620 orig_conv.inner = (void*)(orig & (~1));
11621 orig_conv.is_owned = false;
11622 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
11623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11625 uint64_t ret_ref = (uint64_t)ret_var.inner;
11626 if (ret_var.is_owned) {
11632 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
11633 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
11634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11636 uint64_t ret_ref = (uint64_t)ret_var.inner;
11637 if (ret_var.is_owned) {
11643 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
11644 LDKChannelHandshakeLimits this_obj_conv;
11645 this_obj_conv.inner = (void*)(this_obj & (~1));
11646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11647 ChannelHandshakeLimits_free(this_obj_conv);
11650 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
11651 LDKChannelHandshakeLimits this_ptr_conv;
11652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11653 this_ptr_conv.is_owned = false;
11654 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
11658 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
11659 LDKChannelHandshakeLimits this_ptr_conv;
11660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11661 this_ptr_conv.is_owned = false;
11662 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
11665 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
11666 LDKChannelHandshakeLimits this_ptr_conv;
11667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11668 this_ptr_conv.is_owned = false;
11669 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
11673 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11674 LDKChannelHandshakeLimits this_ptr_conv;
11675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11676 this_ptr_conv.is_owned = false;
11677 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
11680 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11681 LDKChannelHandshakeLimits this_ptr_conv;
11682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11683 this_ptr_conv.is_owned = false;
11684 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
11688 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11689 LDKChannelHandshakeLimits this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = false;
11692 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11695 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
11696 LDKChannelHandshakeLimits this_ptr_conv;
11697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11698 this_ptr_conv.is_owned = false;
11699 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
11703 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11704 LDKChannelHandshakeLimits this_ptr_conv;
11705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11706 this_ptr_conv.is_owned = false;
11707 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
11710 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
11711 LDKChannelHandshakeLimits this_ptr_conv;
11712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11713 this_ptr_conv.is_owned = false;
11714 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
11718 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11719 LDKChannelHandshakeLimits this_ptr_conv;
11720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11721 this_ptr_conv.is_owned = false;
11722 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
11725 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
11726 LDKChannelHandshakeLimits this_ptr_conv;
11727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11728 this_ptr_conv.is_owned = false;
11729 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
11733 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
11734 LDKChannelHandshakeLimits this_ptr_conv;
11735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11736 this_ptr_conv.is_owned = false;
11737 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
11740 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
11741 LDKChannelHandshakeLimits this_ptr_conv;
11742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11743 this_ptr_conv.is_owned = false;
11744 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
11748 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
11749 LDKChannelHandshakeLimits this_ptr_conv;
11750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11751 this_ptr_conv.is_owned = false;
11752 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
11755 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
11756 LDKChannelHandshakeLimits this_ptr_conv;
11757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11758 this_ptr_conv.is_owned = false;
11759 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
11763 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
11764 LDKChannelHandshakeLimits this_ptr_conv;
11765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11766 this_ptr_conv.is_owned = false;
11767 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
11770 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) {
11771 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);
11772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11774 uint64_t ret_ref = (uint64_t)ret_var.inner;
11775 if (ret_var.is_owned) {
11781 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
11782 LDKChannelHandshakeLimits orig_conv;
11783 orig_conv.inner = (void*)(orig & (~1));
11784 orig_conv.is_owned = false;
11785 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
11786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11788 uint64_t ret_ref = (uint64_t)ret_var.inner;
11789 if (ret_var.is_owned) {
11795 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
11796 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
11797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11799 uint64_t ret_ref = (uint64_t)ret_var.inner;
11800 if (ret_var.is_owned) {
11806 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
11807 LDKChannelConfig this_obj_conv;
11808 this_obj_conv.inner = (void*)(this_obj & (~1));
11809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11810 ChannelConfig_free(this_obj_conv);
11813 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
11814 LDKChannelConfig this_ptr_conv;
11815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11816 this_ptr_conv.is_owned = false;
11817 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
11821 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
11822 LDKChannelConfig this_ptr_conv;
11823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11824 this_ptr_conv.is_owned = false;
11825 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
11828 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
11829 LDKChannelConfig this_ptr_conv;
11830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11831 this_ptr_conv.is_owned = false;
11832 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
11836 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
11837 LDKChannelConfig this_ptr_conv;
11838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11839 this_ptr_conv.is_owned = false;
11840 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
11843 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
11844 LDKChannelConfig this_ptr_conv;
11845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11846 this_ptr_conv.is_owned = false;
11847 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
11851 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
11852 LDKChannelConfig this_ptr_conv;
11853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11854 this_ptr_conv.is_owned = false;
11855 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
11858 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
11859 LDKChannelConfig this_ptr_conv;
11860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11861 this_ptr_conv.is_owned = false;
11862 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
11866 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
11867 LDKChannelConfig this_ptr_conv;
11868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11869 this_ptr_conv.is_owned = false;
11870 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
11873 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
11874 LDKChannelConfig this_ptr_conv;
11875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11876 this_ptr_conv.is_owned = false;
11877 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
11881 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
11882 LDKChannelConfig this_ptr_conv;
11883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11884 this_ptr_conv.is_owned = false;
11885 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
11888 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
11889 LDKChannelConfig this_ptr_conv;
11890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11891 this_ptr_conv.is_owned = false;
11892 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
11896 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
11897 LDKChannelConfig this_ptr_conv;
11898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11899 this_ptr_conv.is_owned = false;
11900 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
11903 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
11904 LDKChannelConfig this_ptr_conv;
11905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11906 this_ptr_conv.is_owned = false;
11907 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
11911 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
11912 LDKChannelConfig this_ptr_conv;
11913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11914 this_ptr_conv.is_owned = false;
11915 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
11918 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
11919 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
11920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11922 uint64_t ret_ref = (uint64_t)ret_var.inner;
11923 if (ret_var.is_owned) {
11929 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
11930 LDKChannelConfig orig_conv;
11931 orig_conv.inner = (void*)(orig & (~1));
11932 orig_conv.is_owned = false;
11933 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
11934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11936 uint64_t ret_ref = (uint64_t)ret_var.inner;
11937 if (ret_var.is_owned) {
11943 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
11944 LDKChannelConfig ret_var = ChannelConfig_default();
11945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11947 uint64_t ret_ref = (uint64_t)ret_var.inner;
11948 if (ret_var.is_owned) {
11954 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
11955 LDKChannelConfig obj_conv;
11956 obj_conv.inner = (void*)(obj & (~1));
11957 obj_conv.is_owned = false;
11958 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
11959 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11960 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11961 CVec_u8Z_free(ret_var);
11965 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
11966 LDKu8slice ser_ref;
11967 ser_ref.datalen = *((uint32_t*)ser);
11968 ser_ref.data = (int8_t*)(ser + 4);
11969 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11970 *ret_conv = ChannelConfig_read(ser_ref);
11971 return (uint64_t)ret_conv;
11974 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
11975 LDKUserConfig this_obj_conv;
11976 this_obj_conv.inner = (void*)(this_obj & (~1));
11977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11978 UserConfig_free(this_obj_conv);
11981 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
11982 LDKUserConfig this_ptr_conv;
11983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11984 this_ptr_conv.is_owned = false;
11985 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
11986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11988 uint64_t ret_ref = (uint64_t)ret_var.inner;
11989 if (ret_var.is_owned) {
11995 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
11996 LDKUserConfig this_ptr_conv;
11997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11998 this_ptr_conv.is_owned = false;
11999 LDKChannelHandshakeConfig val_conv;
12000 val_conv.inner = (void*)(val & (~1));
12001 val_conv.is_owned = (val & 1) || (val == 0);
12002 val_conv = ChannelHandshakeConfig_clone(&val_conv);
12003 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
12006 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
12007 LDKUserConfig this_ptr_conv;
12008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12009 this_ptr_conv.is_owned = false;
12010 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
12011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12013 uint64_t ret_ref = (uint64_t)ret_var.inner;
12014 if (ret_var.is_owned) {
12020 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
12021 LDKUserConfig this_ptr_conv;
12022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12023 this_ptr_conv.is_owned = false;
12024 LDKChannelHandshakeLimits val_conv;
12025 val_conv.inner = (void*)(val & (~1));
12026 val_conv.is_owned = (val & 1) || (val == 0);
12027 val_conv = ChannelHandshakeLimits_clone(&val_conv);
12028 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
12031 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
12032 LDKUserConfig this_ptr_conv;
12033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12034 this_ptr_conv.is_owned = false;
12035 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
12036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12038 uint64_t ret_ref = (uint64_t)ret_var.inner;
12039 if (ret_var.is_owned) {
12045 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
12046 LDKUserConfig this_ptr_conv;
12047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12048 this_ptr_conv.is_owned = false;
12049 LDKChannelConfig val_conv;
12050 val_conv.inner = (void*)(val & (~1));
12051 val_conv.is_owned = (val & 1) || (val == 0);
12052 val_conv = ChannelConfig_clone(&val_conv);
12053 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
12056 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
12057 LDKUserConfig this_ptr_conv;
12058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12059 this_ptr_conv.is_owned = false;
12060 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
12064 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
12065 LDKUserConfig this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = false;
12068 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
12071 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) {
12072 LDKChannelHandshakeConfig own_channel_config_arg_conv;
12073 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
12074 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
12075 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
12076 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
12077 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
12078 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
12079 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
12080 LDKChannelConfig channel_options_arg_conv;
12081 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
12082 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
12083 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
12084 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);
12085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12087 uint64_t ret_ref = (uint64_t)ret_var.inner;
12088 if (ret_var.is_owned) {
12094 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
12095 LDKUserConfig orig_conv;
12096 orig_conv.inner = (void*)(orig & (~1));
12097 orig_conv.is_owned = false;
12098 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
12099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12101 uint64_t ret_ref = (uint64_t)ret_var.inner;
12102 if (ret_var.is_owned) {
12108 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
12109 LDKUserConfig ret_var = UserConfig_default();
12110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12112 uint64_t ret_ref = (uint64_t)ret_var.inner;
12113 if (ret_var.is_owned) {
12119 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
12120 LDKBestBlock this_obj_conv;
12121 this_obj_conv.inner = (void*)(this_obj & (~1));
12122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12123 BestBlock_free(this_obj_conv);
12126 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
12127 LDKBestBlock orig_conv;
12128 orig_conv.inner = (void*)(orig & (~1));
12129 orig_conv.is_owned = false;
12130 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
12131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12133 uint64_t ret_ref = (uint64_t)ret_var.inner;
12134 if (ret_var.is_owned) {
12140 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
12141 LDKNetwork network_conv = LDKNetwork_from_js(network);
12142 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
12143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12145 uint64_t ret_ref = (uint64_t)ret_var.inner;
12146 if (ret_var.is_owned) {
12152 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
12153 LDKThirtyTwoBytes block_hash_ref;
12154 CHECK(*((uint32_t*)block_hash) == 32);
12155 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
12156 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
12157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12159 uint64_t ret_ref = (uint64_t)ret_var.inner;
12160 if (ret_var.is_owned) {
12166 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
12167 LDKBestBlock this_arg_conv;
12168 this_arg_conv.inner = (void*)(this_arg & (~1));
12169 this_arg_conv.is_owned = false;
12170 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12171 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
12175 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
12176 LDKBestBlock this_arg_conv;
12177 this_arg_conv.inner = (void*)(this_arg & (~1));
12178 this_arg_conv.is_owned = false;
12179 int32_t ret_val = BestBlock_height(&this_arg_conv);
12183 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
12184 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
12185 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
12189 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
12190 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
12194 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
12195 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
12199 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
12200 if ((this_ptr & 1) != 0) return;
12201 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
12202 FREE((void*)this_ptr);
12203 Access_free(this_ptr_conv);
12206 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
12207 if ((this_ptr & 1) != 0) return;
12208 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
12209 FREE((void*)this_ptr);
12210 Listen_free(this_ptr_conv);
12213 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
12214 if ((this_ptr & 1) != 0) return;
12215 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
12216 FREE((void*)this_ptr);
12217 Confirm_free(this_ptr_conv);
12220 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
12221 if ((this_ptr & 1) != 0) return;
12222 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
12223 FREE((void*)this_ptr);
12224 Watch_free(this_ptr_conv);
12227 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
12228 if ((this_ptr & 1) != 0) return;
12229 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
12230 FREE((void*)this_ptr);
12231 Filter_free(this_ptr_conv);
12234 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
12235 LDKWatchedOutput this_obj_conv;
12236 this_obj_conv.inner = (void*)(this_obj & (~1));
12237 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12238 WatchedOutput_free(this_obj_conv);
12241 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
12242 LDKWatchedOutput this_ptr_conv;
12243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12244 this_ptr_conv.is_owned = false;
12245 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12246 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
12250 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
12251 LDKWatchedOutput this_ptr_conv;
12252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12253 this_ptr_conv.is_owned = false;
12254 LDKThirtyTwoBytes val_ref;
12255 CHECK(*((uint32_t*)val) == 32);
12256 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12257 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
12260 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
12261 LDKWatchedOutput this_ptr_conv;
12262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12263 this_ptr_conv.is_owned = false;
12264 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
12265 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12266 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12267 uint64_t ret_ref = (uint64_t)ret_var.inner;
12268 if (ret_var.is_owned) {
12274 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
12275 LDKWatchedOutput this_ptr_conv;
12276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12277 this_ptr_conv.is_owned = false;
12278 LDKOutPoint val_conv;
12279 val_conv.inner = (void*)(val & (~1));
12280 val_conv.is_owned = (val & 1) || (val == 0);
12281 val_conv = OutPoint_clone(&val_conv);
12282 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
12285 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
12286 LDKWatchedOutput this_ptr_conv;
12287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12288 this_ptr_conv.is_owned = false;
12289 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
12290 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12291 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12295 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
12296 LDKWatchedOutput this_ptr_conv;
12297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12298 this_ptr_conv.is_owned = false;
12299 LDKCVec_u8Z val_ref;
12300 val_ref.datalen = *((uint32_t*)val);
12301 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12302 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12303 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
12306 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
12307 LDKThirtyTwoBytes block_hash_arg_ref;
12308 CHECK(*((uint32_t*)block_hash_arg) == 32);
12309 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
12310 LDKOutPoint outpoint_arg_conv;
12311 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
12312 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
12313 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
12314 LDKCVec_u8Z script_pubkey_arg_ref;
12315 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
12316 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12317 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
12318 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
12319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12321 uint64_t ret_ref = (uint64_t)ret_var.inner;
12322 if (ret_var.is_owned) {
12328 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
12329 LDKWatchedOutput orig_conv;
12330 orig_conv.inner = (void*)(orig & (~1));
12331 orig_conv.is_owned = false;
12332 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
12333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12335 uint64_t ret_ref = (uint64_t)ret_var.inner;
12336 if (ret_var.is_owned) {
12342 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
12343 LDKWatchedOutput o_conv;
12344 o_conv.inner = (void*)(o & (~1));
12345 o_conv.is_owned = false;
12346 int64_t ret_val = WatchedOutput_hash(&o_conv);
12350 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
12351 if ((this_ptr & 1) != 0) return;
12352 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
12353 FREE((void*)this_ptr);
12354 BroadcasterInterface_free(this_ptr_conv);
12357 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
12358 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
12359 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
12363 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
12364 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
12368 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
12369 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
12373 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
12374 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
12378 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
12379 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
12380 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
12381 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
12385 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
12386 if ((this_ptr & 1) != 0) return;
12387 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
12388 FREE((void*)this_ptr);
12389 FeeEstimator_free(this_ptr_conv);
12392 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
12393 LDKChainMonitor this_obj_conv;
12394 this_obj_conv.inner = (void*)(this_obj & (~1));
12395 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12396 ChainMonitor_free(this_obj_conv);
12399 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
12400 LDKFilter *chain_source_conv_ptr = NULL;
12401 if (chain_source != 0) {
12402 LDKFilter chain_source_conv;
12403 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
12404 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12405 *chain_source_conv_ptr = chain_source_conv;
12407 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12408 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12409 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
12410 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
12411 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
12412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12414 uint64_t ret_ref = (uint64_t)ret_var.inner;
12415 if (ret_var.is_owned) {
12421 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
12422 LDKChainMonitor this_arg_conv;
12423 this_arg_conv.inner = (void*)(this_arg & (~1));
12424 this_arg_conv.is_owned = false;
12425 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12426 *ret = ChainMonitor_as_Listen(&this_arg_conv);
12427 return (uint64_t)ret;
12430 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
12431 LDKChainMonitor this_arg_conv;
12432 this_arg_conv.inner = (void*)(this_arg & (~1));
12433 this_arg_conv.is_owned = false;
12434 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12435 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
12436 return (uint64_t)ret;
12439 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
12440 LDKChainMonitor this_arg_conv;
12441 this_arg_conv.inner = (void*)(this_arg & (~1));
12442 this_arg_conv.is_owned = false;
12443 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
12444 *ret = ChainMonitor_as_Watch(&this_arg_conv);
12445 return (uint64_t)ret;
12448 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
12449 LDKChainMonitor this_arg_conv;
12450 this_arg_conv.inner = (void*)(this_arg & (~1));
12451 this_arg_conv.is_owned = false;
12452 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12453 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
12454 return (uint64_t)ret;
12457 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
12458 LDKChannelMonitorUpdate this_obj_conv;
12459 this_obj_conv.inner = (void*)(this_obj & (~1));
12460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12461 ChannelMonitorUpdate_free(this_obj_conv);
12464 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
12465 LDKChannelMonitorUpdate this_ptr_conv;
12466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12467 this_ptr_conv.is_owned = false;
12468 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
12472 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
12473 LDKChannelMonitorUpdate this_ptr_conv;
12474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12475 this_ptr_conv.is_owned = false;
12476 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
12479 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
12480 LDKChannelMonitorUpdate orig_conv;
12481 orig_conv.inner = (void*)(orig & (~1));
12482 orig_conv.is_owned = false;
12483 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
12484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12486 uint64_t ret_ref = (uint64_t)ret_var.inner;
12487 if (ret_var.is_owned) {
12493 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
12494 LDKChannelMonitorUpdate obj_conv;
12495 obj_conv.inner = (void*)(obj & (~1));
12496 obj_conv.is_owned = false;
12497 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
12498 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12499 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12500 CVec_u8Z_free(ret_var);
12504 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
12505 LDKu8slice ser_ref;
12506 ser_ref.datalen = *((uint32_t*)ser);
12507 ser_ref.data = (int8_t*)(ser + 4);
12508 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12509 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
12510 return (uint64_t)ret_conv;
12513 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
12514 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
12515 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
12519 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
12520 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
12524 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
12525 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
12529 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
12530 LDKMonitorUpdateError this_obj_conv;
12531 this_obj_conv.inner = (void*)(this_obj & (~1));
12532 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12533 MonitorUpdateError_free(this_obj_conv);
12536 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
12537 LDKMonitorUpdateError orig_conv;
12538 orig_conv.inner = (void*)(orig & (~1));
12539 orig_conv.is_owned = false;
12540 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
12541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12543 uint64_t ret_ref = (uint64_t)ret_var.inner;
12544 if (ret_var.is_owned) {
12550 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
12551 if ((this_ptr & 1) != 0) return;
12552 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
12553 FREE((void*)this_ptr);
12554 MonitorEvent_free(this_ptr_conv);
12557 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
12558 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
12559 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12560 *ret_copy = MonitorEvent_clone(orig_conv);
12561 uint64_t ret_ref = (uint64_t)ret_copy;
12565 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
12566 LDKHTLCUpdate a_conv;
12567 a_conv.inner = (void*)(a & (~1));
12568 a_conv.is_owned = (a & 1) || (a == 0);
12569 a_conv = HTLCUpdate_clone(&a_conv);
12570 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12571 *ret_copy = MonitorEvent_htlcevent(a_conv);
12572 uint64_t ret_ref = (uint64_t)ret_copy;
12576 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_broadcasted(uint32_t a) {
12577 LDKOutPoint a_conv;
12578 a_conv.inner = (void*)(a & (~1));
12579 a_conv.is_owned = (a & 1) || (a == 0);
12580 a_conv = OutPoint_clone(&a_conv);
12581 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12582 *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
12583 uint64_t ret_ref = (uint64_t)ret_copy;
12587 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
12588 LDKHTLCUpdate this_obj_conv;
12589 this_obj_conv.inner = (void*)(this_obj & (~1));
12590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12591 HTLCUpdate_free(this_obj_conv);
12594 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
12595 LDKHTLCUpdate orig_conv;
12596 orig_conv.inner = (void*)(orig & (~1));
12597 orig_conv.is_owned = false;
12598 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
12599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12601 uint64_t ret_ref = (uint64_t)ret_var.inner;
12602 if (ret_var.is_owned) {
12608 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
12609 LDKHTLCUpdate obj_conv;
12610 obj_conv.inner = (void*)(obj & (~1));
12611 obj_conv.is_owned = false;
12612 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
12613 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12614 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12615 CVec_u8Z_free(ret_var);
12619 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
12620 LDKu8slice ser_ref;
12621 ser_ref.datalen = *((uint32_t*)ser);
12622 ser_ref.data = (int8_t*)(ser + 4);
12623 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12624 *ret_conv = HTLCUpdate_read(ser_ref);
12625 return (uint64_t)ret_conv;
12628 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
12629 LDKChannelMonitor this_obj_conv;
12630 this_obj_conv.inner = (void*)(this_obj & (~1));
12631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12632 ChannelMonitor_free(this_obj_conv);
12635 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
12636 LDKChannelMonitor orig_conv;
12637 orig_conv.inner = (void*)(orig & (~1));
12638 orig_conv.is_owned = false;
12639 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
12640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12642 uint64_t ret_ref = (uint64_t)ret_var.inner;
12643 if (ret_var.is_owned) {
12649 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
12650 LDKChannelMonitor obj_conv;
12651 obj_conv.inner = (void*)(obj & (~1));
12652 obj_conv.is_owned = false;
12653 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
12654 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12655 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12656 CVec_u8Z_free(ret_var);
12660 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) {
12661 LDKChannelMonitor this_arg_conv;
12662 this_arg_conv.inner = (void*)(this_arg & (~1));
12663 this_arg_conv.is_owned = false;
12664 LDKChannelMonitorUpdate updates_conv;
12665 updates_conv.inner = (void*)(updates & (~1));
12666 updates_conv.is_owned = false;
12667 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12668 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12669 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12670 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12671 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
12672 return (uint64_t)ret_conv;
12675 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
12676 LDKChannelMonitor this_arg_conv;
12677 this_arg_conv.inner = (void*)(this_arg & (~1));
12678 this_arg_conv.is_owned = false;
12679 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
12683 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
12684 LDKChannelMonitor this_arg_conv;
12685 this_arg_conv.inner = (void*)(this_arg & (~1));
12686 this_arg_conv.is_owned = false;
12687 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12688 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
12689 return (uint64_t)ret_ref;
12692 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
12693 LDKChannelMonitor this_arg_conv;
12694 this_arg_conv.inner = (void*)(this_arg & (~1));
12695 this_arg_conv.is_owned = false;
12696 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
12697 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12698 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12699 for (size_t c = 0; c < ret_var.datalen; c++) {
12700 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12701 *ret_conv_54_ref = ret_var.data[c];
12702 ret_arr_ptr[c] = (uint64_t)ret_conv_54_ref;
12704 FREE(ret_var.data);
12708 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
12709 LDKChannelMonitor this_arg_conv;
12710 this_arg_conv.inner = (void*)(this_arg & (~1));
12711 this_arg_conv.is_owned = false;
12712 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
12713 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
12716 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
12717 LDKChannelMonitor this_arg_conv;
12718 this_arg_conv.inner = (void*)(this_arg & (~1));
12719 this_arg_conv.is_owned = false;
12720 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
12721 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12722 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12723 for (size_t o = 0; o < ret_var.datalen; o++) {
12724 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
12725 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
12726 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
12727 ret_arr_ptr[o] = ret_conv_14_ref;
12729 FREE(ret_var.data);
12733 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
12734 LDKChannelMonitor this_arg_conv;
12735 this_arg_conv.inner = (void*)(this_arg & (~1));
12736 this_arg_conv.is_owned = false;
12737 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
12738 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12739 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12740 for (size_t h = 0; h < ret_var.datalen; h++) {
12741 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12742 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
12743 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
12744 ret_arr_ptr[h] = ret_conv_7_ref;
12746 FREE(ret_var.data);
12750 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
12751 LDKChannelMonitor this_arg_conv;
12752 this_arg_conv.inner = (void*)(this_arg & (~1));
12753 this_arg_conv.is_owned = false;
12754 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
12755 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
12756 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12757 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12758 for (size_t m = 0; m < ret_var.datalen; m++) {
12759 LDKTransaction ret_conv_12_var = ret_var.data[m];
12760 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12761 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
12762 Transaction_free(ret_conv_12_var);
12763 ret_arr_ptr[m] = ret_conv_12_arr;
12765 FREE(ret_var.data);
12769 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) {
12770 LDKChannelMonitor this_arg_conv;
12771 this_arg_conv.inner = (void*)(this_arg & (~1));
12772 this_arg_conv.is_owned = false;
12773 unsigned char header_arr[80];
12774 CHECK(*((uint32_t*)header) == 80);
12775 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12776 unsigned char (*header_ref)[80] = &header_arr;
12777 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12778 txdata_constr.datalen = *((uint32_t*)txdata);
12779 if (txdata_constr.datalen > 0)
12780 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12782 txdata_constr.data = NULL;
12783 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12784 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12785 uint32_t txdata_conv_30 = txdata_vals[e];
12786 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12787 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12788 txdata_constr.data[e] = txdata_conv_30_conv;
12790 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12791 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12792 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12793 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);
12794 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12795 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12796 for (size_t x = 0; x < ret_var.datalen; x++) {
12797 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12798 *ret_conv_49_ref = ret_var.data[x];
12799 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12801 FREE(ret_var.data);
12805 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) {
12806 LDKChannelMonitor this_arg_conv;
12807 this_arg_conv.inner = (void*)(this_arg & (~1));
12808 this_arg_conv.is_owned = false;
12809 unsigned char header_arr[80];
12810 CHECK(*((uint32_t*)header) == 80);
12811 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12812 unsigned char (*header_ref)[80] = &header_arr;
12813 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12814 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12815 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12816 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12819 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) {
12820 LDKChannelMonitor this_arg_conv;
12821 this_arg_conv.inner = (void*)(this_arg & (~1));
12822 this_arg_conv.is_owned = false;
12823 unsigned char header_arr[80];
12824 CHECK(*((uint32_t*)header) == 80);
12825 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12826 unsigned char (*header_ref)[80] = &header_arr;
12827 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12828 txdata_constr.datalen = *((uint32_t*)txdata);
12829 if (txdata_constr.datalen > 0)
12830 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12832 txdata_constr.data = NULL;
12833 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
12834 for (size_t e = 0; e < txdata_constr.datalen; e++) {
12835 uint32_t txdata_conv_30 = txdata_vals[e];
12836 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
12837 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
12838 txdata_constr.data[e] = txdata_conv_30_conv;
12840 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12841 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12842 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12843 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);
12844 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12845 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12846 for (size_t x = 0; x < ret_var.datalen; x++) {
12847 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12848 *ret_conv_49_ref = ret_var.data[x];
12849 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12851 FREE(ret_var.data);
12855 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) {
12856 LDKChannelMonitor this_arg_conv;
12857 this_arg_conv.inner = (void*)(this_arg & (~1));
12858 this_arg_conv.is_owned = false;
12859 unsigned char txid_arr[32];
12860 CHECK(*((uint32_t*)txid) == 32);
12861 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
12862 unsigned char (*txid_ref)[32] = &txid_arr;
12863 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12864 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12865 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12866 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
12869 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) {
12870 LDKChannelMonitor this_arg_conv;
12871 this_arg_conv.inner = (void*)(this_arg & (~1));
12872 this_arg_conv.is_owned = false;
12873 unsigned char header_arr[80];
12874 CHECK(*((uint32_t*)header) == 80);
12875 memcpy(header_arr, (uint8_t*)(header + 4), 80);
12876 unsigned char (*header_ref)[80] = &header_arr;
12877 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
12878 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12879 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12880 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
12881 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
12882 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
12883 for (size_t x = 0; x < ret_var.datalen; x++) {
12884 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12885 *ret_conv_49_ref = ret_var.data[x];
12886 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
12888 FREE(ret_var.data);
12892 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
12893 LDKChannelMonitor this_arg_conv;
12894 this_arg_conv.inner = (void*)(this_arg & (~1));
12895 this_arg_conv.is_owned = false;
12896 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
12897 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
12898 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
12899 for (size_t m = 0; m < ret_var.datalen; m++) {
12900 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12901 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
12902 ret_arr_ptr[m] = ret_conv_12_arr;
12904 FREE(ret_var.data);
12908 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
12909 LDKChannelMonitor this_arg_conv;
12910 this_arg_conv.inner = (void*)(this_arg & (~1));
12911 this_arg_conv.is_owned = false;
12912 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
12913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12915 uint64_t ret_ref = (uint64_t)ret_var.inner;
12916 if (ret_var.is_owned) {
12922 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
12923 if ((this_ptr & 1) != 0) return;
12924 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
12925 FREE((void*)this_ptr);
12926 Persist_free(this_ptr_conv);
12929 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
12930 LDKu8slice ser_ref;
12931 ser_ref.datalen = *((uint32_t*)ser);
12932 ser_ref.data = (int8_t*)(ser + 4);
12933 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
12934 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12935 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
12936 return (uint64_t)ret_conv;
12939 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
12940 LDKOutPoint this_obj_conv;
12941 this_obj_conv.inner = (void*)(this_obj & (~1));
12942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12943 OutPoint_free(this_obj_conv);
12946 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
12947 LDKOutPoint this_ptr_conv;
12948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12949 this_ptr_conv.is_owned = false;
12950 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12951 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
12955 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
12956 LDKOutPoint this_ptr_conv;
12957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12958 this_ptr_conv.is_owned = false;
12959 LDKThirtyTwoBytes val_ref;
12960 CHECK(*((uint32_t*)val) == 32);
12961 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12962 OutPoint_set_txid(&this_ptr_conv, val_ref);
12965 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
12966 LDKOutPoint this_ptr_conv;
12967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12968 this_ptr_conv.is_owned = false;
12969 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
12973 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
12974 LDKOutPoint this_ptr_conv;
12975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12976 this_ptr_conv.is_owned = false;
12977 OutPoint_set_index(&this_ptr_conv, val);
12980 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
12981 LDKThirtyTwoBytes txid_arg_ref;
12982 CHECK(*((uint32_t*)txid_arg) == 32);
12983 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
12984 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
12985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12987 uint64_t ret_ref = (uint64_t)ret_var.inner;
12988 if (ret_var.is_owned) {
12994 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
12995 LDKOutPoint orig_conv;
12996 orig_conv.inner = (void*)(orig & (~1));
12997 orig_conv.is_owned = false;
12998 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
12999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13001 uint64_t ret_ref = (uint64_t)ret_var.inner;
13002 if (ret_var.is_owned) {
13008 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
13009 LDKOutPoint a_conv;
13010 a_conv.inner = (void*)(a & (~1));
13011 a_conv.is_owned = false;
13012 LDKOutPoint b_conv;
13013 b_conv.inner = (void*)(b & (~1));
13014 b_conv.is_owned = false;
13015 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
13019 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
13020 LDKOutPoint o_conv;
13021 o_conv.inner = (void*)(o & (~1));
13022 o_conv.is_owned = false;
13023 int64_t ret_val = OutPoint_hash(&o_conv);
13027 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
13028 LDKOutPoint this_arg_conv;
13029 this_arg_conv.inner = (void*)(this_arg & (~1));
13030 this_arg_conv.is_owned = false;
13031 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13032 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
13036 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
13037 LDKOutPoint obj_conv;
13038 obj_conv.inner = (void*)(obj & (~1));
13039 obj_conv.is_owned = false;
13040 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
13041 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13042 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13043 CVec_u8Z_free(ret_var);
13047 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
13048 LDKu8slice ser_ref;
13049 ser_ref.datalen = *((uint32_t*)ser);
13050 ser_ref.data = (int8_t*)(ser + 4);
13051 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
13052 *ret_conv = OutPoint_read(ser_ref);
13053 return (uint64_t)ret_conv;
13056 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
13057 LDKDelayedPaymentOutputDescriptor this_obj_conv;
13058 this_obj_conv.inner = (void*)(this_obj & (~1));
13059 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13060 DelayedPaymentOutputDescriptor_free(this_obj_conv);
13063 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
13064 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13066 this_ptr_conv.is_owned = false;
13067 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
13068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13070 uint64_t ret_ref = (uint64_t)ret_var.inner;
13071 if (ret_var.is_owned) {
13077 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
13078 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13080 this_ptr_conv.is_owned = false;
13081 LDKOutPoint val_conv;
13082 val_conv.inner = (void*)(val & (~1));
13083 val_conv.is_owned = (val & 1) || (val == 0);
13084 val_conv = OutPoint_clone(&val_conv);
13085 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
13088 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
13089 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13091 this_ptr_conv.is_owned = false;
13092 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13093 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13097 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13098 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13100 this_ptr_conv.is_owned = false;
13101 LDKPublicKey val_ref;
13102 CHECK(*((uint32_t*)val) == 33);
13103 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13104 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
13107 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
13108 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13110 this_ptr_conv.is_owned = false;
13111 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
13115 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
13116 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13118 this_ptr_conv.is_owned = false;
13119 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
13122 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
13123 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13125 this_ptr_conv.is_owned = false;
13126 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
13127 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
13130 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
13131 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13133 this_ptr_conv.is_owned = false;
13134 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13135 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
13139 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
13140 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13142 this_ptr_conv.is_owned = false;
13143 LDKPublicKey val_ref;
13144 CHECK(*((uint32_t*)val) == 33);
13145 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13146 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
13149 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
13150 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13152 this_ptr_conv.is_owned = false;
13153 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13154 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
13158 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
13159 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13161 this_ptr_conv.is_owned = false;
13162 LDKThirtyTwoBytes val_ref;
13163 CHECK(*((uint32_t*)val) == 32);
13164 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13165 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
13168 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
13169 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13171 this_ptr_conv.is_owned = false;
13172 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
13176 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
13177 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
13178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13179 this_ptr_conv.is_owned = false;
13180 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
13183 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) {
13184 LDKOutPoint outpoint_arg_conv;
13185 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13186 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13187 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13188 LDKPublicKey per_commitment_point_arg_ref;
13189 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
13190 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
13191 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
13192 LDKPublicKey revocation_pubkey_arg_ref;
13193 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
13194 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
13195 LDKThirtyTwoBytes channel_keys_id_arg_ref;
13196 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
13197 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
13198 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);
13199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13201 uint64_t ret_ref = (uint64_t)ret_var.inner;
13202 if (ret_var.is_owned) {
13208 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
13209 LDKDelayedPaymentOutputDescriptor orig_conv;
13210 orig_conv.inner = (void*)(orig & (~1));
13211 orig_conv.is_owned = false;
13212 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
13213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13215 uint64_t ret_ref = (uint64_t)ret_var.inner;
13216 if (ret_var.is_owned) {
13222 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
13223 LDKDelayedPaymentOutputDescriptor obj_conv;
13224 obj_conv.inner = (void*)(obj & (~1));
13225 obj_conv.is_owned = false;
13226 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
13227 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13228 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13229 CVec_u8Z_free(ret_var);
13233 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
13234 LDKu8slice ser_ref;
13235 ser_ref.datalen = *((uint32_t*)ser);
13236 ser_ref.data = (int8_t*)(ser + 4);
13237 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13238 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
13239 return (uint64_t)ret_conv;
13242 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
13243 LDKStaticPaymentOutputDescriptor this_obj_conv;
13244 this_obj_conv.inner = (void*)(this_obj & (~1));
13245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13246 StaticPaymentOutputDescriptor_free(this_obj_conv);
13249 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
13250 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13252 this_ptr_conv.is_owned = false;
13253 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
13254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13256 uint64_t ret_ref = (uint64_t)ret_var.inner;
13257 if (ret_var.is_owned) {
13263 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
13264 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13266 this_ptr_conv.is_owned = false;
13267 LDKOutPoint val_conv;
13268 val_conv.inner = (void*)(val & (~1));
13269 val_conv.is_owned = (val & 1) || (val == 0);
13270 val_conv = OutPoint_clone(&val_conv);
13271 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
13274 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
13275 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13277 this_ptr_conv.is_owned = false;
13278 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
13279 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
13282 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
13283 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13285 this_ptr_conv.is_owned = false;
13286 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13287 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
13291 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
13292 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13294 this_ptr_conv.is_owned = false;
13295 LDKThirtyTwoBytes val_ref;
13296 CHECK(*((uint32_t*)val) == 32);
13297 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13298 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
13301 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
13302 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13304 this_ptr_conv.is_owned = false;
13305 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
13309 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
13310 LDKStaticPaymentOutputDescriptor this_ptr_conv;
13311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13312 this_ptr_conv.is_owned = false;
13313 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
13316 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) {
13317 LDKOutPoint outpoint_arg_conv;
13318 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13319 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13320 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13321 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
13322 LDKThirtyTwoBytes channel_keys_id_arg_ref;
13323 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
13324 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
13325 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
13326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13328 uint64_t ret_ref = (uint64_t)ret_var.inner;
13329 if (ret_var.is_owned) {
13335 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
13336 LDKStaticPaymentOutputDescriptor orig_conv;
13337 orig_conv.inner = (void*)(orig & (~1));
13338 orig_conv.is_owned = false;
13339 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
13340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13342 uint64_t ret_ref = (uint64_t)ret_var.inner;
13343 if (ret_var.is_owned) {
13349 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
13350 LDKStaticPaymentOutputDescriptor obj_conv;
13351 obj_conv.inner = (void*)(obj & (~1));
13352 obj_conv.is_owned = false;
13353 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
13354 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13355 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13356 CVec_u8Z_free(ret_var);
13360 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
13361 LDKu8slice ser_ref;
13362 ser_ref.datalen = *((uint32_t*)ser);
13363 ser_ref.data = (int8_t*)(ser + 4);
13364 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13365 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
13366 return (uint64_t)ret_conv;
13369 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
13370 if ((this_ptr & 1) != 0) return;
13371 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
13372 FREE((void*)this_ptr);
13373 SpendableOutputDescriptor_free(this_ptr_conv);
13376 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
13377 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
13378 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13379 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
13380 uint64_t ret_ref = (uint64_t)ret_copy;
13384 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
13385 LDKOutPoint outpoint_conv;
13386 outpoint_conv.inner = (void*)(outpoint & (~1));
13387 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
13388 outpoint_conv = OutPoint_clone(&outpoint_conv);
13389 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
13390 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13391 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
13392 uint64_t ret_ref = (uint64_t)ret_copy;
13396 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
13397 LDKDelayedPaymentOutputDescriptor a_conv;
13398 a_conv.inner = (void*)(a & (~1));
13399 a_conv.is_owned = (a & 1) || (a == 0);
13400 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
13401 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13402 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
13403 uint64_t ret_ref = (uint64_t)ret_copy;
13407 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
13408 LDKStaticPaymentOutputDescriptor a_conv;
13409 a_conv.inner = (void*)(a & (~1));
13410 a_conv.is_owned = (a & 1) || (a == 0);
13411 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
13412 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13413 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
13414 uint64_t ret_ref = (uint64_t)ret_copy;
13418 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
13419 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
13420 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
13421 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13422 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13423 CVec_u8Z_free(ret_var);
13427 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
13428 LDKu8slice ser_ref;
13429 ser_ref.datalen = *((uint32_t*)ser);
13430 ser_ref.data = (int8_t*)(ser + 4);
13431 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13432 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
13433 return (uint64_t)ret_conv;
13436 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
13437 if ((this_ptr & 1) != 0) return;
13438 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
13439 FREE((void*)this_ptr);
13440 BaseSign_free(this_ptr_conv);
13443 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
13444 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
13445 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13446 *ret = Sign_clone(orig_conv);
13447 return (uint64_t)ret;
13450 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
13451 if ((this_ptr & 1) != 0) return;
13452 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
13453 FREE((void*)this_ptr);
13454 Sign_free(this_ptr_conv);
13457 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
13458 if ((this_ptr & 1) != 0) return;
13459 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
13460 FREE((void*)this_ptr);
13461 KeysInterface_free(this_ptr_conv);
13464 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
13465 LDKInMemorySigner this_obj_conv;
13466 this_obj_conv.inner = (void*)(this_obj & (~1));
13467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13468 InMemorySigner_free(this_obj_conv);
13471 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
13472 LDKInMemorySigner this_ptr_conv;
13473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13474 this_ptr_conv.is_owned = false;
13475 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13476 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
13480 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
13481 LDKInMemorySigner this_ptr_conv;
13482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13483 this_ptr_conv.is_owned = false;
13484 LDKSecretKey val_ref;
13485 CHECK(*((uint32_t*)val) == 32);
13486 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13487 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
13490 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
13491 LDKInMemorySigner this_ptr_conv;
13492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13493 this_ptr_conv.is_owned = false;
13494 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13495 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
13499 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
13500 LDKInMemorySigner this_ptr_conv;
13501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13502 this_ptr_conv.is_owned = false;
13503 LDKSecretKey val_ref;
13504 CHECK(*((uint32_t*)val) == 32);
13505 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13506 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
13509 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
13510 LDKInMemorySigner this_ptr_conv;
13511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13512 this_ptr_conv.is_owned = false;
13513 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13514 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
13518 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
13519 LDKInMemorySigner this_ptr_conv;
13520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13521 this_ptr_conv.is_owned = false;
13522 LDKSecretKey val_ref;
13523 CHECK(*((uint32_t*)val) == 32);
13524 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13525 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
13528 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
13529 LDKInMemorySigner this_ptr_conv;
13530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13531 this_ptr_conv.is_owned = false;
13532 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13533 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
13537 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
13538 LDKInMemorySigner this_ptr_conv;
13539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13540 this_ptr_conv.is_owned = false;
13541 LDKSecretKey val_ref;
13542 CHECK(*((uint32_t*)val) == 32);
13543 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13544 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
13547 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
13548 LDKInMemorySigner this_ptr_conv;
13549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13550 this_ptr_conv.is_owned = false;
13551 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13552 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
13556 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
13557 LDKInMemorySigner this_ptr_conv;
13558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13559 this_ptr_conv.is_owned = false;
13560 LDKSecretKey val_ref;
13561 CHECK(*((uint32_t*)val) == 32);
13562 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
13563 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
13566 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
13567 LDKInMemorySigner this_ptr_conv;
13568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13569 this_ptr_conv.is_owned = false;
13570 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13571 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
13575 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
13576 LDKInMemorySigner this_ptr_conv;
13577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13578 this_ptr_conv.is_owned = false;
13579 LDKThirtyTwoBytes val_ref;
13580 CHECK(*((uint32_t*)val) == 32);
13581 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13582 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
13585 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
13586 LDKInMemorySigner orig_conv;
13587 orig_conv.inner = (void*)(orig & (~1));
13588 orig_conv.is_owned = false;
13589 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
13590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13592 uint64_t ret_ref = (uint64_t)ret_var.inner;
13593 if (ret_var.is_owned) {
13599 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) {
13600 LDKSecretKey funding_key_ref;
13601 CHECK(*((uint32_t*)funding_key) == 32);
13602 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
13603 LDKSecretKey revocation_base_key_ref;
13604 CHECK(*((uint32_t*)revocation_base_key) == 32);
13605 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
13606 LDKSecretKey payment_key_ref;
13607 CHECK(*((uint32_t*)payment_key) == 32);
13608 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
13609 LDKSecretKey delayed_payment_base_key_ref;
13610 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
13611 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
13612 LDKSecretKey htlc_base_key_ref;
13613 CHECK(*((uint32_t*)htlc_base_key) == 32);
13614 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
13615 LDKThirtyTwoBytes commitment_seed_ref;
13616 CHECK(*((uint32_t*)commitment_seed) == 32);
13617 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
13618 LDKThirtyTwoBytes channel_keys_id_ref;
13619 CHECK(*((uint32_t*)channel_keys_id) == 32);
13620 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
13621 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);
13622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13624 uint64_t ret_ref = (uint64_t)ret_var.inner;
13625 if (ret_var.is_owned) {
13631 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
13632 LDKInMemorySigner this_arg_conv;
13633 this_arg_conv.inner = (void*)(this_arg & (~1));
13634 this_arg_conv.is_owned = false;
13635 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
13636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13638 uint64_t ret_ref = (uint64_t)ret_var.inner;
13639 if (ret_var.is_owned) {
13645 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
13646 LDKInMemorySigner this_arg_conv;
13647 this_arg_conv.inner = (void*)(this_arg & (~1));
13648 this_arg_conv.is_owned = false;
13649 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
13653 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
13654 LDKInMemorySigner this_arg_conv;
13655 this_arg_conv.inner = (void*)(this_arg & (~1));
13656 this_arg_conv.is_owned = false;
13657 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
13661 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
13662 LDKInMemorySigner this_arg_conv;
13663 this_arg_conv.inner = (void*)(this_arg & (~1));
13664 this_arg_conv.is_owned = false;
13665 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
13669 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
13670 LDKInMemorySigner this_arg_conv;
13671 this_arg_conv.inner = (void*)(this_arg & (~1));
13672 this_arg_conv.is_owned = false;
13673 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
13674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13676 uint64_t ret_ref = (uint64_t)ret_var.inner;
13677 if (ret_var.is_owned) {
13683 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
13684 LDKInMemorySigner this_arg_conv;
13685 this_arg_conv.inner = (void*)(this_arg & (~1));
13686 this_arg_conv.is_owned = false;
13687 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_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 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) {
13698 LDKInMemorySigner this_arg_conv;
13699 this_arg_conv.inner = (void*)(this_arg & (~1));
13700 this_arg_conv.is_owned = false;
13701 LDKTransaction spend_tx_ref;
13702 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13703 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13704 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13705 spend_tx_ref.data_is_owned = true;
13706 LDKStaticPaymentOutputDescriptor descriptor_conv;
13707 descriptor_conv.inner = (void*)(descriptor & (~1));
13708 descriptor_conv.is_owned = false;
13709 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13710 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13711 return (uint64_t)ret_conv;
13714 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) {
13715 LDKInMemorySigner this_arg_conv;
13716 this_arg_conv.inner = (void*)(this_arg & (~1));
13717 this_arg_conv.is_owned = false;
13718 LDKTransaction spend_tx_ref;
13719 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
13720 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
13721 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
13722 spend_tx_ref.data_is_owned = true;
13723 LDKDelayedPaymentOutputDescriptor descriptor_conv;
13724 descriptor_conv.inner = (void*)(descriptor & (~1));
13725 descriptor_conv.is_owned = false;
13726 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13727 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
13728 return (uint64_t)ret_conv;
13731 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
13732 LDKInMemorySigner this_arg_conv;
13733 this_arg_conv.inner = (void*)(this_arg & (~1));
13734 this_arg_conv.is_owned = false;
13735 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
13736 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
13737 return (uint64_t)ret;
13740 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
13741 LDKInMemorySigner this_arg_conv;
13742 this_arg_conv.inner = (void*)(this_arg & (~1));
13743 this_arg_conv.is_owned = false;
13744 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
13745 *ret = InMemorySigner_as_Sign(&this_arg_conv);
13746 return (uint64_t)ret;
13749 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
13750 LDKInMemorySigner obj_conv;
13751 obj_conv.inner = (void*)(obj & (~1));
13752 obj_conv.is_owned = false;
13753 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
13754 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13755 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13756 CVec_u8Z_free(ret_var);
13760 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
13761 LDKu8slice ser_ref;
13762 ser_ref.datalen = *((uint32_t*)ser);
13763 ser_ref.data = (int8_t*)(ser + 4);
13764 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13765 *ret_conv = InMemorySigner_read(ser_ref);
13766 return (uint64_t)ret_conv;
13769 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
13770 LDKKeysManager this_obj_conv;
13771 this_obj_conv.inner = (void*)(this_obj & (~1));
13772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13773 KeysManager_free(this_obj_conv);
13776 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
13777 unsigned char seed_arr[32];
13778 CHECK(*((uint32_t*)seed) == 32);
13779 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
13780 unsigned char (*seed_ref)[32] = &seed_arr;
13781 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
13782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13784 uint64_t ret_ref = (uint64_t)ret_var.inner;
13785 if (ret_var.is_owned) {
13791 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
13792 LDKKeysManager this_arg_conv;
13793 this_arg_conv.inner = (void*)(this_arg & (~1));
13794 this_arg_conv.is_owned = false;
13795 unsigned char params_arr[32];
13796 CHECK(*((uint32_t*)params) == 32);
13797 memcpy(params_arr, (uint8_t*)(params + 4), 32);
13798 unsigned char (*params_ref)[32] = ¶ms_arr;
13799 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
13800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13802 uint64_t ret_ref = (uint64_t)ret_var.inner;
13803 if (ret_var.is_owned) {
13809 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) {
13810 LDKKeysManager this_arg_conv;
13811 this_arg_conv.inner = (void*)(this_arg & (~1));
13812 this_arg_conv.is_owned = false;
13813 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13814 descriptors_constr.datalen = *((uint32_t*)descriptors);
13815 if (descriptors_constr.datalen > 0)
13816 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13818 descriptors_constr.data = NULL;
13819 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
13820 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13821 uint32_t descriptors_conv_27 = descriptors_vals[b];
13822 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
13823 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
13824 descriptors_constr.data[b] = descriptors_conv_27_conv;
13826 LDKCVec_TxOutZ outputs_constr;
13827 outputs_constr.datalen = *((uint32_t*)outputs);
13828 if (outputs_constr.datalen > 0)
13829 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13831 outputs_constr.data = NULL;
13832 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
13833 for (size_t h = 0; h < outputs_constr.datalen; h++) {
13834 uint32_t outputs_conv_7 = outputs_vals[h];
13835 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
13836 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
13837 outputs_constr.data[h] = outputs_conv_7_conv;
13839 LDKCVec_u8Z change_destination_script_ref;
13840 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
13841 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13842 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
13843 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13844 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
13845 return (uint64_t)ret_conv;
13848 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
13849 LDKKeysManager this_arg_conv;
13850 this_arg_conv.inner = (void*)(this_arg & (~1));
13851 this_arg_conv.is_owned = false;
13852 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
13853 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
13854 return (uint64_t)ret;
13857 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
13858 LDKChannelManager this_obj_conv;
13859 this_obj_conv.inner = (void*)(this_obj & (~1));
13860 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13861 ChannelManager_free(this_obj_conv);
13864 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
13865 LDKChainParameters this_obj_conv;
13866 this_obj_conv.inner = (void*)(this_obj & (~1));
13867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13868 ChainParameters_free(this_obj_conv);
13871 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
13872 LDKChainParameters this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = false;
13875 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
13879 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
13880 LDKChainParameters this_ptr_conv;
13881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13882 this_ptr_conv.is_owned = false;
13883 LDKNetwork val_conv = LDKNetwork_from_js(val);
13884 ChainParameters_set_network(&this_ptr_conv, val_conv);
13887 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
13888 LDKChainParameters this_ptr_conv;
13889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13890 this_ptr_conv.is_owned = false;
13891 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
13892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13894 uint64_t ret_ref = (uint64_t)ret_var.inner;
13895 if (ret_var.is_owned) {
13901 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
13902 LDKChainParameters this_ptr_conv;
13903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13904 this_ptr_conv.is_owned = false;
13905 LDKBestBlock val_conv;
13906 val_conv.inner = (void*)(val & (~1));
13907 val_conv.is_owned = (val & 1) || (val == 0);
13908 val_conv = BestBlock_clone(&val_conv);
13909 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
13912 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
13913 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
13914 LDKBestBlock best_block_arg_conv;
13915 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
13916 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
13917 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
13918 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
13919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13921 uint64_t ret_ref = (uint64_t)ret_var.inner;
13922 if (ret_var.is_owned) {
13928 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
13929 LDKChainParameters orig_conv;
13930 orig_conv.inner = (void*)(orig & (~1));
13931 orig_conv.is_owned = false;
13932 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
13933 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13934 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13935 uint64_t ret_ref = (uint64_t)ret_var.inner;
13936 if (ret_var.is_owned) {
13942 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
13943 LDKChannelCounterparty this_obj_conv;
13944 this_obj_conv.inner = (void*)(this_obj & (~1));
13945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13946 ChannelCounterparty_free(this_obj_conv);
13949 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
13950 LDKChannelCounterparty this_ptr_conv;
13951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13952 this_ptr_conv.is_owned = false;
13953 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13954 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
13958 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
13959 LDKChannelCounterparty this_ptr_conv;
13960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13961 this_ptr_conv.is_owned = false;
13962 LDKPublicKey val_ref;
13963 CHECK(*((uint32_t*)val) == 33);
13964 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13965 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
13968 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
13969 LDKChannelCounterparty this_ptr_conv;
13970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13971 this_ptr_conv.is_owned = false;
13972 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
13973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13975 uint64_t ret_ref = (uint64_t)ret_var.inner;
13976 if (ret_var.is_owned) {
13982 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
13983 LDKChannelCounterparty this_ptr_conv;
13984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13985 this_ptr_conv.is_owned = false;
13986 LDKInitFeatures val_conv;
13987 val_conv.inner = (void*)(val & (~1));
13988 val_conv.is_owned = (val & 1) || (val == 0);
13989 val_conv = InitFeatures_clone(&val_conv);
13990 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
13993 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
13994 LDKChannelCounterparty this_ptr_conv;
13995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13996 this_ptr_conv.is_owned = false;
13997 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
14001 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
14002 LDKChannelCounterparty this_ptr_conv;
14003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14004 this_ptr_conv.is_owned = false;
14005 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
14008 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
14009 LDKChannelCounterparty orig_conv;
14010 orig_conv.inner = (void*)(orig & (~1));
14011 orig_conv.is_owned = false;
14012 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
14013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14015 uint64_t ret_ref = (uint64_t)ret_var.inner;
14016 if (ret_var.is_owned) {
14022 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
14023 LDKChannelDetails this_obj_conv;
14024 this_obj_conv.inner = (void*)(this_obj & (~1));
14025 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14026 ChannelDetails_free(this_obj_conv);
14029 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
14030 LDKChannelDetails this_ptr_conv;
14031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14032 this_ptr_conv.is_owned = false;
14033 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14034 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
14038 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
14039 LDKChannelDetails this_ptr_conv;
14040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14041 this_ptr_conv.is_owned = false;
14042 LDKThirtyTwoBytes val_ref;
14043 CHECK(*((uint32_t*)val) == 32);
14044 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14045 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
14048 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
14049 LDKChannelDetails this_ptr_conv;
14050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14051 this_ptr_conv.is_owned = false;
14052 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
14053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14055 uint64_t ret_ref = (uint64_t)ret_var.inner;
14056 if (ret_var.is_owned) {
14062 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
14063 LDKChannelDetails this_ptr_conv;
14064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14065 this_ptr_conv.is_owned = false;
14066 LDKChannelCounterparty val_conv;
14067 val_conv.inner = (void*)(val & (~1));
14068 val_conv.is_owned = (val & 1) || (val == 0);
14069 val_conv = ChannelCounterparty_clone(&val_conv);
14070 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
14073 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
14074 LDKChannelDetails this_ptr_conv;
14075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14076 this_ptr_conv.is_owned = false;
14077 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
14078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14080 uint64_t ret_ref = (uint64_t)ret_var.inner;
14081 if (ret_var.is_owned) {
14087 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
14088 LDKChannelDetails this_ptr_conv;
14089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14090 this_ptr_conv.is_owned = false;
14091 LDKOutPoint val_conv;
14092 val_conv.inner = (void*)(val & (~1));
14093 val_conv.is_owned = (val & 1) || (val == 0);
14094 val_conv = OutPoint_clone(&val_conv);
14095 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
14098 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
14099 LDKChannelDetails this_ptr_conv;
14100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14101 this_ptr_conv.is_owned = false;
14102 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14103 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
14104 uint64_t ret_ref = (uint64_t)ret_copy;
14108 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
14109 LDKChannelDetails this_ptr_conv;
14110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14111 this_ptr_conv.is_owned = false;
14112 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
14113 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
14116 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
14117 LDKChannelDetails this_ptr_conv;
14118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14119 this_ptr_conv.is_owned = false;
14120 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
14124 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14125 LDKChannelDetails this_ptr_conv;
14126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14127 this_ptr_conv.is_owned = false;
14128 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
14131 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
14132 LDKChannelDetails this_ptr_conv;
14133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14134 this_ptr_conv.is_owned = false;
14135 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14136 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
14137 uint64_t ret_ref = (uint64_t)ret_copy;
14141 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
14142 LDKChannelDetails this_ptr_conv;
14143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14144 this_ptr_conv.is_owned = false;
14145 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
14146 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
14149 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
14150 LDKChannelDetails this_ptr_conv;
14151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14152 this_ptr_conv.is_owned = false;
14153 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
14157 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
14158 LDKChannelDetails this_ptr_conv;
14159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14160 this_ptr_conv.is_owned = false;
14161 ChannelDetails_set_user_id(&this_ptr_conv, val);
14164 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
14165 LDKChannelDetails this_ptr_conv;
14166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14167 this_ptr_conv.is_owned = false;
14168 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
14172 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
14173 LDKChannelDetails this_ptr_conv;
14174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14175 this_ptr_conv.is_owned = false;
14176 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
14179 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
14180 LDKChannelDetails this_ptr_conv;
14181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14182 this_ptr_conv.is_owned = false;
14183 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
14187 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
14188 LDKChannelDetails this_ptr_conv;
14189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14190 this_ptr_conv.is_owned = false;
14191 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
14194 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
14195 LDKChannelDetails this_ptr_conv;
14196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14197 this_ptr_conv.is_owned = false;
14198 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14199 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
14200 uint64_t ret_ref = (uint64_t)ret_copy;
14204 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
14205 LDKChannelDetails this_ptr_conv;
14206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14207 this_ptr_conv.is_owned = false;
14208 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
14209 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
14212 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
14213 LDKChannelDetails this_ptr_conv;
14214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14215 this_ptr_conv.is_owned = false;
14216 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14217 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
14218 uint64_t ret_ref = (uint64_t)ret_copy;
14222 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
14223 LDKChannelDetails this_ptr_conv;
14224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14225 this_ptr_conv.is_owned = false;
14226 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
14227 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
14230 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
14231 LDKChannelDetails this_ptr_conv;
14232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14233 this_ptr_conv.is_owned = false;
14234 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
14238 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
14239 LDKChannelDetails this_ptr_conv;
14240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14241 this_ptr_conv.is_owned = false;
14242 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
14245 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
14246 LDKChannelDetails this_ptr_conv;
14247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14248 this_ptr_conv.is_owned = false;
14249 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
14253 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
14254 LDKChannelDetails this_ptr_conv;
14255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14256 this_ptr_conv.is_owned = false;
14257 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
14260 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
14261 LDKChannelDetails this_ptr_conv;
14262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14263 this_ptr_conv.is_owned = false;
14264 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
14268 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
14269 LDKChannelDetails this_ptr_conv;
14270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14271 this_ptr_conv.is_owned = false;
14272 ChannelDetails_set_is_usable(&this_ptr_conv, val);
14275 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
14276 LDKChannelDetails this_ptr_conv;
14277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14278 this_ptr_conv.is_owned = false;
14279 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
14283 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
14284 LDKChannelDetails this_ptr_conv;
14285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14286 this_ptr_conv.is_owned = false;
14287 ChannelDetails_set_is_public(&this_ptr_conv, val);
14290 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) {
14291 LDKThirtyTwoBytes channel_id_arg_ref;
14292 CHECK(*((uint32_t*)channel_id_arg) == 32);
14293 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
14294 LDKChannelCounterparty counterparty_arg_conv;
14295 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
14296 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
14297 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
14298 LDKOutPoint funding_txo_arg_conv;
14299 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
14300 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
14301 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
14302 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
14303 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
14304 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
14305 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
14306 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);
14307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14309 uint64_t ret_ref = (uint64_t)ret_var.inner;
14310 if (ret_var.is_owned) {
14316 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
14317 LDKChannelDetails orig_conv;
14318 orig_conv.inner = (void*)(orig & (~1));
14319 orig_conv.is_owned = false;
14320 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
14321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14323 uint64_t ret_ref = (uint64_t)ret_var.inner;
14324 if (ret_var.is_owned) {
14330 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
14331 if ((this_ptr & 1) != 0) return;
14332 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
14333 FREE((void*)this_ptr);
14334 PaymentSendFailure_free(this_ptr_conv);
14337 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
14338 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
14339 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14340 *ret_copy = PaymentSendFailure_clone(orig_conv);
14341 uint64_t ret_ref = (uint64_t)ret_copy;
14345 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
14346 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
14347 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14348 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
14349 uint64_t ret_ref = (uint64_t)ret_copy;
14353 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
14354 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14355 a_constr.datalen = *((uint32_t*)a);
14356 if (a_constr.datalen > 0)
14357 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14359 a_constr.data = NULL;
14360 uint32_t* a_vals = (uint32_t*)(a + 4);
14361 for (size_t w = 0; w < a_constr.datalen; w++) {
14362 uint32_t a_conv_22 = a_vals[w];
14363 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14364 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14365 a_constr.data[w] = a_conv_22_conv;
14367 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14368 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
14369 uint64_t ret_ref = (uint64_t)ret_copy;
14373 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
14374 LDKCVec_APIErrorZ a_constr;
14375 a_constr.datalen = *((uint32_t*)a);
14376 if (a_constr.datalen > 0)
14377 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14379 a_constr.data = NULL;
14380 uint32_t* a_vals = (uint32_t*)(a + 4);
14381 for (size_t k = 0; k < a_constr.datalen; k++) {
14382 uint32_t a_conv_10 = a_vals[k];
14383 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
14384 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
14385 a_constr.data[k] = a_conv_10_conv;
14387 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14388 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
14389 uint64_t ret_ref = (uint64_t)ret_copy;
14393 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
14394 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
14395 a_constr.datalen = *((uint32_t*)a);
14396 if (a_constr.datalen > 0)
14397 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14399 a_constr.data = NULL;
14400 uint32_t* a_vals = (uint32_t*)(a + 4);
14401 for (size_t w = 0; w < a_constr.datalen; w++) {
14402 uint32_t a_conv_22 = a_vals[w];
14403 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
14404 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
14405 a_constr.data[w] = a_conv_22_conv;
14407 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
14408 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
14409 uint64_t ret_ref = (uint64_t)ret_copy;
14413 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) {
14414 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
14415 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14416 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14417 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14418 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14419 LDKUserConfig config_conv;
14420 config_conv.inner = (void*)(config & (~1));
14421 config_conv.is_owned = (config & 1) || (config == 0);
14422 config_conv = UserConfig_clone(&config_conv);
14423 LDKChainParameters params_conv;
14424 params_conv.inner = (void*)(params & (~1));
14425 params_conv.is_owned = (params & 1) || (params == 0);
14426 params_conv = ChainParameters_clone(¶ms_conv);
14427 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
14428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14430 uint64_t ret_ref = (uint64_t)ret_var.inner;
14431 if (ret_var.is_owned) {
14437 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
14438 LDKChannelManager this_arg_conv;
14439 this_arg_conv.inner = (void*)(this_arg & (~1));
14440 this_arg_conv.is_owned = false;
14441 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
14442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14444 uint64_t ret_ref = (uint64_t)ret_var.inner;
14445 if (ret_var.is_owned) {
14451 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) {
14452 LDKChannelManager this_arg_conv;
14453 this_arg_conv.inner = (void*)(this_arg & (~1));
14454 this_arg_conv.is_owned = false;
14455 LDKPublicKey their_network_key_ref;
14456 CHECK(*((uint32_t*)their_network_key) == 33);
14457 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
14458 LDKUserConfig override_config_conv;
14459 override_config_conv.inner = (void*)(override_config & (~1));
14460 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
14461 override_config_conv = UserConfig_clone(&override_config_conv);
14462 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14463 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
14464 return (uint64_t)ret_conv;
14467 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
14468 LDKChannelManager this_arg_conv;
14469 this_arg_conv.inner = (void*)(this_arg & (~1));
14470 this_arg_conv.is_owned = false;
14471 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
14472 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14473 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14474 for (size_t q = 0; q < ret_var.datalen; q++) {
14475 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14476 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14477 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14478 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14479 if (ret_conv_16_var.is_owned) {
14480 ret_conv_16_ref |= 1;
14482 ret_arr_ptr[q] = ret_conv_16_ref;
14484 FREE(ret_var.data);
14488 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
14489 LDKChannelManager this_arg_conv;
14490 this_arg_conv.inner = (void*)(this_arg & (~1));
14491 this_arg_conv.is_owned = false;
14492 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
14493 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14494 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14495 for (size_t q = 0; q < ret_var.datalen; q++) {
14496 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14497 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14498 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14499 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
14500 if (ret_conv_16_var.is_owned) {
14501 ret_conv_16_ref |= 1;
14503 ret_arr_ptr[q] = ret_conv_16_ref;
14505 FREE(ret_var.data);
14509 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14510 LDKChannelManager this_arg_conv;
14511 this_arg_conv.inner = (void*)(this_arg & (~1));
14512 this_arg_conv.is_owned = false;
14513 unsigned char channel_id_arr[32];
14514 CHECK(*((uint32_t*)channel_id) == 32);
14515 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14516 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14517 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14518 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
14519 return (uint64_t)ret_conv;
14522 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
14523 LDKChannelManager this_arg_conv;
14524 this_arg_conv.inner = (void*)(this_arg & (~1));
14525 this_arg_conv.is_owned = false;
14526 unsigned char channel_id_arr[32];
14527 CHECK(*((uint32_t*)channel_id) == 32);
14528 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14529 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14530 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14531 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
14532 return (uint64_t)ret_conv;
14535 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
14536 LDKChannelManager this_arg_conv;
14537 this_arg_conv.inner = (void*)(this_arg & (~1));
14538 this_arg_conv.is_owned = false;
14539 unsigned char channel_id_arr[32];
14540 CHECK(*((uint32_t*)channel_id) == 32);
14541 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
14542 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
14543 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14544 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
14545 return (uint64_t)ret_conv;
14548 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
14549 LDKChannelManager this_arg_conv;
14550 this_arg_conv.inner = (void*)(this_arg & (~1));
14551 this_arg_conv.is_owned = false;
14552 ChannelManager_force_close_all_channels(&this_arg_conv);
14555 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
14556 LDKChannelManager this_arg_conv;
14557 this_arg_conv.inner = (void*)(this_arg & (~1));
14558 this_arg_conv.is_owned = false;
14559 LDKRoute route_conv;
14560 route_conv.inner = (void*)(route & (~1));
14561 route_conv.is_owned = false;
14562 LDKThirtyTwoBytes payment_hash_ref;
14563 CHECK(*((uint32_t*)payment_hash) == 32);
14564 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14565 LDKThirtyTwoBytes payment_secret_ref;
14566 CHECK(*((uint32_t*)payment_secret) == 32);
14567 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
14568 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14569 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
14570 return (uint64_t)ret_conv;
14573 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
14574 LDKChannelManager this_arg_conv;
14575 this_arg_conv.inner = (void*)(this_arg & (~1));
14576 this_arg_conv.is_owned = false;
14577 LDKRoute route_conv;
14578 route_conv.inner = (void*)(route & (~1));
14579 route_conv.is_owned = false;
14580 LDKThirtyTwoBytes payment_preimage_ref;
14581 CHECK(*((uint32_t*)payment_preimage) == 32);
14582 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
14583 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
14584 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
14585 return (uint64_t)ret_conv;
14588 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
14589 LDKChannelManager this_arg_conv;
14590 this_arg_conv.inner = (void*)(this_arg & (~1));
14591 this_arg_conv.is_owned = false;
14592 unsigned char temporary_channel_id_arr[32];
14593 CHECK(*((uint32_t*)temporary_channel_id) == 32);
14594 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
14595 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
14596 LDKTransaction funding_transaction_ref;
14597 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
14598 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
14599 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
14600 funding_transaction_ref.data_is_owned = true;
14601 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14602 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
14603 return (uint64_t)ret_conv;
14606 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
14607 LDKChannelManager this_arg_conv;
14608 this_arg_conv.inner = (void*)(this_arg & (~1));
14609 this_arg_conv.is_owned = false;
14610 LDKThreeBytes rgb_ref;
14611 CHECK(*((uint32_t*)rgb) == 3);
14612 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
14613 LDKThirtyTwoBytes alias_ref;
14614 CHECK(*((uint32_t*)alias) == 32);
14615 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
14616 LDKCVec_NetAddressZ addresses_constr;
14617 addresses_constr.datalen = *((uint32_t*)addresses);
14618 if (addresses_constr.datalen > 0)
14619 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14621 addresses_constr.data = NULL;
14622 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
14623 for (size_t m = 0; m < addresses_constr.datalen; m++) {
14624 uint32_t addresses_conv_12 = addresses_vals[m];
14625 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
14626 addresses_constr.data[m] = addresses_conv_12_conv;
14628 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
14631 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
14632 LDKChannelManager this_arg_conv;
14633 this_arg_conv.inner = (void*)(this_arg & (~1));
14634 this_arg_conv.is_owned = false;
14635 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
14638 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
14639 LDKChannelManager this_arg_conv;
14640 this_arg_conv.inner = (void*)(this_arg & (~1));
14641 this_arg_conv.is_owned = false;
14642 ChannelManager_timer_tick_occurred(&this_arg_conv);
14645 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
14646 LDKChannelManager this_arg_conv;
14647 this_arg_conv.inner = (void*)(this_arg & (~1));
14648 this_arg_conv.is_owned = false;
14649 unsigned char payment_hash_arr[32];
14650 CHECK(*((uint32_t*)payment_hash) == 32);
14651 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
14652 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14653 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
14657 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
14658 LDKChannelManager this_arg_conv;
14659 this_arg_conv.inner = (void*)(this_arg & (~1));
14660 this_arg_conv.is_owned = false;
14661 LDKThirtyTwoBytes payment_preimage_ref;
14662 CHECK(*((uint32_t*)payment_preimage) == 32);
14663 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
14664 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
14668 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
14669 LDKChannelManager this_arg_conv;
14670 this_arg_conv.inner = (void*)(this_arg & (~1));
14671 this_arg_conv.is_owned = false;
14672 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14673 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
14677 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
14678 LDKChannelManager this_arg_conv;
14679 this_arg_conv.inner = (void*)(this_arg & (~1));
14680 this_arg_conv.is_owned = false;
14681 LDKOutPoint funding_txo_conv;
14682 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14683 funding_txo_conv.is_owned = false;
14684 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
14687 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) {
14688 LDKChannelManager this_arg_conv;
14689 this_arg_conv.inner = (void*)(this_arg & (~1));
14690 this_arg_conv.is_owned = false;
14691 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14692 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14693 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
14694 return (uint64_t)ret_ref;
14697 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) {
14698 LDKChannelManager this_arg_conv;
14699 this_arg_conv.inner = (void*)(this_arg & (~1));
14700 this_arg_conv.is_owned = false;
14701 LDKThirtyTwoBytes payment_hash_ref;
14702 CHECK(*((uint32_t*)payment_hash) == 32);
14703 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
14704 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
14705 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14706 *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);
14707 return (uint64_t)ret_conv;
14710 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
14711 LDKChannelManager this_arg_conv;
14712 this_arg_conv.inner = (void*)(this_arg & (~1));
14713 this_arg_conv.is_owned = false;
14714 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14715 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
14716 return (uint64_t)ret;
14719 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
14720 LDKChannelManager this_arg_conv;
14721 this_arg_conv.inner = (void*)(this_arg & (~1));
14722 this_arg_conv.is_owned = false;
14723 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14724 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
14725 return (uint64_t)ret;
14728 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
14729 LDKChannelManager this_arg_conv;
14730 this_arg_conv.inner = (void*)(this_arg & (~1));
14731 this_arg_conv.is_owned = false;
14732 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14733 *ret = ChannelManager_as_Listen(&this_arg_conv);
14734 return (uint64_t)ret;
14737 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
14738 LDKChannelManager this_arg_conv;
14739 this_arg_conv.inner = (void*)(this_arg & (~1));
14740 this_arg_conv.is_owned = false;
14741 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14742 *ret = ChannelManager_as_Confirm(&this_arg_conv);
14743 return (uint64_t)ret;
14746 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
14747 LDKChannelManager this_arg_conv;
14748 this_arg_conv.inner = (void*)(this_arg & (~1));
14749 this_arg_conv.is_owned = false;
14750 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
14754 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
14755 LDKChannelManager this_arg_conv;
14756 this_arg_conv.inner = (void*)(this_arg & (~1));
14757 this_arg_conv.is_owned = false;
14758 ChannelManager_await_persistable_update(&this_arg_conv);
14761 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
14762 LDKChannelManager this_arg_conv;
14763 this_arg_conv.inner = (void*)(this_arg & (~1));
14764 this_arg_conv.is_owned = false;
14765 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
14766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14768 uint64_t ret_ref = (uint64_t)ret_var.inner;
14769 if (ret_var.is_owned) {
14775 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
14776 LDKChannelManager this_arg_conv;
14777 this_arg_conv.inner = (void*)(this_arg & (~1));
14778 this_arg_conv.is_owned = false;
14779 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14780 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
14781 return (uint64_t)ret;
14784 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
14785 LDKChannelManager obj_conv;
14786 obj_conv.inner = (void*)(obj & (~1));
14787 obj_conv.is_owned = false;
14788 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
14789 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14790 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14791 CVec_u8Z_free(ret_var);
14795 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
14796 LDKChannelManagerReadArgs this_obj_conv;
14797 this_obj_conv.inner = (void*)(this_obj & (~1));
14798 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14799 ChannelManagerReadArgs_free(this_obj_conv);
14802 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
14803 LDKChannelManagerReadArgs this_ptr_conv;
14804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14805 this_ptr_conv.is_owned = false;
14806 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
14810 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
14811 LDKChannelManagerReadArgs this_ptr_conv;
14812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14813 this_ptr_conv.is_owned = false;
14814 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
14815 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
14818 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
14819 LDKChannelManagerReadArgs this_ptr_conv;
14820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14821 this_ptr_conv.is_owned = false;
14822 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
14826 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
14827 LDKChannelManagerReadArgs this_ptr_conv;
14828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14829 this_ptr_conv.is_owned = false;
14830 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
14831 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
14834 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
14835 LDKChannelManagerReadArgs this_ptr_conv;
14836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14837 this_ptr_conv.is_owned = false;
14838 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
14842 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
14843 LDKChannelManagerReadArgs this_ptr_conv;
14844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14845 this_ptr_conv.is_owned = false;
14846 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
14847 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
14850 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
14851 LDKChannelManagerReadArgs this_ptr_conv;
14852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14853 this_ptr_conv.is_owned = false;
14854 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
14858 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
14859 LDKChannelManagerReadArgs this_ptr_conv;
14860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14861 this_ptr_conv.is_owned = false;
14862 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
14863 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
14866 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
14867 LDKChannelManagerReadArgs this_ptr_conv;
14868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14869 this_ptr_conv.is_owned = false;
14870 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
14874 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
14875 LDKChannelManagerReadArgs this_ptr_conv;
14876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14877 this_ptr_conv.is_owned = false;
14878 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
14879 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
14882 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
14883 LDKChannelManagerReadArgs this_ptr_conv;
14884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14885 this_ptr_conv.is_owned = false;
14886 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
14887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14889 uint64_t ret_ref = (uint64_t)ret_var.inner;
14890 if (ret_var.is_owned) {
14896 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
14897 LDKChannelManagerReadArgs this_ptr_conv;
14898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14899 this_ptr_conv.is_owned = false;
14900 LDKUserConfig val_conv;
14901 val_conv.inner = (void*)(val & (~1));
14902 val_conv.is_owned = (val & 1) || (val == 0);
14903 val_conv = UserConfig_clone(&val_conv);
14904 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
14907 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) {
14908 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
14909 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14910 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
14911 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
14912 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14913 LDKUserConfig default_config_conv;
14914 default_config_conv.inner = (void*)(default_config & (~1));
14915 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
14916 default_config_conv = UserConfig_clone(&default_config_conv);
14917 LDKCVec_ChannelMonitorZ channel_monitors_constr;
14918 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
14919 if (channel_monitors_constr.datalen > 0)
14920 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
14922 channel_monitors_constr.data = NULL;
14923 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
14924 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
14925 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
14926 LDKChannelMonitor channel_monitors_conv_16_conv;
14927 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
14928 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
14929 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
14931 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);
14932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14934 uint64_t ret_ref = (uint64_t)ret_var.inner;
14935 if (ret_var.is_owned) {
14941 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
14942 LDKu8slice ser_ref;
14943 ser_ref.datalen = *((uint32_t*)ser);
14944 ser_ref.data = (int8_t*)(ser + 4);
14945 LDKChannelManagerReadArgs arg_conv;
14946 arg_conv.inner = (void*)(arg & (~1));
14947 arg_conv.is_owned = (arg & 1) || (arg == 0);
14948 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
14949 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14950 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
14951 return (uint64_t)ret_conv;
14954 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
14955 LDKDecodeError this_obj_conv;
14956 this_obj_conv.inner = (void*)(this_obj & (~1));
14957 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14958 DecodeError_free(this_obj_conv);
14961 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
14962 LDKDecodeError orig_conv;
14963 orig_conv.inner = (void*)(orig & (~1));
14964 orig_conv.is_owned = false;
14965 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
14966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14968 uint64_t ret_ref = (uint64_t)ret_var.inner;
14969 if (ret_var.is_owned) {
14975 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
14976 LDKInit this_obj_conv;
14977 this_obj_conv.inner = (void*)(this_obj & (~1));
14978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14979 Init_free(this_obj_conv);
14982 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
14983 LDKInit this_ptr_conv;
14984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14985 this_ptr_conv.is_owned = false;
14986 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
14987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14989 uint64_t ret_ref = (uint64_t)ret_var.inner;
14990 if (ret_var.is_owned) {
14996 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
14997 LDKInit this_ptr_conv;
14998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14999 this_ptr_conv.is_owned = false;
15000 LDKInitFeatures val_conv;
15001 val_conv.inner = (void*)(val & (~1));
15002 val_conv.is_owned = (val & 1) || (val == 0);
15003 val_conv = InitFeatures_clone(&val_conv);
15004 Init_set_features(&this_ptr_conv, val_conv);
15007 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
15008 LDKInitFeatures features_arg_conv;
15009 features_arg_conv.inner = (void*)(features_arg & (~1));
15010 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15011 features_arg_conv = InitFeatures_clone(&features_arg_conv);
15012 LDKInit ret_var = Init_new(features_arg_conv);
15013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15015 uint64_t ret_ref = (uint64_t)ret_var.inner;
15016 if (ret_var.is_owned) {
15022 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
15024 orig_conv.inner = (void*)(orig & (~1));
15025 orig_conv.is_owned = false;
15026 LDKInit ret_var = Init_clone(&orig_conv);
15027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15029 uint64_t ret_ref = (uint64_t)ret_var.inner;
15030 if (ret_var.is_owned) {
15036 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
15037 LDKErrorMessage this_obj_conv;
15038 this_obj_conv.inner = (void*)(this_obj & (~1));
15039 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15040 ErrorMessage_free(this_obj_conv);
15043 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
15044 LDKErrorMessage this_ptr_conv;
15045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15046 this_ptr_conv.is_owned = false;
15047 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15048 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
15052 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15053 LDKErrorMessage this_ptr_conv;
15054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15055 this_ptr_conv.is_owned = false;
15056 LDKThirtyTwoBytes val_ref;
15057 CHECK(*((uint32_t*)val) == 32);
15058 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15059 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
15062 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
15063 LDKErrorMessage this_ptr_conv;
15064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15065 this_ptr_conv.is_owned = false;
15066 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
15067 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15072 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
15073 LDKErrorMessage this_ptr_conv;
15074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15075 this_ptr_conv.is_owned = false;
15076 LDKStr val_conv = str_ref_to_owned_c(val);
15077 ErrorMessage_set_data(&this_ptr_conv, val_conv);
15080 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
15081 LDKThirtyTwoBytes channel_id_arg_ref;
15082 CHECK(*((uint32_t*)channel_id_arg) == 32);
15083 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15084 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
15085 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
15086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15088 uint64_t ret_ref = (uint64_t)ret_var.inner;
15089 if (ret_var.is_owned) {
15095 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
15096 LDKErrorMessage orig_conv;
15097 orig_conv.inner = (void*)(orig & (~1));
15098 orig_conv.is_owned = false;
15099 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
15100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15102 uint64_t ret_ref = (uint64_t)ret_var.inner;
15103 if (ret_var.is_owned) {
15109 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
15110 LDKPing this_obj_conv;
15111 this_obj_conv.inner = (void*)(this_obj & (~1));
15112 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15113 Ping_free(this_obj_conv);
15116 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
15117 LDKPing this_ptr_conv;
15118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15119 this_ptr_conv.is_owned = false;
15120 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
15124 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
15125 LDKPing this_ptr_conv;
15126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15127 this_ptr_conv.is_owned = false;
15128 Ping_set_ponglen(&this_ptr_conv, val);
15131 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
15132 LDKPing this_ptr_conv;
15133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15134 this_ptr_conv.is_owned = false;
15135 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
15139 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
15140 LDKPing this_ptr_conv;
15141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15142 this_ptr_conv.is_owned = false;
15143 Ping_set_byteslen(&this_ptr_conv, val);
15146 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
15147 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
15148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15150 uint64_t ret_ref = (uint64_t)ret_var.inner;
15151 if (ret_var.is_owned) {
15157 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
15159 orig_conv.inner = (void*)(orig & (~1));
15160 orig_conv.is_owned = false;
15161 LDKPing ret_var = Ping_clone(&orig_conv);
15162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15164 uint64_t ret_ref = (uint64_t)ret_var.inner;
15165 if (ret_var.is_owned) {
15171 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
15172 LDKPong this_obj_conv;
15173 this_obj_conv.inner = (void*)(this_obj & (~1));
15174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15175 Pong_free(this_obj_conv);
15178 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
15179 LDKPong this_ptr_conv;
15180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15181 this_ptr_conv.is_owned = false;
15182 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
15186 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
15187 LDKPong this_ptr_conv;
15188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15189 this_ptr_conv.is_owned = false;
15190 Pong_set_byteslen(&this_ptr_conv, val);
15193 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
15194 LDKPong ret_var = Pong_new(byteslen_arg);
15195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15197 uint64_t ret_ref = (uint64_t)ret_var.inner;
15198 if (ret_var.is_owned) {
15204 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
15206 orig_conv.inner = (void*)(orig & (~1));
15207 orig_conv.is_owned = false;
15208 LDKPong ret_var = Pong_clone(&orig_conv);
15209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15211 uint64_t ret_ref = (uint64_t)ret_var.inner;
15212 if (ret_var.is_owned) {
15218 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
15219 LDKOpenChannel this_obj_conv;
15220 this_obj_conv.inner = (void*)(this_obj & (~1));
15221 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15222 OpenChannel_free(this_obj_conv);
15225 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
15226 LDKOpenChannel this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15230 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
15234 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
15235 LDKOpenChannel this_ptr_conv;
15236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15237 this_ptr_conv.is_owned = false;
15238 LDKThirtyTwoBytes val_ref;
15239 CHECK(*((uint32_t*)val) == 32);
15240 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15241 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
15244 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
15245 LDKOpenChannel this_ptr_conv;
15246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15247 this_ptr_conv.is_owned = false;
15248 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15249 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
15253 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15254 LDKOpenChannel this_ptr_conv;
15255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15256 this_ptr_conv.is_owned = false;
15257 LDKThirtyTwoBytes val_ref;
15258 CHECK(*((uint32_t*)val) == 32);
15259 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15260 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
15263 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
15264 LDKOpenChannel this_ptr_conv;
15265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15266 this_ptr_conv.is_owned = false;
15267 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
15271 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
15272 LDKOpenChannel this_ptr_conv;
15273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15274 this_ptr_conv.is_owned = false;
15275 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
15278 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
15279 LDKOpenChannel this_ptr_conv;
15280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15281 this_ptr_conv.is_owned = false;
15282 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
15286 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
15287 LDKOpenChannel this_ptr_conv;
15288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15289 this_ptr_conv.is_owned = false;
15290 OpenChannel_set_push_msat(&this_ptr_conv, val);
15293 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
15294 LDKOpenChannel this_ptr_conv;
15295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15296 this_ptr_conv.is_owned = false;
15297 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
15301 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
15302 LDKOpenChannel this_ptr_conv;
15303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15304 this_ptr_conv.is_owned = false;
15305 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
15308 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
15309 LDKOpenChannel this_ptr_conv;
15310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15311 this_ptr_conv.is_owned = false;
15312 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
15316 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
15317 LDKOpenChannel this_ptr_conv;
15318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15319 this_ptr_conv.is_owned = false;
15320 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15323 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
15324 LDKOpenChannel this_ptr_conv;
15325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15326 this_ptr_conv.is_owned = false;
15327 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
15331 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
15332 LDKOpenChannel this_ptr_conv;
15333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15334 this_ptr_conv.is_owned = false;
15335 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
15338 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
15339 LDKOpenChannel this_ptr_conv;
15340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15341 this_ptr_conv.is_owned = false;
15342 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
15346 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
15347 LDKOpenChannel this_ptr_conv;
15348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15349 this_ptr_conv.is_owned = false;
15350 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15353 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
15354 LDKOpenChannel this_ptr_conv;
15355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15356 this_ptr_conv.is_owned = false;
15357 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
15361 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
15362 LDKOpenChannel this_ptr_conv;
15363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15364 this_ptr_conv.is_owned = false;
15365 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
15368 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
15369 LDKOpenChannel this_ptr_conv;
15370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15371 this_ptr_conv.is_owned = false;
15372 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
15376 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15377 LDKOpenChannel this_ptr_conv;
15378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15379 this_ptr_conv.is_owned = false;
15380 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
15383 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15384 LDKOpenChannel this_ptr_conv;
15385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15386 this_ptr_conv.is_owned = false;
15387 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
15391 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15392 LDKOpenChannel this_ptr_conv;
15393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15394 this_ptr_conv.is_owned = false;
15395 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15398 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
15399 LDKOpenChannel this_ptr_conv;
15400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15401 this_ptr_conv.is_owned = false;
15402 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15403 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15407 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15408 LDKOpenChannel this_ptr_conv;
15409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15410 this_ptr_conv.is_owned = false;
15411 LDKPublicKey val_ref;
15412 CHECK(*((uint32_t*)val) == 33);
15413 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15414 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15417 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
15418 LDKOpenChannel this_ptr_conv;
15419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15420 this_ptr_conv.is_owned = false;
15421 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15422 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15426 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15427 LDKOpenChannel this_ptr_conv;
15428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15429 this_ptr_conv.is_owned = false;
15430 LDKPublicKey val_ref;
15431 CHECK(*((uint32_t*)val) == 33);
15432 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15433 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15436 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
15437 LDKOpenChannel this_ptr_conv;
15438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15439 this_ptr_conv.is_owned = false;
15440 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15441 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15445 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15446 LDKOpenChannel this_ptr_conv;
15447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15448 this_ptr_conv.is_owned = false;
15449 LDKPublicKey val_ref;
15450 CHECK(*((uint32_t*)val) == 33);
15451 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15452 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
15455 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15456 LDKOpenChannel this_ptr_conv;
15457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15458 this_ptr_conv.is_owned = false;
15459 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15460 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15464 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15465 LDKOpenChannel this_ptr_conv;
15466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15467 this_ptr_conv.is_owned = false;
15468 LDKPublicKey val_ref;
15469 CHECK(*((uint32_t*)val) == 33);
15470 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15471 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15474 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
15475 LDKOpenChannel this_ptr_conv;
15476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15477 this_ptr_conv.is_owned = false;
15478 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15479 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15483 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15484 LDKOpenChannel this_ptr_conv;
15485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15486 this_ptr_conv.is_owned = false;
15487 LDKPublicKey val_ref;
15488 CHECK(*((uint32_t*)val) == 33);
15489 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15490 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15493 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15494 LDKOpenChannel this_ptr_conv;
15495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15496 this_ptr_conv.is_owned = false;
15497 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15498 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15502 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15503 LDKOpenChannel this_ptr_conv;
15504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15505 this_ptr_conv.is_owned = false;
15506 LDKPublicKey val_ref;
15507 CHECK(*((uint32_t*)val) == 33);
15508 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15509 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15512 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
15513 LDKOpenChannel this_ptr_conv;
15514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15515 this_ptr_conv.is_owned = false;
15516 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
15520 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
15521 LDKOpenChannel this_ptr_conv;
15522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15523 this_ptr_conv.is_owned = false;
15524 OpenChannel_set_channel_flags(&this_ptr_conv, val);
15527 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
15528 LDKOpenChannel orig_conv;
15529 orig_conv.inner = (void*)(orig & (~1));
15530 orig_conv.is_owned = false;
15531 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
15532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15534 uint64_t ret_ref = (uint64_t)ret_var.inner;
15535 if (ret_var.is_owned) {
15541 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
15542 LDKAcceptChannel this_obj_conv;
15543 this_obj_conv.inner = (void*)(this_obj & (~1));
15544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15545 AcceptChannel_free(this_obj_conv);
15548 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
15549 LDKAcceptChannel this_ptr_conv;
15550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15551 this_ptr_conv.is_owned = false;
15552 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15553 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
15557 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15558 LDKAcceptChannel this_ptr_conv;
15559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15560 this_ptr_conv.is_owned = false;
15561 LDKThirtyTwoBytes val_ref;
15562 CHECK(*((uint32_t*)val) == 32);
15563 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15564 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
15567 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
15568 LDKAcceptChannel this_ptr_conv;
15569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15570 this_ptr_conv.is_owned = false;
15571 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
15575 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
15576 LDKAcceptChannel this_ptr_conv;
15577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15578 this_ptr_conv.is_owned = false;
15579 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
15582 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
15583 LDKAcceptChannel this_ptr_conv;
15584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15585 this_ptr_conv.is_owned = false;
15586 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
15590 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
15591 LDKAcceptChannel this_ptr_conv;
15592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15593 this_ptr_conv.is_owned = false;
15594 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15597 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
15598 LDKAcceptChannel this_ptr_conv;
15599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15600 this_ptr_conv.is_owned = false;
15601 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
15605 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
15606 LDKAcceptChannel this_ptr_conv;
15607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15608 this_ptr_conv.is_owned = false;
15609 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
15612 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
15613 LDKAcceptChannel this_ptr_conv;
15614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15615 this_ptr_conv.is_owned = false;
15616 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
15620 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
15621 LDKAcceptChannel this_ptr_conv;
15622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15623 this_ptr_conv.is_owned = false;
15624 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
15627 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
15628 LDKAcceptChannel this_ptr_conv;
15629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15630 this_ptr_conv.is_owned = false;
15631 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
15635 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
15636 LDKAcceptChannel this_ptr_conv;
15637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15638 this_ptr_conv.is_owned = false;
15639 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
15642 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
15643 LDKAcceptChannel this_ptr_conv;
15644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15645 this_ptr_conv.is_owned = false;
15646 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
15650 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
15651 LDKAcceptChannel this_ptr_conv;
15652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15653 this_ptr_conv.is_owned = false;
15654 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
15657 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
15658 LDKAcceptChannel this_ptr_conv;
15659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15660 this_ptr_conv.is_owned = false;
15661 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
15665 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
15666 LDKAcceptChannel this_ptr_conv;
15667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15668 this_ptr_conv.is_owned = false;
15669 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
15672 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
15673 LDKAcceptChannel this_ptr_conv;
15674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15675 this_ptr_conv.is_owned = false;
15676 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15677 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15681 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15682 LDKAcceptChannel this_ptr_conv;
15683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15684 this_ptr_conv.is_owned = false;
15685 LDKPublicKey val_ref;
15686 CHECK(*((uint32_t*)val) == 33);
15687 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15688 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
15691 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
15692 LDKAcceptChannel this_ptr_conv;
15693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15694 this_ptr_conv.is_owned = false;
15695 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15696 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15700 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15701 LDKAcceptChannel this_ptr_conv;
15702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15703 this_ptr_conv.is_owned = false;
15704 LDKPublicKey val_ref;
15705 CHECK(*((uint32_t*)val) == 33);
15706 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15707 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
15710 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
15711 LDKAcceptChannel this_ptr_conv;
15712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15713 this_ptr_conv.is_owned = false;
15714 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15715 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
15719 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15720 LDKAcceptChannel this_ptr_conv;
15721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15722 this_ptr_conv.is_owned = false;
15723 LDKPublicKey val_ref;
15724 CHECK(*((uint32_t*)val) == 33);
15725 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15726 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
15729 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
15730 LDKAcceptChannel this_ptr_conv;
15731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15732 this_ptr_conv.is_owned = false;
15733 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15734 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15738 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15739 LDKAcceptChannel this_ptr_conv;
15740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15741 this_ptr_conv.is_owned = false;
15742 LDKPublicKey val_ref;
15743 CHECK(*((uint32_t*)val) == 33);
15744 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15745 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15748 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
15749 LDKAcceptChannel this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = false;
15752 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15753 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
15757 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
15758 LDKAcceptChannel this_ptr_conv;
15759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15760 this_ptr_conv.is_owned = false;
15761 LDKPublicKey val_ref;
15762 CHECK(*((uint32_t*)val) == 33);
15763 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15764 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
15767 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
15768 LDKAcceptChannel this_ptr_conv;
15769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15770 this_ptr_conv.is_owned = false;
15771 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15772 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15776 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15777 LDKAcceptChannel this_ptr_conv;
15778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15779 this_ptr_conv.is_owned = false;
15780 LDKPublicKey val_ref;
15781 CHECK(*((uint32_t*)val) == 33);
15782 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15783 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
15786 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
15787 LDKAcceptChannel orig_conv;
15788 orig_conv.inner = (void*)(orig & (~1));
15789 orig_conv.is_owned = false;
15790 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
15791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15793 uint64_t ret_ref = (uint64_t)ret_var.inner;
15794 if (ret_var.is_owned) {
15800 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
15801 LDKFundingCreated this_obj_conv;
15802 this_obj_conv.inner = (void*)(this_obj & (~1));
15803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15804 FundingCreated_free(this_obj_conv);
15807 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
15808 LDKFundingCreated this_ptr_conv;
15809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15810 this_ptr_conv.is_owned = false;
15811 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15812 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
15816 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
15817 LDKFundingCreated this_ptr_conv;
15818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15819 this_ptr_conv.is_owned = false;
15820 LDKThirtyTwoBytes val_ref;
15821 CHECK(*((uint32_t*)val) == 32);
15822 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15823 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
15826 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
15827 LDKFundingCreated this_ptr_conv;
15828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15829 this_ptr_conv.is_owned = false;
15830 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15831 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
15835 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
15836 LDKFundingCreated this_ptr_conv;
15837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15838 this_ptr_conv.is_owned = false;
15839 LDKThirtyTwoBytes val_ref;
15840 CHECK(*((uint32_t*)val) == 32);
15841 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15842 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
15845 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
15846 LDKFundingCreated this_ptr_conv;
15847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15848 this_ptr_conv.is_owned = false;
15849 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
15853 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
15854 LDKFundingCreated this_ptr_conv;
15855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15856 this_ptr_conv.is_owned = false;
15857 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
15860 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
15861 LDKFundingCreated this_ptr_conv;
15862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15863 this_ptr_conv.is_owned = false;
15864 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15865 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
15869 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
15870 LDKFundingCreated this_ptr_conv;
15871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15872 this_ptr_conv.is_owned = false;
15873 LDKSignature val_ref;
15874 CHECK(*((uint32_t*)val) == 64);
15875 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15876 FundingCreated_set_signature(&this_ptr_conv, val_ref);
15879 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) {
15880 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
15881 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
15882 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
15883 LDKThirtyTwoBytes funding_txid_arg_ref;
15884 CHECK(*((uint32_t*)funding_txid_arg) == 32);
15885 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
15886 LDKSignature signature_arg_ref;
15887 CHECK(*((uint32_t*)signature_arg) == 64);
15888 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15889 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
15890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15892 uint64_t ret_ref = (uint64_t)ret_var.inner;
15893 if (ret_var.is_owned) {
15899 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
15900 LDKFundingCreated orig_conv;
15901 orig_conv.inner = (void*)(orig & (~1));
15902 orig_conv.is_owned = false;
15903 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
15904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15906 uint64_t ret_ref = (uint64_t)ret_var.inner;
15907 if (ret_var.is_owned) {
15913 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
15914 LDKFundingSigned this_obj_conv;
15915 this_obj_conv.inner = (void*)(this_obj & (~1));
15916 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15917 FundingSigned_free(this_obj_conv);
15920 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
15921 LDKFundingSigned this_ptr_conv;
15922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15923 this_ptr_conv.is_owned = false;
15924 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15925 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
15929 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15930 LDKFundingSigned this_ptr_conv;
15931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15932 this_ptr_conv.is_owned = false;
15933 LDKThirtyTwoBytes val_ref;
15934 CHECK(*((uint32_t*)val) == 32);
15935 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15936 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
15939 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
15940 LDKFundingSigned this_ptr_conv;
15941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15942 this_ptr_conv.is_owned = false;
15943 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
15944 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
15948 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
15949 LDKFundingSigned this_ptr_conv;
15950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15951 this_ptr_conv.is_owned = false;
15952 LDKSignature val_ref;
15953 CHECK(*((uint32_t*)val) == 64);
15954 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
15955 FundingSigned_set_signature(&this_ptr_conv, val_ref);
15958 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
15959 LDKThirtyTwoBytes channel_id_arg_ref;
15960 CHECK(*((uint32_t*)channel_id_arg) == 32);
15961 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15962 LDKSignature signature_arg_ref;
15963 CHECK(*((uint32_t*)signature_arg) == 64);
15964 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
15965 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
15966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15968 uint64_t ret_ref = (uint64_t)ret_var.inner;
15969 if (ret_var.is_owned) {
15975 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
15976 LDKFundingSigned orig_conv;
15977 orig_conv.inner = (void*)(orig & (~1));
15978 orig_conv.is_owned = false;
15979 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
15980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15982 uint64_t ret_ref = (uint64_t)ret_var.inner;
15983 if (ret_var.is_owned) {
15989 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
15990 LDKFundingLocked this_obj_conv;
15991 this_obj_conv.inner = (void*)(this_obj & (~1));
15992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15993 FundingLocked_free(this_obj_conv);
15996 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
15997 LDKFundingLocked this_ptr_conv;
15998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15999 this_ptr_conv.is_owned = false;
16000 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16001 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
16005 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16006 LDKFundingLocked this_ptr_conv;
16007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16008 this_ptr_conv.is_owned = false;
16009 LDKThirtyTwoBytes val_ref;
16010 CHECK(*((uint32_t*)val) == 32);
16011 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16012 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
16015 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
16016 LDKFundingLocked this_ptr_conv;
16017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16018 this_ptr_conv.is_owned = false;
16019 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16020 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16024 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16025 LDKFundingLocked this_ptr_conv;
16026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16027 this_ptr_conv.is_owned = false;
16028 LDKPublicKey val_ref;
16029 CHECK(*((uint32_t*)val) == 33);
16030 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16031 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
16034 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
16035 LDKThirtyTwoBytes channel_id_arg_ref;
16036 CHECK(*((uint32_t*)channel_id_arg) == 32);
16037 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16038 LDKPublicKey next_per_commitment_point_arg_ref;
16039 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
16040 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
16041 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
16042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16044 uint64_t ret_ref = (uint64_t)ret_var.inner;
16045 if (ret_var.is_owned) {
16051 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
16052 LDKFundingLocked orig_conv;
16053 orig_conv.inner = (void*)(orig & (~1));
16054 orig_conv.is_owned = false;
16055 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
16056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16058 uint64_t ret_ref = (uint64_t)ret_var.inner;
16059 if (ret_var.is_owned) {
16065 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
16066 LDKShutdown this_obj_conv;
16067 this_obj_conv.inner = (void*)(this_obj & (~1));
16068 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16069 Shutdown_free(this_obj_conv);
16072 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
16073 LDKShutdown this_ptr_conv;
16074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16075 this_ptr_conv.is_owned = false;
16076 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16077 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
16081 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16082 LDKShutdown this_ptr_conv;
16083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16084 this_ptr_conv.is_owned = false;
16085 LDKThirtyTwoBytes val_ref;
16086 CHECK(*((uint32_t*)val) == 32);
16087 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16088 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
16091 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
16092 LDKShutdown this_ptr_conv;
16093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16094 this_ptr_conv.is_owned = false;
16095 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
16096 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16097 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16101 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
16102 LDKShutdown this_ptr_conv;
16103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16104 this_ptr_conv.is_owned = false;
16105 LDKCVec_u8Z val_ref;
16106 val_ref.datalen = *((uint32_t*)val);
16107 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16108 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
16109 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
16112 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
16113 LDKThirtyTwoBytes channel_id_arg_ref;
16114 CHECK(*((uint32_t*)channel_id_arg) == 32);
16115 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16116 LDKCVec_u8Z scriptpubkey_arg_ref;
16117 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
16118 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16119 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
16120 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
16121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16123 uint64_t ret_ref = (uint64_t)ret_var.inner;
16124 if (ret_var.is_owned) {
16130 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
16131 LDKShutdown orig_conv;
16132 orig_conv.inner = (void*)(orig & (~1));
16133 orig_conv.is_owned = false;
16134 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
16135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16137 uint64_t ret_ref = (uint64_t)ret_var.inner;
16138 if (ret_var.is_owned) {
16144 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
16145 LDKClosingSignedFeeRange this_obj_conv;
16146 this_obj_conv.inner = (void*)(this_obj & (~1));
16147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16148 ClosingSignedFeeRange_free(this_obj_conv);
16151 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
16152 LDKClosingSignedFeeRange this_ptr_conv;
16153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16154 this_ptr_conv.is_owned = false;
16155 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
16159 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
16160 LDKClosingSignedFeeRange this_ptr_conv;
16161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16162 this_ptr_conv.is_owned = false;
16163 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
16166 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
16167 LDKClosingSignedFeeRange this_ptr_conv;
16168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16169 this_ptr_conv.is_owned = false;
16170 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
16174 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
16175 LDKClosingSignedFeeRange this_ptr_conv;
16176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16177 this_ptr_conv.is_owned = false;
16178 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
16181 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
16182 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
16183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16185 uint64_t ret_ref = (uint64_t)ret_var.inner;
16186 if (ret_var.is_owned) {
16192 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
16193 LDKClosingSignedFeeRange orig_conv;
16194 orig_conv.inner = (void*)(orig & (~1));
16195 orig_conv.is_owned = false;
16196 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
16197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16199 uint64_t ret_ref = (uint64_t)ret_var.inner;
16200 if (ret_var.is_owned) {
16206 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
16207 LDKClosingSigned this_obj_conv;
16208 this_obj_conv.inner = (void*)(this_obj & (~1));
16209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16210 ClosingSigned_free(this_obj_conv);
16213 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
16214 LDKClosingSigned this_ptr_conv;
16215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16216 this_ptr_conv.is_owned = false;
16217 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16218 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
16222 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16223 LDKClosingSigned this_ptr_conv;
16224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16225 this_ptr_conv.is_owned = false;
16226 LDKThirtyTwoBytes val_ref;
16227 CHECK(*((uint32_t*)val) == 32);
16228 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16229 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
16232 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
16233 LDKClosingSigned this_ptr_conv;
16234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16235 this_ptr_conv.is_owned = false;
16236 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
16240 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
16241 LDKClosingSigned this_ptr_conv;
16242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16243 this_ptr_conv.is_owned = false;
16244 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
16247 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
16248 LDKClosingSigned this_ptr_conv;
16249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16250 this_ptr_conv.is_owned = false;
16251 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16252 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
16256 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
16257 LDKClosingSigned this_ptr_conv;
16258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16259 this_ptr_conv.is_owned = false;
16260 LDKSignature val_ref;
16261 CHECK(*((uint32_t*)val) == 64);
16262 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16263 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
16266 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
16267 LDKClosingSigned this_ptr_conv;
16268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16269 this_ptr_conv.is_owned = false;
16270 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
16271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16273 uint64_t ret_ref = (uint64_t)ret_var.inner;
16274 if (ret_var.is_owned) {
16280 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
16281 LDKClosingSigned this_ptr_conv;
16282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16283 this_ptr_conv.is_owned = false;
16284 LDKClosingSignedFeeRange val_conv;
16285 val_conv.inner = (void*)(val & (~1));
16286 val_conv.is_owned = (val & 1) || (val == 0);
16287 val_conv = ClosingSignedFeeRange_clone(&val_conv);
16288 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
16291 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
16292 LDKThirtyTwoBytes channel_id_arg_ref;
16293 CHECK(*((uint32_t*)channel_id_arg) == 32);
16294 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16295 LDKSignature signature_arg_ref;
16296 CHECK(*((uint32_t*)signature_arg) == 64);
16297 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16298 LDKClosingSignedFeeRange fee_range_arg_conv;
16299 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
16300 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
16301 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
16302 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
16303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16305 uint64_t ret_ref = (uint64_t)ret_var.inner;
16306 if (ret_var.is_owned) {
16312 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
16313 LDKClosingSigned orig_conv;
16314 orig_conv.inner = (void*)(orig & (~1));
16315 orig_conv.is_owned = false;
16316 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
16317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16319 uint64_t ret_ref = (uint64_t)ret_var.inner;
16320 if (ret_var.is_owned) {
16326 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
16327 LDKUpdateAddHTLC this_obj_conv;
16328 this_obj_conv.inner = (void*)(this_obj & (~1));
16329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16330 UpdateAddHTLC_free(this_obj_conv);
16333 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
16334 LDKUpdateAddHTLC this_ptr_conv;
16335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16336 this_ptr_conv.is_owned = false;
16337 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16338 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
16342 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16343 LDKUpdateAddHTLC this_ptr_conv;
16344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16345 this_ptr_conv.is_owned = false;
16346 LDKThirtyTwoBytes val_ref;
16347 CHECK(*((uint32_t*)val) == 32);
16348 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16349 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
16352 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
16353 LDKUpdateAddHTLC this_ptr_conv;
16354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16355 this_ptr_conv.is_owned = false;
16356 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
16360 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16361 LDKUpdateAddHTLC this_ptr_conv;
16362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16363 this_ptr_conv.is_owned = false;
16364 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
16367 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
16368 LDKUpdateAddHTLC this_ptr_conv;
16369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16370 this_ptr_conv.is_owned = false;
16371 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
16375 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
16376 LDKUpdateAddHTLC this_ptr_conv;
16377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16378 this_ptr_conv.is_owned = false;
16379 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
16382 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
16383 LDKUpdateAddHTLC this_ptr_conv;
16384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16385 this_ptr_conv.is_owned = false;
16386 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16387 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
16391 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
16392 LDKUpdateAddHTLC this_ptr_conv;
16393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16394 this_ptr_conv.is_owned = false;
16395 LDKThirtyTwoBytes val_ref;
16396 CHECK(*((uint32_t*)val) == 32);
16397 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16398 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
16401 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
16402 LDKUpdateAddHTLC this_ptr_conv;
16403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16404 this_ptr_conv.is_owned = false;
16405 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
16409 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
16410 LDKUpdateAddHTLC this_ptr_conv;
16411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16412 this_ptr_conv.is_owned = false;
16413 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
16416 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
16417 LDKUpdateAddHTLC orig_conv;
16418 orig_conv.inner = (void*)(orig & (~1));
16419 orig_conv.is_owned = false;
16420 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
16421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16423 uint64_t ret_ref = (uint64_t)ret_var.inner;
16424 if (ret_var.is_owned) {
16430 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
16431 LDKUpdateFulfillHTLC this_obj_conv;
16432 this_obj_conv.inner = (void*)(this_obj & (~1));
16433 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16434 UpdateFulfillHTLC_free(this_obj_conv);
16437 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
16438 LDKUpdateFulfillHTLC this_ptr_conv;
16439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16440 this_ptr_conv.is_owned = false;
16441 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16442 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
16446 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16447 LDKUpdateFulfillHTLC this_ptr_conv;
16448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16449 this_ptr_conv.is_owned = false;
16450 LDKThirtyTwoBytes val_ref;
16451 CHECK(*((uint32_t*)val) == 32);
16452 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16453 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
16456 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
16457 LDKUpdateFulfillHTLC this_ptr_conv;
16458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16459 this_ptr_conv.is_owned = false;
16460 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
16464 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16465 LDKUpdateFulfillHTLC this_ptr_conv;
16466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16467 this_ptr_conv.is_owned = false;
16468 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
16471 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
16472 LDKUpdateFulfillHTLC this_ptr_conv;
16473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16474 this_ptr_conv.is_owned = false;
16475 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16476 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
16480 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
16481 LDKUpdateFulfillHTLC this_ptr_conv;
16482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16483 this_ptr_conv.is_owned = false;
16484 LDKThirtyTwoBytes val_ref;
16485 CHECK(*((uint32_t*)val) == 32);
16486 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16487 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
16490 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
16491 LDKThirtyTwoBytes channel_id_arg_ref;
16492 CHECK(*((uint32_t*)channel_id_arg) == 32);
16493 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16494 LDKThirtyTwoBytes payment_preimage_arg_ref;
16495 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
16496 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
16497 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
16498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16500 uint64_t ret_ref = (uint64_t)ret_var.inner;
16501 if (ret_var.is_owned) {
16507 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
16508 LDKUpdateFulfillHTLC orig_conv;
16509 orig_conv.inner = (void*)(orig & (~1));
16510 orig_conv.is_owned = false;
16511 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
16512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16514 uint64_t ret_ref = (uint64_t)ret_var.inner;
16515 if (ret_var.is_owned) {
16521 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
16522 LDKUpdateFailHTLC this_obj_conv;
16523 this_obj_conv.inner = (void*)(this_obj & (~1));
16524 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16525 UpdateFailHTLC_free(this_obj_conv);
16528 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
16529 LDKUpdateFailHTLC this_ptr_conv;
16530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16531 this_ptr_conv.is_owned = false;
16532 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16533 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
16537 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16538 LDKUpdateFailHTLC this_ptr_conv;
16539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16540 this_ptr_conv.is_owned = false;
16541 LDKThirtyTwoBytes val_ref;
16542 CHECK(*((uint32_t*)val) == 32);
16543 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16544 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
16547 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
16548 LDKUpdateFailHTLC this_ptr_conv;
16549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16550 this_ptr_conv.is_owned = false;
16551 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
16555 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16556 LDKUpdateFailHTLC this_ptr_conv;
16557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16558 this_ptr_conv.is_owned = false;
16559 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
16562 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
16563 LDKUpdateFailHTLC orig_conv;
16564 orig_conv.inner = (void*)(orig & (~1));
16565 orig_conv.is_owned = false;
16566 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
16567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16569 uint64_t ret_ref = (uint64_t)ret_var.inner;
16570 if (ret_var.is_owned) {
16576 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
16577 LDKUpdateFailMalformedHTLC this_obj_conv;
16578 this_obj_conv.inner = (void*)(this_obj & (~1));
16579 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16580 UpdateFailMalformedHTLC_free(this_obj_conv);
16583 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
16584 LDKUpdateFailMalformedHTLC this_ptr_conv;
16585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16586 this_ptr_conv.is_owned = false;
16587 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16588 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
16592 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16593 LDKUpdateFailMalformedHTLC this_ptr_conv;
16594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16595 this_ptr_conv.is_owned = false;
16596 LDKThirtyTwoBytes val_ref;
16597 CHECK(*((uint32_t*)val) == 32);
16598 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16599 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
16602 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
16603 LDKUpdateFailMalformedHTLC this_ptr_conv;
16604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16605 this_ptr_conv.is_owned = false;
16606 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
16610 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
16611 LDKUpdateFailMalformedHTLC this_ptr_conv;
16612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16613 this_ptr_conv.is_owned = false;
16614 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
16617 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
16618 LDKUpdateFailMalformedHTLC this_ptr_conv;
16619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16620 this_ptr_conv.is_owned = false;
16621 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
16625 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
16626 LDKUpdateFailMalformedHTLC this_ptr_conv;
16627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16628 this_ptr_conv.is_owned = false;
16629 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
16632 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
16633 LDKUpdateFailMalformedHTLC orig_conv;
16634 orig_conv.inner = (void*)(orig & (~1));
16635 orig_conv.is_owned = false;
16636 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
16637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16639 uint64_t ret_ref = (uint64_t)ret_var.inner;
16640 if (ret_var.is_owned) {
16646 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
16647 LDKCommitmentSigned this_obj_conv;
16648 this_obj_conv.inner = (void*)(this_obj & (~1));
16649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16650 CommitmentSigned_free(this_obj_conv);
16653 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
16654 LDKCommitmentSigned this_ptr_conv;
16655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16656 this_ptr_conv.is_owned = false;
16657 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16658 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
16662 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16663 LDKCommitmentSigned this_ptr_conv;
16664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16665 this_ptr_conv.is_owned = false;
16666 LDKThirtyTwoBytes val_ref;
16667 CHECK(*((uint32_t*)val) == 32);
16668 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16669 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
16672 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
16673 LDKCommitmentSigned this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16677 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
16681 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
16682 LDKCommitmentSigned this_ptr_conv;
16683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16684 this_ptr_conv.is_owned = false;
16685 LDKSignature val_ref;
16686 CHECK(*((uint32_t*)val) == 64);
16687 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16688 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
16691 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
16692 LDKCommitmentSigned this_ptr_conv;
16693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16694 this_ptr_conv.is_owned = false;
16695 LDKCVec_SignatureZ val_constr;
16696 val_constr.datalen = *((uint32_t*)val);
16697 if (val_constr.datalen > 0)
16698 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16700 val_constr.data = NULL;
16701 int8_tArray* val_vals = (int8_tArray*)(val + 4);
16702 for (size_t m = 0; m < val_constr.datalen; m++) {
16703 int8_tArray val_conv_12 = val_vals[m];
16704 LDKSignature val_conv_12_ref;
16705 CHECK(*((uint32_t*)val_conv_12) == 64);
16706 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
16707 val_constr.data[m] = val_conv_12_ref;
16709 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
16712 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
16713 LDKThirtyTwoBytes channel_id_arg_ref;
16714 CHECK(*((uint32_t*)channel_id_arg) == 32);
16715 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16716 LDKSignature signature_arg_ref;
16717 CHECK(*((uint32_t*)signature_arg) == 64);
16718 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16719 LDKCVec_SignatureZ htlc_signatures_arg_constr;
16720 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
16721 if (htlc_signatures_arg_constr.datalen > 0)
16722 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16724 htlc_signatures_arg_constr.data = NULL;
16725 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
16726 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
16727 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
16728 LDKSignature htlc_signatures_arg_conv_12_ref;
16729 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
16730 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
16731 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
16733 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
16734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16736 uint64_t ret_ref = (uint64_t)ret_var.inner;
16737 if (ret_var.is_owned) {
16743 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
16744 LDKCommitmentSigned orig_conv;
16745 orig_conv.inner = (void*)(orig & (~1));
16746 orig_conv.is_owned = false;
16747 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
16748 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16749 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16750 uint64_t ret_ref = (uint64_t)ret_var.inner;
16751 if (ret_var.is_owned) {
16757 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
16758 LDKRevokeAndACK this_obj_conv;
16759 this_obj_conv.inner = (void*)(this_obj & (~1));
16760 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16761 RevokeAndACK_free(this_obj_conv);
16764 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
16765 LDKRevokeAndACK this_ptr_conv;
16766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16767 this_ptr_conv.is_owned = false;
16768 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16769 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
16773 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16774 LDKRevokeAndACK this_ptr_conv;
16775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16776 this_ptr_conv.is_owned = false;
16777 LDKThirtyTwoBytes val_ref;
16778 CHECK(*((uint32_t*)val) == 32);
16779 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16780 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
16783 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
16784 LDKRevokeAndACK this_ptr_conv;
16785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16786 this_ptr_conv.is_owned = false;
16787 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16788 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
16792 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16793 LDKRevokeAndACK this_ptr_conv;
16794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16795 this_ptr_conv.is_owned = false;
16796 LDKThirtyTwoBytes val_ref;
16797 CHECK(*((uint32_t*)val) == 32);
16798 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16799 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
16802 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
16803 LDKRevokeAndACK this_ptr_conv;
16804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16805 this_ptr_conv.is_owned = false;
16806 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16807 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16811 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16812 LDKRevokeAndACK this_ptr_conv;
16813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16814 this_ptr_conv.is_owned = false;
16815 LDKPublicKey val_ref;
16816 CHECK(*((uint32_t*)val) == 33);
16817 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16818 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
16821 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) {
16822 LDKThirtyTwoBytes channel_id_arg_ref;
16823 CHECK(*((uint32_t*)channel_id_arg) == 32);
16824 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16825 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
16826 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
16827 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
16828 LDKPublicKey next_per_commitment_point_arg_ref;
16829 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
16830 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
16831 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
16832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16834 uint64_t ret_ref = (uint64_t)ret_var.inner;
16835 if (ret_var.is_owned) {
16841 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
16842 LDKRevokeAndACK orig_conv;
16843 orig_conv.inner = (void*)(orig & (~1));
16844 orig_conv.is_owned = false;
16845 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
16846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16848 uint64_t ret_ref = (uint64_t)ret_var.inner;
16849 if (ret_var.is_owned) {
16855 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
16856 LDKUpdateFee this_obj_conv;
16857 this_obj_conv.inner = (void*)(this_obj & (~1));
16858 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16859 UpdateFee_free(this_obj_conv);
16862 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
16863 LDKUpdateFee this_ptr_conv;
16864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16865 this_ptr_conv.is_owned = false;
16866 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16867 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
16871 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16872 LDKUpdateFee this_ptr_conv;
16873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16874 this_ptr_conv.is_owned = false;
16875 LDKThirtyTwoBytes val_ref;
16876 CHECK(*((uint32_t*)val) == 32);
16877 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16878 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
16881 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
16882 LDKUpdateFee this_ptr_conv;
16883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16884 this_ptr_conv.is_owned = false;
16885 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
16889 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16890 LDKUpdateFee this_ptr_conv;
16891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16892 this_ptr_conv.is_owned = false;
16893 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
16896 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
16897 LDKThirtyTwoBytes channel_id_arg_ref;
16898 CHECK(*((uint32_t*)channel_id_arg) == 32);
16899 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16900 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
16901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16903 uint64_t ret_ref = (uint64_t)ret_var.inner;
16904 if (ret_var.is_owned) {
16910 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
16911 LDKUpdateFee orig_conv;
16912 orig_conv.inner = (void*)(orig & (~1));
16913 orig_conv.is_owned = false;
16914 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
16915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16917 uint64_t ret_ref = (uint64_t)ret_var.inner;
16918 if (ret_var.is_owned) {
16924 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
16925 LDKDataLossProtect this_obj_conv;
16926 this_obj_conv.inner = (void*)(this_obj & (~1));
16927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16928 DataLossProtect_free(this_obj_conv);
16931 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
16932 LDKDataLossProtect this_ptr_conv;
16933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16934 this_ptr_conv.is_owned = false;
16935 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16936 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
16940 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
16941 LDKDataLossProtect this_ptr_conv;
16942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16943 this_ptr_conv.is_owned = false;
16944 LDKThirtyTwoBytes val_ref;
16945 CHECK(*((uint32_t*)val) == 32);
16946 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16947 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
16950 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
16951 LDKDataLossProtect this_ptr_conv;
16952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16953 this_ptr_conv.is_owned = false;
16954 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16955 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16959 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16960 LDKDataLossProtect this_ptr_conv;
16961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16962 this_ptr_conv.is_owned = false;
16963 LDKPublicKey val_ref;
16964 CHECK(*((uint32_t*)val) == 33);
16965 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16966 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
16969 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
16970 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
16971 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
16972 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
16973 LDKPublicKey my_current_per_commitment_point_arg_ref;
16974 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
16975 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
16976 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
16977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16979 uint64_t ret_ref = (uint64_t)ret_var.inner;
16980 if (ret_var.is_owned) {
16986 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
16987 LDKDataLossProtect orig_conv;
16988 orig_conv.inner = (void*)(orig & (~1));
16989 orig_conv.is_owned = false;
16990 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
16991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16993 uint64_t ret_ref = (uint64_t)ret_var.inner;
16994 if (ret_var.is_owned) {
17000 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
17001 LDKChannelReestablish this_obj_conv;
17002 this_obj_conv.inner = (void*)(this_obj & (~1));
17003 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17004 ChannelReestablish_free(this_obj_conv);
17007 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
17008 LDKChannelReestablish this_ptr_conv;
17009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17010 this_ptr_conv.is_owned = false;
17011 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17012 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
17016 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17017 LDKChannelReestablish this_ptr_conv;
17018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17019 this_ptr_conv.is_owned = false;
17020 LDKThirtyTwoBytes val_ref;
17021 CHECK(*((uint32_t*)val) == 32);
17022 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17023 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
17026 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
17027 LDKChannelReestablish this_ptr_conv;
17028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17029 this_ptr_conv.is_owned = false;
17030 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
17034 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
17035 LDKChannelReestablish this_ptr_conv;
17036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17037 this_ptr_conv.is_owned = false;
17038 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
17041 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
17042 LDKChannelReestablish this_ptr_conv;
17043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17044 this_ptr_conv.is_owned = false;
17045 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
17049 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
17050 LDKChannelReestablish this_ptr_conv;
17051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17052 this_ptr_conv.is_owned = false;
17053 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
17056 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
17057 LDKChannelReestablish orig_conv;
17058 orig_conv.inner = (void*)(orig & (~1));
17059 orig_conv.is_owned = false;
17060 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
17061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17063 uint64_t ret_ref = (uint64_t)ret_var.inner;
17064 if (ret_var.is_owned) {
17070 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
17071 LDKAnnouncementSignatures this_obj_conv;
17072 this_obj_conv.inner = (void*)(this_obj & (~1));
17073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17074 AnnouncementSignatures_free(this_obj_conv);
17077 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
17078 LDKAnnouncementSignatures this_ptr_conv;
17079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17080 this_ptr_conv.is_owned = false;
17081 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17082 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
17086 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17087 LDKAnnouncementSignatures this_ptr_conv;
17088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17089 this_ptr_conv.is_owned = false;
17090 LDKThirtyTwoBytes val_ref;
17091 CHECK(*((uint32_t*)val) == 32);
17092 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17093 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
17096 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
17097 LDKAnnouncementSignatures this_ptr_conv;
17098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17099 this_ptr_conv.is_owned = false;
17100 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
17104 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17105 LDKAnnouncementSignatures this_ptr_conv;
17106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17107 this_ptr_conv.is_owned = false;
17108 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
17111 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
17112 LDKAnnouncementSignatures this_ptr_conv;
17113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17114 this_ptr_conv.is_owned = false;
17115 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17116 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
17120 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
17121 LDKAnnouncementSignatures this_ptr_conv;
17122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17123 this_ptr_conv.is_owned = false;
17124 LDKSignature val_ref;
17125 CHECK(*((uint32_t*)val) == 64);
17126 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17127 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
17130 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
17131 LDKAnnouncementSignatures this_ptr_conv;
17132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17133 this_ptr_conv.is_owned = false;
17134 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17135 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
17139 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
17140 LDKAnnouncementSignatures this_ptr_conv;
17141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17142 this_ptr_conv.is_owned = false;
17143 LDKSignature val_ref;
17144 CHECK(*((uint32_t*)val) == 64);
17145 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17146 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
17149 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) {
17150 LDKThirtyTwoBytes channel_id_arg_ref;
17151 CHECK(*((uint32_t*)channel_id_arg) == 32);
17152 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17153 LDKSignature node_signature_arg_ref;
17154 CHECK(*((uint32_t*)node_signature_arg) == 64);
17155 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
17156 LDKSignature bitcoin_signature_arg_ref;
17157 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
17158 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
17159 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
17160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17162 uint64_t ret_ref = (uint64_t)ret_var.inner;
17163 if (ret_var.is_owned) {
17169 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
17170 LDKAnnouncementSignatures orig_conv;
17171 orig_conv.inner = (void*)(orig & (~1));
17172 orig_conv.is_owned = false;
17173 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
17174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17176 uint64_t ret_ref = (uint64_t)ret_var.inner;
17177 if (ret_var.is_owned) {
17183 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
17184 if ((this_ptr & 1) != 0) return;
17185 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
17186 FREE((void*)this_ptr);
17187 NetAddress_free(this_ptr_conv);
17190 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
17191 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
17192 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
17193 *ret_copy = NetAddress_clone(orig_conv);
17194 uint64_t ret_ref = (uint64_t)ret_copy;
17198 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
17199 LDKFourBytes addr_ref;
17200 CHECK(*((uint32_t*)addr) == 4);
17201 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
17202 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
17203 *ret_copy = NetAddress_ipv4(addr_ref, port);
17204 uint64_t ret_ref = (uint64_t)ret_copy;
17208 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
17209 LDKSixteenBytes addr_ref;
17210 CHECK(*((uint32_t*)addr) == 16);
17211 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
17212 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
17213 *ret_copy = NetAddress_ipv6(addr_ref, port);
17214 uint64_t ret_ref = (uint64_t)ret_copy;
17218 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
17219 LDKTenBytes addr_ref;
17220 CHECK(*((uint32_t*)addr) == 10);
17221 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
17222 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
17223 *ret_copy = NetAddress_onion_v2(addr_ref, port);
17224 uint64_t ret_ref = (uint64_t)ret_copy;
17228 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
17229 LDKThirtyTwoBytes ed25519_pubkey_ref;
17230 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
17231 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
17232 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
17233 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
17234 uint64_t ret_ref = (uint64_t)ret_copy;
17238 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
17239 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
17240 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
17241 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17242 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17243 CVec_u8Z_free(ret_var);
17247 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
17248 LDKu8slice ser_ref;
17249 ser_ref.datalen = *((uint32_t*)ser);
17250 ser_ref.data = (int8_t*)(ser + 4);
17251 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
17252 *ret_conv = Result_read(ser_ref);
17253 return (uint64_t)ret_conv;
17256 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
17257 LDKu8slice ser_ref;
17258 ser_ref.datalen = *((uint32_t*)ser);
17259 ser_ref.data = (int8_t*)(ser + 4);
17260 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17261 *ret_conv = NetAddress_read(ser_ref);
17262 return (uint64_t)ret_conv;
17265 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
17266 LDKUnsignedNodeAnnouncement this_obj_conv;
17267 this_obj_conv.inner = (void*)(this_obj & (~1));
17268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17269 UnsignedNodeAnnouncement_free(this_obj_conv);
17272 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
17273 LDKUnsignedNodeAnnouncement this_ptr_conv;
17274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17275 this_ptr_conv.is_owned = false;
17276 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
17277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17279 uint64_t ret_ref = (uint64_t)ret_var.inner;
17280 if (ret_var.is_owned) {
17286 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
17287 LDKUnsignedNodeAnnouncement this_ptr_conv;
17288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17289 this_ptr_conv.is_owned = false;
17290 LDKNodeFeatures val_conv;
17291 val_conv.inner = (void*)(val & (~1));
17292 val_conv.is_owned = (val & 1) || (val == 0);
17293 val_conv = NodeFeatures_clone(&val_conv);
17294 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
17297 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
17298 LDKUnsignedNodeAnnouncement this_ptr_conv;
17299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17300 this_ptr_conv.is_owned = false;
17301 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
17305 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
17306 LDKUnsignedNodeAnnouncement this_ptr_conv;
17307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17308 this_ptr_conv.is_owned = false;
17309 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
17312 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
17313 LDKUnsignedNodeAnnouncement this_ptr_conv;
17314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17315 this_ptr_conv.is_owned = false;
17316 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17317 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
17321 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
17322 LDKUnsignedNodeAnnouncement this_ptr_conv;
17323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17324 this_ptr_conv.is_owned = false;
17325 LDKPublicKey val_ref;
17326 CHECK(*((uint32_t*)val) == 33);
17327 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17328 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
17331 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
17332 LDKUnsignedNodeAnnouncement this_ptr_conv;
17333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17334 this_ptr_conv.is_owned = false;
17335 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
17336 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
17340 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
17341 LDKUnsignedNodeAnnouncement this_ptr_conv;
17342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17343 this_ptr_conv.is_owned = false;
17344 LDKThreeBytes val_ref;
17345 CHECK(*((uint32_t*)val) == 3);
17346 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
17347 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
17350 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
17351 LDKUnsignedNodeAnnouncement this_ptr_conv;
17352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17353 this_ptr_conv.is_owned = false;
17354 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17355 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
17359 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
17360 LDKUnsignedNodeAnnouncement this_ptr_conv;
17361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17362 this_ptr_conv.is_owned = false;
17363 LDKThirtyTwoBytes val_ref;
17364 CHECK(*((uint32_t*)val) == 32);
17365 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17366 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
17369 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
17370 LDKUnsignedNodeAnnouncement this_ptr_conv;
17371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17372 this_ptr_conv.is_owned = false;
17373 LDKCVec_NetAddressZ val_constr;
17374 val_constr.datalen = *((uint32_t*)val);
17375 if (val_constr.datalen > 0)
17376 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17378 val_constr.data = NULL;
17379 uint32_t* val_vals = (uint32_t*)(val + 4);
17380 for (size_t m = 0; m < val_constr.datalen; m++) {
17381 uint32_t val_conv_12 = val_vals[m];
17382 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
17383 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
17384 val_constr.data[m] = val_conv_12_conv;
17386 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
17389 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
17390 LDKUnsignedNodeAnnouncement orig_conv;
17391 orig_conv.inner = (void*)(orig & (~1));
17392 orig_conv.is_owned = false;
17393 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
17394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17396 uint64_t ret_ref = (uint64_t)ret_var.inner;
17397 if (ret_var.is_owned) {
17403 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
17404 LDKNodeAnnouncement this_obj_conv;
17405 this_obj_conv.inner = (void*)(this_obj & (~1));
17406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17407 NodeAnnouncement_free(this_obj_conv);
17410 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
17411 LDKNodeAnnouncement this_ptr_conv;
17412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17413 this_ptr_conv.is_owned = false;
17414 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17415 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
17419 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
17420 LDKNodeAnnouncement this_ptr_conv;
17421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17422 this_ptr_conv.is_owned = false;
17423 LDKSignature val_ref;
17424 CHECK(*((uint32_t*)val) == 64);
17425 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17426 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
17429 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
17430 LDKNodeAnnouncement this_ptr_conv;
17431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17432 this_ptr_conv.is_owned = false;
17433 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
17434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17436 uint64_t ret_ref = (uint64_t)ret_var.inner;
17437 if (ret_var.is_owned) {
17443 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17444 LDKNodeAnnouncement this_ptr_conv;
17445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17446 this_ptr_conv.is_owned = false;
17447 LDKUnsignedNodeAnnouncement val_conv;
17448 val_conv.inner = (void*)(val & (~1));
17449 val_conv.is_owned = (val & 1) || (val == 0);
17450 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
17451 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
17454 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
17455 LDKSignature signature_arg_ref;
17456 CHECK(*((uint32_t*)signature_arg) == 64);
17457 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17458 LDKUnsignedNodeAnnouncement contents_arg_conv;
17459 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17460 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17461 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
17462 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
17463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17465 uint64_t ret_ref = (uint64_t)ret_var.inner;
17466 if (ret_var.is_owned) {
17472 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
17473 LDKNodeAnnouncement orig_conv;
17474 orig_conv.inner = (void*)(orig & (~1));
17475 orig_conv.is_owned = false;
17476 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
17477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17479 uint64_t ret_ref = (uint64_t)ret_var.inner;
17480 if (ret_var.is_owned) {
17486 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
17487 LDKUnsignedChannelAnnouncement this_obj_conv;
17488 this_obj_conv.inner = (void*)(this_obj & (~1));
17489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17490 UnsignedChannelAnnouncement_free(this_obj_conv);
17493 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
17494 LDKUnsignedChannelAnnouncement this_ptr_conv;
17495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17496 this_ptr_conv.is_owned = false;
17497 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
17498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17500 uint64_t ret_ref = (uint64_t)ret_var.inner;
17501 if (ret_var.is_owned) {
17507 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
17508 LDKUnsignedChannelAnnouncement this_ptr_conv;
17509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17510 this_ptr_conv.is_owned = false;
17511 LDKChannelFeatures val_conv;
17512 val_conv.inner = (void*)(val & (~1));
17513 val_conv.is_owned = (val & 1) || (val == 0);
17514 val_conv = ChannelFeatures_clone(&val_conv);
17515 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
17518 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
17519 LDKUnsignedChannelAnnouncement this_ptr_conv;
17520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17521 this_ptr_conv.is_owned = false;
17522 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17523 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
17527 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17528 LDKUnsignedChannelAnnouncement this_ptr_conv;
17529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17530 this_ptr_conv.is_owned = false;
17531 LDKThirtyTwoBytes val_ref;
17532 CHECK(*((uint32_t*)val) == 32);
17533 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17534 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
17537 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
17538 LDKUnsignedChannelAnnouncement this_ptr_conv;
17539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17540 this_ptr_conv.is_owned = false;
17541 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
17545 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17546 LDKUnsignedChannelAnnouncement this_ptr_conv;
17547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17548 this_ptr_conv.is_owned = false;
17549 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
17552 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
17553 LDKUnsignedChannelAnnouncement this_ptr_conv;
17554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17555 this_ptr_conv.is_owned = false;
17556 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17557 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
17561 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
17562 LDKUnsignedChannelAnnouncement this_ptr_conv;
17563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17564 this_ptr_conv.is_owned = false;
17565 LDKPublicKey val_ref;
17566 CHECK(*((uint32_t*)val) == 33);
17567 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17568 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
17571 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
17572 LDKUnsignedChannelAnnouncement this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17576 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
17580 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
17581 LDKUnsignedChannelAnnouncement this_ptr_conv;
17582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17583 this_ptr_conv.is_owned = false;
17584 LDKPublicKey val_ref;
17585 CHECK(*((uint32_t*)val) == 33);
17586 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17587 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
17590 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
17591 LDKUnsignedChannelAnnouncement this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17595 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
17599 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
17600 LDKUnsignedChannelAnnouncement this_ptr_conv;
17601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17602 this_ptr_conv.is_owned = false;
17603 LDKPublicKey val_ref;
17604 CHECK(*((uint32_t*)val) == 33);
17605 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17606 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
17609 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
17610 LDKUnsignedChannelAnnouncement this_ptr_conv;
17611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17612 this_ptr_conv.is_owned = false;
17613 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17614 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
17618 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
17619 LDKUnsignedChannelAnnouncement this_ptr_conv;
17620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17621 this_ptr_conv.is_owned = false;
17622 LDKPublicKey val_ref;
17623 CHECK(*((uint32_t*)val) == 33);
17624 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17625 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
17628 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
17629 LDKUnsignedChannelAnnouncement orig_conv;
17630 orig_conv.inner = (void*)(orig & (~1));
17631 orig_conv.is_owned = false;
17632 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
17633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17635 uint64_t ret_ref = (uint64_t)ret_var.inner;
17636 if (ret_var.is_owned) {
17642 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
17643 LDKChannelAnnouncement this_obj_conv;
17644 this_obj_conv.inner = (void*)(this_obj & (~1));
17645 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17646 ChannelAnnouncement_free(this_obj_conv);
17649 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
17650 LDKChannelAnnouncement this_ptr_conv;
17651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17652 this_ptr_conv.is_owned = false;
17653 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17654 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
17658 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
17659 LDKChannelAnnouncement this_ptr_conv;
17660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17661 this_ptr_conv.is_owned = false;
17662 LDKSignature val_ref;
17663 CHECK(*((uint32_t*)val) == 64);
17664 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17665 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
17668 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
17669 LDKChannelAnnouncement this_ptr_conv;
17670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17671 this_ptr_conv.is_owned = false;
17672 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17673 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
17677 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
17678 LDKChannelAnnouncement this_ptr_conv;
17679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17680 this_ptr_conv.is_owned = false;
17681 LDKSignature val_ref;
17682 CHECK(*((uint32_t*)val) == 64);
17683 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17684 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
17687 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
17688 LDKChannelAnnouncement this_ptr_conv;
17689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17690 this_ptr_conv.is_owned = false;
17691 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17692 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
17696 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
17697 LDKChannelAnnouncement this_ptr_conv;
17698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17699 this_ptr_conv.is_owned = false;
17700 LDKSignature val_ref;
17701 CHECK(*((uint32_t*)val) == 64);
17702 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17703 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
17706 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
17707 LDKChannelAnnouncement this_ptr_conv;
17708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17709 this_ptr_conv.is_owned = false;
17710 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17711 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
17715 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
17716 LDKChannelAnnouncement this_ptr_conv;
17717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17718 this_ptr_conv.is_owned = false;
17719 LDKSignature val_ref;
17720 CHECK(*((uint32_t*)val) == 64);
17721 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17722 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
17725 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
17726 LDKChannelAnnouncement this_ptr_conv;
17727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17728 this_ptr_conv.is_owned = false;
17729 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
17730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17732 uint64_t ret_ref = (uint64_t)ret_var.inner;
17733 if (ret_var.is_owned) {
17739 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
17740 LDKChannelAnnouncement this_ptr_conv;
17741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17742 this_ptr_conv.is_owned = false;
17743 LDKUnsignedChannelAnnouncement val_conv;
17744 val_conv.inner = (void*)(val & (~1));
17745 val_conv.is_owned = (val & 1) || (val == 0);
17746 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
17747 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
17750 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) {
17751 LDKSignature node_signature_1_arg_ref;
17752 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
17753 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
17754 LDKSignature node_signature_2_arg_ref;
17755 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
17756 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
17757 LDKSignature bitcoin_signature_1_arg_ref;
17758 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
17759 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
17760 LDKSignature bitcoin_signature_2_arg_ref;
17761 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
17762 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
17763 LDKUnsignedChannelAnnouncement contents_arg_conv;
17764 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17765 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17766 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
17767 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);
17768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17770 uint64_t ret_ref = (uint64_t)ret_var.inner;
17771 if (ret_var.is_owned) {
17777 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
17778 LDKChannelAnnouncement orig_conv;
17779 orig_conv.inner = (void*)(orig & (~1));
17780 orig_conv.is_owned = false;
17781 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
17782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17784 uint64_t ret_ref = (uint64_t)ret_var.inner;
17785 if (ret_var.is_owned) {
17791 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
17792 LDKUnsignedChannelUpdate this_obj_conv;
17793 this_obj_conv.inner = (void*)(this_obj & (~1));
17794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17795 UnsignedChannelUpdate_free(this_obj_conv);
17798 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
17799 LDKUnsignedChannelUpdate this_ptr_conv;
17800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17801 this_ptr_conv.is_owned = false;
17802 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17803 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
17807 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17808 LDKUnsignedChannelUpdate this_ptr_conv;
17809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17810 this_ptr_conv.is_owned = false;
17811 LDKThirtyTwoBytes val_ref;
17812 CHECK(*((uint32_t*)val) == 32);
17813 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17814 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
17817 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
17818 LDKUnsignedChannelUpdate this_ptr_conv;
17819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17820 this_ptr_conv.is_owned = false;
17821 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
17825 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17826 LDKUnsignedChannelUpdate this_ptr_conv;
17827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17828 this_ptr_conv.is_owned = false;
17829 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
17832 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
17833 LDKUnsignedChannelUpdate this_ptr_conv;
17834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17835 this_ptr_conv.is_owned = false;
17836 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
17840 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
17841 LDKUnsignedChannelUpdate this_ptr_conv;
17842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17843 this_ptr_conv.is_owned = false;
17844 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
17847 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
17848 LDKUnsignedChannelUpdate this_ptr_conv;
17849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17850 this_ptr_conv.is_owned = false;
17851 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
17855 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
17856 LDKUnsignedChannelUpdate this_ptr_conv;
17857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17858 this_ptr_conv.is_owned = false;
17859 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
17862 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
17863 LDKUnsignedChannelUpdate this_ptr_conv;
17864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17865 this_ptr_conv.is_owned = false;
17866 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
17870 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17871 LDKUnsignedChannelUpdate this_ptr_conv;
17872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17873 this_ptr_conv.is_owned = false;
17874 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
17877 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
17878 LDKUnsignedChannelUpdate this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
17885 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17886 LDKUnsignedChannelUpdate this_ptr_conv;
17887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17888 this_ptr_conv.is_owned = false;
17889 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
17892 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
17893 LDKUnsignedChannelUpdate this_ptr_conv;
17894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17895 this_ptr_conv.is_owned = false;
17896 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
17900 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
17901 LDKUnsignedChannelUpdate this_ptr_conv;
17902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17903 this_ptr_conv.is_owned = false;
17904 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
17907 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
17908 LDKUnsignedChannelUpdate this_ptr_conv;
17909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17910 this_ptr_conv.is_owned = false;
17911 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
17915 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17916 LDKUnsignedChannelUpdate this_ptr_conv;
17917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17918 this_ptr_conv.is_owned = false;
17919 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
17922 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
17923 LDKUnsignedChannelUpdate orig_conv;
17924 orig_conv.inner = (void*)(orig & (~1));
17925 orig_conv.is_owned = false;
17926 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
17927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17929 uint64_t ret_ref = (uint64_t)ret_var.inner;
17930 if (ret_var.is_owned) {
17936 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
17937 LDKChannelUpdate this_obj_conv;
17938 this_obj_conv.inner = (void*)(this_obj & (~1));
17939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17940 ChannelUpdate_free(this_obj_conv);
17943 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
17944 LDKChannelUpdate this_ptr_conv;
17945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17946 this_ptr_conv.is_owned = false;
17947 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17948 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
17952 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
17953 LDKChannelUpdate this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 LDKSignature val_ref;
17957 CHECK(*((uint32_t*)val) == 64);
17958 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17959 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
17962 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
17963 LDKChannelUpdate this_ptr_conv;
17964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17965 this_ptr_conv.is_owned = false;
17966 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
17967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17969 uint64_t ret_ref = (uint64_t)ret_var.inner;
17970 if (ret_var.is_owned) {
17976 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
17977 LDKChannelUpdate this_ptr_conv;
17978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17979 this_ptr_conv.is_owned = false;
17980 LDKUnsignedChannelUpdate val_conv;
17981 val_conv.inner = (void*)(val & (~1));
17982 val_conv.is_owned = (val & 1) || (val == 0);
17983 val_conv = UnsignedChannelUpdate_clone(&val_conv);
17984 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
17987 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
17988 LDKSignature signature_arg_ref;
17989 CHECK(*((uint32_t*)signature_arg) == 64);
17990 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17991 LDKUnsignedChannelUpdate contents_arg_conv;
17992 contents_arg_conv.inner = (void*)(contents_arg & (~1));
17993 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
17994 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
17995 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
17996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17998 uint64_t ret_ref = (uint64_t)ret_var.inner;
17999 if (ret_var.is_owned) {
18005 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
18006 LDKChannelUpdate orig_conv;
18007 orig_conv.inner = (void*)(orig & (~1));
18008 orig_conv.is_owned = false;
18009 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
18010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18012 uint64_t ret_ref = (uint64_t)ret_var.inner;
18013 if (ret_var.is_owned) {
18019 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
18020 LDKQueryChannelRange this_obj_conv;
18021 this_obj_conv.inner = (void*)(this_obj & (~1));
18022 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18023 QueryChannelRange_free(this_obj_conv);
18026 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
18027 LDKQueryChannelRange this_ptr_conv;
18028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18029 this_ptr_conv.is_owned = false;
18030 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18031 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
18035 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18036 LDKQueryChannelRange this_ptr_conv;
18037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18038 this_ptr_conv.is_owned = false;
18039 LDKThirtyTwoBytes val_ref;
18040 CHECK(*((uint32_t*)val) == 32);
18041 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18042 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
18045 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
18046 LDKQueryChannelRange this_ptr_conv;
18047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18048 this_ptr_conv.is_owned = false;
18049 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
18053 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
18054 LDKQueryChannelRange this_ptr_conv;
18055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18056 this_ptr_conv.is_owned = false;
18057 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
18060 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
18061 LDKQueryChannelRange this_ptr_conv;
18062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18063 this_ptr_conv.is_owned = false;
18064 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
18068 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
18069 LDKQueryChannelRange this_ptr_conv;
18070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18071 this_ptr_conv.is_owned = false;
18072 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
18075 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
18076 LDKThirtyTwoBytes chain_hash_arg_ref;
18077 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18078 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18079 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
18080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18082 uint64_t ret_ref = (uint64_t)ret_var.inner;
18083 if (ret_var.is_owned) {
18089 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
18090 LDKQueryChannelRange orig_conv;
18091 orig_conv.inner = (void*)(orig & (~1));
18092 orig_conv.is_owned = false;
18093 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
18094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18096 uint64_t ret_ref = (uint64_t)ret_var.inner;
18097 if (ret_var.is_owned) {
18103 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
18104 LDKReplyChannelRange this_obj_conv;
18105 this_obj_conv.inner = (void*)(this_obj & (~1));
18106 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18107 ReplyChannelRange_free(this_obj_conv);
18110 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
18111 LDKReplyChannelRange this_ptr_conv;
18112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18113 this_ptr_conv.is_owned = false;
18114 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18115 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
18119 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18120 LDKReplyChannelRange this_ptr_conv;
18121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18122 this_ptr_conv.is_owned = false;
18123 LDKThirtyTwoBytes val_ref;
18124 CHECK(*((uint32_t*)val) == 32);
18125 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18126 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
18129 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
18130 LDKReplyChannelRange this_ptr_conv;
18131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18132 this_ptr_conv.is_owned = false;
18133 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
18137 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
18138 LDKReplyChannelRange this_ptr_conv;
18139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18140 this_ptr_conv.is_owned = false;
18141 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
18144 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
18145 LDKReplyChannelRange this_ptr_conv;
18146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18147 this_ptr_conv.is_owned = false;
18148 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
18152 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
18153 LDKReplyChannelRange this_ptr_conv;
18154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18155 this_ptr_conv.is_owned = false;
18156 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
18159 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
18160 LDKReplyChannelRange this_ptr_conv;
18161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18162 this_ptr_conv.is_owned = false;
18163 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
18167 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
18168 LDKReplyChannelRange this_ptr_conv;
18169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18170 this_ptr_conv.is_owned = false;
18171 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
18174 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
18175 LDKReplyChannelRange this_ptr_conv;
18176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18177 this_ptr_conv.is_owned = false;
18178 LDKCVec_u64Z val_constr;
18179 val_constr.datalen = *((uint32_t*)val);
18180 if (val_constr.datalen > 0)
18181 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18183 val_constr.data = NULL;
18184 int64_t* val_vals = (int64_t*)(val + 4);
18185 for (size_t i = 0; i < val_constr.datalen; i++) {
18186 int64_t val_conv_8 = val_vals[i];
18187 val_constr.data[i] = val_conv_8;
18189 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
18192 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) {
18193 LDKThirtyTwoBytes chain_hash_arg_ref;
18194 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18195 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18196 LDKCVec_u64Z short_channel_ids_arg_constr;
18197 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
18198 if (short_channel_ids_arg_constr.datalen > 0)
18199 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18201 short_channel_ids_arg_constr.data = NULL;
18202 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
18203 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
18204 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
18205 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
18207 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
18208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18210 uint64_t ret_ref = (uint64_t)ret_var.inner;
18211 if (ret_var.is_owned) {
18217 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
18218 LDKReplyChannelRange orig_conv;
18219 orig_conv.inner = (void*)(orig & (~1));
18220 orig_conv.is_owned = false;
18221 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
18222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18224 uint64_t ret_ref = (uint64_t)ret_var.inner;
18225 if (ret_var.is_owned) {
18231 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
18232 LDKQueryShortChannelIds this_obj_conv;
18233 this_obj_conv.inner = (void*)(this_obj & (~1));
18234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18235 QueryShortChannelIds_free(this_obj_conv);
18238 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
18239 LDKQueryShortChannelIds this_ptr_conv;
18240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18241 this_ptr_conv.is_owned = false;
18242 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18243 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
18247 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18248 LDKQueryShortChannelIds this_ptr_conv;
18249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18250 this_ptr_conv.is_owned = false;
18251 LDKThirtyTwoBytes val_ref;
18252 CHECK(*((uint32_t*)val) == 32);
18253 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18254 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
18257 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
18258 LDKQueryShortChannelIds this_ptr_conv;
18259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18260 this_ptr_conv.is_owned = false;
18261 LDKCVec_u64Z val_constr;
18262 val_constr.datalen = *((uint32_t*)val);
18263 if (val_constr.datalen > 0)
18264 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18266 val_constr.data = NULL;
18267 int64_t* val_vals = (int64_t*)(val + 4);
18268 for (size_t i = 0; i < val_constr.datalen; i++) {
18269 int64_t val_conv_8 = val_vals[i];
18270 val_constr.data[i] = val_conv_8;
18272 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
18275 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
18276 LDKThirtyTwoBytes chain_hash_arg_ref;
18277 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18278 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18279 LDKCVec_u64Z short_channel_ids_arg_constr;
18280 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
18281 if (short_channel_ids_arg_constr.datalen > 0)
18282 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18284 short_channel_ids_arg_constr.data = NULL;
18285 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
18286 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
18287 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
18288 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
18290 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
18291 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18292 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18293 uint64_t ret_ref = (uint64_t)ret_var.inner;
18294 if (ret_var.is_owned) {
18300 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
18301 LDKQueryShortChannelIds orig_conv;
18302 orig_conv.inner = (void*)(orig & (~1));
18303 orig_conv.is_owned = false;
18304 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
18305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18307 uint64_t ret_ref = (uint64_t)ret_var.inner;
18308 if (ret_var.is_owned) {
18314 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
18315 LDKReplyShortChannelIdsEnd this_obj_conv;
18316 this_obj_conv.inner = (void*)(this_obj & (~1));
18317 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18318 ReplyShortChannelIdsEnd_free(this_obj_conv);
18321 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
18322 LDKReplyShortChannelIdsEnd this_ptr_conv;
18323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18324 this_ptr_conv.is_owned = false;
18325 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18326 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
18330 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18331 LDKReplyShortChannelIdsEnd this_ptr_conv;
18332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18333 this_ptr_conv.is_owned = false;
18334 LDKThirtyTwoBytes val_ref;
18335 CHECK(*((uint32_t*)val) == 32);
18336 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18337 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
18340 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
18341 LDKReplyShortChannelIdsEnd this_ptr_conv;
18342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18343 this_ptr_conv.is_owned = false;
18344 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
18348 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
18349 LDKReplyShortChannelIdsEnd this_ptr_conv;
18350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18351 this_ptr_conv.is_owned = false;
18352 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
18355 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
18356 LDKThirtyTwoBytes chain_hash_arg_ref;
18357 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18358 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18359 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
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_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
18370 LDKReplyShortChannelIdsEnd orig_conv;
18371 orig_conv.inner = (void*)(orig & (~1));
18372 orig_conv.is_owned = false;
18373 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_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_GossipTimestampFilter_free(uint32_t this_obj) {
18384 LDKGossipTimestampFilter this_obj_conv;
18385 this_obj_conv.inner = (void*)(this_obj & (~1));
18386 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18387 GossipTimestampFilter_free(this_obj_conv);
18390 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
18391 LDKGossipTimestampFilter this_ptr_conv;
18392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18393 this_ptr_conv.is_owned = false;
18394 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18395 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
18399 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18400 LDKGossipTimestampFilter this_ptr_conv;
18401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18402 this_ptr_conv.is_owned = false;
18403 LDKThirtyTwoBytes val_ref;
18404 CHECK(*((uint32_t*)val) == 32);
18405 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18406 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
18409 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
18410 LDKGossipTimestampFilter this_ptr_conv;
18411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18412 this_ptr_conv.is_owned = false;
18413 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
18417 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
18418 LDKGossipTimestampFilter this_ptr_conv;
18419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18420 this_ptr_conv.is_owned = false;
18421 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
18424 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
18425 LDKGossipTimestampFilter this_ptr_conv;
18426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18427 this_ptr_conv.is_owned = false;
18428 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
18432 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
18433 LDKGossipTimestampFilter this_ptr_conv;
18434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18435 this_ptr_conv.is_owned = false;
18436 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
18439 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
18440 LDKThirtyTwoBytes chain_hash_arg_ref;
18441 CHECK(*((uint32_t*)chain_hash_arg) == 32);
18442 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
18443 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
18444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18446 uint64_t ret_ref = (uint64_t)ret_var.inner;
18447 if (ret_var.is_owned) {
18453 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
18454 LDKGossipTimestampFilter orig_conv;
18455 orig_conv.inner = (void*)(orig & (~1));
18456 orig_conv.is_owned = false;
18457 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
18458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18460 uint64_t ret_ref = (uint64_t)ret_var.inner;
18461 if (ret_var.is_owned) {
18467 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
18468 if ((this_ptr & 1) != 0) return;
18469 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
18470 FREE((void*)this_ptr);
18471 ErrorAction_free(this_ptr_conv);
18474 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
18475 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
18476 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18477 *ret_copy = ErrorAction_clone(orig_conv);
18478 uint64_t ret_ref = (uint64_t)ret_copy;
18482 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
18483 LDKErrorMessage msg_conv;
18484 msg_conv.inner = (void*)(msg & (~1));
18485 msg_conv.is_owned = (msg & 1) || (msg == 0);
18486 msg_conv = ErrorMessage_clone(&msg_conv);
18487 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18488 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
18489 uint64_t ret_ref = (uint64_t)ret_copy;
18493 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
18494 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18495 *ret_copy = ErrorAction_ignore_error();
18496 uint64_t ret_ref = (uint64_t)ret_copy;
18500 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
18501 LDKLevel a_conv = LDKLevel_from_js(a);
18502 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18503 *ret_copy = ErrorAction_ignore_and_log(a_conv);
18504 uint64_t ret_ref = (uint64_t)ret_copy;
18508 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
18509 LDKErrorMessage msg_conv;
18510 msg_conv.inner = (void*)(msg & (~1));
18511 msg_conv.is_owned = (msg & 1) || (msg == 0);
18512 msg_conv = ErrorMessage_clone(&msg_conv);
18513 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18514 *ret_copy = ErrorAction_send_error_message(msg_conv);
18515 uint64_t ret_ref = (uint64_t)ret_copy;
18519 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
18520 LDKLightningError this_obj_conv;
18521 this_obj_conv.inner = (void*)(this_obj & (~1));
18522 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18523 LightningError_free(this_obj_conv);
18526 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
18527 LDKLightningError this_ptr_conv;
18528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18529 this_ptr_conv.is_owned = false;
18530 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
18531 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
18536 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
18537 LDKLightningError this_ptr_conv;
18538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18539 this_ptr_conv.is_owned = false;
18540 LDKStr val_conv = str_ref_to_owned_c(val);
18541 LightningError_set_err(&this_ptr_conv, val_conv);
18544 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
18545 LDKLightningError this_ptr_conv;
18546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18547 this_ptr_conv.is_owned = false;
18548 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
18549 *ret_copy = LightningError_get_action(&this_ptr_conv);
18550 uint64_t ret_ref = (uint64_t)ret_copy;
18554 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
18555 LDKLightningError this_ptr_conv;
18556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18557 this_ptr_conv.is_owned = false;
18558 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
18559 LightningError_set_action(&this_ptr_conv, val_conv);
18562 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
18563 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
18564 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
18565 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
18566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18568 uint64_t ret_ref = (uint64_t)ret_var.inner;
18569 if (ret_var.is_owned) {
18575 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
18576 LDKLightningError orig_conv;
18577 orig_conv.inner = (void*)(orig & (~1));
18578 orig_conv.is_owned = false;
18579 LDKLightningError ret_var = LightningError_clone(&orig_conv);
18580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18582 uint64_t ret_ref = (uint64_t)ret_var.inner;
18583 if (ret_var.is_owned) {
18589 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
18590 LDKCommitmentUpdate this_obj_conv;
18591 this_obj_conv.inner = (void*)(this_obj & (~1));
18592 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18593 CommitmentUpdate_free(this_obj_conv);
18596 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
18597 LDKCommitmentUpdate this_ptr_conv;
18598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18599 this_ptr_conv.is_owned = false;
18600 LDKCVec_UpdateAddHTLCZ val_constr;
18601 val_constr.datalen = *((uint32_t*)val);
18602 if (val_constr.datalen > 0)
18603 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18605 val_constr.data = NULL;
18606 uint32_t* val_vals = (uint32_t*)(val + 4);
18607 for (size_t p = 0; p < val_constr.datalen; p++) {
18608 uint32_t val_conv_15 = val_vals[p];
18609 LDKUpdateAddHTLC val_conv_15_conv;
18610 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
18611 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
18612 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
18613 val_constr.data[p] = val_conv_15_conv;
18615 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
18618 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
18619 LDKCommitmentUpdate this_ptr_conv;
18620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18621 this_ptr_conv.is_owned = false;
18622 LDKCVec_UpdateFulfillHTLCZ val_constr;
18623 val_constr.datalen = *((uint32_t*)val);
18624 if (val_constr.datalen > 0)
18625 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18627 val_constr.data = NULL;
18628 uint32_t* val_vals = (uint32_t*)(val + 4);
18629 for (size_t t = 0; t < val_constr.datalen; t++) {
18630 uint32_t val_conv_19 = val_vals[t];
18631 LDKUpdateFulfillHTLC val_conv_19_conv;
18632 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
18633 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
18634 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
18635 val_constr.data[t] = val_conv_19_conv;
18637 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
18640 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
18641 LDKCommitmentUpdate this_ptr_conv;
18642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18643 this_ptr_conv.is_owned = false;
18644 LDKCVec_UpdateFailHTLCZ val_constr;
18645 val_constr.datalen = *((uint32_t*)val);
18646 if (val_constr.datalen > 0)
18647 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18649 val_constr.data = NULL;
18650 uint32_t* val_vals = (uint32_t*)(val + 4);
18651 for (size_t q = 0; q < val_constr.datalen; q++) {
18652 uint32_t val_conv_16 = val_vals[q];
18653 LDKUpdateFailHTLC val_conv_16_conv;
18654 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
18655 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
18656 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
18657 val_constr.data[q] = val_conv_16_conv;
18659 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
18662 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
18663 LDKCommitmentUpdate this_ptr_conv;
18664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18665 this_ptr_conv.is_owned = false;
18666 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
18667 val_constr.datalen = *((uint32_t*)val);
18668 if (val_constr.datalen > 0)
18669 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18671 val_constr.data = NULL;
18672 uint32_t* val_vals = (uint32_t*)(val + 4);
18673 for (size_t z = 0; z < val_constr.datalen; z++) {
18674 uint32_t val_conv_25 = val_vals[z];
18675 LDKUpdateFailMalformedHTLC val_conv_25_conv;
18676 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
18677 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
18678 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
18679 val_constr.data[z] = val_conv_25_conv;
18681 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
18684 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
18685 LDKCommitmentUpdate this_ptr_conv;
18686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18687 this_ptr_conv.is_owned = false;
18688 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
18689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18691 uint64_t ret_ref = (uint64_t)ret_var.inner;
18692 if (ret_var.is_owned) {
18698 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
18699 LDKCommitmentUpdate this_ptr_conv;
18700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18701 this_ptr_conv.is_owned = false;
18702 LDKUpdateFee val_conv;
18703 val_conv.inner = (void*)(val & (~1));
18704 val_conv.is_owned = (val & 1) || (val == 0);
18705 val_conv = UpdateFee_clone(&val_conv);
18706 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
18709 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
18710 LDKCommitmentUpdate this_ptr_conv;
18711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18712 this_ptr_conv.is_owned = false;
18713 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
18714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18716 uint64_t ret_ref = (uint64_t)ret_var.inner;
18717 if (ret_var.is_owned) {
18723 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
18724 LDKCommitmentUpdate this_ptr_conv;
18725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18726 this_ptr_conv.is_owned = false;
18727 LDKCommitmentSigned val_conv;
18728 val_conv.inner = (void*)(val & (~1));
18729 val_conv.is_owned = (val & 1) || (val == 0);
18730 val_conv = CommitmentSigned_clone(&val_conv);
18731 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
18734 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) {
18735 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
18736 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
18737 if (update_add_htlcs_arg_constr.datalen > 0)
18738 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18740 update_add_htlcs_arg_constr.data = NULL;
18741 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
18742 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
18743 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
18744 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
18745 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
18746 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
18747 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
18748 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
18750 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
18751 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
18752 if (update_fulfill_htlcs_arg_constr.datalen > 0)
18753 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18755 update_fulfill_htlcs_arg_constr.data = NULL;
18756 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
18757 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
18758 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
18759 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
18760 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
18761 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
18762 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
18763 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
18765 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
18766 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
18767 if (update_fail_htlcs_arg_constr.datalen > 0)
18768 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18770 update_fail_htlcs_arg_constr.data = NULL;
18771 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
18772 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
18773 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
18774 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
18775 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
18776 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
18777 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
18778 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
18780 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
18781 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
18782 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
18783 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18785 update_fail_malformed_htlcs_arg_constr.data = NULL;
18786 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
18787 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
18788 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
18789 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
18790 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
18791 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);
18792 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
18793 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
18795 LDKUpdateFee update_fee_arg_conv;
18796 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
18797 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
18798 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
18799 LDKCommitmentSigned commitment_signed_arg_conv;
18800 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
18801 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
18802 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
18803 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);
18804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18806 uint64_t ret_ref = (uint64_t)ret_var.inner;
18807 if (ret_var.is_owned) {
18813 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
18814 LDKCommitmentUpdate orig_conv;
18815 orig_conv.inner = (void*)(orig & (~1));
18816 orig_conv.is_owned = false;
18817 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
18818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18820 uint64_t ret_ref = (uint64_t)ret_var.inner;
18821 if (ret_var.is_owned) {
18827 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
18828 if ((this_ptr & 1) != 0) return;
18829 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
18830 FREE((void*)this_ptr);
18831 HTLCFailChannelUpdate_free(this_ptr_conv);
18834 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
18835 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
18836 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18837 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
18838 uint64_t ret_ref = (uint64_t)ret_copy;
18842 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_update_message(uint32_t msg) {
18843 LDKChannelUpdate msg_conv;
18844 msg_conv.inner = (void*)(msg & (~1));
18845 msg_conv.is_owned = (msg & 1) || (msg == 0);
18846 msg_conv = ChannelUpdate_clone(&msg_conv);
18847 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18848 *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
18849 uint64_t ret_ref = (uint64_t)ret_copy;
18853 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
18854 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18855 *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
18856 uint64_t ret_ref = (uint64_t)ret_copy;
18860 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
18861 LDKPublicKey node_id_ref;
18862 CHECK(*((uint32_t*)node_id) == 33);
18863 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
18864 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
18865 *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
18866 uint64_t ret_ref = (uint64_t)ret_copy;
18870 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
18871 if ((this_ptr & 1) != 0) return;
18872 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
18873 FREE((void*)this_ptr);
18874 ChannelMessageHandler_free(this_ptr_conv);
18877 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
18878 if ((this_ptr & 1) != 0) return;
18879 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
18880 FREE((void*)this_ptr);
18881 RoutingMessageHandler_free(this_ptr_conv);
18884 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
18885 LDKAcceptChannel obj_conv;
18886 obj_conv.inner = (void*)(obj & (~1));
18887 obj_conv.is_owned = false;
18888 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
18889 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18890 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18891 CVec_u8Z_free(ret_var);
18895 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
18896 LDKu8slice ser_ref;
18897 ser_ref.datalen = *((uint32_t*)ser);
18898 ser_ref.data = (int8_t*)(ser + 4);
18899 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18900 *ret_conv = AcceptChannel_read(ser_ref);
18901 return (uint64_t)ret_conv;
18904 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
18905 LDKAnnouncementSignatures obj_conv;
18906 obj_conv.inner = (void*)(obj & (~1));
18907 obj_conv.is_owned = false;
18908 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
18909 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18910 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18911 CVec_u8Z_free(ret_var);
18915 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
18916 LDKu8slice ser_ref;
18917 ser_ref.datalen = *((uint32_t*)ser);
18918 ser_ref.data = (int8_t*)(ser + 4);
18919 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18920 *ret_conv = AnnouncementSignatures_read(ser_ref);
18921 return (uint64_t)ret_conv;
18924 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
18925 LDKChannelReestablish obj_conv;
18926 obj_conv.inner = (void*)(obj & (~1));
18927 obj_conv.is_owned = false;
18928 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
18929 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18930 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18931 CVec_u8Z_free(ret_var);
18935 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
18936 LDKu8slice ser_ref;
18937 ser_ref.datalen = *((uint32_t*)ser);
18938 ser_ref.data = (int8_t*)(ser + 4);
18939 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18940 *ret_conv = ChannelReestablish_read(ser_ref);
18941 return (uint64_t)ret_conv;
18944 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
18945 LDKClosingSigned obj_conv;
18946 obj_conv.inner = (void*)(obj & (~1));
18947 obj_conv.is_owned = false;
18948 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
18949 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18950 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18951 CVec_u8Z_free(ret_var);
18955 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
18956 LDKu8slice ser_ref;
18957 ser_ref.datalen = *((uint32_t*)ser);
18958 ser_ref.data = (int8_t*)(ser + 4);
18959 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18960 *ret_conv = ClosingSigned_read(ser_ref);
18961 return (uint64_t)ret_conv;
18964 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
18965 LDKClosingSignedFeeRange obj_conv;
18966 obj_conv.inner = (void*)(obj & (~1));
18967 obj_conv.is_owned = false;
18968 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
18969 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18970 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18971 CVec_u8Z_free(ret_var);
18975 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
18976 LDKu8slice ser_ref;
18977 ser_ref.datalen = *((uint32_t*)ser);
18978 ser_ref.data = (int8_t*)(ser + 4);
18979 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18980 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
18981 return (uint64_t)ret_conv;
18984 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
18985 LDKCommitmentSigned obj_conv;
18986 obj_conv.inner = (void*)(obj & (~1));
18987 obj_conv.is_owned = false;
18988 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
18989 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18990 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18991 CVec_u8Z_free(ret_var);
18995 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
18996 LDKu8slice ser_ref;
18997 ser_ref.datalen = *((uint32_t*)ser);
18998 ser_ref.data = (int8_t*)(ser + 4);
18999 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19000 *ret_conv = CommitmentSigned_read(ser_ref);
19001 return (uint64_t)ret_conv;
19004 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
19005 LDKFundingCreated obj_conv;
19006 obj_conv.inner = (void*)(obj & (~1));
19007 obj_conv.is_owned = false;
19008 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
19009 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19010 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19011 CVec_u8Z_free(ret_var);
19015 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
19016 LDKu8slice ser_ref;
19017 ser_ref.datalen = *((uint32_t*)ser);
19018 ser_ref.data = (int8_t*)(ser + 4);
19019 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19020 *ret_conv = FundingCreated_read(ser_ref);
19021 return (uint64_t)ret_conv;
19024 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
19025 LDKFundingSigned obj_conv;
19026 obj_conv.inner = (void*)(obj & (~1));
19027 obj_conv.is_owned = false;
19028 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
19029 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19030 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19031 CVec_u8Z_free(ret_var);
19035 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
19036 LDKu8slice ser_ref;
19037 ser_ref.datalen = *((uint32_t*)ser);
19038 ser_ref.data = (int8_t*)(ser + 4);
19039 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19040 *ret_conv = FundingSigned_read(ser_ref);
19041 return (uint64_t)ret_conv;
19044 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
19045 LDKFundingLocked obj_conv;
19046 obj_conv.inner = (void*)(obj & (~1));
19047 obj_conv.is_owned = false;
19048 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
19049 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19050 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19051 CVec_u8Z_free(ret_var);
19055 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
19056 LDKu8slice ser_ref;
19057 ser_ref.datalen = *((uint32_t*)ser);
19058 ser_ref.data = (int8_t*)(ser + 4);
19059 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
19060 *ret_conv = FundingLocked_read(ser_ref);
19061 return (uint64_t)ret_conv;
19064 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
19066 obj_conv.inner = (void*)(obj & (~1));
19067 obj_conv.is_owned = false;
19068 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
19069 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19070 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19071 CVec_u8Z_free(ret_var);
19075 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
19076 LDKu8slice ser_ref;
19077 ser_ref.datalen = *((uint32_t*)ser);
19078 ser_ref.data = (int8_t*)(ser + 4);
19079 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19080 *ret_conv = Init_read(ser_ref);
19081 return (uint64_t)ret_conv;
19084 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
19085 LDKOpenChannel obj_conv;
19086 obj_conv.inner = (void*)(obj & (~1));
19087 obj_conv.is_owned = false;
19088 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
19089 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19090 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19091 CVec_u8Z_free(ret_var);
19095 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
19096 LDKu8slice ser_ref;
19097 ser_ref.datalen = *((uint32_t*)ser);
19098 ser_ref.data = (int8_t*)(ser + 4);
19099 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19100 *ret_conv = OpenChannel_read(ser_ref);
19101 return (uint64_t)ret_conv;
19104 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
19105 LDKRevokeAndACK obj_conv;
19106 obj_conv.inner = (void*)(obj & (~1));
19107 obj_conv.is_owned = false;
19108 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
19109 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19110 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19111 CVec_u8Z_free(ret_var);
19115 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
19116 LDKu8slice ser_ref;
19117 ser_ref.datalen = *((uint32_t*)ser);
19118 ser_ref.data = (int8_t*)(ser + 4);
19119 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19120 *ret_conv = RevokeAndACK_read(ser_ref);
19121 return (uint64_t)ret_conv;
19124 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
19125 LDKShutdown obj_conv;
19126 obj_conv.inner = (void*)(obj & (~1));
19127 obj_conv.is_owned = false;
19128 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
19129 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19130 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19131 CVec_u8Z_free(ret_var);
19135 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
19136 LDKu8slice ser_ref;
19137 ser_ref.datalen = *((uint32_t*)ser);
19138 ser_ref.data = (int8_t*)(ser + 4);
19139 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19140 *ret_conv = Shutdown_read(ser_ref);
19141 return (uint64_t)ret_conv;
19144 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
19145 LDKUpdateFailHTLC obj_conv;
19146 obj_conv.inner = (void*)(obj & (~1));
19147 obj_conv.is_owned = false;
19148 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
19149 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19150 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19151 CVec_u8Z_free(ret_var);
19155 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
19156 LDKu8slice ser_ref;
19157 ser_ref.datalen = *((uint32_t*)ser);
19158 ser_ref.data = (int8_t*)(ser + 4);
19159 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19160 *ret_conv = UpdateFailHTLC_read(ser_ref);
19161 return (uint64_t)ret_conv;
19164 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
19165 LDKUpdateFailMalformedHTLC obj_conv;
19166 obj_conv.inner = (void*)(obj & (~1));
19167 obj_conv.is_owned = false;
19168 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
19169 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19170 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19171 CVec_u8Z_free(ret_var);
19175 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
19176 LDKu8slice ser_ref;
19177 ser_ref.datalen = *((uint32_t*)ser);
19178 ser_ref.data = (int8_t*)(ser + 4);
19179 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19180 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
19181 return (uint64_t)ret_conv;
19184 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
19185 LDKUpdateFee obj_conv;
19186 obj_conv.inner = (void*)(obj & (~1));
19187 obj_conv.is_owned = false;
19188 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
19189 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19190 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19191 CVec_u8Z_free(ret_var);
19195 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
19196 LDKu8slice ser_ref;
19197 ser_ref.datalen = *((uint32_t*)ser);
19198 ser_ref.data = (int8_t*)(ser + 4);
19199 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19200 *ret_conv = UpdateFee_read(ser_ref);
19201 return (uint64_t)ret_conv;
19204 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
19205 LDKUpdateFulfillHTLC obj_conv;
19206 obj_conv.inner = (void*)(obj & (~1));
19207 obj_conv.is_owned = false;
19208 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
19209 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19210 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19211 CVec_u8Z_free(ret_var);
19215 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
19216 LDKu8slice ser_ref;
19217 ser_ref.datalen = *((uint32_t*)ser);
19218 ser_ref.data = (int8_t*)(ser + 4);
19219 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19220 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
19221 return (uint64_t)ret_conv;
19224 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
19225 LDKUpdateAddHTLC obj_conv;
19226 obj_conv.inner = (void*)(obj & (~1));
19227 obj_conv.is_owned = false;
19228 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
19229 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19230 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19231 CVec_u8Z_free(ret_var);
19235 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
19236 LDKu8slice ser_ref;
19237 ser_ref.datalen = *((uint32_t*)ser);
19238 ser_ref.data = (int8_t*)(ser + 4);
19239 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19240 *ret_conv = UpdateAddHTLC_read(ser_ref);
19241 return (uint64_t)ret_conv;
19244 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
19246 obj_conv.inner = (void*)(obj & (~1));
19247 obj_conv.is_owned = false;
19248 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
19249 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19250 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19251 CVec_u8Z_free(ret_var);
19255 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
19256 LDKu8slice ser_ref;
19257 ser_ref.datalen = *((uint32_t*)ser);
19258 ser_ref.data = (int8_t*)(ser + 4);
19259 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19260 *ret_conv = Ping_read(ser_ref);
19261 return (uint64_t)ret_conv;
19264 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
19266 obj_conv.inner = (void*)(obj & (~1));
19267 obj_conv.is_owned = false;
19268 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
19269 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19270 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19271 CVec_u8Z_free(ret_var);
19275 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
19276 LDKu8slice ser_ref;
19277 ser_ref.datalen = *((uint32_t*)ser);
19278 ser_ref.data = (int8_t*)(ser + 4);
19279 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19280 *ret_conv = Pong_read(ser_ref);
19281 return (uint64_t)ret_conv;
19284 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
19285 LDKUnsignedChannelAnnouncement obj_conv;
19286 obj_conv.inner = (void*)(obj & (~1));
19287 obj_conv.is_owned = false;
19288 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
19289 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19290 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19291 CVec_u8Z_free(ret_var);
19295 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
19296 LDKu8slice ser_ref;
19297 ser_ref.datalen = *((uint32_t*)ser);
19298 ser_ref.data = (int8_t*)(ser + 4);
19299 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19300 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
19301 return (uint64_t)ret_conv;
19304 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
19305 LDKChannelAnnouncement obj_conv;
19306 obj_conv.inner = (void*)(obj & (~1));
19307 obj_conv.is_owned = false;
19308 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
19309 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19310 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19311 CVec_u8Z_free(ret_var);
19315 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
19316 LDKu8slice ser_ref;
19317 ser_ref.datalen = *((uint32_t*)ser);
19318 ser_ref.data = (int8_t*)(ser + 4);
19319 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19320 *ret_conv = ChannelAnnouncement_read(ser_ref);
19321 return (uint64_t)ret_conv;
19324 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
19325 LDKUnsignedChannelUpdate obj_conv;
19326 obj_conv.inner = (void*)(obj & (~1));
19327 obj_conv.is_owned = false;
19328 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
19329 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19330 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19331 CVec_u8Z_free(ret_var);
19335 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
19336 LDKu8slice ser_ref;
19337 ser_ref.datalen = *((uint32_t*)ser);
19338 ser_ref.data = (int8_t*)(ser + 4);
19339 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19340 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
19341 return (uint64_t)ret_conv;
19344 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
19345 LDKChannelUpdate obj_conv;
19346 obj_conv.inner = (void*)(obj & (~1));
19347 obj_conv.is_owned = false;
19348 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
19349 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19350 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19351 CVec_u8Z_free(ret_var);
19355 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
19356 LDKu8slice ser_ref;
19357 ser_ref.datalen = *((uint32_t*)ser);
19358 ser_ref.data = (int8_t*)(ser + 4);
19359 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19360 *ret_conv = ChannelUpdate_read(ser_ref);
19361 return (uint64_t)ret_conv;
19364 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
19365 LDKErrorMessage obj_conv;
19366 obj_conv.inner = (void*)(obj & (~1));
19367 obj_conv.is_owned = false;
19368 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
19369 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19370 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19371 CVec_u8Z_free(ret_var);
19375 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
19376 LDKu8slice ser_ref;
19377 ser_ref.datalen = *((uint32_t*)ser);
19378 ser_ref.data = (int8_t*)(ser + 4);
19379 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19380 *ret_conv = ErrorMessage_read(ser_ref);
19381 return (uint64_t)ret_conv;
19384 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
19385 LDKUnsignedNodeAnnouncement obj_conv;
19386 obj_conv.inner = (void*)(obj & (~1));
19387 obj_conv.is_owned = false;
19388 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
19389 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19390 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19391 CVec_u8Z_free(ret_var);
19395 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
19396 LDKu8slice ser_ref;
19397 ser_ref.datalen = *((uint32_t*)ser);
19398 ser_ref.data = (int8_t*)(ser + 4);
19399 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19400 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
19401 return (uint64_t)ret_conv;
19404 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
19405 LDKNodeAnnouncement obj_conv;
19406 obj_conv.inner = (void*)(obj & (~1));
19407 obj_conv.is_owned = false;
19408 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
19409 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19410 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19411 CVec_u8Z_free(ret_var);
19415 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
19416 LDKu8slice ser_ref;
19417 ser_ref.datalen = *((uint32_t*)ser);
19418 ser_ref.data = (int8_t*)(ser + 4);
19419 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19420 *ret_conv = NodeAnnouncement_read(ser_ref);
19421 return (uint64_t)ret_conv;
19424 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
19425 LDKu8slice ser_ref;
19426 ser_ref.datalen = *((uint32_t*)ser);
19427 ser_ref.data = (int8_t*)(ser + 4);
19428 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19429 *ret_conv = QueryShortChannelIds_read(ser_ref);
19430 return (uint64_t)ret_conv;
19433 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
19434 LDKQueryShortChannelIds obj_conv;
19435 obj_conv.inner = (void*)(obj & (~1));
19436 obj_conv.is_owned = false;
19437 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
19438 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19439 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19440 CVec_u8Z_free(ret_var);
19444 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
19445 LDKu8slice ser_ref;
19446 ser_ref.datalen = *((uint32_t*)ser);
19447 ser_ref.data = (int8_t*)(ser + 4);
19448 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19449 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
19450 return (uint64_t)ret_conv;
19453 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
19454 LDKReplyShortChannelIdsEnd obj_conv;
19455 obj_conv.inner = (void*)(obj & (~1));
19456 obj_conv.is_owned = false;
19457 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
19458 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19459 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19460 CVec_u8Z_free(ret_var);
19464 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
19465 LDKQueryChannelRange this_arg_conv;
19466 this_arg_conv.inner = (void*)(this_arg & (~1));
19467 this_arg_conv.is_owned = false;
19468 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
19472 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
19473 LDKu8slice ser_ref;
19474 ser_ref.datalen = *((uint32_t*)ser);
19475 ser_ref.data = (int8_t*)(ser + 4);
19476 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19477 *ret_conv = QueryChannelRange_read(ser_ref);
19478 return (uint64_t)ret_conv;
19481 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
19482 LDKQueryChannelRange obj_conv;
19483 obj_conv.inner = (void*)(obj & (~1));
19484 obj_conv.is_owned = false;
19485 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
19486 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19487 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19488 CVec_u8Z_free(ret_var);
19492 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
19493 LDKu8slice ser_ref;
19494 ser_ref.datalen = *((uint32_t*)ser);
19495 ser_ref.data = (int8_t*)(ser + 4);
19496 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19497 *ret_conv = ReplyChannelRange_read(ser_ref);
19498 return (uint64_t)ret_conv;
19501 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
19502 LDKReplyChannelRange obj_conv;
19503 obj_conv.inner = (void*)(obj & (~1));
19504 obj_conv.is_owned = false;
19505 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
19506 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19507 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19508 CVec_u8Z_free(ret_var);
19512 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
19513 LDKu8slice ser_ref;
19514 ser_ref.datalen = *((uint32_t*)ser);
19515 ser_ref.data = (int8_t*)(ser + 4);
19516 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19517 *ret_conv = GossipTimestampFilter_read(ser_ref);
19518 return (uint64_t)ret_conv;
19521 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
19522 LDKGossipTimestampFilter obj_conv;
19523 obj_conv.inner = (void*)(obj & (~1));
19524 obj_conv.is_owned = false;
19525 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
19526 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19527 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19528 CVec_u8Z_free(ret_var);
19532 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
19533 LDKIgnoringMessageHandler this_obj_conv;
19534 this_obj_conv.inner = (void*)(this_obj & (~1));
19535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19536 IgnoringMessageHandler_free(this_obj_conv);
19539 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
19540 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
19541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19543 uint64_t ret_ref = (uint64_t)ret_var.inner;
19544 if (ret_var.is_owned) {
19550 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19551 LDKIgnoringMessageHandler this_arg_conv;
19552 this_arg_conv.inner = (void*)(this_arg & (~1));
19553 this_arg_conv.is_owned = false;
19554 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19555 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19556 return (uint64_t)ret;
19559 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
19560 LDKIgnoringMessageHandler this_arg_conv;
19561 this_arg_conv.inner = (void*)(this_arg & (~1));
19562 this_arg_conv.is_owned = false;
19563 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19564 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
19565 return (uint64_t)ret;
19568 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
19569 LDKErroringMessageHandler this_obj_conv;
19570 this_obj_conv.inner = (void*)(this_obj & (~1));
19571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19572 ErroringMessageHandler_free(this_obj_conv);
19575 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
19576 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
19577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19579 uint64_t ret_ref = (uint64_t)ret_var.inner;
19580 if (ret_var.is_owned) {
19586 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
19587 LDKErroringMessageHandler this_arg_conv;
19588 this_arg_conv.inner = (void*)(this_arg & (~1));
19589 this_arg_conv.is_owned = false;
19590 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19591 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
19592 return (uint64_t)ret;
19595 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
19596 LDKErroringMessageHandler this_arg_conv;
19597 this_arg_conv.inner = (void*)(this_arg & (~1));
19598 this_arg_conv.is_owned = false;
19599 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
19600 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
19601 return (uint64_t)ret;
19604 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
19605 LDKMessageHandler this_obj_conv;
19606 this_obj_conv.inner = (void*)(this_obj & (~1));
19607 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19608 MessageHandler_free(this_obj_conv);
19611 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
19612 LDKMessageHandler this_ptr_conv;
19613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19614 this_ptr_conv.is_owned = false;
19615 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
19619 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
19620 LDKMessageHandler this_ptr_conv;
19621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19622 this_ptr_conv.is_owned = false;
19623 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
19624 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
19627 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
19628 LDKMessageHandler this_ptr_conv;
19629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19630 this_ptr_conv.is_owned = false;
19631 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
19635 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
19636 LDKMessageHandler this_ptr_conv;
19637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19638 this_ptr_conv.is_owned = false;
19639 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
19640 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
19643 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
19644 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
19645 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
19646 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
19647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19649 uint64_t ret_ref = (uint64_t)ret_var.inner;
19650 if (ret_var.is_owned) {
19656 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
19657 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
19658 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19659 *ret = SocketDescriptor_clone(orig_conv);
19660 return (uint64_t)ret;
19663 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
19664 if ((this_ptr & 1) != 0) return;
19665 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
19666 FREE((void*)this_ptr);
19667 SocketDescriptor_free(this_ptr_conv);
19670 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
19671 LDKPeerHandleError this_obj_conv;
19672 this_obj_conv.inner = (void*)(this_obj & (~1));
19673 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19674 PeerHandleError_free(this_obj_conv);
19677 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
19678 LDKPeerHandleError this_ptr_conv;
19679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19680 this_ptr_conv.is_owned = false;
19681 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
19685 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
19686 LDKPeerHandleError this_ptr_conv;
19687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19688 this_ptr_conv.is_owned = false;
19689 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
19692 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
19693 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
19694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19696 uint64_t ret_ref = (uint64_t)ret_var.inner;
19697 if (ret_var.is_owned) {
19703 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
19704 LDKPeerHandleError orig_conv;
19705 orig_conv.inner = (void*)(orig & (~1));
19706 orig_conv.is_owned = false;
19707 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
19708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19710 uint64_t ret_ref = (uint64_t)ret_var.inner;
19711 if (ret_var.is_owned) {
19717 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
19718 LDKPeerManager this_obj_conv;
19719 this_obj_conv.inner = (void*)(this_obj & (~1));
19720 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19721 PeerManager_free(this_obj_conv);
19724 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) {
19725 LDKMessageHandler message_handler_conv;
19726 message_handler_conv.inner = (void*)(message_handler & (~1));
19727 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
19728 // Warning: we need a move here but no clone is available for LDKMessageHandler
19729 LDKSecretKey our_node_secret_ref;
19730 CHECK(*((uint32_t*)our_node_secret) == 32);
19731 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
19732 unsigned char ephemeral_random_data_arr[32];
19733 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
19734 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
19735 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
19736 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19737 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
19738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19740 uint64_t ret_ref = (uint64_t)ret_var.inner;
19741 if (ret_var.is_owned) {
19747 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
19748 LDKPeerManager this_arg_conv;
19749 this_arg_conv.inner = (void*)(this_arg & (~1));
19750 this_arg_conv.is_owned = false;
19751 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
19752 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
19753 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19754 for (size_t m = 0; m < ret_var.datalen; m++) {
19755 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19756 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
19757 ret_arr_ptr[m] = ret_conv_12_arr;
19759 FREE(ret_var.data);
19763 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
19764 LDKPeerManager this_arg_conv;
19765 this_arg_conv.inner = (void*)(this_arg & (~1));
19766 this_arg_conv.is_owned = false;
19767 LDKPublicKey their_node_id_ref;
19768 CHECK(*((uint32_t*)their_node_id) == 33);
19769 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
19770 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19771 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19772 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
19773 return (uint64_t)ret_conv;
19776 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
19777 LDKPeerManager this_arg_conv;
19778 this_arg_conv.inner = (void*)(this_arg & (~1));
19779 this_arg_conv.is_owned = false;
19780 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19781 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19782 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
19783 return (uint64_t)ret_conv;
19786 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
19787 LDKPeerManager this_arg_conv;
19788 this_arg_conv.inner = (void*)(this_arg & (~1));
19789 this_arg_conv.is_owned = false;
19790 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19791 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19792 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
19793 return (uint64_t)ret_conv;
19796 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
19797 LDKPeerManager this_arg_conv;
19798 this_arg_conv.inner = (void*)(this_arg & (~1));
19799 this_arg_conv.is_owned = false;
19800 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
19801 LDKu8slice data_ref;
19802 data_ref.datalen = *((uint32_t*)data);
19803 data_ref.data = (int8_t*)(data + 4);
19804 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
19805 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
19806 return (uint64_t)ret_conv;
19809 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
19810 LDKPeerManager this_arg_conv;
19811 this_arg_conv.inner = (void*)(this_arg & (~1));
19812 this_arg_conv.is_owned = false;
19813 PeerManager_process_events(&this_arg_conv);
19816 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
19817 LDKPeerManager this_arg_conv;
19818 this_arg_conv.inner = (void*)(this_arg & (~1));
19819 this_arg_conv.is_owned = false;
19820 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
19821 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
19824 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
19825 LDKPeerManager this_arg_conv;
19826 this_arg_conv.inner = (void*)(this_arg & (~1));
19827 this_arg_conv.is_owned = false;
19828 LDKPublicKey node_id_ref;
19829 CHECK(*((uint32_t*)node_id) == 33);
19830 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
19831 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
19834 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
19835 LDKPeerManager this_arg_conv;
19836 this_arg_conv.inner = (void*)(this_arg & (~1));
19837 this_arg_conv.is_owned = false;
19838 PeerManager_timer_tick_occurred(&this_arg_conv);
19841 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
19842 unsigned char commitment_seed_arr[32];
19843 CHECK(*((uint32_t*)commitment_seed) == 32);
19844 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
19845 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
19846 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19847 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
19851 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
19852 LDKPublicKey per_commitment_point_ref;
19853 CHECK(*((uint32_t*)per_commitment_point) == 33);
19854 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19855 unsigned char base_secret_arr[32];
19856 CHECK(*((uint32_t*)base_secret) == 32);
19857 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
19858 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
19859 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19860 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
19861 return (uint64_t)ret_conv;
19864 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
19865 LDKPublicKey per_commitment_point_ref;
19866 CHECK(*((uint32_t*)per_commitment_point) == 33);
19867 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19868 LDKPublicKey base_point_ref;
19869 CHECK(*((uint32_t*)base_point) == 33);
19870 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
19871 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19872 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
19873 return (uint64_t)ret_conv;
19876 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
19877 unsigned char per_commitment_secret_arr[32];
19878 CHECK(*((uint32_t*)per_commitment_secret) == 32);
19879 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
19880 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
19881 unsigned char countersignatory_revocation_base_secret_arr[32];
19882 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
19883 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
19884 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
19885 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
19886 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
19887 return (uint64_t)ret_conv;
19890 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
19891 LDKPublicKey per_commitment_point_ref;
19892 CHECK(*((uint32_t*)per_commitment_point) == 33);
19893 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
19894 LDKPublicKey countersignatory_revocation_base_point_ref;
19895 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
19896 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
19897 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19898 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
19899 return (uint64_t)ret_conv;
19902 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
19903 LDKTxCreationKeys this_obj_conv;
19904 this_obj_conv.inner = (void*)(this_obj & (~1));
19905 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19906 TxCreationKeys_free(this_obj_conv);
19909 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
19910 LDKTxCreationKeys this_ptr_conv;
19911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19912 this_ptr_conv.is_owned = false;
19913 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19914 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19918 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19919 LDKTxCreationKeys this_ptr_conv;
19920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19921 this_ptr_conv.is_owned = false;
19922 LDKPublicKey val_ref;
19923 CHECK(*((uint32_t*)val) == 33);
19924 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19925 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
19928 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
19929 LDKTxCreationKeys this_ptr_conv;
19930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19931 this_ptr_conv.is_owned = false;
19932 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19933 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
19937 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
19938 LDKTxCreationKeys this_ptr_conv;
19939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19940 this_ptr_conv.is_owned = false;
19941 LDKPublicKey val_ref;
19942 CHECK(*((uint32_t*)val) == 33);
19943 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19944 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
19947 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
19948 LDKTxCreationKeys this_ptr_conv;
19949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19950 this_ptr_conv.is_owned = false;
19951 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19952 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
19956 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
19957 LDKTxCreationKeys this_ptr_conv;
19958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19959 this_ptr_conv.is_owned = false;
19960 LDKPublicKey val_ref;
19961 CHECK(*((uint32_t*)val) == 33);
19962 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19963 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
19966 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
19967 LDKTxCreationKeys this_ptr_conv;
19968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19969 this_ptr_conv.is_owned = false;
19970 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19971 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
19975 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
19976 LDKTxCreationKeys this_ptr_conv;
19977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19978 this_ptr_conv.is_owned = false;
19979 LDKPublicKey val_ref;
19980 CHECK(*((uint32_t*)val) == 33);
19981 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19982 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
19985 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
19986 LDKTxCreationKeys this_ptr_conv;
19987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19988 this_ptr_conv.is_owned = false;
19989 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19990 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
19994 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
19995 LDKTxCreationKeys this_ptr_conv;
19996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19997 this_ptr_conv.is_owned = false;
19998 LDKPublicKey val_ref;
19999 CHECK(*((uint32_t*)val) == 33);
20000 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20001 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
20004 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) {
20005 LDKPublicKey per_commitment_point_arg_ref;
20006 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
20007 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
20008 LDKPublicKey revocation_key_arg_ref;
20009 CHECK(*((uint32_t*)revocation_key_arg) == 33);
20010 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
20011 LDKPublicKey broadcaster_htlc_key_arg_ref;
20012 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
20013 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
20014 LDKPublicKey countersignatory_htlc_key_arg_ref;
20015 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
20016 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
20017 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
20018 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
20019 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
20020 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);
20021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20023 uint64_t ret_ref = (uint64_t)ret_var.inner;
20024 if (ret_var.is_owned) {
20030 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
20031 LDKTxCreationKeys orig_conv;
20032 orig_conv.inner = (void*)(orig & (~1));
20033 orig_conv.is_owned = false;
20034 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
20035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20037 uint64_t ret_ref = (uint64_t)ret_var.inner;
20038 if (ret_var.is_owned) {
20044 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
20045 LDKTxCreationKeys obj_conv;
20046 obj_conv.inner = (void*)(obj & (~1));
20047 obj_conv.is_owned = false;
20048 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
20049 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20050 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20051 CVec_u8Z_free(ret_var);
20055 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
20056 LDKu8slice ser_ref;
20057 ser_ref.datalen = *((uint32_t*)ser);
20058 ser_ref.data = (int8_t*)(ser + 4);
20059 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
20060 *ret_conv = TxCreationKeys_read(ser_ref);
20061 return (uint64_t)ret_conv;
20064 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
20065 LDKChannelPublicKeys this_obj_conv;
20066 this_obj_conv.inner = (void*)(this_obj & (~1));
20067 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20068 ChannelPublicKeys_free(this_obj_conv);
20071 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
20072 LDKChannelPublicKeys this_ptr_conv;
20073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20074 this_ptr_conv.is_owned = false;
20075 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20076 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
20080 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
20081 LDKChannelPublicKeys this_ptr_conv;
20082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20083 this_ptr_conv.is_owned = false;
20084 LDKPublicKey val_ref;
20085 CHECK(*((uint32_t*)val) == 33);
20086 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20087 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
20090 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
20091 LDKChannelPublicKeys this_ptr_conv;
20092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20093 this_ptr_conv.is_owned = false;
20094 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20095 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
20099 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
20100 LDKChannelPublicKeys this_ptr_conv;
20101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20102 this_ptr_conv.is_owned = false;
20103 LDKPublicKey val_ref;
20104 CHECK(*((uint32_t*)val) == 33);
20105 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20106 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
20109 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
20110 LDKChannelPublicKeys this_ptr_conv;
20111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20112 this_ptr_conv.is_owned = false;
20113 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20114 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
20118 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
20119 LDKChannelPublicKeys this_ptr_conv;
20120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20121 this_ptr_conv.is_owned = false;
20122 LDKPublicKey val_ref;
20123 CHECK(*((uint32_t*)val) == 33);
20124 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20125 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
20128 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
20129 LDKChannelPublicKeys this_ptr_conv;
20130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20131 this_ptr_conv.is_owned = false;
20132 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20133 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
20137 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
20138 LDKChannelPublicKeys this_ptr_conv;
20139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20140 this_ptr_conv.is_owned = false;
20141 LDKPublicKey val_ref;
20142 CHECK(*((uint32_t*)val) == 33);
20143 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20144 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
20147 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
20148 LDKChannelPublicKeys this_ptr_conv;
20149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20150 this_ptr_conv.is_owned = false;
20151 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20152 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
20156 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
20157 LDKChannelPublicKeys this_ptr_conv;
20158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20159 this_ptr_conv.is_owned = false;
20160 LDKPublicKey val_ref;
20161 CHECK(*((uint32_t*)val) == 33);
20162 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
20163 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
20166 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) {
20167 LDKPublicKey funding_pubkey_arg_ref;
20168 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
20169 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
20170 LDKPublicKey revocation_basepoint_arg_ref;
20171 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
20172 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
20173 LDKPublicKey payment_point_arg_ref;
20174 CHECK(*((uint32_t*)payment_point_arg) == 33);
20175 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
20176 LDKPublicKey delayed_payment_basepoint_arg_ref;
20177 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
20178 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
20179 LDKPublicKey htlc_basepoint_arg_ref;
20180 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
20181 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
20182 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);
20183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20185 uint64_t ret_ref = (uint64_t)ret_var.inner;
20186 if (ret_var.is_owned) {
20192 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
20193 LDKChannelPublicKeys orig_conv;
20194 orig_conv.inner = (void*)(orig & (~1));
20195 orig_conv.is_owned = false;
20196 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
20197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20199 uint64_t ret_ref = (uint64_t)ret_var.inner;
20200 if (ret_var.is_owned) {
20206 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
20207 LDKChannelPublicKeys obj_conv;
20208 obj_conv.inner = (void*)(obj & (~1));
20209 obj_conv.is_owned = false;
20210 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
20211 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20212 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20213 CVec_u8Z_free(ret_var);
20217 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
20218 LDKu8slice ser_ref;
20219 ser_ref.datalen = *((uint32_t*)ser);
20220 ser_ref.data = (int8_t*)(ser + 4);
20221 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
20222 *ret_conv = ChannelPublicKeys_read(ser_ref);
20223 return (uint64_t)ret_conv;
20226 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) {
20227 LDKPublicKey per_commitment_point_ref;
20228 CHECK(*((uint32_t*)per_commitment_point) == 33);
20229 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
20230 LDKPublicKey broadcaster_delayed_payment_base_ref;
20231 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
20232 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
20233 LDKPublicKey broadcaster_htlc_base_ref;
20234 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
20235 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
20236 LDKPublicKey countersignatory_revocation_base_ref;
20237 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
20238 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
20239 LDKPublicKey countersignatory_htlc_base_ref;
20240 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
20241 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
20242 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
20243 *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);
20244 return (uint64_t)ret_conv;
20247 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
20248 LDKPublicKey per_commitment_point_ref;
20249 CHECK(*((uint32_t*)per_commitment_point) == 33);
20250 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
20251 LDKChannelPublicKeys broadcaster_keys_conv;
20252 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
20253 broadcaster_keys_conv.is_owned = false;
20254 LDKChannelPublicKeys countersignatory_keys_conv;
20255 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
20256 countersignatory_keys_conv.is_owned = false;
20257 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
20258 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
20259 return (uint64_t)ret_conv;
20262 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
20263 LDKPublicKey revocation_key_ref;
20264 CHECK(*((uint32_t*)revocation_key) == 33);
20265 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
20266 LDKPublicKey broadcaster_delayed_payment_key_ref;
20267 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
20268 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
20269 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
20270 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20271 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20272 CVec_u8Z_free(ret_var);
20276 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
20277 LDKHTLCOutputInCommitment this_obj_conv;
20278 this_obj_conv.inner = (void*)(this_obj & (~1));
20279 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20280 HTLCOutputInCommitment_free(this_obj_conv);
20283 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
20284 LDKHTLCOutputInCommitment this_ptr_conv;
20285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20286 this_ptr_conv.is_owned = false;
20287 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
20291 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
20292 LDKHTLCOutputInCommitment this_ptr_conv;
20293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20294 this_ptr_conv.is_owned = false;
20295 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
20298 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
20299 LDKHTLCOutputInCommitment this_ptr_conv;
20300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20301 this_ptr_conv.is_owned = false;
20302 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
20306 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
20307 LDKHTLCOutputInCommitment this_ptr_conv;
20308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20309 this_ptr_conv.is_owned = false;
20310 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
20313 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
20314 LDKHTLCOutputInCommitment this_ptr_conv;
20315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20316 this_ptr_conv.is_owned = false;
20317 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
20321 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
20322 LDKHTLCOutputInCommitment this_ptr_conv;
20323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20324 this_ptr_conv.is_owned = false;
20325 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
20328 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
20329 LDKHTLCOutputInCommitment this_ptr_conv;
20330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20331 this_ptr_conv.is_owned = false;
20332 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20333 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
20337 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
20338 LDKHTLCOutputInCommitment this_ptr_conv;
20339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20340 this_ptr_conv.is_owned = false;
20341 LDKThirtyTwoBytes val_ref;
20342 CHECK(*((uint32_t*)val) == 32);
20343 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20344 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
20347 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
20348 LDKHTLCOutputInCommitment this_ptr_conv;
20349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20350 this_ptr_conv.is_owned = false;
20351 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
20352 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
20353 uint64_t ret_ref = (uint64_t)ret_copy;
20357 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
20358 LDKHTLCOutputInCommitment this_ptr_conv;
20359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20360 this_ptr_conv.is_owned = false;
20361 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
20362 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
20365 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) {
20366 LDKThirtyTwoBytes payment_hash_arg_ref;
20367 CHECK(*((uint32_t*)payment_hash_arg) == 32);
20368 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
20369 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
20370 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
20371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20373 uint64_t ret_ref = (uint64_t)ret_var.inner;
20374 if (ret_var.is_owned) {
20380 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
20381 LDKHTLCOutputInCommitment orig_conv;
20382 orig_conv.inner = (void*)(orig & (~1));
20383 orig_conv.is_owned = false;
20384 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
20385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20387 uint64_t ret_ref = (uint64_t)ret_var.inner;
20388 if (ret_var.is_owned) {
20394 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
20395 LDKHTLCOutputInCommitment obj_conv;
20396 obj_conv.inner = (void*)(obj & (~1));
20397 obj_conv.is_owned = false;
20398 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
20399 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20400 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20401 CVec_u8Z_free(ret_var);
20405 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
20406 LDKu8slice ser_ref;
20407 ser_ref.datalen = *((uint32_t*)ser);
20408 ser_ref.data = (int8_t*)(ser + 4);
20409 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
20410 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
20411 return (uint64_t)ret_conv;
20414 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
20415 LDKHTLCOutputInCommitment htlc_conv;
20416 htlc_conv.inner = (void*)(htlc & (~1));
20417 htlc_conv.is_owned = false;
20418 LDKTxCreationKeys keys_conv;
20419 keys_conv.inner = (void*)(keys & (~1));
20420 keys_conv.is_owned = false;
20421 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
20422 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20423 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20424 CVec_u8Z_free(ret_var);
20428 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
20429 LDKPublicKey broadcaster_ref;
20430 CHECK(*((uint32_t*)broadcaster) == 33);
20431 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
20432 LDKPublicKey countersignatory_ref;
20433 CHECK(*((uint32_t*)countersignatory) == 33);
20434 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
20435 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
20436 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20437 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20438 CVec_u8Z_free(ret_var);
20442 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) {
20443 unsigned char commitment_txid_arr[32];
20444 CHECK(*((uint32_t*)commitment_txid) == 32);
20445 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
20446 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
20447 LDKHTLCOutputInCommitment htlc_conv;
20448 htlc_conv.inner = (void*)(htlc & (~1));
20449 htlc_conv.is_owned = false;
20450 LDKPublicKey broadcaster_delayed_payment_key_ref;
20451 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
20452 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
20453 LDKPublicKey revocation_key_ref;
20454 CHECK(*((uint32_t*)revocation_key) == 33);
20455 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
20456 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
20457 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20458 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20459 Transaction_free(ret_var);
20463 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
20464 LDKChannelTransactionParameters this_obj_conv;
20465 this_obj_conv.inner = (void*)(this_obj & (~1));
20466 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20467 ChannelTransactionParameters_free(this_obj_conv);
20470 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
20471 LDKChannelTransactionParameters this_ptr_conv;
20472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20473 this_ptr_conv.is_owned = false;
20474 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
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_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
20485 LDKChannelTransactionParameters this_ptr_conv;
20486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20487 this_ptr_conv.is_owned = false;
20488 LDKChannelPublicKeys val_conv;
20489 val_conv.inner = (void*)(val & (~1));
20490 val_conv.is_owned = (val & 1) || (val == 0);
20491 val_conv = ChannelPublicKeys_clone(&val_conv);
20492 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
20495 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
20496 LDKChannelTransactionParameters this_ptr_conv;
20497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20498 this_ptr_conv.is_owned = false;
20499 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
20503 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20504 LDKChannelTransactionParameters this_ptr_conv;
20505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20506 this_ptr_conv.is_owned = false;
20507 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
20510 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
20511 LDKChannelTransactionParameters this_ptr_conv;
20512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20513 this_ptr_conv.is_owned = false;
20514 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
20518 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
20519 LDKChannelTransactionParameters this_ptr_conv;
20520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20521 this_ptr_conv.is_owned = false;
20522 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
20525 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
20526 LDKChannelTransactionParameters this_ptr_conv;
20527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20528 this_ptr_conv.is_owned = false;
20529 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
20530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20532 uint64_t ret_ref = (uint64_t)ret_var.inner;
20533 if (ret_var.is_owned) {
20539 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
20540 LDKChannelTransactionParameters this_ptr_conv;
20541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20542 this_ptr_conv.is_owned = false;
20543 LDKCounterpartyChannelTransactionParameters val_conv;
20544 val_conv.inner = (void*)(val & (~1));
20545 val_conv.is_owned = (val & 1) || (val == 0);
20546 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
20547 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
20550 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
20551 LDKChannelTransactionParameters this_ptr_conv;
20552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20553 this_ptr_conv.is_owned = false;
20554 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
20555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20557 uint64_t ret_ref = (uint64_t)ret_var.inner;
20558 if (ret_var.is_owned) {
20564 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
20565 LDKChannelTransactionParameters this_ptr_conv;
20566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20567 this_ptr_conv.is_owned = false;
20568 LDKOutPoint val_conv;
20569 val_conv.inner = (void*)(val & (~1));
20570 val_conv.is_owned = (val & 1) || (val == 0);
20571 val_conv = OutPoint_clone(&val_conv);
20572 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
20575 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) {
20576 LDKChannelPublicKeys holder_pubkeys_arg_conv;
20577 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
20578 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
20579 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
20580 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
20581 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
20582 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
20583 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
20584 LDKOutPoint funding_outpoint_arg_conv;
20585 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
20586 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
20587 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
20588 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);
20589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20591 uint64_t ret_ref = (uint64_t)ret_var.inner;
20592 if (ret_var.is_owned) {
20598 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
20599 LDKChannelTransactionParameters orig_conv;
20600 orig_conv.inner = (void*)(orig & (~1));
20601 orig_conv.is_owned = false;
20602 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
20603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20605 uint64_t ret_ref = (uint64_t)ret_var.inner;
20606 if (ret_var.is_owned) {
20612 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
20613 LDKCounterpartyChannelTransactionParameters this_obj_conv;
20614 this_obj_conv.inner = (void*)(this_obj & (~1));
20615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20616 CounterpartyChannelTransactionParameters_free(this_obj_conv);
20619 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
20620 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20622 this_ptr_conv.is_owned = false;
20623 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
20624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20626 uint64_t ret_ref = (uint64_t)ret_var.inner;
20627 if (ret_var.is_owned) {
20633 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
20634 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20636 this_ptr_conv.is_owned = false;
20637 LDKChannelPublicKeys val_conv;
20638 val_conv.inner = (void*)(val & (~1));
20639 val_conv.is_owned = (val & 1) || (val == 0);
20640 val_conv = ChannelPublicKeys_clone(&val_conv);
20641 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
20644 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
20645 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20647 this_ptr_conv.is_owned = false;
20648 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
20652 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
20653 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
20654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20655 this_ptr_conv.is_owned = false;
20656 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
20659 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
20660 LDKChannelPublicKeys pubkeys_arg_conv;
20661 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
20662 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
20663 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
20664 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
20665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20667 uint64_t ret_ref = (uint64_t)ret_var.inner;
20668 if (ret_var.is_owned) {
20674 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
20675 LDKCounterpartyChannelTransactionParameters orig_conv;
20676 orig_conv.inner = (void*)(orig & (~1));
20677 orig_conv.is_owned = false;
20678 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
20679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20681 uint64_t ret_ref = (uint64_t)ret_var.inner;
20682 if (ret_var.is_owned) {
20688 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
20689 LDKChannelTransactionParameters this_arg_conv;
20690 this_arg_conv.inner = (void*)(this_arg & (~1));
20691 this_arg_conv.is_owned = false;
20692 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
20696 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
20697 LDKChannelTransactionParameters this_arg_conv;
20698 this_arg_conv.inner = (void*)(this_arg & (~1));
20699 this_arg_conv.is_owned = false;
20700 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
20701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20703 uint64_t ret_ref = (uint64_t)ret_var.inner;
20704 if (ret_var.is_owned) {
20710 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
20711 LDKChannelTransactionParameters this_arg_conv;
20712 this_arg_conv.inner = (void*)(this_arg & (~1));
20713 this_arg_conv.is_owned = false;
20714 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
20715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20717 uint64_t ret_ref = (uint64_t)ret_var.inner;
20718 if (ret_var.is_owned) {
20724 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
20725 LDKCounterpartyChannelTransactionParameters obj_conv;
20726 obj_conv.inner = (void*)(obj & (~1));
20727 obj_conv.is_owned = false;
20728 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
20729 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20730 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20731 CVec_u8Z_free(ret_var);
20735 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
20736 LDKu8slice ser_ref;
20737 ser_ref.datalen = *((uint32_t*)ser);
20738 ser_ref.data = (int8_t*)(ser + 4);
20739 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
20740 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
20741 return (uint64_t)ret_conv;
20744 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
20745 LDKChannelTransactionParameters obj_conv;
20746 obj_conv.inner = (void*)(obj & (~1));
20747 obj_conv.is_owned = false;
20748 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
20749 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20750 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20751 CVec_u8Z_free(ret_var);
20755 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
20756 LDKu8slice ser_ref;
20757 ser_ref.datalen = *((uint32_t*)ser);
20758 ser_ref.data = (int8_t*)(ser + 4);
20759 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
20760 *ret_conv = ChannelTransactionParameters_read(ser_ref);
20761 return (uint64_t)ret_conv;
20764 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
20765 LDKDirectedChannelTransactionParameters this_obj_conv;
20766 this_obj_conv.inner = (void*)(this_obj & (~1));
20767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20768 DirectedChannelTransactionParameters_free(this_obj_conv);
20771 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
20772 LDKDirectedChannelTransactionParameters this_arg_conv;
20773 this_arg_conv.inner = (void*)(this_arg & (~1));
20774 this_arg_conv.is_owned = false;
20775 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
20776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20778 uint64_t ret_ref = (uint64_t)ret_var.inner;
20779 if (ret_var.is_owned) {
20785 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
20786 LDKDirectedChannelTransactionParameters this_arg_conv;
20787 this_arg_conv.inner = (void*)(this_arg & (~1));
20788 this_arg_conv.is_owned = false;
20789 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
20790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20792 uint64_t ret_ref = (uint64_t)ret_var.inner;
20793 if (ret_var.is_owned) {
20799 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
20800 LDKDirectedChannelTransactionParameters this_arg_conv;
20801 this_arg_conv.inner = (void*)(this_arg & (~1));
20802 this_arg_conv.is_owned = false;
20803 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
20807 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
20808 LDKDirectedChannelTransactionParameters this_arg_conv;
20809 this_arg_conv.inner = (void*)(this_arg & (~1));
20810 this_arg_conv.is_owned = false;
20811 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
20815 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
20816 LDKDirectedChannelTransactionParameters this_arg_conv;
20817 this_arg_conv.inner = (void*)(this_arg & (~1));
20818 this_arg_conv.is_owned = false;
20819 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
20820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20822 uint64_t ret_ref = (uint64_t)ret_var.inner;
20823 if (ret_var.is_owned) {
20829 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
20830 LDKHolderCommitmentTransaction this_obj_conv;
20831 this_obj_conv.inner = (void*)(this_obj & (~1));
20832 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20833 HolderCommitmentTransaction_free(this_obj_conv);
20836 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
20837 LDKHolderCommitmentTransaction this_ptr_conv;
20838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20839 this_ptr_conv.is_owned = false;
20840 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
20841 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
20845 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
20846 LDKHolderCommitmentTransaction this_ptr_conv;
20847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20848 this_ptr_conv.is_owned = false;
20849 LDKSignature val_ref;
20850 CHECK(*((uint32_t*)val) == 64);
20851 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
20852 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
20855 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
20856 LDKHolderCommitmentTransaction this_ptr_conv;
20857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20858 this_ptr_conv.is_owned = false;
20859 LDKCVec_SignatureZ val_constr;
20860 val_constr.datalen = *((uint32_t*)val);
20861 if (val_constr.datalen > 0)
20862 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20864 val_constr.data = NULL;
20865 int8_tArray* val_vals = (int8_tArray*)(val + 4);
20866 for (size_t m = 0; m < val_constr.datalen; m++) {
20867 int8_tArray val_conv_12 = val_vals[m];
20868 LDKSignature val_conv_12_ref;
20869 CHECK(*((uint32_t*)val_conv_12) == 64);
20870 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
20871 val_constr.data[m] = val_conv_12_ref;
20873 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
20876 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
20877 LDKHolderCommitmentTransaction orig_conv;
20878 orig_conv.inner = (void*)(orig & (~1));
20879 orig_conv.is_owned = false;
20880 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_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 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
20891 LDKHolderCommitmentTransaction obj_conv;
20892 obj_conv.inner = (void*)(obj & (~1));
20893 obj_conv.is_owned = false;
20894 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
20895 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20896 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20897 CVec_u8Z_free(ret_var);
20901 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
20902 LDKu8slice ser_ref;
20903 ser_ref.datalen = *((uint32_t*)ser);
20904 ser_ref.data = (int8_t*)(ser + 4);
20905 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
20906 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
20907 return (uint64_t)ret_conv;
20910 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) {
20911 LDKCommitmentTransaction commitment_tx_conv;
20912 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
20913 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
20914 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
20915 LDKSignature counterparty_sig_ref;
20916 CHECK(*((uint32_t*)counterparty_sig) == 64);
20917 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
20918 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
20919 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
20920 if (counterparty_htlc_sigs_constr.datalen > 0)
20921 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20923 counterparty_htlc_sigs_constr.data = NULL;
20924 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
20925 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
20926 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
20927 LDKSignature counterparty_htlc_sigs_conv_12_ref;
20928 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
20929 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
20930 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
20932 LDKPublicKey holder_funding_key_ref;
20933 CHECK(*((uint32_t*)holder_funding_key) == 33);
20934 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
20935 LDKPublicKey counterparty_funding_key_ref;
20936 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
20937 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
20938 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
20939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20941 uint64_t ret_ref = (uint64_t)ret_var.inner;
20942 if (ret_var.is_owned) {
20948 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
20949 LDKBuiltCommitmentTransaction this_obj_conv;
20950 this_obj_conv.inner = (void*)(this_obj & (~1));
20951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20952 BuiltCommitmentTransaction_free(this_obj_conv);
20955 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
20956 LDKBuiltCommitmentTransaction this_ptr_conv;
20957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20958 this_ptr_conv.is_owned = false;
20959 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
20960 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20961 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20962 Transaction_free(ret_var);
20966 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
20967 LDKBuiltCommitmentTransaction this_ptr_conv;
20968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20969 this_ptr_conv.is_owned = false;
20970 LDKTransaction val_ref;
20971 val_ref.datalen = *((uint32_t*)val);
20972 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
20973 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
20974 val_ref.data_is_owned = true;
20975 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
20978 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
20979 LDKBuiltCommitmentTransaction this_ptr_conv;
20980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20981 this_ptr_conv.is_owned = false;
20982 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20983 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
20987 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
20988 LDKBuiltCommitmentTransaction this_ptr_conv;
20989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20990 this_ptr_conv.is_owned = false;
20991 LDKThirtyTwoBytes val_ref;
20992 CHECK(*((uint32_t*)val) == 32);
20993 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20994 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
20997 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
20998 LDKTransaction transaction_arg_ref;
20999 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
21000 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
21001 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
21002 transaction_arg_ref.data_is_owned = true;
21003 LDKThirtyTwoBytes txid_arg_ref;
21004 CHECK(*((uint32_t*)txid_arg) == 32);
21005 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
21006 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
21007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21009 uint64_t ret_ref = (uint64_t)ret_var.inner;
21010 if (ret_var.is_owned) {
21016 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
21017 LDKBuiltCommitmentTransaction orig_conv;
21018 orig_conv.inner = (void*)(orig & (~1));
21019 orig_conv.is_owned = false;
21020 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
21021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21023 uint64_t ret_ref = (uint64_t)ret_var.inner;
21024 if (ret_var.is_owned) {
21030 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
21031 LDKBuiltCommitmentTransaction obj_conv;
21032 obj_conv.inner = (void*)(obj & (~1));
21033 obj_conv.is_owned = false;
21034 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_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 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
21042 LDKu8slice ser_ref;
21043 ser_ref.datalen = *((uint32_t*)ser);
21044 ser_ref.data = (int8_t*)(ser + 4);
21045 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
21046 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
21047 return (uint64_t)ret_conv;
21050 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
21051 LDKBuiltCommitmentTransaction this_arg_conv;
21052 this_arg_conv.inner = (void*)(this_arg & (~1));
21053 this_arg_conv.is_owned = false;
21054 LDKu8slice funding_redeemscript_ref;
21055 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
21056 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
21057 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21058 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
21062 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) {
21063 LDKBuiltCommitmentTransaction this_arg_conv;
21064 this_arg_conv.inner = (void*)(this_arg & (~1));
21065 this_arg_conv.is_owned = false;
21066 unsigned char funding_key_arr[32];
21067 CHECK(*((uint32_t*)funding_key) == 32);
21068 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
21069 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
21070 LDKu8slice funding_redeemscript_ref;
21071 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
21072 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
21073 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
21074 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
21078 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
21079 LDKCommitmentTransaction this_obj_conv;
21080 this_obj_conv.inner = (void*)(this_obj & (~1));
21081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21082 CommitmentTransaction_free(this_obj_conv);
21085 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
21086 LDKCommitmentTransaction orig_conv;
21087 orig_conv.inner = (void*)(orig & (~1));
21088 orig_conv.is_owned = false;
21089 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
21090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21092 uint64_t ret_ref = (uint64_t)ret_var.inner;
21093 if (ret_var.is_owned) {
21099 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
21100 LDKCommitmentTransaction obj_conv;
21101 obj_conv.inner = (void*)(obj & (~1));
21102 obj_conv.is_owned = false;
21103 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
21104 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21105 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21106 CVec_u8Z_free(ret_var);
21110 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
21111 LDKu8slice ser_ref;
21112 ser_ref.datalen = *((uint32_t*)ser);
21113 ser_ref.data = (int8_t*)(ser + 4);
21114 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
21115 *ret_conv = CommitmentTransaction_read(ser_ref);
21116 return (uint64_t)ret_conv;
21119 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
21120 LDKCommitmentTransaction this_arg_conv;
21121 this_arg_conv.inner = (void*)(this_arg & (~1));
21122 this_arg_conv.is_owned = false;
21123 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
21127 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
21128 LDKCommitmentTransaction this_arg_conv;
21129 this_arg_conv.inner = (void*)(this_arg & (~1));
21130 this_arg_conv.is_owned = false;
21131 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
21135 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
21136 LDKCommitmentTransaction this_arg_conv;
21137 this_arg_conv.inner = (void*)(this_arg & (~1));
21138 this_arg_conv.is_owned = false;
21139 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
21143 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
21144 LDKCommitmentTransaction this_arg_conv;
21145 this_arg_conv.inner = (void*)(this_arg & (~1));
21146 this_arg_conv.is_owned = false;
21147 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
21151 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
21152 LDKCommitmentTransaction this_arg_conv;
21153 this_arg_conv.inner = (void*)(this_arg & (~1));
21154 this_arg_conv.is_owned = false;
21155 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
21156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21158 uint64_t ret_ref = (uint64_t)ret_var.inner;
21159 if (ret_var.is_owned) {
21165 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
21166 LDKCommitmentTransaction this_arg_conv;
21167 this_arg_conv.inner = (void*)(this_arg & (~1));
21168 this_arg_conv.is_owned = false;
21169 LDKDirectedChannelTransactionParameters channel_parameters_conv;
21170 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
21171 channel_parameters_conv.is_owned = false;
21172 LDKChannelPublicKeys broadcaster_keys_conv;
21173 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21174 broadcaster_keys_conv.is_owned = false;
21175 LDKChannelPublicKeys countersignatory_keys_conv;
21176 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21177 countersignatory_keys_conv.is_owned = false;
21178 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
21179 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
21180 return (uint64_t)ret_conv;
21183 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
21184 LDKTrustedCommitmentTransaction this_obj_conv;
21185 this_obj_conv.inner = (void*)(this_obj & (~1));
21186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21187 TrustedCommitmentTransaction_free(this_obj_conv);
21190 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
21191 LDKTrustedCommitmentTransaction this_arg_conv;
21192 this_arg_conv.inner = (void*)(this_arg & (~1));
21193 this_arg_conv.is_owned = false;
21194 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21195 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
21199 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
21200 LDKTrustedCommitmentTransaction this_arg_conv;
21201 this_arg_conv.inner = (void*)(this_arg & (~1));
21202 this_arg_conv.is_owned = false;
21203 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
21204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21206 uint64_t ret_ref = (uint64_t)ret_var.inner;
21207 if (ret_var.is_owned) {
21213 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
21214 LDKTrustedCommitmentTransaction this_arg_conv;
21215 this_arg_conv.inner = (void*)(this_arg & (~1));
21216 this_arg_conv.is_owned = false;
21217 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
21218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21220 uint64_t ret_ref = (uint64_t)ret_var.inner;
21221 if (ret_var.is_owned) {
21227 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
21228 LDKTrustedCommitmentTransaction this_arg_conv;
21229 this_arg_conv.inner = (void*)(this_arg & (~1));
21230 this_arg_conv.is_owned = false;
21231 unsigned char htlc_base_key_arr[32];
21232 CHECK(*((uint32_t*)htlc_base_key) == 32);
21233 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
21234 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
21235 LDKDirectedChannelTransactionParameters channel_parameters_conv;
21236 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
21237 channel_parameters_conv.is_owned = false;
21238 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
21239 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
21240 return (uint64_t)ret_conv;
21243 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) {
21244 LDKPublicKey broadcaster_payment_basepoint_ref;
21245 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
21246 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
21247 LDKPublicKey countersignatory_payment_basepoint_ref;
21248 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
21249 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
21250 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
21254 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
21255 LDKInitFeatures a_conv;
21256 a_conv.inner = (void*)(a & (~1));
21257 a_conv.is_owned = false;
21258 LDKInitFeatures b_conv;
21259 b_conv.inner = (void*)(b & (~1));
21260 b_conv.is_owned = false;
21261 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
21265 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
21266 LDKNodeFeatures a_conv;
21267 a_conv.inner = (void*)(a & (~1));
21268 a_conv.is_owned = false;
21269 LDKNodeFeatures b_conv;
21270 b_conv.inner = (void*)(b & (~1));
21271 b_conv.is_owned = false;
21272 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
21276 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
21277 LDKChannelFeatures a_conv;
21278 a_conv.inner = (void*)(a & (~1));
21279 a_conv.is_owned = false;
21280 LDKChannelFeatures b_conv;
21281 b_conv.inner = (void*)(b & (~1));
21282 b_conv.is_owned = false;
21283 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
21287 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
21288 LDKInvoiceFeatures a_conv;
21289 a_conv.inner = (void*)(a & (~1));
21290 a_conv.is_owned = false;
21291 LDKInvoiceFeatures b_conv;
21292 b_conv.inner = (void*)(b & (~1));
21293 b_conv.is_owned = false;
21294 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
21298 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
21299 LDKInitFeatures orig_conv;
21300 orig_conv.inner = (void*)(orig & (~1));
21301 orig_conv.is_owned = false;
21302 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
21303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21305 uint64_t ret_ref = (uint64_t)ret_var.inner;
21306 if (ret_var.is_owned) {
21312 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
21313 LDKNodeFeatures orig_conv;
21314 orig_conv.inner = (void*)(orig & (~1));
21315 orig_conv.is_owned = false;
21316 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
21317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21319 uint64_t ret_ref = (uint64_t)ret_var.inner;
21320 if (ret_var.is_owned) {
21326 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
21327 LDKChannelFeatures orig_conv;
21328 orig_conv.inner = (void*)(orig & (~1));
21329 orig_conv.is_owned = false;
21330 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
21331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21333 uint64_t ret_ref = (uint64_t)ret_var.inner;
21334 if (ret_var.is_owned) {
21340 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
21341 LDKInvoiceFeatures orig_conv;
21342 orig_conv.inner = (void*)(orig & (~1));
21343 orig_conv.is_owned = false;
21344 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
21345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21347 uint64_t ret_ref = (uint64_t)ret_var.inner;
21348 if (ret_var.is_owned) {
21354 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
21355 LDKInitFeatures this_obj_conv;
21356 this_obj_conv.inner = (void*)(this_obj & (~1));
21357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21358 InitFeatures_free(this_obj_conv);
21361 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
21362 LDKNodeFeatures this_obj_conv;
21363 this_obj_conv.inner = (void*)(this_obj & (~1));
21364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21365 NodeFeatures_free(this_obj_conv);
21368 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
21369 LDKChannelFeatures this_obj_conv;
21370 this_obj_conv.inner = (void*)(this_obj & (~1));
21371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21372 ChannelFeatures_free(this_obj_conv);
21375 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
21376 LDKInvoiceFeatures this_obj_conv;
21377 this_obj_conv.inner = (void*)(this_obj & (~1));
21378 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21379 InvoiceFeatures_free(this_obj_conv);
21382 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
21383 LDKInitFeatures ret_var = InitFeatures_empty();
21384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21386 uint64_t ret_ref = (uint64_t)ret_var.inner;
21387 if (ret_var.is_owned) {
21393 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
21394 LDKInitFeatures ret_var = InitFeatures_known();
21395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21397 uint64_t ret_ref = (uint64_t)ret_var.inner;
21398 if (ret_var.is_owned) {
21404 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
21405 LDKNodeFeatures ret_var = NodeFeatures_empty();
21406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21408 uint64_t ret_ref = (uint64_t)ret_var.inner;
21409 if (ret_var.is_owned) {
21415 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
21416 LDKNodeFeatures ret_var = NodeFeatures_known();
21417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21419 uint64_t ret_ref = (uint64_t)ret_var.inner;
21420 if (ret_var.is_owned) {
21426 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
21427 LDKChannelFeatures ret_var = ChannelFeatures_empty();
21428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21430 uint64_t ret_ref = (uint64_t)ret_var.inner;
21431 if (ret_var.is_owned) {
21437 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
21438 LDKChannelFeatures ret_var = ChannelFeatures_known();
21439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21441 uint64_t ret_ref = (uint64_t)ret_var.inner;
21442 if (ret_var.is_owned) {
21448 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
21449 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
21450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21452 uint64_t ret_ref = (uint64_t)ret_var.inner;
21453 if (ret_var.is_owned) {
21459 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
21460 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
21461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21463 uint64_t ret_ref = (uint64_t)ret_var.inner;
21464 if (ret_var.is_owned) {
21470 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
21471 LDKInitFeatures this_arg_conv;
21472 this_arg_conv.inner = (void*)(this_arg & (~1));
21473 this_arg_conv.is_owned = false;
21474 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
21478 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
21479 LDKNodeFeatures this_arg_conv;
21480 this_arg_conv.inner = (void*)(this_arg & (~1));
21481 this_arg_conv.is_owned = false;
21482 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
21486 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
21487 LDKInvoiceFeatures this_arg_conv;
21488 this_arg_conv.inner = (void*)(this_arg & (~1));
21489 this_arg_conv.is_owned = false;
21490 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
21494 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
21495 LDKInitFeatures obj_conv;
21496 obj_conv.inner = (void*)(obj & (~1));
21497 obj_conv.is_owned = false;
21498 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
21499 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21500 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21501 CVec_u8Z_free(ret_var);
21505 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
21506 LDKNodeFeatures obj_conv;
21507 obj_conv.inner = (void*)(obj & (~1));
21508 obj_conv.is_owned = false;
21509 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
21510 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21511 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21512 CVec_u8Z_free(ret_var);
21516 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
21517 LDKChannelFeatures obj_conv;
21518 obj_conv.inner = (void*)(obj & (~1));
21519 obj_conv.is_owned = false;
21520 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
21521 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21522 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21523 CVec_u8Z_free(ret_var);
21527 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
21528 LDKInvoiceFeatures obj_conv;
21529 obj_conv.inner = (void*)(obj & (~1));
21530 obj_conv.is_owned = false;
21531 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
21532 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21533 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21534 CVec_u8Z_free(ret_var);
21538 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
21539 LDKu8slice ser_ref;
21540 ser_ref.datalen = *((uint32_t*)ser);
21541 ser_ref.data = (int8_t*)(ser + 4);
21542 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21543 *ret_conv = InitFeatures_read(ser_ref);
21544 return (uint64_t)ret_conv;
21547 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
21548 LDKu8slice ser_ref;
21549 ser_ref.datalen = *((uint32_t*)ser);
21550 ser_ref.data = (int8_t*)(ser + 4);
21551 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21552 *ret_conv = NodeFeatures_read(ser_ref);
21553 return (uint64_t)ret_conv;
21556 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
21557 LDKu8slice ser_ref;
21558 ser_ref.datalen = *((uint32_t*)ser);
21559 ser_ref.data = (int8_t*)(ser + 4);
21560 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21561 *ret_conv = ChannelFeatures_read(ser_ref);
21562 return (uint64_t)ret_conv;
21565 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
21566 LDKu8slice ser_ref;
21567 ser_ref.datalen = *((uint32_t*)ser);
21568 ser_ref.data = (int8_t*)(ser + 4);
21569 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
21570 *ret_conv = InvoiceFeatures_read(ser_ref);
21571 return (uint64_t)ret_conv;
21574 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
21575 LDKShutdownScript this_obj_conv;
21576 this_obj_conv.inner = (void*)(this_obj & (~1));
21577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21578 ShutdownScript_free(this_obj_conv);
21581 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
21582 LDKShutdownScript orig_conv;
21583 orig_conv.inner = (void*)(orig & (~1));
21584 orig_conv.is_owned = false;
21585 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
21586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21588 uint64_t ret_ref = (uint64_t)ret_var.inner;
21589 if (ret_var.is_owned) {
21595 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
21596 LDKInvalidShutdownScript this_obj_conv;
21597 this_obj_conv.inner = (void*)(this_obj & (~1));
21598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21599 InvalidShutdownScript_free(this_obj_conv);
21602 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
21603 LDKInvalidShutdownScript this_ptr_conv;
21604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21605 this_ptr_conv.is_owned = false;
21606 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
21607 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21608 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21612 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
21613 LDKInvalidShutdownScript this_ptr_conv;
21614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21615 this_ptr_conv.is_owned = false;
21616 LDKCVec_u8Z val_ref;
21617 val_ref.datalen = *((uint32_t*)val);
21618 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21619 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
21620 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
21623 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
21624 LDKCVec_u8Z script_arg_ref;
21625 script_arg_ref.datalen = *((uint32_t*)script_arg);
21626 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21627 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
21628 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
21629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21631 uint64_t ret_ref = (uint64_t)ret_var.inner;
21632 if (ret_var.is_owned) {
21638 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
21639 LDKShutdownScript obj_conv;
21640 obj_conv.inner = (void*)(obj & (~1));
21641 obj_conv.is_owned = false;
21642 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
21643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21645 CVec_u8Z_free(ret_var);
21649 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
21650 LDKu8slice ser_ref;
21651 ser_ref.datalen = *((uint32_t*)ser);
21652 ser_ref.data = (int8_t*)(ser + 4);
21653 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
21654 *ret_conv = ShutdownScript_read(ser_ref);
21655 return (uint64_t)ret_conv;
21658 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
21659 unsigned char pubkey_hash_arr[20];
21660 CHECK(*((uint32_t*)pubkey_hash) == 20);
21661 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
21662 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
21663 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
21664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21666 uint64_t ret_ref = (uint64_t)ret_var.inner;
21667 if (ret_var.is_owned) {
21673 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
21674 unsigned char script_hash_arr[20];
21675 CHECK(*((uint32_t*)script_hash) == 20);
21676 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
21677 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
21678 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
21679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21681 uint64_t ret_ref = (uint64_t)ret_var.inner;
21682 if (ret_var.is_owned) {
21688 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
21689 unsigned char pubkey_hash_arr[20];
21690 CHECK(*((uint32_t*)pubkey_hash) == 20);
21691 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
21692 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
21693 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
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_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
21704 unsigned char script_hash_arr[32];
21705 CHECK(*((uint32_t*)script_hash) == 32);
21706 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
21707 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
21708 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
21709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21711 uint64_t ret_ref = (uint64_t)ret_var.inner;
21712 if (ret_var.is_owned) {
21718 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
21719 LDKu8slice program_ref;
21720 program_ref.datalen = *((uint32_t*)program);
21721 program_ref.data = (int8_t*)(program + 4);
21722 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
21723 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
21724 return (uint64_t)ret_conv;
21727 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
21728 LDKShutdownScript this_arg_conv;
21729 this_arg_conv.inner = (void*)(this_arg & (~1));
21730 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
21731 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
21732 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
21733 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21734 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21735 CVec_u8Z_free(ret_var);
21739 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
21740 LDKShutdownScript this_arg_conv;
21741 this_arg_conv.inner = (void*)(this_arg & (~1));
21742 this_arg_conv.is_owned = false;
21743 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21744 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
21748 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
21749 LDKShutdownScript this_arg_conv;
21750 this_arg_conv.inner = (void*)(this_arg & (~1));
21751 this_arg_conv.is_owned = false;
21752 LDKInitFeatures features_conv;
21753 features_conv.inner = (void*)(features & (~1));
21754 features_conv.is_owned = false;
21755 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
21759 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
21760 LDKRouteHop this_obj_conv;
21761 this_obj_conv.inner = (void*)(this_obj & (~1));
21762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21763 RouteHop_free(this_obj_conv);
21766 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
21767 LDKRouteHop this_ptr_conv;
21768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21769 this_ptr_conv.is_owned = false;
21770 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21771 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
21775 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
21776 LDKRouteHop this_ptr_conv;
21777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21778 this_ptr_conv.is_owned = false;
21779 LDKPublicKey val_ref;
21780 CHECK(*((uint32_t*)val) == 33);
21781 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21782 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
21785 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
21786 LDKRouteHop this_ptr_conv;
21787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21788 this_ptr_conv.is_owned = false;
21789 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
21790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21792 uint64_t ret_ref = (uint64_t)ret_var.inner;
21793 if (ret_var.is_owned) {
21799 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
21800 LDKRouteHop this_ptr_conv;
21801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21802 this_ptr_conv.is_owned = false;
21803 LDKNodeFeatures val_conv;
21804 val_conv.inner = (void*)(val & (~1));
21805 val_conv.is_owned = (val & 1) || (val == 0);
21806 val_conv = NodeFeatures_clone(&val_conv);
21807 RouteHop_set_node_features(&this_ptr_conv, val_conv);
21810 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
21811 LDKRouteHop this_ptr_conv;
21812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21813 this_ptr_conv.is_owned = false;
21814 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
21818 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
21819 LDKRouteHop this_ptr_conv;
21820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21821 this_ptr_conv.is_owned = false;
21822 RouteHop_set_short_channel_id(&this_ptr_conv, val);
21825 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
21826 LDKRouteHop this_ptr_conv;
21827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21828 this_ptr_conv.is_owned = false;
21829 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
21830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21832 uint64_t ret_ref = (uint64_t)ret_var.inner;
21833 if (ret_var.is_owned) {
21839 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
21840 LDKRouteHop this_ptr_conv;
21841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21842 this_ptr_conv.is_owned = false;
21843 LDKChannelFeatures val_conv;
21844 val_conv.inner = (void*)(val & (~1));
21845 val_conv.is_owned = (val & 1) || (val == 0);
21846 val_conv = ChannelFeatures_clone(&val_conv);
21847 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
21850 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
21851 LDKRouteHop this_ptr_conv;
21852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21853 this_ptr_conv.is_owned = false;
21854 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
21858 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
21859 LDKRouteHop this_ptr_conv;
21860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21861 this_ptr_conv.is_owned = false;
21862 RouteHop_set_fee_msat(&this_ptr_conv, val);
21865 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
21866 LDKRouteHop this_ptr_conv;
21867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21868 this_ptr_conv.is_owned = false;
21869 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
21873 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
21874 LDKRouteHop this_ptr_conv;
21875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21876 this_ptr_conv.is_owned = false;
21877 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
21880 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) {
21881 LDKPublicKey pubkey_arg_ref;
21882 CHECK(*((uint32_t*)pubkey_arg) == 33);
21883 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
21884 LDKNodeFeatures node_features_arg_conv;
21885 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
21886 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
21887 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
21888 LDKChannelFeatures channel_features_arg_conv;
21889 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
21890 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
21891 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
21892 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);
21893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21895 uint64_t ret_ref = (uint64_t)ret_var.inner;
21896 if (ret_var.is_owned) {
21902 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
21903 LDKRouteHop orig_conv;
21904 orig_conv.inner = (void*)(orig & (~1));
21905 orig_conv.is_owned = false;
21906 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
21907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21909 uint64_t ret_ref = (uint64_t)ret_var.inner;
21910 if (ret_var.is_owned) {
21916 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
21917 LDKRouteHop obj_conv;
21918 obj_conv.inner = (void*)(obj & (~1));
21919 obj_conv.is_owned = false;
21920 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
21921 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21922 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21923 CVec_u8Z_free(ret_var);
21927 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
21928 LDKu8slice ser_ref;
21929 ser_ref.datalen = *((uint32_t*)ser);
21930 ser_ref.data = (int8_t*)(ser + 4);
21931 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21932 *ret_conv = RouteHop_read(ser_ref);
21933 return (uint64_t)ret_conv;
21936 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
21937 LDKRoute this_obj_conv;
21938 this_obj_conv.inner = (void*)(this_obj & (~1));
21939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21940 Route_free(this_obj_conv);
21943 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
21944 LDKRoute this_ptr_conv;
21945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21946 this_ptr_conv.is_owned = false;
21947 LDKCVec_CVec_RouteHopZZ val_constr;
21948 val_constr.datalen = *((uint32_t*)val);
21949 if (val_constr.datalen > 0)
21950 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21952 val_constr.data = NULL;
21953 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
21954 for (size_t m = 0; m < val_constr.datalen; m++) {
21955 uint32_tArray val_conv_12 = val_vals[m];
21956 LDKCVec_RouteHopZ val_conv_12_constr;
21957 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
21958 if (val_conv_12_constr.datalen > 0)
21959 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21961 val_conv_12_constr.data = NULL;
21962 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
21963 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
21964 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
21965 LDKRouteHop val_conv_12_conv_10_conv;
21966 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
21967 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
21968 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
21969 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
21971 val_constr.data[m] = val_conv_12_constr;
21973 Route_set_paths(&this_ptr_conv, val_constr);
21976 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
21977 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
21978 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
21979 if (paths_arg_constr.datalen > 0)
21980 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
21982 paths_arg_constr.data = NULL;
21983 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
21984 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
21985 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
21986 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
21987 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
21988 if (paths_arg_conv_12_constr.datalen > 0)
21989 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21991 paths_arg_conv_12_constr.data = NULL;
21992 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
21993 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
21994 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
21995 LDKRouteHop paths_arg_conv_12_conv_10_conv;
21996 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
21997 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
21998 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
21999 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
22001 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
22003 LDKRoute ret_var = Route_new(paths_arg_constr);
22004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22006 uint64_t ret_ref = (uint64_t)ret_var.inner;
22007 if (ret_var.is_owned) {
22013 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
22014 LDKRoute orig_conv;
22015 orig_conv.inner = (void*)(orig & (~1));
22016 orig_conv.is_owned = false;
22017 LDKRoute ret_var = Route_clone(&orig_conv);
22018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22020 uint64_t ret_ref = (uint64_t)ret_var.inner;
22021 if (ret_var.is_owned) {
22027 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
22029 obj_conv.inner = (void*)(obj & (~1));
22030 obj_conv.is_owned = false;
22031 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
22032 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22033 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22034 CVec_u8Z_free(ret_var);
22038 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
22039 LDKu8slice ser_ref;
22040 ser_ref.datalen = *((uint32_t*)ser);
22041 ser_ref.data = (int8_t*)(ser + 4);
22042 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22043 *ret_conv = Route_read(ser_ref);
22044 return (uint64_t)ret_conv;
22047 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
22048 LDKRouteHint this_obj_conv;
22049 this_obj_conv.inner = (void*)(this_obj & (~1));
22050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22051 RouteHint_free(this_obj_conv);
22054 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
22055 LDKRouteHint a_conv;
22056 a_conv.inner = (void*)(a & (~1));
22057 a_conv.is_owned = false;
22058 LDKRouteHint b_conv;
22059 b_conv.inner = (void*)(b & (~1));
22060 b_conv.is_owned = false;
22061 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
22065 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
22066 LDKRouteHint orig_conv;
22067 orig_conv.inner = (void*)(orig & (~1));
22068 orig_conv.is_owned = false;
22069 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
22070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22072 uint64_t ret_ref = (uint64_t)ret_var.inner;
22073 if (ret_var.is_owned) {
22079 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
22080 LDKRouteHintHop this_obj_conv;
22081 this_obj_conv.inner = (void*)(this_obj & (~1));
22082 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22083 RouteHintHop_free(this_obj_conv);
22086 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
22087 LDKRouteHintHop this_ptr_conv;
22088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22089 this_ptr_conv.is_owned = false;
22090 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22091 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
22095 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
22096 LDKRouteHintHop this_ptr_conv;
22097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22098 this_ptr_conv.is_owned = false;
22099 LDKPublicKey val_ref;
22100 CHECK(*((uint32_t*)val) == 33);
22101 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22102 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
22105 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
22106 LDKRouteHintHop this_ptr_conv;
22107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22108 this_ptr_conv.is_owned = false;
22109 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
22113 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
22114 LDKRouteHintHop this_ptr_conv;
22115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22116 this_ptr_conv.is_owned = false;
22117 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
22120 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
22121 LDKRouteHintHop this_ptr_conv;
22122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22123 this_ptr_conv.is_owned = false;
22124 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
22125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22127 uint64_t ret_ref = (uint64_t)ret_var.inner;
22128 if (ret_var.is_owned) {
22134 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
22135 LDKRouteHintHop this_ptr_conv;
22136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22137 this_ptr_conv.is_owned = false;
22138 LDKRoutingFees val_conv;
22139 val_conv.inner = (void*)(val & (~1));
22140 val_conv.is_owned = (val & 1) || (val == 0);
22141 val_conv = RoutingFees_clone(&val_conv);
22142 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
22145 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
22146 LDKRouteHintHop this_ptr_conv;
22147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22148 this_ptr_conv.is_owned = false;
22149 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
22153 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
22154 LDKRouteHintHop this_ptr_conv;
22155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22156 this_ptr_conv.is_owned = false;
22157 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
22160 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
22161 LDKRouteHintHop this_ptr_conv;
22162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22163 this_ptr_conv.is_owned = false;
22164 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22165 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
22166 uint64_t ret_ref = (uint64_t)ret_copy;
22170 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
22171 LDKRouteHintHop this_ptr_conv;
22172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22173 this_ptr_conv.is_owned = false;
22174 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22175 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
22178 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
22179 LDKRouteHintHop this_ptr_conv;
22180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22181 this_ptr_conv.is_owned = false;
22182 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22183 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
22184 uint64_t ret_ref = (uint64_t)ret_copy;
22188 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
22189 LDKRouteHintHop this_ptr_conv;
22190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22191 this_ptr_conv.is_owned = false;
22192 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22193 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
22196 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) {
22197 LDKPublicKey src_node_id_arg_ref;
22198 CHECK(*((uint32_t*)src_node_id_arg) == 33);
22199 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
22200 LDKRoutingFees fees_arg_conv;
22201 fees_arg_conv.inner = (void*)(fees_arg & (~1));
22202 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
22203 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
22204 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
22205 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
22206 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);
22207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22209 uint64_t ret_ref = (uint64_t)ret_var.inner;
22210 if (ret_var.is_owned) {
22216 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
22217 LDKRouteHintHop a_conv;
22218 a_conv.inner = (void*)(a & (~1));
22219 a_conv.is_owned = false;
22220 LDKRouteHintHop b_conv;
22221 b_conv.inner = (void*)(b & (~1));
22222 b_conv.is_owned = false;
22223 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
22227 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
22228 LDKRouteHintHop orig_conv;
22229 orig_conv.inner = (void*)(orig & (~1));
22230 orig_conv.is_owned = false;
22231 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
22232 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22233 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22234 uint64_t ret_ref = (uint64_t)ret_var.inner;
22235 if (ret_var.is_owned) {
22241 uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
22242 LDKPublicKey our_node_id_ref;
22243 CHECK(*((uint32_t*)our_node_id) == 33);
22244 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
22245 LDKNetworkGraph network_conv;
22246 network_conv.inner = (void*)(network & (~1));
22247 network_conv.is_owned = false;
22248 LDKPublicKey payee_ref;
22249 CHECK(*((uint32_t*)payee) == 33);
22250 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
22251 LDKCVec_ChannelDetailsZ first_hops_constr;
22252 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
22253 if (first_hops != 0) {
22254 first_hops_constr.datalen = *((uint32_t*)first_hops);
22255 if (first_hops_constr.datalen > 0)
22256 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22258 first_hops_constr.data = NULL;
22259 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
22260 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
22261 uint32_t first_hops_conv_16 = first_hops_vals[q];
22262 LDKChannelDetails first_hops_conv_16_conv;
22263 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
22264 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
22265 first_hops_constr.data[q] = first_hops_conv_16_conv;
22267 first_hops_ptr = &first_hops_constr;
22269 LDKCVec_RouteHintZ last_hops_constr;
22270 last_hops_constr.datalen = *((uint32_t*)last_hops);
22271 if (last_hops_constr.datalen > 0)
22272 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
22274 last_hops_constr.data = NULL;
22275 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
22276 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
22277 uint32_t last_hops_conv_11 = last_hops_vals[l];
22278 LDKRouteHint last_hops_conv_11_conv;
22279 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
22280 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
22281 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
22282 last_hops_constr.data[l] = last_hops_conv_11_conv;
22284 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22285 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22286 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
22287 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
22288 return (uint64_t)ret_conv;
22291 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) {
22292 LDKPublicKey our_node_id_ref;
22293 CHECK(*((uint32_t*)our_node_id) == 33);
22294 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
22295 LDKNetworkGraph network_conv;
22296 network_conv.inner = (void*)(network & (~1));
22297 network_conv.is_owned = false;
22298 LDKPublicKey payee_ref;
22299 CHECK(*((uint32_t*)payee) == 33);
22300 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
22301 LDKInvoiceFeatures payee_features_conv;
22302 payee_features_conv.inner = (void*)(payee_features & (~1));
22303 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
22304 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
22305 LDKCVec_ChannelDetailsZ first_hops_constr;
22306 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
22307 if (first_hops != 0) {
22308 first_hops_constr.datalen = *((uint32_t*)first_hops);
22309 if (first_hops_constr.datalen > 0)
22310 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22312 first_hops_constr.data = NULL;
22313 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
22314 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
22315 uint32_t first_hops_conv_16 = first_hops_vals[q];
22316 LDKChannelDetails first_hops_conv_16_conv;
22317 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
22318 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
22319 first_hops_constr.data[q] = first_hops_conv_16_conv;
22321 first_hops_ptr = &first_hops_constr;
22323 LDKCVec_RouteHintZ last_hops_constr;
22324 last_hops_constr.datalen = *((uint32_t*)last_hops);
22325 if (last_hops_constr.datalen > 0)
22326 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
22328 last_hops_constr.data = NULL;
22329 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
22330 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
22331 uint32_t last_hops_conv_11 = last_hops_vals[l];
22332 LDKRouteHint last_hops_conv_11_conv;
22333 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
22334 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
22335 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
22336 last_hops_constr.data[l] = last_hops_conv_11_conv;
22338 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22339 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22340 *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);
22341 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
22342 return (uint64_t)ret_conv;
22345 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
22346 LDKNetworkGraph this_obj_conv;
22347 this_obj_conv.inner = (void*)(this_obj & (~1));
22348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22349 NetworkGraph_free(this_obj_conv);
22352 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
22353 LDKNetworkGraph orig_conv;
22354 orig_conv.inner = (void*)(orig & (~1));
22355 orig_conv.is_owned = false;
22356 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
22357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22359 uint64_t ret_ref = (uint64_t)ret_var.inner;
22360 if (ret_var.is_owned) {
22366 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
22367 LDKLockedNetworkGraph this_obj_conv;
22368 this_obj_conv.inner = (void*)(this_obj & (~1));
22369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22370 LockedNetworkGraph_free(this_obj_conv);
22373 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
22374 LDKNetGraphMsgHandler this_obj_conv;
22375 this_obj_conv.inner = (void*)(this_obj & (~1));
22376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22377 NetGraphMsgHandler_free(this_obj_conv);
22380 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
22381 LDKThirtyTwoBytes genesis_hash_ref;
22382 CHECK(*((uint32_t*)genesis_hash) == 32);
22383 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
22384 LDKAccess *chain_access_conv_ptr = NULL;
22385 if (chain_access != 0) {
22386 LDKAccess chain_access_conv;
22387 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22388 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22389 *chain_access_conv_ptr = chain_access_conv;
22391 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22392 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
22393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22395 uint64_t ret_ref = (uint64_t)ret_var.inner;
22396 if (ret_var.is_owned) {
22402 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
22403 LDKAccess *chain_access_conv_ptr = NULL;
22404 if (chain_access != 0) {
22405 LDKAccess chain_access_conv;
22406 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22407 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22408 *chain_access_conv_ptr = chain_access_conv;
22410 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22411 LDKNetworkGraph network_graph_conv;
22412 network_graph_conv.inner = (void*)(network_graph & (~1));
22413 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
22414 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
22415 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
22416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22418 uint64_t ret_ref = (uint64_t)ret_var.inner;
22419 if (ret_var.is_owned) {
22425 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
22426 LDKNetGraphMsgHandler this_arg_conv;
22427 this_arg_conv.inner = (void*)(this_arg & (~1));
22428 this_arg_conv.is_owned = false;
22429 LDKAccess *chain_access_conv_ptr = NULL;
22430 if (chain_access != 0) {
22431 LDKAccess chain_access_conv;
22432 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
22433 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
22434 *chain_access_conv_ptr = chain_access_conv;
22436 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
22439 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
22440 LDKNetGraphMsgHandler this_arg_conv;
22441 this_arg_conv.inner = (void*)(this_arg & (~1));
22442 this_arg_conv.is_owned = false;
22443 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
22444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22446 uint64_t ret_ref = (uint64_t)ret_var.inner;
22447 if (ret_var.is_owned) {
22453 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
22454 LDKLockedNetworkGraph this_arg_conv;
22455 this_arg_conv.inner = (void*)(this_arg & (~1));
22456 this_arg_conv.is_owned = false;
22457 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
22458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22460 uint64_t ret_ref = (uint64_t)ret_var.inner;
22461 if (ret_var.is_owned) {
22467 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
22468 LDKNetGraphMsgHandler this_arg_conv;
22469 this_arg_conv.inner = (void*)(this_arg & (~1));
22470 this_arg_conv.is_owned = false;
22471 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
22472 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
22473 return (uint64_t)ret;
22476 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
22477 LDKNetGraphMsgHandler this_arg_conv;
22478 this_arg_conv.inner = (void*)(this_arg & (~1));
22479 this_arg_conv.is_owned = false;
22480 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22481 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
22482 return (uint64_t)ret;
22485 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
22486 LDKDirectionalChannelInfo this_obj_conv;
22487 this_obj_conv.inner = (void*)(this_obj & (~1));
22488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22489 DirectionalChannelInfo_free(this_obj_conv);
22492 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
22493 LDKDirectionalChannelInfo this_ptr_conv;
22494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22495 this_ptr_conv.is_owned = false;
22496 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
22500 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
22501 LDKDirectionalChannelInfo this_ptr_conv;
22502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22503 this_ptr_conv.is_owned = false;
22504 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
22507 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
22508 LDKDirectionalChannelInfo this_ptr_conv;
22509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22510 this_ptr_conv.is_owned = false;
22511 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
22515 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
22516 LDKDirectionalChannelInfo this_ptr_conv;
22517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22518 this_ptr_conv.is_owned = false;
22519 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
22522 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
22523 LDKDirectionalChannelInfo this_ptr_conv;
22524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22525 this_ptr_conv.is_owned = false;
22526 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
22530 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
22531 LDKDirectionalChannelInfo this_ptr_conv;
22532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22533 this_ptr_conv.is_owned = false;
22534 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
22537 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
22538 LDKDirectionalChannelInfo this_ptr_conv;
22539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22540 this_ptr_conv.is_owned = false;
22541 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
22545 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22546 LDKDirectionalChannelInfo this_ptr_conv;
22547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22548 this_ptr_conv.is_owned = false;
22549 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
22552 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
22553 LDKDirectionalChannelInfo this_ptr_conv;
22554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22555 this_ptr_conv.is_owned = false;
22556 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22557 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
22558 uint64_t ret_ref = (uint64_t)ret_copy;
22562 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
22563 LDKDirectionalChannelInfo this_ptr_conv;
22564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22565 this_ptr_conv.is_owned = false;
22566 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22567 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
22570 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
22571 LDKDirectionalChannelInfo this_ptr_conv;
22572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22573 this_ptr_conv.is_owned = false;
22574 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
22575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22577 uint64_t ret_ref = (uint64_t)ret_var.inner;
22578 if (ret_var.is_owned) {
22584 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
22585 LDKDirectionalChannelInfo this_ptr_conv;
22586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22587 this_ptr_conv.is_owned = false;
22588 LDKRoutingFees val_conv;
22589 val_conv.inner = (void*)(val & (~1));
22590 val_conv.is_owned = (val & 1) || (val == 0);
22591 val_conv = RoutingFees_clone(&val_conv);
22592 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
22595 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
22596 LDKDirectionalChannelInfo this_ptr_conv;
22597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22598 this_ptr_conv.is_owned = false;
22599 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
22600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22602 uint64_t ret_ref = (uint64_t)ret_var.inner;
22603 if (ret_var.is_owned) {
22609 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
22610 LDKDirectionalChannelInfo this_ptr_conv;
22611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22612 this_ptr_conv.is_owned = false;
22613 LDKChannelUpdate val_conv;
22614 val_conv.inner = (void*)(val & (~1));
22615 val_conv.is_owned = (val & 1) || (val == 0);
22616 val_conv = ChannelUpdate_clone(&val_conv);
22617 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
22620 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) {
22621 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
22622 LDKRoutingFees fees_arg_conv;
22623 fees_arg_conv.inner = (void*)(fees_arg & (~1));
22624 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
22625 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
22626 LDKChannelUpdate last_update_message_arg_conv;
22627 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
22628 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
22629 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
22630 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);
22631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22633 uint64_t ret_ref = (uint64_t)ret_var.inner;
22634 if (ret_var.is_owned) {
22640 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
22641 LDKDirectionalChannelInfo orig_conv;
22642 orig_conv.inner = (void*)(orig & (~1));
22643 orig_conv.is_owned = false;
22644 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
22645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22647 uint64_t ret_ref = (uint64_t)ret_var.inner;
22648 if (ret_var.is_owned) {
22654 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
22655 LDKDirectionalChannelInfo obj_conv;
22656 obj_conv.inner = (void*)(obj & (~1));
22657 obj_conv.is_owned = false;
22658 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
22659 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22660 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22661 CVec_u8Z_free(ret_var);
22665 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
22666 LDKu8slice ser_ref;
22667 ser_ref.datalen = *((uint32_t*)ser);
22668 ser_ref.data = (int8_t*)(ser + 4);
22669 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
22670 *ret_conv = DirectionalChannelInfo_read(ser_ref);
22671 return (uint64_t)ret_conv;
22674 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
22675 LDKChannelInfo this_obj_conv;
22676 this_obj_conv.inner = (void*)(this_obj & (~1));
22677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22678 ChannelInfo_free(this_obj_conv);
22681 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
22682 LDKChannelInfo this_ptr_conv;
22683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22684 this_ptr_conv.is_owned = false;
22685 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
22686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22688 uint64_t ret_ref = (uint64_t)ret_var.inner;
22689 if (ret_var.is_owned) {
22695 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
22696 LDKChannelInfo this_ptr_conv;
22697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22698 this_ptr_conv.is_owned = false;
22699 LDKChannelFeatures val_conv;
22700 val_conv.inner = (void*)(val & (~1));
22701 val_conv.is_owned = (val & 1) || (val == 0);
22702 val_conv = ChannelFeatures_clone(&val_conv);
22703 ChannelInfo_set_features(&this_ptr_conv, val_conv);
22706 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
22707 LDKChannelInfo this_ptr_conv;
22708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22709 this_ptr_conv.is_owned = false;
22710 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22711 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
22715 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
22716 LDKChannelInfo this_ptr_conv;
22717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22718 this_ptr_conv.is_owned = false;
22719 LDKPublicKey val_ref;
22720 CHECK(*((uint32_t*)val) == 33);
22721 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22722 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
22725 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
22726 LDKChannelInfo this_ptr_conv;
22727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22728 this_ptr_conv.is_owned = false;
22729 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
22730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22732 uint64_t ret_ref = (uint64_t)ret_var.inner;
22733 if (ret_var.is_owned) {
22739 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
22740 LDKChannelInfo this_ptr_conv;
22741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22742 this_ptr_conv.is_owned = false;
22743 LDKDirectionalChannelInfo val_conv;
22744 val_conv.inner = (void*)(val & (~1));
22745 val_conv.is_owned = (val & 1) || (val == 0);
22746 val_conv = DirectionalChannelInfo_clone(&val_conv);
22747 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
22750 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
22751 LDKChannelInfo this_ptr_conv;
22752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22753 this_ptr_conv.is_owned = false;
22754 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22755 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
22759 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
22760 LDKChannelInfo this_ptr_conv;
22761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22762 this_ptr_conv.is_owned = false;
22763 LDKPublicKey val_ref;
22764 CHECK(*((uint32_t*)val) == 33);
22765 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22766 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
22769 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
22770 LDKChannelInfo this_ptr_conv;
22771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22772 this_ptr_conv.is_owned = false;
22773 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
22774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22776 uint64_t ret_ref = (uint64_t)ret_var.inner;
22777 if (ret_var.is_owned) {
22783 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
22784 LDKChannelInfo this_ptr_conv;
22785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22786 this_ptr_conv.is_owned = false;
22787 LDKDirectionalChannelInfo val_conv;
22788 val_conv.inner = (void*)(val & (~1));
22789 val_conv.is_owned = (val & 1) || (val == 0);
22790 val_conv = DirectionalChannelInfo_clone(&val_conv);
22791 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
22794 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
22795 LDKChannelInfo this_ptr_conv;
22796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22797 this_ptr_conv.is_owned = false;
22798 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22799 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
22800 uint64_t ret_ref = (uint64_t)ret_copy;
22804 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
22805 LDKChannelInfo this_ptr_conv;
22806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22807 this_ptr_conv.is_owned = false;
22808 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
22809 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
22812 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
22813 LDKChannelInfo this_ptr_conv;
22814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22815 this_ptr_conv.is_owned = false;
22816 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
22817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22819 uint64_t ret_ref = (uint64_t)ret_var.inner;
22820 if (ret_var.is_owned) {
22826 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
22827 LDKChannelInfo this_ptr_conv;
22828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22829 this_ptr_conv.is_owned = false;
22830 LDKChannelAnnouncement val_conv;
22831 val_conv.inner = (void*)(val & (~1));
22832 val_conv.is_owned = (val & 1) || (val == 0);
22833 val_conv = ChannelAnnouncement_clone(&val_conv);
22834 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
22837 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) {
22838 LDKChannelFeatures features_arg_conv;
22839 features_arg_conv.inner = (void*)(features_arg & (~1));
22840 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22841 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
22842 LDKPublicKey node_one_arg_ref;
22843 CHECK(*((uint32_t*)node_one_arg) == 33);
22844 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
22845 LDKDirectionalChannelInfo one_to_two_arg_conv;
22846 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
22847 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
22848 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
22849 LDKPublicKey node_two_arg_ref;
22850 CHECK(*((uint32_t*)node_two_arg) == 33);
22851 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
22852 LDKDirectionalChannelInfo two_to_one_arg_conv;
22853 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
22854 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
22855 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
22856 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
22857 LDKChannelAnnouncement announcement_message_arg_conv;
22858 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
22859 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
22860 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
22861 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);
22862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22864 uint64_t ret_ref = (uint64_t)ret_var.inner;
22865 if (ret_var.is_owned) {
22871 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
22872 LDKChannelInfo orig_conv;
22873 orig_conv.inner = (void*)(orig & (~1));
22874 orig_conv.is_owned = false;
22875 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
22876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22878 uint64_t ret_ref = (uint64_t)ret_var.inner;
22879 if (ret_var.is_owned) {
22885 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
22886 LDKChannelInfo obj_conv;
22887 obj_conv.inner = (void*)(obj & (~1));
22888 obj_conv.is_owned = false;
22889 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
22890 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22891 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22892 CVec_u8Z_free(ret_var);
22896 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
22897 LDKu8slice ser_ref;
22898 ser_ref.datalen = *((uint32_t*)ser);
22899 ser_ref.data = (int8_t*)(ser + 4);
22900 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
22901 *ret_conv = ChannelInfo_read(ser_ref);
22902 return (uint64_t)ret_conv;
22905 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
22906 LDKRoutingFees this_obj_conv;
22907 this_obj_conv.inner = (void*)(this_obj & (~1));
22908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22909 RoutingFees_free(this_obj_conv);
22912 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
22913 LDKRoutingFees this_ptr_conv;
22914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22915 this_ptr_conv.is_owned = false;
22916 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
22920 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
22921 LDKRoutingFees this_ptr_conv;
22922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22923 this_ptr_conv.is_owned = false;
22924 RoutingFees_set_base_msat(&this_ptr_conv, val);
22927 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
22928 LDKRoutingFees this_ptr_conv;
22929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22930 this_ptr_conv.is_owned = false;
22931 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
22935 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
22936 LDKRoutingFees this_ptr_conv;
22937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22938 this_ptr_conv.is_owned = false;
22939 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
22942 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
22943 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
22944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22946 uint64_t ret_ref = (uint64_t)ret_var.inner;
22947 if (ret_var.is_owned) {
22953 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
22954 LDKRoutingFees a_conv;
22955 a_conv.inner = (void*)(a & (~1));
22956 a_conv.is_owned = false;
22957 LDKRoutingFees b_conv;
22958 b_conv.inner = (void*)(b & (~1));
22959 b_conv.is_owned = false;
22960 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
22964 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
22965 LDKRoutingFees orig_conv;
22966 orig_conv.inner = (void*)(orig & (~1));
22967 orig_conv.is_owned = false;
22968 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
22969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22971 uint64_t ret_ref = (uint64_t)ret_var.inner;
22972 if (ret_var.is_owned) {
22978 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
22979 LDKRoutingFees obj_conv;
22980 obj_conv.inner = (void*)(obj & (~1));
22981 obj_conv.is_owned = false;
22982 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
22983 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22984 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22985 CVec_u8Z_free(ret_var);
22989 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
22990 LDKu8slice ser_ref;
22991 ser_ref.datalen = *((uint32_t*)ser);
22992 ser_ref.data = (int8_t*)(ser + 4);
22993 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
22994 *ret_conv = RoutingFees_read(ser_ref);
22995 return (uint64_t)ret_conv;
22998 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
22999 LDKNodeAnnouncementInfo this_obj_conv;
23000 this_obj_conv.inner = (void*)(this_obj & (~1));
23001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23002 NodeAnnouncementInfo_free(this_obj_conv);
23005 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
23006 LDKNodeAnnouncementInfo this_ptr_conv;
23007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23008 this_ptr_conv.is_owned = false;
23009 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
23010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23012 uint64_t ret_ref = (uint64_t)ret_var.inner;
23013 if (ret_var.is_owned) {
23019 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
23020 LDKNodeAnnouncementInfo this_ptr_conv;
23021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23022 this_ptr_conv.is_owned = false;
23023 LDKNodeFeatures val_conv;
23024 val_conv.inner = (void*)(val & (~1));
23025 val_conv.is_owned = (val & 1) || (val == 0);
23026 val_conv = NodeFeatures_clone(&val_conv);
23027 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
23030 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
23031 LDKNodeAnnouncementInfo this_ptr_conv;
23032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23033 this_ptr_conv.is_owned = false;
23034 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
23038 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
23039 LDKNodeAnnouncementInfo this_ptr_conv;
23040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23041 this_ptr_conv.is_owned = false;
23042 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
23045 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
23046 LDKNodeAnnouncementInfo this_ptr_conv;
23047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23048 this_ptr_conv.is_owned = false;
23049 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
23050 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
23054 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
23055 LDKNodeAnnouncementInfo this_ptr_conv;
23056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23057 this_ptr_conv.is_owned = false;
23058 LDKThreeBytes val_ref;
23059 CHECK(*((uint32_t*)val) == 3);
23060 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
23061 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
23064 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
23065 LDKNodeAnnouncementInfo this_ptr_conv;
23066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23067 this_ptr_conv.is_owned = false;
23068 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23069 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
23073 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
23074 LDKNodeAnnouncementInfo this_ptr_conv;
23075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23076 this_ptr_conv.is_owned = false;
23077 LDKThirtyTwoBytes val_ref;
23078 CHECK(*((uint32_t*)val) == 32);
23079 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
23080 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
23083 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
23084 LDKNodeAnnouncementInfo this_ptr_conv;
23085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23086 this_ptr_conv.is_owned = false;
23087 LDKCVec_NetAddressZ val_constr;
23088 val_constr.datalen = *((uint32_t*)val);
23089 if (val_constr.datalen > 0)
23090 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23092 val_constr.data = NULL;
23093 uint32_t* val_vals = (uint32_t*)(val + 4);
23094 for (size_t m = 0; m < val_constr.datalen; m++) {
23095 uint32_t val_conv_12 = val_vals[m];
23096 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
23097 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23098 val_constr.data[m] = val_conv_12_conv;
23100 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
23103 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
23104 LDKNodeAnnouncementInfo this_ptr_conv;
23105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23106 this_ptr_conv.is_owned = false;
23107 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
23108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23110 uint64_t ret_ref = (uint64_t)ret_var.inner;
23111 if (ret_var.is_owned) {
23117 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
23118 LDKNodeAnnouncementInfo this_ptr_conv;
23119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23120 this_ptr_conv.is_owned = false;
23121 LDKNodeAnnouncement val_conv;
23122 val_conv.inner = (void*)(val & (~1));
23123 val_conv.is_owned = (val & 1) || (val == 0);
23124 val_conv = NodeAnnouncement_clone(&val_conv);
23125 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
23128 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) {
23129 LDKNodeFeatures features_arg_conv;
23130 features_arg_conv.inner = (void*)(features_arg & (~1));
23131 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23132 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
23133 LDKThreeBytes rgb_arg_ref;
23134 CHECK(*((uint32_t*)rgb_arg) == 3);
23135 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
23136 LDKThirtyTwoBytes alias_arg_ref;
23137 CHECK(*((uint32_t*)alias_arg) == 32);
23138 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
23139 LDKCVec_NetAddressZ addresses_arg_constr;
23140 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
23141 if (addresses_arg_constr.datalen > 0)
23142 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23144 addresses_arg_constr.data = NULL;
23145 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
23146 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
23147 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
23148 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
23149 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
23151 LDKNodeAnnouncement announcement_message_arg_conv;
23152 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23153 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23154 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
23155 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
23156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23158 uint64_t ret_ref = (uint64_t)ret_var.inner;
23159 if (ret_var.is_owned) {
23165 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
23166 LDKNodeAnnouncementInfo orig_conv;
23167 orig_conv.inner = (void*)(orig & (~1));
23168 orig_conv.is_owned = false;
23169 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
23170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23172 uint64_t ret_ref = (uint64_t)ret_var.inner;
23173 if (ret_var.is_owned) {
23179 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
23180 LDKNodeAnnouncementInfo obj_conv;
23181 obj_conv.inner = (void*)(obj & (~1));
23182 obj_conv.is_owned = false;
23183 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
23184 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23185 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23186 CVec_u8Z_free(ret_var);
23190 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
23191 LDKu8slice ser_ref;
23192 ser_ref.datalen = *((uint32_t*)ser);
23193 ser_ref.data = (int8_t*)(ser + 4);
23194 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23195 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
23196 return (uint64_t)ret_conv;
23199 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
23200 LDKNodeInfo this_obj_conv;
23201 this_obj_conv.inner = (void*)(this_obj & (~1));
23202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23203 NodeInfo_free(this_obj_conv);
23206 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
23207 LDKNodeInfo this_ptr_conv;
23208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23209 this_ptr_conv.is_owned = false;
23210 LDKCVec_u64Z val_constr;
23211 val_constr.datalen = *((uint32_t*)val);
23212 if (val_constr.datalen > 0)
23213 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23215 val_constr.data = NULL;
23216 int64_t* val_vals = (int64_t*)(val + 4);
23217 for (size_t i = 0; i < val_constr.datalen; i++) {
23218 int64_t val_conv_8 = val_vals[i];
23219 val_constr.data[i] = val_conv_8;
23221 NodeInfo_set_channels(&this_ptr_conv, val_constr);
23224 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
23225 LDKNodeInfo this_ptr_conv;
23226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23227 this_ptr_conv.is_owned = false;
23228 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
23229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23231 uint64_t ret_ref = (uint64_t)ret_var.inner;
23232 if (ret_var.is_owned) {
23238 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
23239 LDKNodeInfo this_ptr_conv;
23240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23241 this_ptr_conv.is_owned = false;
23242 LDKRoutingFees val_conv;
23243 val_conv.inner = (void*)(val & (~1));
23244 val_conv.is_owned = (val & 1) || (val == 0);
23245 val_conv = RoutingFees_clone(&val_conv);
23246 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
23249 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
23250 LDKNodeInfo this_ptr_conv;
23251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23252 this_ptr_conv.is_owned = false;
23253 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
23254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23256 uint64_t ret_ref = (uint64_t)ret_var.inner;
23257 if (ret_var.is_owned) {
23263 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
23264 LDKNodeInfo this_ptr_conv;
23265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23266 this_ptr_conv.is_owned = false;
23267 LDKNodeAnnouncementInfo val_conv;
23268 val_conv.inner = (void*)(val & (~1));
23269 val_conv.is_owned = (val & 1) || (val == 0);
23270 val_conv = NodeAnnouncementInfo_clone(&val_conv);
23271 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
23274 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
23275 LDKCVec_u64Z channels_arg_constr;
23276 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
23277 if (channels_arg_constr.datalen > 0)
23278 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23280 channels_arg_constr.data = NULL;
23281 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
23282 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
23283 int64_t channels_arg_conv_8 = channels_arg_vals[i];
23284 channels_arg_constr.data[i] = channels_arg_conv_8;
23286 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
23287 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
23288 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
23289 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
23290 LDKNodeAnnouncementInfo announcement_info_arg_conv;
23291 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
23292 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
23293 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
23294 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
23295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23297 uint64_t ret_ref = (uint64_t)ret_var.inner;
23298 if (ret_var.is_owned) {
23304 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
23305 LDKNodeInfo orig_conv;
23306 orig_conv.inner = (void*)(orig & (~1));
23307 orig_conv.is_owned = false;
23308 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
23309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23311 uint64_t ret_ref = (uint64_t)ret_var.inner;
23312 if (ret_var.is_owned) {
23318 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
23319 LDKNodeInfo obj_conv;
23320 obj_conv.inner = (void*)(obj & (~1));
23321 obj_conv.is_owned = false;
23322 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
23323 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23324 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23325 CVec_u8Z_free(ret_var);
23329 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
23330 LDKu8slice ser_ref;
23331 ser_ref.datalen = *((uint32_t*)ser);
23332 ser_ref.data = (int8_t*)(ser + 4);
23333 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23334 *ret_conv = NodeInfo_read(ser_ref);
23335 return (uint64_t)ret_conv;
23338 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
23339 LDKNetworkGraph obj_conv;
23340 obj_conv.inner = (void*)(obj & (~1));
23341 obj_conv.is_owned = false;
23342 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
23343 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23344 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23345 CVec_u8Z_free(ret_var);
23349 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
23350 LDKu8slice ser_ref;
23351 ser_ref.datalen = *((uint32_t*)ser);
23352 ser_ref.data = (int8_t*)(ser + 4);
23353 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23354 *ret_conv = NetworkGraph_read(ser_ref);
23355 return (uint64_t)ret_conv;
23358 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
23359 LDKThirtyTwoBytes genesis_hash_ref;
23360 CHECK(*((uint32_t*)genesis_hash) == 32);
23361 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
23362 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
23363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23365 uint64_t ret_ref = (uint64_t)ret_var.inner;
23366 if (ret_var.is_owned) {
23372 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
23373 LDKNetworkGraph this_arg_conv;
23374 this_arg_conv.inner = (void*)(this_arg & (~1));
23375 this_arg_conv.is_owned = false;
23376 LDKNodeAnnouncement msg_conv;
23377 msg_conv.inner = (void*)(msg & (~1));
23378 msg_conv.is_owned = false;
23379 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23380 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
23381 return (uint64_t)ret_conv;
23384 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
23385 LDKNetworkGraph this_arg_conv;
23386 this_arg_conv.inner = (void*)(this_arg & (~1));
23387 this_arg_conv.is_owned = false;
23388 LDKUnsignedNodeAnnouncement msg_conv;
23389 msg_conv.inner = (void*)(msg & (~1));
23390 msg_conv.is_owned = false;
23391 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23392 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
23393 return (uint64_t)ret_conv;
23396 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
23397 LDKNetworkGraph this_arg_conv;
23398 this_arg_conv.inner = (void*)(this_arg & (~1));
23399 this_arg_conv.is_owned = false;
23400 LDKChannelAnnouncement msg_conv;
23401 msg_conv.inner = (void*)(msg & (~1));
23402 msg_conv.is_owned = false;
23403 LDKAccess *chain_access_conv_ptr = NULL;
23404 if (chain_access != 0) {
23405 LDKAccess chain_access_conv;
23406 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23407 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23408 *chain_access_conv_ptr = chain_access_conv;
23410 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23411 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
23412 return (uint64_t)ret_conv;
23415 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
23416 LDKNetworkGraph this_arg_conv;
23417 this_arg_conv.inner = (void*)(this_arg & (~1));
23418 this_arg_conv.is_owned = false;
23419 LDKUnsignedChannelAnnouncement msg_conv;
23420 msg_conv.inner = (void*)(msg & (~1));
23421 msg_conv.is_owned = false;
23422 LDKAccess *chain_access_conv_ptr = NULL;
23423 if (chain_access != 0) {
23424 LDKAccess chain_access_conv;
23425 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23426 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23427 *chain_access_conv_ptr = chain_access_conv;
23429 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23430 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
23431 return (uint64_t)ret_conv;
23434 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
23435 LDKNetworkGraph this_arg_conv;
23436 this_arg_conv.inner = (void*)(this_arg & (~1));
23437 this_arg_conv.is_owned = false;
23438 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
23441 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
23442 LDKNetworkGraph this_arg_conv;
23443 this_arg_conv.inner = (void*)(this_arg & (~1));
23444 this_arg_conv.is_owned = false;
23445 LDKChannelUpdate msg_conv;
23446 msg_conv.inner = (void*)(msg & (~1));
23447 msg_conv.is_owned = false;
23448 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23449 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
23450 return (uint64_t)ret_conv;
23453 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
23454 LDKNetworkGraph this_arg_conv;
23455 this_arg_conv.inner = (void*)(this_arg & (~1));
23456 this_arg_conv.is_owned = false;
23457 LDKUnsignedChannelUpdate msg_conv;
23458 msg_conv.inner = (void*)(msg & (~1));
23459 msg_conv.is_owned = false;
23460 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23461 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
23462 return (uint64_t)ret_conv;
23465 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
23466 LDKFilesystemPersister this_obj_conv;
23467 this_obj_conv.inner = (void*)(this_obj & (~1));
23468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23469 FilesystemPersister_free(this_obj_conv);
23472 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
23473 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
23474 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
23475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23477 uint64_t ret_ref = (uint64_t)ret_var.inner;
23478 if (ret_var.is_owned) {
23484 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
23485 LDKFilesystemPersister this_arg_conv;
23486 this_arg_conv.inner = (void*)(this_arg & (~1));
23487 this_arg_conv.is_owned = false;
23488 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
23489 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23494 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
23495 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
23496 LDKChannelManager manager_conv;
23497 manager_conv.inner = (void*)(manager & (~1));
23498 manager_conv.is_owned = false;
23499 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23500 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
23501 return (uint64_t)ret_conv;
23504 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
23505 LDKFilesystemPersister this_arg_conv;
23506 this_arg_conv.inner = (void*)(this_arg & (~1));
23507 this_arg_conv.is_owned = false;
23508 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
23509 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
23510 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
23511 return (uint64_t)ret_conv;
23514 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
23515 LDKFilesystemPersister this_arg_conv;
23516 this_arg_conv.inner = (void*)(this_arg & (~1));
23517 this_arg_conv.is_owned = false;
23518 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
23519 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
23520 return (uint64_t)ret;
23523 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
23524 LDKBackgroundProcessor this_obj_conv;
23525 this_obj_conv.inner = (void*)(this_obj & (~1));
23526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23527 BackgroundProcessor_free(this_obj_conv);
23530 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
23531 if ((this_ptr & 1) != 0) return;
23532 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
23533 FREE((void*)this_ptr);
23534 ChannelManagerPersister_free(this_ptr_conv);
23537 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) {
23538 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
23539 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
23540 LDKChainMonitor chain_monitor_conv;
23541 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
23542 chain_monitor_conv.is_owned = false;
23543 LDKChannelManager channel_manager_conv;
23544 channel_manager_conv.inner = (void*)(channel_manager & (~1));
23545 channel_manager_conv.is_owned = false;
23546 LDKPeerManager peer_manager_conv;
23547 peer_manager_conv.inner = (void*)(peer_manager & (~1));
23548 peer_manager_conv.is_owned = false;
23549 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23550 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
23551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23553 uint64_t ret_ref = (uint64_t)ret_var.inner;
23554 if (ret_var.is_owned) {
23560 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
23561 LDKBackgroundProcessor this_arg_conv;
23562 this_arg_conv.inner = (void*)(this_arg & (~1));
23563 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23564 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
23565 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23566 *ret_conv = BackgroundProcessor_join(this_arg_conv);
23567 return (uint64_t)ret_conv;
23570 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
23571 LDKBackgroundProcessor this_arg_conv;
23572 this_arg_conv.inner = (void*)(this_arg & (~1));
23573 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23574 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
23575 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23576 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
23577 return (uint64_t)ret_conv;
23580 void __attribute__((visibility("default"))) TS_check_platform() {
23584 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
23585 LDKInvoice this_obj_conv;
23586 this_obj_conv.inner = (void*)(this_obj & (~1));
23587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23588 Invoice_free(this_obj_conv);
23591 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
23593 a_conv.inner = (void*)(a & (~1));
23594 a_conv.is_owned = false;
23596 b_conv.inner = (void*)(b & (~1));
23597 b_conv.is_owned = false;
23598 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
23602 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
23603 LDKInvoice orig_conv;
23604 orig_conv.inner = (void*)(orig & (~1));
23605 orig_conv.is_owned = false;
23606 LDKInvoice ret_var = Invoice_clone(&orig_conv);
23607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23609 uint64_t ret_ref = (uint64_t)ret_var.inner;
23610 if (ret_var.is_owned) {
23616 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
23617 LDKSignedRawInvoice this_obj_conv;
23618 this_obj_conv.inner = (void*)(this_obj & (~1));
23619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23620 SignedRawInvoice_free(this_obj_conv);
23623 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
23624 LDKSignedRawInvoice a_conv;
23625 a_conv.inner = (void*)(a & (~1));
23626 a_conv.is_owned = false;
23627 LDKSignedRawInvoice b_conv;
23628 b_conv.inner = (void*)(b & (~1));
23629 b_conv.is_owned = false;
23630 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
23634 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
23635 LDKSignedRawInvoice orig_conv;
23636 orig_conv.inner = (void*)(orig & (~1));
23637 orig_conv.is_owned = false;
23638 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
23639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23641 uint64_t ret_ref = (uint64_t)ret_var.inner;
23642 if (ret_var.is_owned) {
23648 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
23649 LDKRawInvoice this_obj_conv;
23650 this_obj_conv.inner = (void*)(this_obj & (~1));
23651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23652 RawInvoice_free(this_obj_conv);
23655 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
23656 LDKRawInvoice this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
23660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23662 uint64_t ret_ref = (uint64_t)ret_var.inner;
23663 if (ret_var.is_owned) {
23669 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
23670 LDKRawInvoice this_ptr_conv;
23671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23672 this_ptr_conv.is_owned = false;
23673 LDKRawDataPart val_conv;
23674 val_conv.inner = (void*)(val & (~1));
23675 val_conv.is_owned = (val & 1) || (val == 0);
23676 val_conv = RawDataPart_clone(&val_conv);
23677 RawInvoice_set_data(&this_ptr_conv, val_conv);
23680 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
23681 LDKRawInvoice a_conv;
23682 a_conv.inner = (void*)(a & (~1));
23683 a_conv.is_owned = false;
23684 LDKRawInvoice b_conv;
23685 b_conv.inner = (void*)(b & (~1));
23686 b_conv.is_owned = false;
23687 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
23691 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
23692 LDKRawInvoice orig_conv;
23693 orig_conv.inner = (void*)(orig & (~1));
23694 orig_conv.is_owned = false;
23695 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
23696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23698 uint64_t ret_ref = (uint64_t)ret_var.inner;
23699 if (ret_var.is_owned) {
23705 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
23706 LDKRawDataPart this_obj_conv;
23707 this_obj_conv.inner = (void*)(this_obj & (~1));
23708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23709 RawDataPart_free(this_obj_conv);
23712 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
23713 LDKRawDataPart this_ptr_conv;
23714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23715 this_ptr_conv.is_owned = false;
23716 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
23717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23719 uint64_t ret_ref = (uint64_t)ret_var.inner;
23720 if (ret_var.is_owned) {
23726 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
23727 LDKRawDataPart this_ptr_conv;
23728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23729 this_ptr_conv.is_owned = false;
23730 LDKPositiveTimestamp val_conv;
23731 val_conv.inner = (void*)(val & (~1));
23732 val_conv.is_owned = (val & 1) || (val == 0);
23733 val_conv = PositiveTimestamp_clone(&val_conv);
23734 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
23737 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
23738 LDKRawDataPart a_conv;
23739 a_conv.inner = (void*)(a & (~1));
23740 a_conv.is_owned = false;
23741 LDKRawDataPart b_conv;
23742 b_conv.inner = (void*)(b & (~1));
23743 b_conv.is_owned = false;
23744 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
23748 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
23749 LDKRawDataPart orig_conv;
23750 orig_conv.inner = (void*)(orig & (~1));
23751 orig_conv.is_owned = false;
23752 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
23753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23755 uint64_t ret_ref = (uint64_t)ret_var.inner;
23756 if (ret_var.is_owned) {
23762 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
23763 LDKPositiveTimestamp this_obj_conv;
23764 this_obj_conv.inner = (void*)(this_obj & (~1));
23765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23766 PositiveTimestamp_free(this_obj_conv);
23769 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
23770 LDKPositiveTimestamp a_conv;
23771 a_conv.inner = (void*)(a & (~1));
23772 a_conv.is_owned = false;
23773 LDKPositiveTimestamp b_conv;
23774 b_conv.inner = (void*)(b & (~1));
23775 b_conv.is_owned = false;
23776 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
23780 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
23781 LDKPositiveTimestamp orig_conv;
23782 orig_conv.inner = (void*)(orig & (~1));
23783 orig_conv.is_owned = false;
23784 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
23785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23787 uint64_t ret_ref = (uint64_t)ret_var.inner;
23788 if (ret_var.is_owned) {
23794 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
23795 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
23796 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
23800 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
23801 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
23805 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
23806 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
23810 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
23811 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
23815 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
23816 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
23820 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
23821 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
23822 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
23823 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
23827 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
23828 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
23829 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
23833 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
23834 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
23835 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
23839 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
23840 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
23844 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
23845 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
23849 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
23850 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
23854 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
23855 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
23859 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
23860 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
23864 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
23865 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
23866 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
23867 jboolean ret_val = Currency_eq(a_conv, b_conv);
23871 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
23872 LDKSha256 this_obj_conv;
23873 this_obj_conv.inner = (void*)(this_obj & (~1));
23874 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23875 Sha256_free(this_obj_conv);
23878 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
23880 a_conv.inner = (void*)(a & (~1));
23881 a_conv.is_owned = false;
23883 b_conv.inner = (void*)(b & (~1));
23884 b_conv.is_owned = false;
23885 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
23889 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
23890 LDKSha256 orig_conv;
23891 orig_conv.inner = (void*)(orig & (~1));
23892 orig_conv.is_owned = false;
23893 LDKSha256 ret_var = Sha256_clone(&orig_conv);
23894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23896 uint64_t ret_ref = (uint64_t)ret_var.inner;
23897 if (ret_var.is_owned) {
23903 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
23904 LDKDescription this_obj_conv;
23905 this_obj_conv.inner = (void*)(this_obj & (~1));
23906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23907 Description_free(this_obj_conv);
23910 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
23911 LDKDescription a_conv;
23912 a_conv.inner = (void*)(a & (~1));
23913 a_conv.is_owned = false;
23914 LDKDescription b_conv;
23915 b_conv.inner = (void*)(b & (~1));
23916 b_conv.is_owned = false;
23917 jboolean ret_val = Description_eq(&a_conv, &b_conv);
23921 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
23922 LDKDescription orig_conv;
23923 orig_conv.inner = (void*)(orig & (~1));
23924 orig_conv.is_owned = false;
23925 LDKDescription ret_var = Description_clone(&orig_conv);
23926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23928 uint64_t ret_ref = (uint64_t)ret_var.inner;
23929 if (ret_var.is_owned) {
23935 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
23936 LDKPayeePubKey this_obj_conv;
23937 this_obj_conv.inner = (void*)(this_obj & (~1));
23938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23939 PayeePubKey_free(this_obj_conv);
23942 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
23943 LDKPayeePubKey a_conv;
23944 a_conv.inner = (void*)(a & (~1));
23945 a_conv.is_owned = false;
23946 LDKPayeePubKey b_conv;
23947 b_conv.inner = (void*)(b & (~1));
23948 b_conv.is_owned = false;
23949 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
23953 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
23954 LDKPayeePubKey orig_conv;
23955 orig_conv.inner = (void*)(orig & (~1));
23956 orig_conv.is_owned = false;
23957 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
23958 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23959 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23960 uint64_t ret_ref = (uint64_t)ret_var.inner;
23961 if (ret_var.is_owned) {
23967 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
23968 LDKExpiryTime this_obj_conv;
23969 this_obj_conv.inner = (void*)(this_obj & (~1));
23970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23971 ExpiryTime_free(this_obj_conv);
23974 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
23975 LDKExpiryTime a_conv;
23976 a_conv.inner = (void*)(a & (~1));
23977 a_conv.is_owned = false;
23978 LDKExpiryTime b_conv;
23979 b_conv.inner = (void*)(b & (~1));
23980 b_conv.is_owned = false;
23981 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
23985 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
23986 LDKExpiryTime orig_conv;
23987 orig_conv.inner = (void*)(orig & (~1));
23988 orig_conv.is_owned = false;
23989 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
23990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23992 uint64_t ret_ref = (uint64_t)ret_var.inner;
23993 if (ret_var.is_owned) {
23999 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
24000 LDKMinFinalCltvExpiry this_obj_conv;
24001 this_obj_conv.inner = (void*)(this_obj & (~1));
24002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24003 MinFinalCltvExpiry_free(this_obj_conv);
24006 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
24007 LDKMinFinalCltvExpiry a_conv;
24008 a_conv.inner = (void*)(a & (~1));
24009 a_conv.is_owned = false;
24010 LDKMinFinalCltvExpiry b_conv;
24011 b_conv.inner = (void*)(b & (~1));
24012 b_conv.is_owned = false;
24013 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
24017 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
24018 LDKMinFinalCltvExpiry orig_conv;
24019 orig_conv.inner = (void*)(orig & (~1));
24020 orig_conv.is_owned = false;
24021 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
24022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24024 uint64_t ret_ref = (uint64_t)ret_var.inner;
24025 if (ret_var.is_owned) {
24031 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
24032 if ((this_ptr & 1) != 0) return;
24033 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
24034 FREE((void*)this_ptr);
24035 Fallback_free(this_ptr_conv);
24038 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
24039 LDKFallback* orig_conv = (LDKFallback*)orig;
24040 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24041 *ret_copy = Fallback_clone(orig_conv);
24042 uint64_t ret_ref = (uint64_t)ret_copy;
24046 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
24048 LDKCVec_u8Z program_ref;
24049 program_ref.datalen = *((uint32_t*)program);
24050 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
24051 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
24052 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24053 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
24054 uint64_t ret_ref = (uint64_t)ret_copy;
24058 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
24059 LDKTwentyBytes a_ref;
24060 CHECK(*((uint32_t*)a) == 20);
24061 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
24062 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24063 *ret_copy = Fallback_pub_key_hash(a_ref);
24064 uint64_t ret_ref = (uint64_t)ret_copy;
24068 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
24069 LDKTwentyBytes a_ref;
24070 CHECK(*((uint32_t*)a) == 20);
24071 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
24072 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24073 *ret_copy = Fallback_script_hash(a_ref);
24074 uint64_t ret_ref = (uint64_t)ret_copy;
24078 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
24079 LDKFallback* a_conv = (LDKFallback*)a;
24080 LDKFallback* b_conv = (LDKFallback*)b;
24081 jboolean ret_val = Fallback_eq(a_conv, b_conv);
24085 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
24086 LDKInvoiceSignature this_obj_conv;
24087 this_obj_conv.inner = (void*)(this_obj & (~1));
24088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24089 InvoiceSignature_free(this_obj_conv);
24092 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
24093 LDKInvoiceSignature a_conv;
24094 a_conv.inner = (void*)(a & (~1));
24095 a_conv.is_owned = false;
24096 LDKInvoiceSignature b_conv;
24097 b_conv.inner = (void*)(b & (~1));
24098 b_conv.is_owned = false;
24099 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
24103 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
24104 LDKInvoiceSignature orig_conv;
24105 orig_conv.inner = (void*)(orig & (~1));
24106 orig_conv.is_owned = false;
24107 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
24108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24110 uint64_t ret_ref = (uint64_t)ret_var.inner;
24111 if (ret_var.is_owned) {
24117 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
24118 LDKPrivateRoute this_obj_conv;
24119 this_obj_conv.inner = (void*)(this_obj & (~1));
24120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24121 PrivateRoute_free(this_obj_conv);
24124 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
24125 LDKPrivateRoute a_conv;
24126 a_conv.inner = (void*)(a & (~1));
24127 a_conv.is_owned = false;
24128 LDKPrivateRoute b_conv;
24129 b_conv.inner = (void*)(b & (~1));
24130 b_conv.is_owned = false;
24131 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
24135 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
24136 LDKPrivateRoute orig_conv;
24137 orig_conv.inner = (void*)(orig & (~1));
24138 orig_conv.is_owned = false;
24139 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
24140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24142 uint64_t ret_ref = (uint64_t)ret_var.inner;
24143 if (ret_var.is_owned) {
24149 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
24150 LDKSignedRawInvoice this_arg_conv;
24151 this_arg_conv.inner = (void*)(this_arg & (~1));
24152 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24153 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
24154 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
24155 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
24156 return (uint64_t)ret_ref;
24159 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
24160 LDKSignedRawInvoice this_arg_conv;
24161 this_arg_conv.inner = (void*)(this_arg & (~1));
24162 this_arg_conv.is_owned = false;
24163 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
24164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24166 uint64_t ret_ref = (uint64_t)ret_var.inner;
24167 if (ret_var.is_owned) {
24173 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
24174 LDKSignedRawInvoice this_arg_conv;
24175 this_arg_conv.inner = (void*)(this_arg & (~1));
24176 this_arg_conv.is_owned = false;
24177 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24178 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
24182 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
24183 LDKSignedRawInvoice this_arg_conv;
24184 this_arg_conv.inner = (void*)(this_arg & (~1));
24185 this_arg_conv.is_owned = false;
24186 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
24187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24189 uint64_t ret_ref = (uint64_t)ret_var.inner;
24190 if (ret_var.is_owned) {
24196 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
24197 LDKSignedRawInvoice this_arg_conv;
24198 this_arg_conv.inner = (void*)(this_arg & (~1));
24199 this_arg_conv.is_owned = false;
24200 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
24201 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
24202 return (uint64_t)ret_conv;
24205 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
24206 LDKSignedRawInvoice this_arg_conv;
24207 this_arg_conv.inner = (void*)(this_arg & (~1));
24208 this_arg_conv.is_owned = false;
24209 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
24213 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
24214 LDKRawInvoice this_arg_conv;
24215 this_arg_conv.inner = (void*)(this_arg & (~1));
24216 this_arg_conv.is_owned = false;
24217 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24218 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
24222 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
24223 LDKRawInvoice this_arg_conv;
24224 this_arg_conv.inner = (void*)(this_arg & (~1));
24225 this_arg_conv.is_owned = false;
24226 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
24227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24229 uint64_t ret_ref = (uint64_t)ret_var.inner;
24230 if (ret_var.is_owned) {
24236 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
24237 LDKRawInvoice this_arg_conv;
24238 this_arg_conv.inner = (void*)(this_arg & (~1));
24239 this_arg_conv.is_owned = false;
24240 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
24241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24243 uint64_t ret_ref = (uint64_t)ret_var.inner;
24244 if (ret_var.is_owned) {
24250 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
24251 LDKRawInvoice this_arg_conv;
24252 this_arg_conv.inner = (void*)(this_arg & (~1));
24253 this_arg_conv.is_owned = false;
24254 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
24255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24257 uint64_t ret_ref = (uint64_t)ret_var.inner;
24258 if (ret_var.is_owned) {
24264 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
24265 LDKRawInvoice this_arg_conv;
24266 this_arg_conv.inner = (void*)(this_arg & (~1));
24267 this_arg_conv.is_owned = false;
24268 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
24269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24271 uint64_t ret_ref = (uint64_t)ret_var.inner;
24272 if (ret_var.is_owned) {
24278 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
24279 LDKRawInvoice this_arg_conv;
24280 this_arg_conv.inner = (void*)(this_arg & (~1));
24281 this_arg_conv.is_owned = false;
24282 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
24283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24285 uint64_t ret_ref = (uint64_t)ret_var.inner;
24286 if (ret_var.is_owned) {
24292 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
24293 LDKRawInvoice this_arg_conv;
24294 this_arg_conv.inner = (void*)(this_arg & (~1));
24295 this_arg_conv.is_owned = false;
24296 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
24297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24299 uint64_t ret_ref = (uint64_t)ret_var.inner;
24300 if (ret_var.is_owned) {
24306 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
24307 LDKRawInvoice this_arg_conv;
24308 this_arg_conv.inner = (void*)(this_arg & (~1));
24309 this_arg_conv.is_owned = false;
24310 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24311 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
24315 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
24316 LDKRawInvoice this_arg_conv;
24317 this_arg_conv.inner = (void*)(this_arg & (~1));
24318 this_arg_conv.is_owned = false;
24319 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
24320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24322 uint64_t ret_ref = (uint64_t)ret_var.inner;
24323 if (ret_var.is_owned) {
24329 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
24330 LDKRawInvoice this_arg_conv;
24331 this_arg_conv.inner = (void*)(this_arg & (~1));
24332 this_arg_conv.is_owned = false;
24333 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
24334 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
24335 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
24336 for (size_t o = 0; o < ret_var.datalen; o++) {
24337 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
24338 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24339 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24340 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
24341 if (ret_conv_14_var.is_owned) {
24342 ret_conv_14_ref |= 1;
24344 ret_arr_ptr[o] = ret_conv_14_ref;
24346 FREE(ret_var.data);
24350 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
24351 LDKRawInvoice this_arg_conv;
24352 this_arg_conv.inner = (void*)(this_arg & (~1));
24353 this_arg_conv.is_owned = false;
24354 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24355 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
24356 uint64_t ret_ref = (uint64_t)ret_copy;
24360 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
24361 LDKRawInvoice this_arg_conv;
24362 this_arg_conv.inner = (void*)(this_arg & (~1));
24363 this_arg_conv.is_owned = false;
24364 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
24368 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
24369 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
24370 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
24371 return (uint64_t)ret_conv;
24374 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
24375 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
24376 *ret_conv = PositiveTimestamp_from_system_time(time);
24377 return (uint64_t)ret_conv;
24380 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
24381 LDKPositiveTimestamp this_arg_conv;
24382 this_arg_conv.inner = (void*)(this_arg & (~1));
24383 this_arg_conv.is_owned = false;
24384 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
24388 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
24389 LDKPositiveTimestamp this_arg_conv;
24390 this_arg_conv.inner = (void*)(this_arg & (~1));
24391 this_arg_conv.is_owned = false;
24392 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
24396 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
24397 LDKInvoice this_arg_conv;
24398 this_arg_conv.inner = (void*)(this_arg & (~1));
24399 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24400 this_arg_conv = Invoice_clone(&this_arg_conv);
24401 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
24402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24404 uint64_t ret_ref = (uint64_t)ret_var.inner;
24405 if (ret_var.is_owned) {
24411 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
24412 LDKInvoice this_arg_conv;
24413 this_arg_conv.inner = (void*)(this_arg & (~1));
24414 this_arg_conv.is_owned = false;
24415 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
24416 *ret_conv = Invoice_check_signature(&this_arg_conv);
24417 return (uint64_t)ret_conv;
24420 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
24421 LDKSignedRawInvoice signed_invoice_conv;
24422 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
24423 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
24424 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
24425 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
24426 *ret_conv = Invoice_from_signed(signed_invoice_conv);
24427 return (uint64_t)ret_conv;
24430 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
24431 LDKInvoice this_arg_conv;
24432 this_arg_conv.inner = (void*)(this_arg & (~1));
24433 this_arg_conv.is_owned = false;
24434 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
24438 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
24439 LDKInvoice this_arg_conv;
24440 this_arg_conv.inner = (void*)(this_arg & (~1));
24441 this_arg_conv.is_owned = false;
24442 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24443 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
24447 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
24448 LDKInvoice this_arg_conv;
24449 this_arg_conv.inner = (void*)(this_arg & (~1));
24450 this_arg_conv.is_owned = false;
24451 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24452 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
24456 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
24457 LDKInvoice this_arg_conv;
24458 this_arg_conv.inner = (void*)(this_arg & (~1));
24459 this_arg_conv.is_owned = false;
24460 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24461 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
24465 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
24466 LDKInvoice this_arg_conv;
24467 this_arg_conv.inner = (void*)(this_arg & (~1));
24468 this_arg_conv.is_owned = false;
24469 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
24470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24472 uint64_t ret_ref = (uint64_t)ret_var.inner;
24473 if (ret_var.is_owned) {
24479 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
24480 LDKInvoice this_arg_conv;
24481 this_arg_conv.inner = (void*)(this_arg & (~1));
24482 this_arg_conv.is_owned = false;
24483 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24484 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
24488 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
24489 LDKInvoice this_arg_conv;
24490 this_arg_conv.inner = (void*)(this_arg & (~1));
24491 this_arg_conv.is_owned = false;
24492 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
24496 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
24497 LDKInvoice this_arg_conv;
24498 this_arg_conv.inner = (void*)(this_arg & (~1));
24499 this_arg_conv.is_owned = false;
24500 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
24504 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
24505 LDKInvoice this_arg_conv;
24506 this_arg_conv.inner = (void*)(this_arg & (~1));
24507 this_arg_conv.is_owned = false;
24508 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
24509 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
24510 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
24511 for (size_t o = 0; o < ret_var.datalen; o++) {
24512 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
24513 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24514 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24515 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
24516 if (ret_conv_14_var.is_owned) {
24517 ret_conv_14_ref |= 1;
24519 ret_arr_ptr[o] = ret_conv_14_ref;
24521 FREE(ret_var.data);
24525 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
24526 LDKInvoice this_arg_conv;
24527 this_arg_conv.inner = (void*)(this_arg & (~1));
24528 this_arg_conv.is_owned = false;
24529 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
24530 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
24531 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
24532 for (size_t l = 0; l < ret_var.datalen; l++) {
24533 LDKRouteHint ret_conv_11_var = ret_var.data[l];
24534 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24535 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24536 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
24537 if (ret_conv_11_var.is_owned) {
24538 ret_conv_11_ref |= 1;
24540 ret_arr_ptr[l] = ret_conv_11_ref;
24542 FREE(ret_var.data);
24546 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
24547 LDKInvoice this_arg_conv;
24548 this_arg_conv.inner = (void*)(this_arg & (~1));
24549 this_arg_conv.is_owned = false;
24550 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
24554 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
24555 LDKInvoice this_arg_conv;
24556 this_arg_conv.inner = (void*)(this_arg & (~1));
24557 this_arg_conv.is_owned = false;
24558 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24559 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
24560 uint64_t ret_ref = (uint64_t)ret_copy;
24564 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
24565 LDKStr description_conv = str_ref_to_owned_c(description);
24566 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
24567 *ret_conv = Description_new(description_conv);
24568 return (uint64_t)ret_conv;
24571 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
24572 LDKDescription this_arg_conv;
24573 this_arg_conv.inner = (void*)(this_arg & (~1));
24574 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24575 this_arg_conv = Description_clone(&this_arg_conv);
24576 LDKStr ret_str = Description_into_inner(this_arg_conv);
24577 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24582 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
24583 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
24584 *ret_conv = ExpiryTime_from_seconds(seconds);
24585 return (uint64_t)ret_conv;
24588 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
24589 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
24590 *ret_conv = ExpiryTime_from_duration(duration);
24591 return (uint64_t)ret_conv;
24594 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
24595 LDKExpiryTime this_arg_conv;
24596 this_arg_conv.inner = (void*)(this_arg & (~1));
24597 this_arg_conv.is_owned = false;
24598 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
24602 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
24603 LDKExpiryTime this_arg_conv;
24604 this_arg_conv.inner = (void*)(this_arg & (~1));
24605 this_arg_conv.is_owned = false;
24606 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
24610 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
24611 LDKRouteHint hops_conv;
24612 hops_conv.inner = (void*)(hops & (~1));
24613 hops_conv.is_owned = (hops & 1) || (hops == 0);
24614 hops_conv = RouteHint_clone(&hops_conv);
24615 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
24616 *ret_conv = PrivateRoute_new(hops_conv);
24617 return (uint64_t)ret_conv;
24620 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
24621 LDKPrivateRoute this_arg_conv;
24622 this_arg_conv.inner = (void*)(this_arg & (~1));
24623 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24624 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
24625 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
24626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24628 uint64_t ret_ref = (uint64_t)ret_var.inner;
24629 if (ret_var.is_owned) {
24635 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
24636 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
24637 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
24641 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
24642 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
24646 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
24647 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
24651 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
24652 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
24656 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
24657 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
24661 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
24662 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
24663 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
24664 jboolean ret_val = CreationError_eq(a_conv, b_conv);
24668 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
24669 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
24670 LDKStr ret_str = CreationError_to_str(o_conv);
24671 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24676 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
24677 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
24678 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
24682 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
24683 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
24687 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
24688 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
24692 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
24693 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
24697 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
24698 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
24702 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
24703 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
24707 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
24708 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
24712 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
24713 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
24717 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
24718 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
24722 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
24723 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
24724 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
24725 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
24729 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
24730 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
24731 LDKStr ret_str = SemanticError_to_str(o_conv);
24732 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24737 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
24738 if ((this_ptr & 1) != 0) return;
24739 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
24740 FREE((void*)this_ptr);
24741 SignOrCreationError_free(this_ptr_conv);
24744 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
24745 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
24746 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24747 *ret_copy = SignOrCreationError_clone(orig_conv);
24748 uint64_t ret_ref = (uint64_t)ret_copy;
24752 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
24753 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24754 *ret_copy = SignOrCreationError_sign_error();
24755 uint64_t ret_ref = (uint64_t)ret_copy;
24759 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
24760 LDKCreationError a_conv = LDKCreationError_from_js(a);
24761 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
24762 *ret_copy = SignOrCreationError_creation_error(a_conv);
24763 uint64_t ret_ref = (uint64_t)ret_copy;
24767 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
24768 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
24769 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
24770 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
24774 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
24775 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
24776 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
24777 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24782 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) {
24783 LDKChannelManager channelmanager_conv;
24784 channelmanager_conv.inner = (void*)(channelmanager & (~1));
24785 channelmanager_conv.is_owned = false;
24786 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24787 LDKCurrency network_conv = LDKCurrency_from_js(network);
24788 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
24789 LDKStr description_conv = str_ref_to_owned_c(description);
24790 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24791 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
24792 return (uint64_t)ret_conv;
24795 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
24796 LDKStr s_conv = str_ref_to_owned_c(s);
24797 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
24798 *ret_conv = SiPrefix_from_str(s_conv);
24799 return (uint64_t)ret_conv;
24802 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
24803 LDKStr s_conv = str_ref_to_owned_c(s);
24804 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
24805 *ret_conv = Invoice_from_str(s_conv);
24806 return (uint64_t)ret_conv;
24809 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
24810 LDKStr s_conv = str_ref_to_owned_c(s);
24811 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
24812 *ret_conv = SignedRawInvoice_from_str(s_conv);
24813 return (uint64_t)ret_conv;
24816 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
24818 o_conv.inner = (void*)(o & (~1));
24819 o_conv.is_owned = false;
24820 LDKStr ret_str = Invoice_to_str(&o_conv);
24821 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24826 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
24827 LDKSignedRawInvoice o_conv;
24828 o_conv.inner = (void*)(o & (~1));
24829 o_conv.is_owned = false;
24830 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
24831 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24836 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
24837 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
24838 LDKStr ret_str = Currency_to_str(o_conv);
24839 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
24844 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
24845 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
24846 LDKStr ret_str = SiPrefix_to_str(o_conv);
24847 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);