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_NoPaymentSecret;
271 case 5: return LDKSemanticError_MultiplePaymentSecrets;
272 case 6: return LDKSemanticError_InvalidFeatures;
273 case 7: return LDKSemanticError_InvalidRecoveryId;
274 case 8: return LDKSemanticError_InvalidSignature;
275 case 9: return LDKSemanticError_ImpreciseAmount;
279 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
281 case LDKSemanticError_NoPaymentHash: return 0;
282 case LDKSemanticError_MultiplePaymentHashes: return 1;
283 case LDKSemanticError_NoDescription: return 2;
284 case LDKSemanticError_MultipleDescriptions: return 3;
285 case LDKSemanticError_NoPaymentSecret: return 4;
286 case LDKSemanticError_MultiplePaymentSecrets: return 5;
287 case LDKSemanticError_InvalidFeatures: return 6;
288 case LDKSemanticError_InvalidRecoveryId: return 7;
289 case LDKSemanticError_InvalidSignature: return 8;
290 case LDKSemanticError_ImpreciseAmount: return 9;
294 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
296 case 0: return LDKSiPrefix_Milli;
297 case 1: return LDKSiPrefix_Micro;
298 case 2: return LDKSiPrefix_Nano;
299 case 3: return LDKSiPrefix_Pico;
303 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
305 case LDKSiPrefix_Milli: return 0;
306 case LDKSiPrefix_Micro: return 1;
307 case LDKSiPrefix_Nano: return 2;
308 case LDKSiPrefix_Pico: return 3;
312 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
313 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
314 ret->datalen = *((uint32_t*)elems);
315 if (ret->datalen == 0) {
318 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
319 int8_t *java_elems = (int8_t*)(elems + 4);
320 for (size_t i = 0; i < ret->datalen; i++) {
321 ret->data[i] = java_elems[i];
324 return (uint64_t)ret;
326 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
327 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
328 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
331 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) {
332 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
333 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
334 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
335 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
336 CVec_u8Z_free(ret_var);
340 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
341 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
342 int64_t ret_val = TxOut_get_value(thing_conv);
346 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
347 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
349 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
350 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
351 CHECK(val->result_ok);
352 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
353 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
356 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
357 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
358 CHECK(!val->result_ok);
359 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
362 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
363 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
365 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
366 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
367 CHECK(val->result_ok);
368 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
369 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
373 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
374 CHECK(!val->result_ok);
375 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
379 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
382 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
383 CHECK(val->result_ok);
384 LDKTxCreationKeys res_var = (*val->contents.result);
385 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
386 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
387 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
391 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
392 CHECK(!val->result_ok);
393 LDKDecodeError err_var = (*val->contents.err);
394 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
400 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
403 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
404 CHECK(val->result_ok);
405 LDKChannelPublicKeys res_var = (*val->contents.result);
406 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
407 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
408 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
412 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
413 CHECK(!val->result_ok);
414 LDKDecodeError err_var = (*val->contents.err);
415 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
416 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
417 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
420 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
421 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
424 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
425 CHECK(val->result_ok);
426 LDKTxCreationKeys res_var = (*val->contents.result);
427 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
428 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
429 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
432 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
433 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
434 CHECK(!val->result_ok);
435 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
438 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
439 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
441 case LDKCOption_u32Z_Some: {
442 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
444 case LDKCOption_u32Z_None: {
445 return 0 /* LDKCOption_u32Z - None */;
450 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
451 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
453 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
454 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
455 CHECK(val->result_ok);
456 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
457 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
458 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
459 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
462 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
463 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
464 CHECK(!val->result_ok);
465 LDKDecodeError err_var = (*val->contents.err);
466 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
467 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
468 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
471 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
472 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
474 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
475 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
476 CHECK(val->result_ok);
477 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
478 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
479 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
480 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
483 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
484 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
485 CHECK(!val->result_ok);
486 LDKDecodeError err_var = (*val->contents.err);
487 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
488 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
489 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
492 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
493 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
495 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
496 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
497 CHECK(val->result_ok);
498 LDKChannelTransactionParameters res_var = (*val->contents.result);
499 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
500 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
501 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
504 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
505 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
506 CHECK(!val->result_ok);
507 LDKDecodeError err_var = (*val->contents.err);
508 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
509 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
510 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
513 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
514 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
517 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
518 CHECK(val->result_ok);
519 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
520 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
521 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
522 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
526 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
527 CHECK(!val->result_ok);
528 LDKDecodeError err_var = (*val->contents.err);
529 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
530 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
531 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
534 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
535 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
537 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
538 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
539 CHECK(val->result_ok);
540 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
541 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
542 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
543 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
546 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
547 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
548 CHECK(!val->result_ok);
549 LDKDecodeError err_var = (*val->contents.err);
550 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
551 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
552 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
555 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
556 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
558 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
559 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
560 CHECK(val->result_ok);
561 LDKTrustedClosingTransaction res_var = (*val->contents.result);
562 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
563 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
564 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
567 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
568 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
569 CHECK(!val->result_ok);
570 return *val->contents.err;
572 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
573 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
575 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
576 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
577 CHECK(val->result_ok);
578 LDKCommitmentTransaction 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 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
585 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
586 CHECK(!val->result_ok);
587 LDKDecodeError err_var = (*val->contents.err);
588 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
589 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
590 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
593 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
594 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
596 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
597 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
598 CHECK(val->result_ok);
599 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
600 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
601 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
602 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
605 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
606 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
607 CHECK(!val->result_ok);
608 return *val->contents.err;
610 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
611 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
613 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
614 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
615 CHECK(val->result_ok);
616 LDKCVec_SignatureZ res_var = (*val->contents.result);
617 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
618 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
619 for (size_t m = 0; m < res_var.datalen; m++) {
620 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
621 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
622 res_arr_ptr[m] = res_conv_12_arr;
626 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
627 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
628 CHECK(!val->result_ok);
629 return *val->contents.err;
631 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
632 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
634 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
635 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(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_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
644 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
645 CHECK(!val->result_ok);
646 LDKDecodeError 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_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
653 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
655 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
656 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
657 CHECK(val->result_ok);
658 LDKShutdownScript res_var = (*val->contents.result);
659 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
660 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
661 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
664 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
665 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
666 CHECK(!val->result_ok);
667 LDKInvalidShutdownScript err_var = (*val->contents.err);
668 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
669 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
670 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
673 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
674 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
676 void __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_ok(uint32_t arg) {
677 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
678 CHECK(val->result_ok);
679 return *val->contents.result;
681 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_get_err(uint32_t arg) {
682 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
683 CHECK(!val->result_ok);
684 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
687 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_result_ok(uint32_t arg) {
688 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
690 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_ok(uint32_t arg) {
691 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
692 CHECK(val->result_ok);
693 LDKRouteHop res_var = (*val->contents.result);
694 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
695 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
696 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
699 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteHopDecodeErrorZ_get_err(uint32_t arg) {
700 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
701 CHECK(!val->result_ok);
702 LDKDecodeError err_var = (*val->contents.err);
703 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
704 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
705 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
708 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
709 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
710 ret->datalen = *((uint32_t*)elems);
711 if (ret->datalen == 0) {
714 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
715 uint32_t *java_elems = (uint32_t*)(elems + 4);
716 for (size_t i = 0; i < ret->datalen; i++) {
717 uint32_t arr_elem = java_elems[i];
718 LDKRouteHop arr_elem_conv;
719 arr_elem_conv.inner = (void*)(arr_elem & (~1));
720 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
721 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
722 ret->data[i] = arr_elem_conv;
725 return (uint64_t)ret;
727 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
728 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
729 for (size_t i = 0; i < ret.datalen; i++) {
730 ret.data[i] = RouteHop_clone(&orig->data[i]);
734 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
735 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
736 for (size_t i = 0; i < ret.datalen; i++) {
737 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
741 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
742 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
744 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
745 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
746 CHECK(val->result_ok);
747 LDKRoute res_var = (*val->contents.result);
748 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
749 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
750 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
754 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
755 CHECK(!val->result_ok);
756 LDKDecodeError err_var = (*val->contents.err);
757 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
758 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
759 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
762 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
763 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
765 case LDKCOption_u64Z_Some: {
766 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
768 case LDKCOption_u64Z_None: {
769 return 0 /* LDKCOption_u64Z - None */;
774 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
775 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
776 ret->datalen = *((uint32_t*)elems);
777 if (ret->datalen == 0) {
780 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
781 uint32_t *java_elems = (uint32_t*)(elems + 4);
782 for (size_t i = 0; i < ret->datalen; i++) {
783 uint32_t arr_elem = java_elems[i];
784 LDKChannelDetails arr_elem_conv;
785 arr_elem_conv.inner = (void*)(arr_elem & (~1));
786 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
787 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
788 ret->data[i] = arr_elem_conv;
791 return (uint64_t)ret;
793 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
794 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
795 for (size_t i = 0; i < ret.datalen; i++) {
796 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
800 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
801 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
802 ret->datalen = *((uint32_t*)elems);
803 if (ret->datalen == 0) {
806 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
807 uint32_t *java_elems = (uint32_t*)(elems + 4);
808 for (size_t i = 0; i < ret->datalen; i++) {
809 uint32_t arr_elem = java_elems[i];
810 LDKRouteHint arr_elem_conv;
811 arr_elem_conv.inner = (void*)(arr_elem & (~1));
812 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
813 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
814 ret->data[i] = arr_elem_conv;
817 return (uint64_t)ret;
819 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
820 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
821 for (size_t i = 0; i < ret.datalen; i++) {
822 ret.data[i] = RouteHint_clone(&orig->data[i]);
826 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
827 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
829 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
830 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
831 CHECK(val->result_ok);
832 LDKRoute res_var = (*val->contents.result);
833 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
834 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
835 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
838 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
839 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
840 CHECK(!val->result_ok);
841 LDKLightningError err_var = (*val->contents.err);
842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
847 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
848 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
850 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
851 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
852 CHECK(val->result_ok);
853 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
854 return (uint64_t)res_ref;
856 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
857 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
858 CHECK(!val->result_ok);
859 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
862 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
863 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
865 LDKTransaction b_ref;
866 b_ref.datalen = *((uint32_t*)b);
867 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
868 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
869 b_ref.data_is_owned = false;
871 return (uint64_t)ret;
873 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
874 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
877 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
878 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
879 LDKTransaction b_var = tuple->b;
880 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
881 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
884 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
885 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
886 ret->datalen = *((uint32_t*)elems);
887 if (ret->datalen == 0) {
890 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
891 uint32_t *java_elems = (uint32_t*)(elems + 4);
892 for (size_t i = 0; i < ret->datalen; i++) {
893 uint32_t arr_elem = java_elems[i];
894 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
895 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
896 ret->data[i] = arr_elem_conv;
899 return (uint64_t)ret;
901 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
902 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
903 for (size_t i = 0; i < ret.datalen; i++) {
904 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
908 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
909 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
910 for (size_t i = 0; i < ret.datalen; i++) {
911 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
915 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
916 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
918 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
919 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
920 CHECK(val->result_ok);
921 return *val->contents.result;
923 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
924 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
925 CHECK(!val->result_ok);
926 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
929 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
930 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
932 case LDKMonitorEvent_HTLCEvent: {
933 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
934 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
935 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
936 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
937 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
939 case LDKMonitorEvent_CommitmentTxConfirmed: {
940 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
941 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
943 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
944 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
949 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
950 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
951 ret->datalen = *((uint32_t*)elems);
952 if (ret->datalen == 0) {
955 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
956 uint32_t *java_elems = (uint32_t*)(elems + 4);
957 for (size_t i = 0; i < ret->datalen; i++) {
958 uint32_t arr_elem = java_elems[i];
959 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
960 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
961 ret->data[i] = arr_elem_conv;
964 return (uint64_t)ret;
966 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
967 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
968 for (size_t i = 0; i < ret.datalen; i++) {
969 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
973 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
974 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
976 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
977 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
978 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
980 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
981 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
986 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
987 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
989 case LDKNetworkUpdate_ChannelUpdateMessage: {
990 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
991 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
992 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
993 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
994 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
996 case LDKNetworkUpdate_ChannelClosed: {
997 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
999 case LDKNetworkUpdate_NodeFailure: {
1000 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1001 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1002 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1007 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1008 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1010 case LDKCOption_NetworkUpdateZ_Some: {
1011 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1012 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1014 case LDKCOption_NetworkUpdateZ_None: {
1015 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1020 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1021 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1023 case LDKSpendableOutputDescriptor_StaticOutput: {
1024 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1025 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1026 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1027 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1028 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1029 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1031 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1032 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1033 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1034 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1035 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1036 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1038 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1039 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1040 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1041 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1042 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1043 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1048 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1049 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1050 ret->datalen = *((uint32_t*)elems);
1051 if (ret->datalen == 0) {
1054 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1055 uint32_t *java_elems = (uint32_t*)(elems + 4);
1056 for (size_t i = 0; i < ret->datalen; i++) {
1057 uint32_t arr_elem = java_elems[i];
1058 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1059 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1060 ret->data[i] = arr_elem_conv;
1063 return (uint64_t)ret;
1065 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1066 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1067 for (size_t i = 0; i < ret.datalen; i++) {
1068 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1072 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1073 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1075 case LDKErrorAction_DisconnectPeer: {
1076 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1077 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1078 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1079 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1080 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1082 case LDKErrorAction_IgnoreError: {
1083 return 0 /* LDKErrorAction - IgnoreError */;
1085 case LDKErrorAction_IgnoreAndLog: {
1086 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1087 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1089 case LDKErrorAction_SendErrorMessage: {
1090 LDKErrorMessage msg_var = obj->send_error_message.msg;
1091 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1092 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1093 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1094 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1099 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1100 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1102 case LDKMessageSendEvent_SendAcceptChannel: {
1103 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1104 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1105 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1106 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1109 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1111 case LDKMessageSendEvent_SendOpenChannel: {
1112 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1113 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1114 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1115 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1116 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1117 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1118 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1120 case LDKMessageSendEvent_SendFundingCreated: {
1121 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1122 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1123 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1124 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1125 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1126 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1127 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1129 case LDKMessageSendEvent_SendFundingSigned: {
1130 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1131 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1132 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1133 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1136 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1138 case LDKMessageSendEvent_SendFundingLocked: {
1139 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1140 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1141 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1142 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1143 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1144 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1145 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1147 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1148 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1149 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1150 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1151 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1152 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1153 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1154 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1156 case LDKMessageSendEvent_UpdateHTLCs: {
1157 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1158 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1159 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1160 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1161 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1162 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1163 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1165 case LDKMessageSendEvent_SendRevokeAndACK: {
1166 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1167 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1168 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.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 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1174 case LDKMessageSendEvent_SendClosingSigned: {
1175 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1176 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1177 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1178 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1179 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1180 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1181 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1183 case LDKMessageSendEvent_SendShutdown: {
1184 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1185 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1186 LDKShutdown msg_var = obj->send_shutdown.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 - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1192 case LDKMessageSendEvent_SendChannelReestablish: {
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_reestablish.node_id.compressed_form, 33);
1195 LDKChannelReestablish msg_var = obj->send_channel_reestablish.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 - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1201 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1202 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1203 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1204 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1205 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1206 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1207 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1208 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1209 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1210 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1212 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1213 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1214 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1215 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1216 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1217 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1219 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1220 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1221 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1222 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1223 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1224 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1226 case LDKMessageSendEvent_SendChannelUpdate: {
1227 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1228 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1229 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1230 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1231 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1232 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1233 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1235 case LDKMessageSendEvent_HandleError: {
1236 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1237 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1238 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1239 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1241 case LDKMessageSendEvent_SendChannelRangeQuery: {
1242 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1243 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1244 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1245 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1246 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1247 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1248 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1250 case LDKMessageSendEvent_SendShortIdsQuery: {
1251 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1252 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1253 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1254 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1255 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1256 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1257 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1259 case LDKMessageSendEvent_SendReplyChannelRange: {
1260 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1261 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1262 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1263 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1264 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1265 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1266 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1271 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1272 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1273 ret->datalen = *((uint32_t*)elems);
1274 if (ret->datalen == 0) {
1277 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1278 uint32_t *java_elems = (uint32_t*)(elems + 4);
1279 for (size_t i = 0; i < ret->datalen; i++) {
1280 uint32_t arr_elem = java_elems[i];
1281 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1282 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1283 ret->data[i] = arr_elem_conv;
1286 return (uint64_t)ret;
1288 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1289 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1290 for (size_t i = 0; i < ret.datalen; i++) {
1291 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1295 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1296 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1298 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1299 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1300 CHECK(val->result_ok);
1301 LDKInitFeatures res_var = (*val->contents.result);
1302 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1303 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1304 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1307 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1308 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1309 CHECK(!val->result_ok);
1310 LDKDecodeError err_var = (*val->contents.err);
1311 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1312 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1313 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1316 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1317 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1319 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1320 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1321 CHECK(val->result_ok);
1322 LDKNodeFeatures res_var = (*val->contents.result);
1323 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1328 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1329 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1330 CHECK(!val->result_ok);
1331 LDKDecodeError err_var = (*val->contents.err);
1332 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1333 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1334 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1337 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1338 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1340 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1341 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1342 CHECK(val->result_ok);
1343 LDKChannelFeatures res_var = (*val->contents.result);
1344 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1349 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1350 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1351 CHECK(!val->result_ok);
1352 LDKDecodeError err_var = (*val->contents.err);
1353 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1354 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1355 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1358 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1359 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1362 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1363 CHECK(val->result_ok);
1364 LDKInvoiceFeatures res_var = (*val->contents.result);
1365 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1371 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1372 CHECK(!val->result_ok);
1373 LDKDecodeError err_var = (*val->contents.err);
1374 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1375 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1376 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1379 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1380 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1383 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1384 CHECK(val->result_ok);
1385 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1391 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1392 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1393 CHECK(!val->result_ok);
1394 LDKDecodeError err_var = (*val->contents.err);
1395 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1396 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1397 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1400 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1401 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1404 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1405 CHECK(val->result_ok);
1406 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1407 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1412 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1413 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1414 CHECK(!val->result_ok);
1415 LDKDecodeError err_var = (*val->contents.err);
1416 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1421 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1422 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1424 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1425 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1426 CHECK(val->result_ok);
1427 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1431 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1432 CHECK(!val->result_ok);
1433 LDKDecodeError err_var = (*val->contents.err);
1434 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1435 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1436 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1439 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1440 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1442 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1443 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1444 CHECK(val->result_ok);
1445 return *val->contents.result;
1447 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1448 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1449 CHECK(!val->result_ok);
1450 return *val->contents.err;
1452 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1453 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1455 CHECK(*((uint32_t*)a) == 64);
1456 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1458 LDKCVec_SignatureZ b_constr;
1459 b_constr.datalen = *((uint32_t*)b);
1460 if (b_constr.datalen > 0)
1461 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1463 b_constr.data = NULL;
1464 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1465 for (size_t m = 0; m < b_constr.datalen; m++) {
1466 int8_tArray b_conv_12 = b_vals[m];
1467 LDKSignature b_conv_12_ref;
1468 CHECK(*((uint32_t*)b_conv_12) == 64);
1469 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1470 b_constr.data[m] = b_conv_12_ref;
1473 return (uint64_t)ret;
1475 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1476 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1477 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1478 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1481 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1482 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1483 LDKCVec_SignatureZ b_var = tuple->b;
1484 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1485 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1486 for (size_t m = 0; m < b_var.datalen; m++) {
1487 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1488 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1489 b_arr_ptr[m] = b_conv_12_arr;
1493 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1494 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1497 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1498 CHECK(val->result_ok);
1499 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
1502 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1503 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1504 CHECK(!val->result_ok);
1505 return *val->contents.err;
1507 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1508 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1510 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1511 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1512 CHECK(val->result_ok);
1513 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1514 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1517 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1518 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1519 CHECK(!val->result_ok);
1520 return *val->contents.err;
1522 typedef struct LDKBaseSign_JCalls {
1523 atomic_size_t refcnt;
1524 uint32_t get_per_commitment_point_meth;
1525 uint32_t release_commitment_secret_meth;
1526 uint32_t validate_holder_commitment_meth;
1527 uint32_t channel_keys_id_meth;
1528 uint32_t sign_counterparty_commitment_meth;
1529 uint32_t validate_counterparty_revocation_meth;
1530 uint32_t sign_holder_commitment_and_htlcs_meth;
1531 uint32_t sign_justice_revoked_output_meth;
1532 uint32_t sign_justice_revoked_htlc_meth;
1533 uint32_t sign_counterparty_htlc_transaction_meth;
1534 uint32_t sign_closing_transaction_meth;
1535 uint32_t sign_channel_announcement_meth;
1536 uint32_t ready_channel_meth;
1537 } LDKBaseSign_JCalls;
1538 static void LDKBaseSign_JCalls_free(void* this_arg) {
1539 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1540 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1541 js_free(j_calls->get_per_commitment_point_meth);
1542 js_free(j_calls->release_commitment_secret_meth);
1543 js_free(j_calls->validate_holder_commitment_meth);
1544 js_free(j_calls->channel_keys_id_meth);
1545 js_free(j_calls->sign_counterparty_commitment_meth);
1546 js_free(j_calls->validate_counterparty_revocation_meth);
1547 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1548 js_free(j_calls->sign_justice_revoked_output_meth);
1549 js_free(j_calls->sign_justice_revoked_htlc_meth);
1550 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1551 js_free(j_calls->sign_closing_transaction_meth);
1552 js_free(j_calls->sign_channel_announcement_meth);
1553 js_free(j_calls->ready_channel_meth);
1557 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1558 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1559 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1560 LDKPublicKey ret_ref;
1561 CHECK(*((uint32_t*)ret) == 33);
1562 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1565 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1566 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1567 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1568 LDKThirtyTwoBytes ret_ref;
1569 CHECK(*((uint32_t*)ret) == 32);
1570 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1573 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1574 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1575 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1576 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1577 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1578 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1579 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
1580 if (holder_tx_var.is_owned) {
1583 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1584 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1585 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1588 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1589 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1590 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1591 LDKThirtyTwoBytes ret_ref;
1592 CHECK(*((uint32_t*)ret) == 32);
1593 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1596 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1597 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1598 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1599 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1600 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1601 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1602 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1603 if (commitment_tx_var.is_owned) {
1604 commitment_tx_ref |= 1;
1606 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1607 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1608 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1611 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1612 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1613 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1614 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1615 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1616 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1617 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1620 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1621 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1622 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1623 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1624 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1625 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1626 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1627 if (commitment_tx_var.is_owned) {
1628 commitment_tx_ref |= 1;
1630 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1631 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1632 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1635 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]) {
1636 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1637 LDKTransaction justice_tx_var = justice_tx;
1638 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1639 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1640 Transaction_free(justice_tx_var);
1641 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1642 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1643 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1644 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1645 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1648 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) {
1649 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1650 LDKTransaction justice_tx_var = justice_tx;
1651 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1652 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1653 Transaction_free(justice_tx_var);
1654 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1655 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1656 LDKHTLCOutputInCommitment htlc_var = *htlc;
1657 htlc_var = HTLCOutputInCommitment_clone(htlc);
1658 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1659 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1660 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1661 if (htlc_var.is_owned) {
1664 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);
1665 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1666 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1669 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) {
1670 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1671 LDKTransaction htlc_tx_var = htlc_tx;
1672 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1673 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1674 Transaction_free(htlc_tx_var);
1675 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1676 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1677 LDKHTLCOutputInCommitment htlc_var = *htlc;
1678 htlc_var = HTLCOutputInCommitment_clone(htlc);
1679 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1680 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1681 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1682 if (htlc_var.is_owned) {
1685 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);
1686 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1687 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1690 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1691 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1692 LDKClosingTransaction closing_tx_var = *closing_tx;
1693 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
1694 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1695 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1696 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
1697 if (closing_tx_var.is_owned) {
1698 closing_tx_ref |= 1;
1700 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1701 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1702 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1705 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1706 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1707 LDKUnsignedChannelAnnouncement msg_var = *msg;
1708 msg_var = UnsignedChannelAnnouncement_clone(msg);
1709 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1710 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1711 uint64_t msg_ref = (uint64_t)msg_var.inner;
1712 if (msg_var.is_owned) {
1715 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1716 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1717 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1720 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1721 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1722 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1723 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1724 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1725 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1726 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1727 if (channel_parameters_var.is_owned) {
1728 channel_parameters_ref |= 1;
1730 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1732 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1733 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1734 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1736 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1737 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1738 atomic_init(&calls->refcnt, 1);
1739 //TODO: Assign calls->o from o
1741 LDKChannelPublicKeys pubkeys_conv;
1742 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1743 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1744 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1747 .this_arg = (void*) calls,
1748 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1749 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1750 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1751 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1752 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1753 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1754 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1755 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1756 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1757 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1758 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1759 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1760 .ready_channel = ready_channel_LDKBaseSign_jcall,
1761 .free = LDKBaseSign_JCalls_free,
1762 .pubkeys = pubkeys_conv,
1763 .set_pubkeys = NULL,
1767 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1768 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1769 *res_ptr = LDKBaseSign_init(o, pubkeys);
1770 return (long)res_ptr;
1772 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1773 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1774 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1775 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1779 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1780 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1781 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1782 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1786 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1787 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1788 LDKHolderCommitmentTransaction holder_tx_conv;
1789 holder_tx_conv.inner = (void*)(holder_tx & (~1));
1790 holder_tx_conv.is_owned = false;
1791 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1792 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
1793 return (uint64_t)ret_conv;
1796 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1797 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1798 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1799 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1803 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1804 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1805 LDKCommitmentTransaction commitment_tx_conv;
1806 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1807 commitment_tx_conv.is_owned = false;
1808 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1809 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1810 return (uint64_t)ret_conv;
1813 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
1814 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1815 unsigned char secret_arr[32];
1816 CHECK(*((uint32_t*)secret) == 32);
1817 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
1818 unsigned char (*secret_ref)[32] = &secret_arr;
1819 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1820 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1821 return (uint64_t)ret_conv;
1824 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1825 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1826 LDKHolderCommitmentTransaction commitment_tx_conv;
1827 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1828 commitment_tx_conv.is_owned = false;
1829 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1830 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1831 return (uint64_t)ret_conv;
1834 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) {
1835 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1836 LDKTransaction justice_tx_ref;
1837 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1838 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1839 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1840 justice_tx_ref.data_is_owned = true;
1841 unsigned char per_commitment_key_arr[32];
1842 CHECK(*((uint32_t*)per_commitment_key) == 32);
1843 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1844 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1845 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1846 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1847 return (uint64_t)ret_conv;
1850 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) {
1851 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1852 LDKTransaction justice_tx_ref;
1853 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1854 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1855 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1856 justice_tx_ref.data_is_owned = true;
1857 unsigned char per_commitment_key_arr[32];
1858 CHECK(*((uint32_t*)per_commitment_key) == 32);
1859 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1860 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1861 LDKHTLCOutputInCommitment htlc_conv;
1862 htlc_conv.inner = (void*)(htlc & (~1));
1863 htlc_conv.is_owned = false;
1864 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1865 *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);
1866 return (uint64_t)ret_conv;
1869 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) {
1870 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1871 LDKTransaction htlc_tx_ref;
1872 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1873 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1874 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1875 htlc_tx_ref.data_is_owned = true;
1876 LDKPublicKey per_commitment_point_ref;
1877 CHECK(*((uint32_t*)per_commitment_point) == 33);
1878 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1879 LDKHTLCOutputInCommitment htlc_conv;
1880 htlc_conv.inner = (void*)(htlc & (~1));
1881 htlc_conv.is_owned = false;
1882 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1883 *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);
1884 return (uint64_t)ret_conv;
1887 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
1888 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1889 LDKClosingTransaction closing_tx_conv;
1890 closing_tx_conv.inner = (void*)(closing_tx & (~1));
1891 closing_tx_conv.is_owned = false;
1892 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1893 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1894 return (uint64_t)ret_conv;
1897 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1898 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1899 LDKUnsignedChannelAnnouncement msg_conv;
1900 msg_conv.inner = (void*)(msg & (~1));
1901 msg_conv.is_owned = false;
1902 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1903 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1904 return (uint64_t)ret_conv;
1907 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1908 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1909 LDKChannelTransactionParameters channel_parameters_conv;
1910 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1911 channel_parameters_conv.is_owned = false;
1912 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1915 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1916 if (this_arg->set_pubkeys != NULL)
1917 this_arg->set_pubkeys(this_arg);
1918 return this_arg->pubkeys;
1920 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1921 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1922 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1925 uint64_t ret_ref = (uint64_t)ret_var.inner;
1926 if (ret_var.is_owned) {
1932 typedef struct LDKSign_JCalls {
1933 atomic_size_t refcnt;
1934 LDKBaseSign_JCalls* BaseSign;
1935 uint32_t write_meth;
1937 static void LDKSign_JCalls_free(void* this_arg) {
1938 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1939 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1940 js_free(j_calls->write_meth);
1944 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1945 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1946 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1947 LDKCVec_u8Z ret_ref;
1948 ret_ref.datalen = *((uint32_t*)ret);
1949 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1950 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1953 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1954 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1955 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1956 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1958 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1959 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1960 atomic_init(&calls->refcnt, 1);
1961 //TODO: Assign calls->o from o
1963 LDKChannelPublicKeys pubkeys_conv;
1964 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1965 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1966 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1969 .this_arg = (void*) calls,
1970 .write = write_LDKSign_jcall,
1971 .cloned = LDKSign_JCalls_cloned,
1972 .free = LDKSign_JCalls_free,
1973 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1975 calls->BaseSign = ret.BaseSign.this_arg;
1978 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
1979 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1980 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
1981 return (long)res_ptr;
1983 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
1984 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
1985 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1986 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1987 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
1988 CVec_u8Z_free(ret_var);
1992 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
1993 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
1995 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
1996 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
1997 CHECK(val->result_ok);
1998 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
1999 *res_ret = Sign_clone(&(*val->contents.result));
2000 return (uint64_t)res_ret;
2002 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2003 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2004 CHECK(!val->result_ok);
2005 LDKDecodeError err_var = (*val->contents.err);
2006 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2007 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2008 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2011 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2012 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2014 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2015 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2016 CHECK(val->result_ok);
2017 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2018 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2021 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2022 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2023 CHECK(!val->result_ok);
2024 return *val->contents.err;
2026 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2027 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2028 for (size_t i = 0; i < ret.datalen; i++) {
2029 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2033 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2034 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2036 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2037 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2038 CHECK(val->result_ok);
2039 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2040 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2041 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2042 for (size_t m = 0; m < res_var.datalen; m++) {
2043 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2044 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2045 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2046 res_arr_ptr[m] = res_conv_12_arr;
2050 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2051 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2052 CHECK(!val->result_ok);
2053 return *val->contents.err;
2055 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2056 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2058 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2059 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2060 CHECK(val->result_ok);
2061 LDKInMemorySigner res_var = (*val->contents.result);
2062 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2063 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2064 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2067 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2068 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2069 CHECK(!val->result_ok);
2070 LDKDecodeError err_var = (*val->contents.err);
2071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2073 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2076 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2077 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2078 ret->datalen = *((uint32_t*)elems);
2079 if (ret->datalen == 0) {
2082 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2083 uint32_t *java_elems = (uint32_t*)(elems + 4);
2084 for (size_t i = 0; i < ret->datalen; i++) {
2085 uint32_t arr_elem = java_elems[i];
2086 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2087 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2088 ret->data[i] = arr_elem_conv;
2091 return (uint64_t)ret;
2093 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2094 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2095 for (size_t i = 0; i < ret.datalen; i++) {
2096 ret.data[i] = TxOut_clone(&orig->data[i]);
2100 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2101 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2103 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2104 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2105 CHECK(val->result_ok);
2106 LDKTransaction res_var = (*val->contents.result);
2107 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2108 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2111 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2112 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2113 CHECK(!val->result_ok);
2114 return *val->contents.err;
2116 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2117 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2118 LDKThirtyTwoBytes a_ref;
2119 CHECK(*((uint32_t*)a) == 32);
2120 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2122 LDKChannelMonitor b_conv;
2123 b_conv.inner = (void*)(b & (~1));
2124 b_conv.is_owned = (b & 1) || (b == 0);
2125 b_conv = ChannelMonitor_clone(&b_conv);
2127 return (uint64_t)ret;
2129 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2130 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2131 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2132 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2135 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2136 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2137 LDKChannelMonitor b_var = tuple->b;
2138 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2139 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2140 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2143 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2144 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2145 ret->datalen = *((uint32_t*)elems);
2146 if (ret->datalen == 0) {
2149 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2150 uint32_t *java_elems = (uint32_t*)(elems + 4);
2151 for (size_t i = 0; i < ret->datalen; i++) {
2152 uint32_t arr_elem = java_elems[i];
2153 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2154 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2155 ret->data[i] = arr_elem_conv;
2158 return (uint64_t)ret;
2160 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2161 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2163 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2164 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2165 CHECK(val->result_ok);
2166 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2167 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2168 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2169 for (size_t m = 0; m < res_var.datalen; m++) {
2170 uint64_t res_conv_38_ref = (uint64_t)(&res_var.data[m]) | 1;
2171 res_arr_ptr[m] = res_conv_38_ref;
2175 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2176 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2177 CHECK(!val->result_ok);
2178 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2181 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2182 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2184 case LDKCOption_u16Z_Some: {
2185 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2187 case LDKCOption_u16Z_None: {
2188 return 0 /* LDKCOption_u16Z - None */;
2193 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2194 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2196 case LDKAPIError_APIMisuseError: {
2197 LDKStr err_str = obj->api_misuse_error.err;
2198 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2199 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2201 case LDKAPIError_FeeRateTooHigh: {
2202 LDKStr err_str = obj->fee_rate_too_high.err;
2203 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2204 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2206 case LDKAPIError_RouteError: {
2207 LDKStr err_str = obj->route_error.err;
2208 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2209 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2211 case LDKAPIError_ChannelUnavailable: {
2212 LDKStr err_str = obj->channel_unavailable.err;
2213 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2214 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2216 case LDKAPIError_MonitorUpdateFailed: {
2217 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2219 case LDKAPIError_IncompatibleShutdownScript: {
2220 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2221 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2222 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2223 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2224 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2229 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2230 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2232 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2233 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2234 CHECK(val->result_ok);
2235 return *val->contents.result;
2237 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2238 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2239 CHECK(!val->result_ok);
2240 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2243 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2244 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2245 ret->datalen = *((uint32_t*)elems);
2246 if (ret->datalen == 0) {
2249 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2250 uint32_t *java_elems = (uint32_t*)(elems + 4);
2251 for (size_t i = 0; i < ret->datalen; i++) {
2252 uint32_t arr_elem = java_elems[i];
2253 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2254 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2255 ret->data[i] = arr_elem_conv;
2258 return (uint64_t)ret;
2260 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2261 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2262 for (size_t i = 0; i < ret.datalen; i++) {
2263 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2267 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2268 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2269 ret->datalen = *((uint32_t*)elems);
2270 if (ret->datalen == 0) {
2273 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2274 uint32_t *java_elems = (uint32_t*)(elems + 4);
2275 for (size_t i = 0; i < ret->datalen; i++) {
2276 uint32_t arr_elem = java_elems[i];
2277 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2278 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2279 ret->data[i] = arr_elem_conv;
2282 return (uint64_t)ret;
2284 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2285 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2286 for (size_t i = 0; i < ret.datalen; i++) {
2287 ret.data[i] = APIError_clone(&orig->data[i]);
2291 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2292 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2294 case LDKPaymentSendFailure_ParameterError: {
2295 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2296 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2298 case LDKPaymentSendFailure_PathParameterError: {
2299 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2300 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2301 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2302 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2303 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2304 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2305 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2306 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2308 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2310 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2311 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2312 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2313 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2314 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2315 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2316 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2318 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2320 case LDKPaymentSendFailure_PartialFailure: {
2321 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2322 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2323 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2324 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2325 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2326 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2327 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2328 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2330 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2335 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2336 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2338 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2339 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2340 CHECK(val->result_ok);
2341 return *val->contents.result;
2343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2344 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2345 CHECK(!val->result_ok);
2346 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
2350 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
2352 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
2353 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2354 CHECK(val->result_ok);
2355 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2356 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2359 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
2360 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
2361 CHECK(!val->result_ok);
2362 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2365 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2366 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2368 case LDKNetAddress_IPv4: {
2369 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2370 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2371 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2373 case LDKNetAddress_IPv6: {
2374 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2375 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2376 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2378 case LDKNetAddress_OnionV2: {
2379 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2380 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2381 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2383 case LDKNetAddress_OnionV3: {
2384 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2385 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2386 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2391 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2392 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2393 ret->datalen = *((uint32_t*)elems);
2394 if (ret->datalen == 0) {
2397 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2398 uint32_t *java_elems = (uint32_t*)(elems + 4);
2399 for (size_t i = 0; i < ret->datalen; i++) {
2400 uint32_t arr_elem = java_elems[i];
2401 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2402 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2403 ret->data[i] = arr_elem_conv;
2406 return (uint64_t)ret;
2408 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2409 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2410 for (size_t i = 0; i < ret.datalen; i++) {
2411 ret.data[i] = NetAddress_clone(&orig->data[i]);
2415 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2416 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2417 LDKThirtyTwoBytes a_ref;
2418 CHECK(*((uint32_t*)a) == 32);
2419 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2421 LDKThirtyTwoBytes b_ref;
2422 CHECK(*((uint32_t*)b) == 32);
2423 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2425 return (uint64_t)ret;
2427 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t ptr) {
2428 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2429 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2430 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2433 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t ptr) {
2434 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
2435 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2436 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
2439 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2440 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2442 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2443 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2444 CHECK(val->result_ok);
2445 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2446 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2449 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2450 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2451 CHECK(!val->result_ok);
2452 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2455 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2456 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2457 ret->datalen = *((uint32_t*)elems);
2458 if (ret->datalen == 0) {
2461 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2462 uint32_t *java_elems = (uint32_t*)(elems + 4);
2463 for (size_t i = 0; i < ret->datalen; i++) {
2464 uint32_t arr_elem = java_elems[i];
2465 LDKChannelMonitor arr_elem_conv;
2466 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2467 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2468 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2469 ret->data[i] = arr_elem_conv;
2472 return (uint64_t)ret;
2474 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2475 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2476 for (size_t i = 0; i < ret.datalen; i++) {
2477 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2481 typedef struct LDKWatch_JCalls {
2482 atomic_size_t refcnt;
2483 uint32_t watch_channel_meth;
2484 uint32_t update_channel_meth;
2485 uint32_t release_pending_monitor_events_meth;
2487 static void LDKWatch_JCalls_free(void* this_arg) {
2488 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2489 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2490 js_free(j_calls->watch_channel_meth);
2491 js_free(j_calls->update_channel_meth);
2492 js_free(j_calls->release_pending_monitor_events_meth);
2496 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2497 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2498 LDKOutPoint funding_txo_var = funding_txo;
2499 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2500 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2501 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2502 if (funding_txo_var.is_owned) {
2503 funding_txo_ref |= 1;
2505 LDKChannelMonitor monitor_var = monitor;
2506 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2507 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2508 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2509 if (monitor_var.is_owned) {
2512 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2513 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2514 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2517 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2518 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2519 LDKOutPoint funding_txo_var = funding_txo;
2520 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2521 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2522 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2523 if (funding_txo_var.is_owned) {
2524 funding_txo_ref |= 1;
2526 LDKChannelMonitorUpdate update_var = update;
2527 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2528 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2529 uint64_t update_ref = (uint64_t)update_var.inner;
2530 if (update_var.is_owned) {
2533 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2534 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2535 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2538 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2539 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2540 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2541 LDKCVec_MonitorEventZ ret_constr;
2542 ret_constr.datalen = *((uint32_t*)ret);
2543 if (ret_constr.datalen > 0)
2544 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2546 ret_constr.data = NULL;
2547 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2548 for (size_t o = 0; o < ret_constr.datalen; o++) {
2549 uint32_t ret_conv_14 = ret_vals[o];
2550 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2551 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2552 ret_constr.data[o] = ret_conv_14_conv;
2556 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2557 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2558 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2560 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2561 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2562 atomic_init(&calls->refcnt, 1);
2563 //TODO: Assign calls->o from o
2566 .this_arg = (void*) calls,
2567 .watch_channel = watch_channel_LDKWatch_jcall,
2568 .update_channel = update_channel_LDKWatch_jcall,
2569 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2570 .free = LDKWatch_JCalls_free,
2574 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2575 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2576 *res_ptr = LDKWatch_init(o);
2577 return (long)res_ptr;
2579 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2580 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2581 LDKOutPoint funding_txo_conv;
2582 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2583 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2584 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2585 LDKChannelMonitor monitor_conv;
2586 monitor_conv.inner = (void*)(monitor & (~1));
2587 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2588 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2589 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2590 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2591 return (uint64_t)ret_conv;
2594 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2595 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2596 LDKOutPoint funding_txo_conv;
2597 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2598 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2599 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2600 LDKChannelMonitorUpdate update_conv;
2601 update_conv.inner = (void*)(update & (~1));
2602 update_conv.is_owned = (update & 1) || (update == 0);
2603 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2604 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2605 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2606 return (uint64_t)ret_conv;
2609 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2610 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2611 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2612 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2613 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2614 for (size_t o = 0; o < ret_var.datalen; o++) {
2615 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2616 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2617 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2618 ret_arr_ptr[o] = ret_conv_14_ref;
2624 typedef struct LDKBroadcasterInterface_JCalls {
2625 atomic_size_t refcnt;
2626 uint32_t broadcast_transaction_meth;
2627 } LDKBroadcasterInterface_JCalls;
2628 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2629 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2630 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2631 js_free(j_calls->broadcast_transaction_meth);
2635 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2636 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2637 LDKTransaction tx_var = tx;
2638 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2639 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2640 Transaction_free(tx_var);
2641 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2643 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2644 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2645 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2647 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2648 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2649 atomic_init(&calls->refcnt, 1);
2650 //TODO: Assign calls->o from o
2652 LDKBroadcasterInterface ret = {
2653 .this_arg = (void*) calls,
2654 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2655 .free = LDKBroadcasterInterface_JCalls_free,
2659 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2660 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2661 *res_ptr = LDKBroadcasterInterface_init(o);
2662 return (long)res_ptr;
2664 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2665 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2666 LDKTransaction tx_ref;
2667 tx_ref.datalen = *((uint32_t*)tx);
2668 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2669 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2670 tx_ref.data_is_owned = true;
2671 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2674 typedef struct LDKKeysInterface_JCalls {
2675 atomic_size_t refcnt;
2676 uint32_t get_node_secret_meth;
2677 uint32_t get_destination_script_meth;
2678 uint32_t get_shutdown_scriptpubkey_meth;
2679 uint32_t get_channel_signer_meth;
2680 uint32_t get_secure_random_bytes_meth;
2681 uint32_t read_chan_signer_meth;
2682 uint32_t sign_invoice_meth;
2683 } LDKKeysInterface_JCalls;
2684 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2685 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2686 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2687 js_free(j_calls->get_node_secret_meth);
2688 js_free(j_calls->get_destination_script_meth);
2689 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2690 js_free(j_calls->get_channel_signer_meth);
2691 js_free(j_calls->get_secure_random_bytes_meth);
2692 js_free(j_calls->read_chan_signer_meth);
2693 js_free(j_calls->sign_invoice_meth);
2697 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2698 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2699 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2700 LDKSecretKey ret_ref;
2701 CHECK(*((uint32_t*)ret) == 32);
2702 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2705 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2706 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2707 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2708 LDKCVec_u8Z ret_ref;
2709 ret_ref.datalen = *((uint32_t*)ret);
2710 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2711 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2714 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2715 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2716 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2717 LDKShutdownScript ret_conv;
2718 ret_conv.inner = (void*)(ret & (~1));
2719 ret_conv.is_owned = (ret & 1) || (ret == 0);
2720 ret_conv = ShutdownScript_clone(&ret_conv);
2723 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2724 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2725 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2726 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2727 ret_conv = Sign_clone(&ret_conv);
2730 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2731 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2732 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2733 LDKThirtyTwoBytes ret_ref;
2734 CHECK(*((uint32_t*)ret) == 32);
2735 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2738 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2739 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2740 LDKu8slice reader_var = reader;
2741 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2742 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2743 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2744 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2745 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2748 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2749 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2750 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2751 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2752 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2753 CVec_u8Z_free(invoice_preimage_var);
2754 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2755 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2756 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2759 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2760 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2761 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2763 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2764 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2765 atomic_init(&calls->refcnt, 1);
2766 //TODO: Assign calls->o from o
2768 LDKKeysInterface ret = {
2769 .this_arg = (void*) calls,
2770 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2771 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2772 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2773 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2774 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2775 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2776 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2777 .free = LDKKeysInterface_JCalls_free,
2781 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2782 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2783 *res_ptr = LDKKeysInterface_init(o);
2784 return (long)res_ptr;
2786 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2787 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2788 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2789 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2793 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2794 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2795 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2796 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2797 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2798 CVec_u8Z_free(ret_var);
2802 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2803 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2804 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2807 uint64_t ret_ref = (uint64_t)ret_var.inner;
2808 if (ret_var.is_owned) {
2814 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2815 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2816 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2817 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2818 return (uint64_t)ret_ret;
2821 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2822 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2823 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2824 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2828 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2829 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2830 LDKu8slice reader_ref;
2831 reader_ref.datalen = *((uint32_t*)reader);
2832 reader_ref.data = (int8_t*)(reader + 4);
2833 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2834 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2835 return (uint64_t)ret_conv;
2838 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2839 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2840 LDKCVec_u8Z invoice_preimage_ref;
2841 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2842 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2843 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2844 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2845 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2846 return (uint64_t)ret_conv;
2849 typedef struct LDKFeeEstimator_JCalls {
2850 atomic_size_t refcnt;
2851 uint32_t get_est_sat_per_1000_weight_meth;
2852 } LDKFeeEstimator_JCalls;
2853 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2854 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2855 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2856 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2860 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2861 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2862 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2863 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2865 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
2866 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
2867 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2869 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2870 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2871 atomic_init(&calls->refcnt, 1);
2872 //TODO: Assign calls->o from o
2874 LDKFeeEstimator ret = {
2875 .this_arg = (void*) calls,
2876 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2877 .free = LDKFeeEstimator_JCalls_free,
2881 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2882 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2883 *res_ptr = LDKFeeEstimator_init(o);
2884 return (long)res_ptr;
2886 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2887 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2888 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2889 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2893 typedef struct LDKLogger_JCalls {
2894 atomic_size_t refcnt;
2897 static void LDKLogger_JCalls_free(void* this_arg) {
2898 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2899 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2900 js_free(j_calls->log_meth);
2904 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2905 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2906 const char* record_str = record;
2907 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2908 js_invoke_function_1(j_calls->log_meth, record_conv);
2910 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2911 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2912 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2914 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2915 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2916 atomic_init(&calls->refcnt, 1);
2917 //TODO: Assign calls->o from o
2920 .this_arg = (void*) calls,
2921 .log = log_LDKLogger_jcall,
2922 .free = LDKLogger_JCalls_free,
2926 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2927 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2928 *res_ptr = LDKLogger_init(o);
2929 return (long)res_ptr;
2931 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2932 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2933 LDKThirtyTwoBytes a_ref;
2934 CHECK(*((uint32_t*)a) == 32);
2935 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2937 LDKChannelManager b_conv;
2938 b_conv.inner = (void*)(b & (~1));
2939 b_conv.is_owned = (b & 1) || (b == 0);
2940 // Warning: we need a move here but no clone is available for LDKChannelManager
2942 return (uint64_t)ret;
2944 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2945 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2946 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2947 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2950 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2951 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2952 LDKChannelManager b_var = tuple->b;
2953 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2954 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2955 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2958 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2959 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2961 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2962 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2963 CHECK(val->result_ok);
2964 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2967 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2968 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2969 CHECK(!val->result_ok);
2970 LDKDecodeError err_var = (*val->contents.err);
2971 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2972 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2973 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2976 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
2977 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
2979 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
2980 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2981 CHECK(val->result_ok);
2982 LDKChannelConfig res_var = (*val->contents.result);
2983 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2984 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2985 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2988 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
2989 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
2990 CHECK(!val->result_ok);
2991 LDKDecodeError err_var = (*val->contents.err);
2992 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2993 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2994 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2997 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
2998 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3000 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3001 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3002 CHECK(val->result_ok);
3003 LDKOutPoint res_var = (*val->contents.result);
3004 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3005 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3006 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3009 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3010 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3011 CHECK(!val->result_ok);
3012 LDKDecodeError err_var = (*val->contents.err);
3013 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3014 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3015 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3018 typedef struct LDKType_JCalls {
3019 atomic_size_t refcnt;
3020 uint32_t type_id_meth;
3021 uint32_t debug_str_meth;
3022 uint32_t write_meth;
3024 static void LDKType_JCalls_free(void* this_arg) {
3025 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3026 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3027 js_free(j_calls->type_id_meth);
3028 js_free(j_calls->debug_str_meth);
3029 js_free(j_calls->write_meth);
3033 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3034 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3035 return js_invoke_function_0(j_calls->type_id_meth);
3037 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3038 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3039 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3040 LDKStr ret_conv = str_ref_to_owned_c(ret);
3043 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3044 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3045 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3046 LDKCVec_u8Z ret_ref;
3047 ret_ref.datalen = *((uint32_t*)ret);
3048 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3049 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3052 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3053 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3054 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3056 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3057 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3058 atomic_init(&calls->refcnt, 1);
3059 //TODO: Assign calls->o from o
3062 .this_arg = (void*) calls,
3063 .type_id = type_id_LDKType_jcall,
3064 .debug_str = debug_str_LDKType_jcall,
3065 .write = write_LDKType_jcall,
3066 .cloned = LDKType_JCalls_cloned,
3067 .free = LDKType_JCalls_free,
3071 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3072 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3073 *res_ptr = LDKType_init(o);
3074 return (long)res_ptr;
3076 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3077 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3078 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3082 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3083 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3084 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3085 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3090 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3091 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3092 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3093 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3094 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3095 CVec_u8Z_free(ret_var);
3099 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3100 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3102 case LDKCOption_TypeZ_Some: {
3103 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3104 *some_ret = Type_clone(&obj->some);
3105 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3107 case LDKCOption_TypeZ_None: {
3108 return 0 /* LDKCOption_TypeZ - None */;
3113 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3114 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3116 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3117 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3118 CHECK(val->result_ok);
3119 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3122 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3123 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3124 CHECK(!val->result_ok);
3125 LDKDecodeError err_var = (*val->contents.err);
3126 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3127 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3128 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3131 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3132 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3135 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3136 CHECK(val->result_ok);
3137 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3140 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3141 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3142 CHECK(!val->result_ok);
3143 return *val->contents.err;
3145 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3146 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3148 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3149 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3150 CHECK(val->result_ok);
3151 LDKInvoice res_var = (*val->contents.result);
3152 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3157 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3158 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3159 CHECK(!val->result_ok);
3160 return *val->contents.err;
3162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3163 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3165 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3166 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3167 CHECK(val->result_ok);
3168 LDKSignedRawInvoice res_var = (*val->contents.result);
3169 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3170 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3171 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3174 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3175 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3176 CHECK(!val->result_ok);
3177 return *val->contents.err;
3179 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
3180 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
3181 LDKRawInvoice a_conv;
3182 a_conv.inner = (void*)(a & (~1));
3183 a_conv.is_owned = (a & 1) || (a == 0);
3184 a_conv = RawInvoice_clone(&a_conv);
3186 LDKThirtyTwoBytes b_ref;
3187 CHECK(*((uint32_t*)b) == 32);
3188 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
3190 LDKInvoiceSignature c_conv;
3191 c_conv.inner = (void*)(c & (~1));
3192 c_conv.is_owned = (c & 1) || (c == 0);
3193 c_conv = InvoiceSignature_clone(&c_conv);
3195 return (uint64_t)ret;
3197 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t ptr) {
3198 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3199 LDKRawInvoice a_var = tuple->a;
3200 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3205 int8_tArray __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t ptr) {
3206 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3207 int8_tArray b_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3208 memcpy((uint8_t*)(b_arr + 4), tuple->b.data, 32);
3211 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t ptr) {
3212 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
3213 LDKInvoiceSignature c_var = tuple->c;
3214 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3215 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3216 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
3219 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3220 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3222 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3223 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3224 CHECK(val->result_ok);
3225 LDKPayeePubKey res_var = (*val->contents.result);
3226 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3227 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3228 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3231 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3232 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3233 CHECK(!val->result_ok);
3234 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3237 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3238 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3239 ret->datalen = *((uint32_t*)elems);
3240 if (ret->datalen == 0) {
3243 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3244 uint32_t *java_elems = (uint32_t*)(elems + 4);
3245 for (size_t i = 0; i < ret->datalen; i++) {
3246 uint32_t arr_elem = java_elems[i];
3247 LDKPrivateRoute arr_elem_conv;
3248 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3249 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3250 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3251 ret->data[i] = arr_elem_conv;
3254 return (uint64_t)ret;
3256 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3257 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3258 for (size_t i = 0; i < ret.datalen; i++) {
3259 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3263 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3264 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3266 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3267 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3268 CHECK(val->result_ok);
3269 LDKPositiveTimestamp res_var = (*val->contents.result);
3270 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3271 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3272 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3275 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3276 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3277 CHECK(!val->result_ok);
3278 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3281 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3282 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3284 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3285 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3286 CHECK(val->result_ok);
3287 return *val->contents.result;
3289 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3290 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3291 CHECK(!val->result_ok);
3292 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3295 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3296 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3298 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3299 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3300 CHECK(val->result_ok);
3301 LDKInvoice res_var = (*val->contents.result);
3302 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3303 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3304 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3307 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3308 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3309 CHECK(!val->result_ok);
3310 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3313 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3314 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3316 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3317 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3318 CHECK(val->result_ok);
3319 LDKDescription res_var = (*val->contents.result);
3320 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3321 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3322 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3325 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3326 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3327 CHECK(!val->result_ok);
3328 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3331 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3332 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3335 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3336 CHECK(val->result_ok);
3337 LDKExpiryTime res_var = (*val->contents.result);
3338 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3339 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3340 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3343 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3344 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3345 CHECK(!val->result_ok);
3346 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3350 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3353 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3354 CHECK(val->result_ok);
3355 LDKPrivateRoute res_var = (*val->contents.result);
3356 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3357 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3358 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3362 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3363 CHECK(!val->result_ok);
3364 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3367 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3368 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3370 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3371 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3372 CHECK(val->result_ok);
3373 LDKStr res_str = (*val->contents.result);
3374 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3377 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3378 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3379 CHECK(!val->result_ok);
3380 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3383 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3384 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3386 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3387 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3388 CHECK(val->result_ok);
3389 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3390 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3391 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3392 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3396 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3397 CHECK(!val->result_ok);
3398 LDKDecodeError err_var = (*val->contents.err);
3399 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3400 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3401 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3404 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3405 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3407 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3408 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3409 CHECK(val->result_ok);
3410 LDKHTLCUpdate res_var = (*val->contents.result);
3411 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3412 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3413 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3416 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3417 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3418 CHECK(!val->result_ok);
3419 LDKDecodeError err_var = (*val->contents.err);
3420 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3421 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3422 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3425 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3426 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3428 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3429 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3430 CHECK(val->result_ok);
3431 return *val->contents.result;
3433 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3434 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3435 CHECK(!val->result_ok);
3436 LDKMonitorUpdateError err_var = (*val->contents.err);
3437 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3438 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3439 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3442 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3443 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3445 a_conv.inner = (void*)(a & (~1));
3446 a_conv.is_owned = (a & 1) || (a == 0);
3447 a_conv = OutPoint_clone(&a_conv);
3450 b_ref.datalen = *((uint32_t*)b);
3451 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3452 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3454 return (uint64_t)ret;
3456 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
3457 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3458 LDKOutPoint a_var = tuple->a;
3459 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3460 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3461 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3464 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
3465 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
3466 LDKCVec_u8Z b_var = tuple->b;
3467 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3468 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3471 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3472 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3475 b_ref.datalen = *((uint32_t*)b);
3476 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3477 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3479 return (uint64_t)ret;
3481 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
3482 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3485 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
3486 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
3487 LDKCVec_u8Z b_var = tuple->b;
3488 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3489 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
3492 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3493 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3494 ret->datalen = *((uint32_t*)elems);
3495 if (ret->datalen == 0) {
3498 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3499 uint32_t *java_elems = (uint32_t*)(elems + 4);
3500 for (size_t i = 0; i < ret->datalen; i++) {
3501 uint32_t arr_elem = java_elems[i];
3502 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3503 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3504 ret->data[i] = arr_elem_conv;
3507 return (uint64_t)ret;
3509 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3510 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3511 for (size_t i = 0; i < ret.datalen; i++) {
3512 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3516 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3517 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3518 LDKThirtyTwoBytes a_ref;
3519 CHECK(*((uint32_t*)a) == 32);
3520 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3522 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3523 b_constr.datalen = *((uint32_t*)b);
3524 if (b_constr.datalen > 0)
3525 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3527 b_constr.data = NULL;
3528 uint32_t* b_vals = (uint32_t*)(b + 4);
3529 for (size_t e = 0; e < b_constr.datalen; e++) {
3530 uint32_t b_conv_30 = b_vals[e];
3531 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
3532 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
3533 b_constr.data[e] = b_conv_30_conv;
3536 return (uint64_t)ret;
3538 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
3539 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3540 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3541 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3544 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
3545 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
3546 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
3547 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3548 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3549 for (size_t e = 0; e < b_var.datalen; e++) {
3550 uint64_t b_conv_30_ref = (uint64_t)(&b_var.data[e]) | 1;
3551 b_arr_ptr[e] = b_conv_30_ref;
3555 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3556 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3557 ret->datalen = *((uint32_t*)elems);
3558 if (ret->datalen == 0) {
3561 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3562 uint32_t *java_elems = (uint32_t*)(elems + 4);
3563 for (size_t i = 0; i < ret->datalen; i++) {
3564 uint32_t arr_elem = java_elems[i];
3565 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3566 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3567 ret->data[i] = arr_elem_conv;
3570 return (uint64_t)ret;
3572 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3573 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 };
3574 for (size_t i = 0; i < ret.datalen; i++) {
3575 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3579 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3580 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3582 case LDKPaymentPurpose_InvoicePayment: {
3583 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3584 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3585 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3586 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3587 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3589 case LDKPaymentPurpose_SpontaneousPayment: {
3590 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3591 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3592 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3597 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3598 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3600 case LDKClosureReason_CounterpartyForceClosed: {
3601 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3602 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3603 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3605 case LDKClosureReason_HolderForceClosed: {
3606 return 0 /* LDKClosureReason - HolderForceClosed */;
3608 case LDKClosureReason_CooperativeClosure: {
3609 return 0 /* LDKClosureReason - CooperativeClosure */;
3611 case LDKClosureReason_CommitmentTxConfirmed: {
3612 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3614 case LDKClosureReason_ProcessingError: {
3615 LDKStr err_str = obj->processing_error.err;
3616 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3617 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3619 case LDKClosureReason_DisconnectedPeer: {
3620 return 0 /* LDKClosureReason - DisconnectedPeer */;
3622 case LDKClosureReason_OutdatedChannelManager: {
3623 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3628 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3629 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3631 case LDKEvent_FundingGenerationReady: {
3632 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3633 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3634 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3635 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3636 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3637 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;
3639 case LDKEvent_PaymentReceived: {
3640 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3641 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3642 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3643 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3645 case LDKEvent_PaymentSent: {
3646 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3647 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3648 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
3650 case LDKEvent_PaymentPathFailed: {
3651 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3652 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3653 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3654 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3655 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3656 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3657 for (size_t k = 0; k < path_var.datalen; k++) {
3658 LDKRouteHop path_conv_10_var = path_var.data[k];
3659 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3660 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3661 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3662 path_arr_ptr[k] = path_conv_10_ref;
3664 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr;
3666 case LDKEvent_PendingHTLCsForwardable: {
3667 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3669 case LDKEvent_SpendableOutputs: {
3670 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3671 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3672 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3673 for (size_t b = 0; b < outputs_var.datalen; b++) {
3674 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3675 outputs_arr_ptr[b] = outputs_conv_27_ref;
3677 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3679 case LDKEvent_PaymentForwarded: {
3680 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3681 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3683 case LDKEvent_ChannelClosed: {
3684 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3685 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3686 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3687 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref;
3692 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3693 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3694 ret->datalen = *((uint32_t*)elems);
3695 if (ret->datalen == 0) {
3698 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3699 uint32_t *java_elems = (uint32_t*)(elems + 4);
3700 for (size_t i = 0; i < ret->datalen; i++) {
3701 uint32_t arr_elem = java_elems[i];
3702 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3703 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3704 ret->data[i] = arr_elem_conv;
3707 return (uint64_t)ret;
3709 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3710 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3711 for (size_t i = 0; i < ret.datalen; i++) {
3712 ret.data[i] = Event_clone(&orig->data[i]);
3716 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3717 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3719 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3720 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3722 return (uint64_t)ret;
3724 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
3725 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3728 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
3729 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
3730 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
3731 return (uint64_t)b_ref;
3733 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3734 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3735 ret->datalen = *((uint32_t*)elems);
3736 if (ret->datalen == 0) {
3739 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3740 uint32_t *java_elems = (uint32_t*)(elems + 4);
3741 for (size_t i = 0; i < ret->datalen; i++) {
3742 uint32_t arr_elem = java_elems[i];
3743 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3744 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3745 ret->data[i] = arr_elem_conv;
3748 return (uint64_t)ret;
3750 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3751 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3752 for (size_t i = 0; i < ret.datalen; i++) {
3753 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3757 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3758 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3759 LDKThirtyTwoBytes a_ref;
3760 CHECK(*((uint32_t*)a) == 32);
3761 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3763 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3764 b_constr.datalen = *((uint32_t*)b);
3765 if (b_constr.datalen > 0)
3766 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3768 b_constr.data = NULL;
3769 uint32_t* b_vals = (uint32_t*)(b + 4);
3770 for (size_t z = 0; z < b_constr.datalen; z++) {
3771 uint32_t b_conv_25 = b_vals[z];
3772 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
3773 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
3774 b_constr.data[z] = b_conv_25_conv;
3777 return (uint64_t)ret;
3779 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
3780 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3781 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3782 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
3785 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
3786 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
3787 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
3788 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3789 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
3790 for (size_t z = 0; z < b_var.datalen; z++) {
3791 uint64_t b_conv_25_ref = (uint64_t)(&b_var.data[z]) | 1;
3792 b_arr_ptr[z] = b_conv_25_ref;
3796 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
3797 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
3798 ret->datalen = *((uint32_t*)elems);
3799 if (ret->datalen == 0) {
3802 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
3803 uint32_t *java_elems = (uint32_t*)(elems + 4);
3804 for (size_t i = 0; i < ret->datalen; i++) {
3805 uint32_t arr_elem = java_elems[i];
3806 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
3807 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
3808 ret->data[i] = arr_elem_conv;
3811 return (uint64_t)ret;
3813 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
3814 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 };
3815 for (size_t i = 0; i < ret.datalen; i++) {
3816 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
3820 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
3821 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
3823 case LDKBalance_ClaimableOnChannelClose: {
3824 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
3826 case LDKBalance_ClaimableAwaitingConfirmations: {
3827 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
3829 case LDKBalance_ContentiousClaimable: {
3830 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
3832 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
3833 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
3838 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
3839 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
3840 ret->datalen = *((uint32_t*)elems);
3841 if (ret->datalen == 0) {
3844 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
3845 uint32_t *java_elems = (uint32_t*)(elems + 4);
3846 for (size_t i = 0; i < ret->datalen; i++) {
3847 uint32_t arr_elem = java_elems[i];
3848 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
3849 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
3850 ret->data[i] = arr_elem_conv;
3853 return (uint64_t)ret;
3855 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
3856 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
3857 for (size_t i = 0; i < ret.datalen; i++) {
3858 ret.data[i] = Balance_clone(&orig->data[i]);
3862 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
3863 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
3865 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
3866 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3867 CHECK(val->result_ok);
3868 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
3871 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
3872 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
3873 CHECK(!val->result_ok);
3874 LDKDecodeError err_var = (*val->contents.err);
3875 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3876 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3877 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3880 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
3881 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3883 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
3884 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3885 CHECK(val->result_ok);
3886 return *val->contents.result;
3888 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
3889 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3890 CHECK(!val->result_ok);
3891 LDKLightningError err_var = (*val->contents.err);
3892 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3893 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3894 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3897 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
3898 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
3900 CHECK(*((uint32_t*)a) == 33);
3901 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
3903 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
3904 b_conv = Type_clone(&b_conv);
3906 return (uint64_t)ret;
3908 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_a(uint32_t ptr) {
3909 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
3910 int8_tArray a_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
3911 memcpy((uint8_t*)(a_arr + 4), tuple->a.compressed_form, 33);
3914 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_b(uint32_t ptr) {
3915 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
3916 LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
3917 *b_ret = Type_clone(&tuple->b);
3918 return (uint64_t)b_ret;
3920 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
3921 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
3922 ret->datalen = *((uint32_t*)elems);
3923 if (ret->datalen == 0) {
3926 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
3927 uint32_t *java_elems = (uint32_t*)(elems + 4);
3928 for (size_t i = 0; i < ret->datalen; i++) {
3929 uint32_t arr_elem = java_elems[i];
3930 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
3931 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
3932 ret->data[i] = arr_elem_conv;
3935 return (uint64_t)ret;
3937 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
3938 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
3939 for (size_t i = 0; i < ret.datalen; i++) {
3940 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
3944 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
3945 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3947 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
3948 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3949 CHECK(val->result_ok);
3950 return *val->contents.result;
3952 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
3953 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
3954 CHECK(!val->result_ok);
3955 LDKLightningError err_var = (*val->contents.err);
3956 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3957 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3958 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3961 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
3962 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3963 LDKChannelAnnouncement a_conv;
3964 a_conv.inner = (void*)(a & (~1));
3965 a_conv.is_owned = (a & 1) || (a == 0);
3966 a_conv = ChannelAnnouncement_clone(&a_conv);
3968 LDKChannelUpdate b_conv;
3969 b_conv.inner = (void*)(b & (~1));
3970 b_conv.is_owned = (b & 1) || (b == 0);
3971 b_conv = ChannelUpdate_clone(&b_conv);
3973 LDKChannelUpdate c_conv;
3974 c_conv.inner = (void*)(c & (~1));
3975 c_conv.is_owned = (c & 1) || (c == 0);
3976 c_conv = ChannelUpdate_clone(&c_conv);
3978 return (uint64_t)ret;
3980 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
3981 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3982 LDKChannelAnnouncement a_var = tuple->a;
3983 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3984 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3985 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
3988 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
3989 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3990 LDKChannelUpdate b_var = tuple->b;
3991 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3992 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3993 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3996 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
3997 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3998 LDKChannelUpdate c_var = tuple->c;
3999 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4000 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4001 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4004 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4005 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4006 ret->datalen = *((uint32_t*)elems);
4007 if (ret->datalen == 0) {
4010 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4011 uint32_t *java_elems = (uint32_t*)(elems + 4);
4012 for (size_t i = 0; i < ret->datalen; i++) {
4013 uint32_t arr_elem = java_elems[i];
4014 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4015 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4016 ret->data[i] = arr_elem_conv;
4019 return (uint64_t)ret;
4021 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4022 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4023 for (size_t i = 0; i < ret.datalen; i++) {
4024 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4028 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4029 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4030 ret->datalen = *((uint32_t*)elems);
4031 if (ret->datalen == 0) {
4034 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4035 uint32_t *java_elems = (uint32_t*)(elems + 4);
4036 for (size_t i = 0; i < ret->datalen; i++) {
4037 uint32_t arr_elem = java_elems[i];
4038 LDKNodeAnnouncement arr_elem_conv;
4039 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4040 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4041 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4042 ret->data[i] = arr_elem_conv;
4045 return (uint64_t)ret;
4047 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4048 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4049 for (size_t i = 0; i < ret.datalen; i++) {
4050 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4054 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4055 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4057 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4058 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4059 CHECK(val->result_ok);
4060 LDKCVec_u8Z res_var = (*val->contents.result);
4061 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4062 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4065 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4066 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4067 CHECK(!val->result_ok);
4068 LDKPeerHandleError err_var = (*val->contents.err);
4069 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4070 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4071 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4074 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4075 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4077 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4078 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4079 CHECK(val->result_ok);
4080 return *val->contents.result;
4082 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4083 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4084 CHECK(!val->result_ok);
4085 LDKPeerHandleError err_var = (*val->contents.err);
4086 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4087 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4088 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4091 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4092 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4094 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4095 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4096 CHECK(val->result_ok);
4097 return *val->contents.result;
4099 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4100 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4101 CHECK(!val->result_ok);
4102 LDKPeerHandleError err_var = (*val->contents.err);
4103 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4104 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4105 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4108 typedef struct LDKAccess_JCalls {
4109 atomic_size_t refcnt;
4110 uint32_t get_utxo_meth;
4112 static void LDKAccess_JCalls_free(void* this_arg) {
4113 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4114 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4115 js_free(j_calls->get_utxo_meth);
4119 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4120 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4121 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4122 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4123 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4124 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4125 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4128 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4129 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4130 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4132 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4133 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4134 atomic_init(&calls->refcnt, 1);
4135 //TODO: Assign calls->o from o
4138 .this_arg = (void*) calls,
4139 .get_utxo = get_utxo_LDKAccess_jcall,
4140 .free = LDKAccess_JCalls_free,
4144 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4145 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4146 *res_ptr = LDKAccess_init(o);
4147 return (long)res_ptr;
4149 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4150 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4151 unsigned char genesis_hash_arr[32];
4152 CHECK(*((uint32_t*)genesis_hash) == 32);
4153 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4154 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4155 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4156 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4157 return (uint64_t)ret_conv;
4160 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4161 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4163 case LDKCOption_AccessZ_Some: {
4164 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4165 *some_ret = obj->some;
4166 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4167 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4169 case LDKCOption_AccessZ_None: {
4170 return 0 /* LDKCOption_AccessZ - None */;
4175 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4176 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4178 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4179 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4180 CHECK(val->result_ok);
4181 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4182 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4183 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4184 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4187 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4188 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4189 CHECK(!val->result_ok);
4190 LDKDecodeError err_var = (*val->contents.err);
4191 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4192 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4193 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4196 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4197 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4199 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4200 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4201 CHECK(val->result_ok);
4202 LDKChannelInfo res_var = (*val->contents.result);
4203 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4204 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4205 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4208 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4209 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4210 CHECK(!val->result_ok);
4211 LDKDecodeError err_var = (*val->contents.err);
4212 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4213 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4214 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4217 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4218 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4220 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4221 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4222 CHECK(val->result_ok);
4223 LDKRoutingFees res_var = (*val->contents.result);
4224 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4229 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4230 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4231 CHECK(!val->result_ok);
4232 LDKDecodeError err_var = (*val->contents.err);
4233 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4234 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4235 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4238 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4239 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4241 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4242 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4243 CHECK(val->result_ok);
4244 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4245 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4246 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4247 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4251 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4252 CHECK(!val->result_ok);
4253 LDKDecodeError err_var = (*val->contents.err);
4254 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4255 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4256 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4259 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4260 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4261 ret->datalen = *((uint32_t*)elems);
4262 if (ret->datalen == 0) {
4265 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4266 int64_t *java_elems = (int64_t*)(elems + 4);
4267 for (size_t i = 0; i < ret->datalen; i++) {
4268 ret->data[i] = java_elems[i];
4271 return (uint64_t)ret;
4273 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4274 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4275 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4278 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4279 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4281 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4282 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4283 CHECK(val->result_ok);
4284 LDKNodeInfo res_var = (*val->contents.result);
4285 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4286 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4287 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4291 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4292 CHECK(!val->result_ok);
4293 LDKDecodeError err_var = (*val->contents.err);
4294 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4295 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4296 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4299 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4300 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4302 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4303 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4304 CHECK(val->result_ok);
4305 LDKNetworkGraph res_var = (*val->contents.result);
4306 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4307 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4308 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4311 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4312 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4313 CHECK(!val->result_ok);
4314 LDKDecodeError err_var = (*val->contents.err);
4315 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4316 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4317 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4320 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4321 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4323 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4324 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4325 CHECK(val->result_ok);
4326 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4329 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4330 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4331 CHECK(!val->result_ok);
4332 return *val->contents.err;
4334 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4335 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4338 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4339 CHECK(val->result_ok);
4340 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4341 *res_conv = (*val->contents.result);
4342 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4343 return (uint64_t)res_conv;
4345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4346 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4347 CHECK(!val->result_ok);
4348 LDKDecodeError err_var = (*val->contents.err);
4349 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4350 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4351 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4354 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4355 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4357 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4358 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4359 CHECK(val->result_ok);
4360 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4364 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4365 CHECK(!val->result_ok);
4366 LDKDecodeError err_var = (*val->contents.err);
4367 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4368 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4369 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4372 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4373 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4374 ret->datalen = *((uint32_t*)elems);
4375 if (ret->datalen == 0) {
4378 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4379 uint32_t *java_elems = (uint32_t*)(elems + 4);
4380 for (size_t i = 0; i < ret->datalen; i++) {
4381 uint32_t arr_elem = java_elems[i];
4382 LDKUpdateAddHTLC arr_elem_conv;
4383 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4384 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4385 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4386 ret->data[i] = arr_elem_conv;
4389 return (uint64_t)ret;
4391 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4392 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4393 for (size_t i = 0; i < ret.datalen; i++) {
4394 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4398 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4399 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4400 ret->datalen = *((uint32_t*)elems);
4401 if (ret->datalen == 0) {
4404 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4405 uint32_t *java_elems = (uint32_t*)(elems + 4);
4406 for (size_t i = 0; i < ret->datalen; i++) {
4407 uint32_t arr_elem = java_elems[i];
4408 LDKUpdateFulfillHTLC arr_elem_conv;
4409 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4410 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4411 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4412 ret->data[i] = arr_elem_conv;
4415 return (uint64_t)ret;
4417 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4418 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4419 for (size_t i = 0; i < ret.datalen; i++) {
4420 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4424 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4425 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4426 ret->datalen = *((uint32_t*)elems);
4427 if (ret->datalen == 0) {
4430 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4431 uint32_t *java_elems = (uint32_t*)(elems + 4);
4432 for (size_t i = 0; i < ret->datalen; i++) {
4433 uint32_t arr_elem = java_elems[i];
4434 LDKUpdateFailHTLC arr_elem_conv;
4435 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4436 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4437 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4438 ret->data[i] = arr_elem_conv;
4441 return (uint64_t)ret;
4443 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4444 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4445 for (size_t i = 0; i < ret.datalen; i++) {
4446 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4450 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4451 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4452 ret->datalen = *((uint32_t*)elems);
4453 if (ret->datalen == 0) {
4456 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4457 uint32_t *java_elems = (uint32_t*)(elems + 4);
4458 for (size_t i = 0; i < ret->datalen; i++) {
4459 uint32_t arr_elem = java_elems[i];
4460 LDKUpdateFailMalformedHTLC arr_elem_conv;
4461 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4462 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4463 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4464 ret->data[i] = arr_elem_conv;
4467 return (uint64_t)ret;
4469 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4470 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4471 for (size_t i = 0; i < ret.datalen; i++) {
4472 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4476 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4477 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4479 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4480 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4481 CHECK(val->result_ok);
4482 LDKAcceptChannel res_var = (*val->contents.result);
4483 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4484 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4485 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4488 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4489 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4490 CHECK(!val->result_ok);
4491 LDKDecodeError err_var = (*val->contents.err);
4492 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4493 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4494 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4497 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4498 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4500 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4501 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4502 CHECK(val->result_ok);
4503 LDKAnnouncementSignatures res_var = (*val->contents.result);
4504 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4505 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4506 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4509 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4510 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4511 CHECK(!val->result_ok);
4512 LDKDecodeError err_var = (*val->contents.err);
4513 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4514 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4515 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4518 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4519 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4521 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4522 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4523 CHECK(val->result_ok);
4524 LDKChannelReestablish res_var = (*val->contents.result);
4525 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4526 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4527 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4530 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4531 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4532 CHECK(!val->result_ok);
4533 LDKDecodeError err_var = (*val->contents.err);
4534 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4535 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4536 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4539 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4540 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4542 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4543 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4544 CHECK(val->result_ok);
4545 LDKClosingSigned res_var = (*val->contents.result);
4546 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4547 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4548 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4551 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4552 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4553 CHECK(!val->result_ok);
4554 LDKDecodeError err_var = (*val->contents.err);
4555 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4556 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4557 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4560 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4561 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4563 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4564 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4565 CHECK(val->result_ok);
4566 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4567 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4568 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4569 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4572 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4573 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4574 CHECK(!val->result_ok);
4575 LDKDecodeError err_var = (*val->contents.err);
4576 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4577 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4578 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4581 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4582 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4584 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4585 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4586 CHECK(val->result_ok);
4587 LDKCommitmentSigned res_var = (*val->contents.result);
4588 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4589 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4590 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4593 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4594 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4595 CHECK(!val->result_ok);
4596 LDKDecodeError err_var = (*val->contents.err);
4597 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4598 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4599 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4602 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4603 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4605 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4606 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4607 CHECK(val->result_ok);
4608 LDKFundingCreated res_var = (*val->contents.result);
4609 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4610 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4611 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4614 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4615 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4616 CHECK(!val->result_ok);
4617 LDKDecodeError err_var = (*val->contents.err);
4618 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4619 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4620 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4623 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4624 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4626 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4627 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4628 CHECK(val->result_ok);
4629 LDKFundingSigned res_var = (*val->contents.result);
4630 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4631 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4632 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4635 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4636 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4637 CHECK(!val->result_ok);
4638 LDKDecodeError err_var = (*val->contents.err);
4639 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4640 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4641 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4644 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4645 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4647 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4648 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4649 CHECK(val->result_ok);
4650 LDKFundingLocked res_var = (*val->contents.result);
4651 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4652 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4653 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4656 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4657 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4658 CHECK(!val->result_ok);
4659 LDKDecodeError err_var = (*val->contents.err);
4660 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4661 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4662 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4665 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4666 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4669 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4670 CHECK(val->result_ok);
4671 LDKInit res_var = (*val->contents.result);
4672 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4673 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4674 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4677 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4678 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4679 CHECK(!val->result_ok);
4680 LDKDecodeError err_var = (*val->contents.err);
4681 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4682 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4683 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4686 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4687 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4689 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4690 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4691 CHECK(val->result_ok);
4692 LDKOpenChannel res_var = (*val->contents.result);
4693 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4694 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4695 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4698 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
4699 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4700 CHECK(!val->result_ok);
4701 LDKDecodeError err_var = (*val->contents.err);
4702 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4703 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4704 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4707 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
4708 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4710 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
4711 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4712 CHECK(val->result_ok);
4713 LDKRevokeAndACK res_var = (*val->contents.result);
4714 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4715 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4716 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4719 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
4720 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4721 CHECK(!val->result_ok);
4722 LDKDecodeError err_var = (*val->contents.err);
4723 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4724 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4725 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4728 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
4729 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4731 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
4732 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4733 CHECK(val->result_ok);
4734 LDKShutdown res_var = (*val->contents.result);
4735 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4736 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4737 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4740 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
4741 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4742 CHECK(!val->result_ok);
4743 LDKDecodeError err_var = (*val->contents.err);
4744 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4745 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4746 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4749 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4750 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4752 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4753 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4754 CHECK(val->result_ok);
4755 LDKUpdateFailHTLC res_var = (*val->contents.result);
4756 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4757 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4758 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4761 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
4762 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4763 CHECK(!val->result_ok);
4764 LDKDecodeError err_var = (*val->contents.err);
4765 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4766 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4767 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4770 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4771 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4773 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4774 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4775 CHECK(val->result_ok);
4776 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4777 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4778 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4779 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4782 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
4783 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4784 CHECK(!val->result_ok);
4785 LDKDecodeError err_var = (*val->contents.err);
4786 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4787 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4788 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4791 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
4792 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4794 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
4795 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4796 CHECK(val->result_ok);
4797 LDKUpdateFee res_var = (*val->contents.result);
4798 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4799 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4800 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4803 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
4804 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4805 CHECK(!val->result_ok);
4806 LDKDecodeError err_var = (*val->contents.err);
4807 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4808 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4809 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4812 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4813 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4815 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4816 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4817 CHECK(val->result_ok);
4818 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4819 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4820 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4821 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4824 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
4825 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4826 CHECK(!val->result_ok);
4827 LDKDecodeError err_var = (*val->contents.err);
4828 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4829 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4830 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4833 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
4834 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4836 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
4837 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4838 CHECK(val->result_ok);
4839 LDKUpdateAddHTLC res_var = (*val->contents.result);
4840 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4841 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4842 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4845 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
4846 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4847 CHECK(!val->result_ok);
4848 LDKDecodeError err_var = (*val->contents.err);
4849 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4850 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4851 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4854 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
4855 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4857 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
4858 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4859 CHECK(val->result_ok);
4860 LDKPing res_var = (*val->contents.result);
4861 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4862 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4863 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4866 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
4867 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4868 CHECK(!val->result_ok);
4869 LDKDecodeError err_var = (*val->contents.err);
4870 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4871 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4872 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4875 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
4876 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4878 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
4879 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4880 CHECK(val->result_ok);
4881 LDKPong res_var = (*val->contents.result);
4882 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4883 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4884 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4887 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
4888 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4889 CHECK(!val->result_ok);
4890 LDKDecodeError err_var = (*val->contents.err);
4891 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4892 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4893 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4896 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4897 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4899 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4900 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4901 CHECK(val->result_ok);
4902 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4903 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4904 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4905 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4908 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4909 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4910 CHECK(!val->result_ok);
4911 LDKDecodeError err_var = (*val->contents.err);
4912 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4913 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4914 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4917 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
4918 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4920 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
4921 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4922 CHECK(val->result_ok);
4923 LDKChannelAnnouncement res_var = (*val->contents.result);
4924 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4925 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4926 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4929 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
4930 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4931 CHECK(!val->result_ok);
4932 LDKDecodeError err_var = (*val->contents.err);
4933 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4934 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4935 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4938 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4939 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4941 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4942 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4943 CHECK(val->result_ok);
4944 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4945 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4946 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4947 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4950 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4951 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4952 CHECK(!val->result_ok);
4953 LDKDecodeError err_var = (*val->contents.err);
4954 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4955 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4956 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4959 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
4960 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4962 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
4963 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4964 CHECK(val->result_ok);
4965 LDKChannelUpdate res_var = (*val->contents.result);
4966 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4967 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4968 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4971 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
4972 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4973 CHECK(!val->result_ok);
4974 LDKDecodeError err_var = (*val->contents.err);
4975 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4976 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4977 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4980 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
4981 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4983 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
4984 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4985 CHECK(val->result_ok);
4986 LDKErrorMessage res_var = (*val->contents.result);
4987 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4988 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4989 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4992 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
4993 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4994 CHECK(!val->result_ok);
4995 LDKDecodeError err_var = (*val->contents.err);
4996 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4997 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4998 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5001 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5002 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5004 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5005 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5006 CHECK(val->result_ok);
5007 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5008 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5009 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5010 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5013 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5014 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5015 CHECK(!val->result_ok);
5016 LDKDecodeError err_var = (*val->contents.err);
5017 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5018 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5019 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5022 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5023 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5025 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5026 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5027 CHECK(val->result_ok);
5028 LDKNodeAnnouncement res_var = (*val->contents.result);
5029 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5030 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5031 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5034 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5035 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5036 CHECK(!val->result_ok);
5037 LDKDecodeError err_var = (*val->contents.err);
5038 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5039 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5040 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5043 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5044 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5046 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5047 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5048 CHECK(val->result_ok);
5049 LDKQueryShortChannelIds res_var = (*val->contents.result);
5050 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5051 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5052 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5055 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5056 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5057 CHECK(!val->result_ok);
5058 LDKDecodeError err_var = (*val->contents.err);
5059 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5060 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5061 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5064 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5065 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5067 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5068 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5069 CHECK(val->result_ok);
5070 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5071 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5072 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5073 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5076 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5077 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5078 CHECK(!val->result_ok);
5079 LDKDecodeError err_var = (*val->contents.err);
5080 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5081 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5082 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5085 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5086 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5088 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5089 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5090 CHECK(val->result_ok);
5091 LDKQueryChannelRange res_var = (*val->contents.result);
5092 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5093 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5094 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5097 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5098 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5099 CHECK(!val->result_ok);
5100 LDKDecodeError err_var = (*val->contents.err);
5101 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5102 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5103 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5106 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5107 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5109 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5110 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5111 CHECK(val->result_ok);
5112 LDKReplyChannelRange res_var = (*val->contents.result);
5113 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5114 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5115 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5118 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5119 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5120 CHECK(!val->result_ok);
5121 LDKDecodeError err_var = (*val->contents.err);
5122 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5123 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5124 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5127 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5128 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5130 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5131 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5132 CHECK(val->result_ok);
5133 LDKGossipTimestampFilter res_var = (*val->contents.result);
5134 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5135 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5136 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5140 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5141 CHECK(!val->result_ok);
5142 LDKDecodeError err_var = (*val->contents.err);
5143 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5144 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5145 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5148 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5149 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5151 case LDKSignOrCreationError_SignError: {
5152 return 0 /* LDKSignOrCreationError - SignError */;
5154 case LDKSignOrCreationError_CreationError: {
5155 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5156 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5161 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5162 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5164 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5165 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5166 CHECK(val->result_ok);
5167 LDKInvoice res_var = (*val->contents.result);
5168 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5169 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5170 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5173 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5174 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5175 CHECK(!val->result_ok);
5176 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5179 typedef struct LDKFilter_JCalls {
5180 atomic_size_t refcnt;
5181 uint32_t register_tx_meth;
5182 uint32_t register_output_meth;
5184 static void LDKFilter_JCalls_free(void* this_arg) {
5185 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5186 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5187 js_free(j_calls->register_tx_meth);
5188 js_free(j_calls->register_output_meth);
5192 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5193 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5194 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5195 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5196 LDKu8slice script_pubkey_var = script_pubkey;
5197 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5198 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5199 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5201 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5202 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5203 LDKWatchedOutput output_var = output;
5204 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5205 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5206 uint64_t output_ref = (uint64_t)output_var.inner;
5207 if (output_var.is_owned) {
5210 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5211 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5212 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5215 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5216 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5217 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5219 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5220 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5221 atomic_init(&calls->refcnt, 1);
5222 //TODO: Assign calls->o from o
5225 .this_arg = (void*) calls,
5226 .register_tx = register_tx_LDKFilter_jcall,
5227 .register_output = register_output_LDKFilter_jcall,
5228 .free = LDKFilter_JCalls_free,
5232 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5233 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5234 *res_ptr = LDKFilter_init(o);
5235 return (long)res_ptr;
5237 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5238 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5239 unsigned char txid_arr[32];
5240 CHECK(*((uint32_t*)txid) == 32);
5241 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5242 unsigned char (*txid_ref)[32] = &txid_arr;
5243 LDKu8slice script_pubkey_ref;
5244 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5245 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5246 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5249 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5250 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5251 LDKWatchedOutput output_conv;
5252 output_conv.inner = (void*)(output & (~1));
5253 output_conv.is_owned = (output & 1) || (output == 0);
5254 output_conv = WatchedOutput_clone(&output_conv);
5255 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5256 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5257 uint64_t ret_ref = (uint64_t)ret_copy;
5261 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5262 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5264 case LDKCOption_FilterZ_Some: {
5265 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5266 *some_ret = obj->some;
5267 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5268 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5270 case LDKCOption_FilterZ_None: {
5271 return 0 /* LDKCOption_FilterZ - None */;
5276 typedef struct LDKMessageSendEventsProvider_JCalls {
5277 atomic_size_t refcnt;
5278 uint32_t get_and_clear_pending_msg_events_meth;
5279 } LDKMessageSendEventsProvider_JCalls;
5280 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5281 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5282 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5283 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5287 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5288 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5289 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5290 LDKCVec_MessageSendEventZ ret_constr;
5291 ret_constr.datalen = *((uint32_t*)ret);
5292 if (ret_constr.datalen > 0)
5293 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5295 ret_constr.data = NULL;
5296 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5297 for (size_t s = 0; s < ret_constr.datalen; s++) {
5298 uint32_t ret_conv_18 = ret_vals[s];
5299 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5300 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5301 ret_constr.data[s] = ret_conv_18_conv;
5305 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5306 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5307 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5309 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5310 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5311 atomic_init(&calls->refcnt, 1);
5312 //TODO: Assign calls->o from o
5314 LDKMessageSendEventsProvider ret = {
5315 .this_arg = (void*) calls,
5316 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5317 .free = LDKMessageSendEventsProvider_JCalls_free,
5321 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5322 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5323 *res_ptr = LDKMessageSendEventsProvider_init(o);
5324 return (long)res_ptr;
5326 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5327 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
5328 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5329 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5330 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5331 for (size_t s = 0; s < ret_var.datalen; s++) {
5332 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5333 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
5334 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5335 ret_arr_ptr[s] = ret_conv_18_ref;
5341 typedef struct LDKEventHandler_JCalls {
5342 atomic_size_t refcnt;
5343 uint32_t handle_event_meth;
5344 } LDKEventHandler_JCalls;
5345 static void LDKEventHandler_JCalls_free(void* this_arg) {
5346 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5347 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5348 js_free(j_calls->handle_event_meth);
5352 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5353 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5354 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5355 *ret_event = Event_clone(event);
5356 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5358 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5359 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5360 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5362 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5363 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5364 atomic_init(&calls->refcnt, 1);
5365 //TODO: Assign calls->o from o
5367 LDKEventHandler ret = {
5368 .this_arg = (void*) calls,
5369 .handle_event = handle_event_LDKEventHandler_jcall,
5370 .free = LDKEventHandler_JCalls_free,
5374 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5375 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5376 *res_ptr = LDKEventHandler_init(o);
5377 return (long)res_ptr;
5379 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5380 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
5381 LDKEvent* event_conv = (LDKEvent*)event;
5382 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5385 typedef struct LDKEventsProvider_JCalls {
5386 atomic_size_t refcnt;
5387 uint32_t process_pending_events_meth;
5388 } LDKEventsProvider_JCalls;
5389 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5390 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5391 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5392 js_free(j_calls->process_pending_events_meth);
5396 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5397 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5398 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5399 *handler_ret = handler;
5400 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5402 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5403 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5404 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5406 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5407 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5408 atomic_init(&calls->refcnt, 1);
5409 //TODO: Assign calls->o from o
5411 LDKEventsProvider ret = {
5412 .this_arg = (void*) calls,
5413 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5414 .free = LDKEventsProvider_JCalls_free,
5418 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5419 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5420 *res_ptr = LDKEventsProvider_init(o);
5421 return (long)res_ptr;
5423 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5424 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
5425 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
5426 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5429 typedef struct LDKListen_JCalls {
5430 atomic_size_t refcnt;
5431 uint32_t block_connected_meth;
5432 uint32_t block_disconnected_meth;
5434 static void LDKListen_JCalls_free(void* this_arg) {
5435 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5436 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5437 js_free(j_calls->block_connected_meth);
5438 js_free(j_calls->block_disconnected_meth);
5442 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5443 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5444 LDKu8slice block_var = block;
5445 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5446 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5447 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5449 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5450 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5451 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5452 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5453 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5455 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5456 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5457 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5459 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5460 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5461 atomic_init(&calls->refcnt, 1);
5462 //TODO: Assign calls->o from o
5465 .this_arg = (void*) calls,
5466 .block_connected = block_connected_LDKListen_jcall,
5467 .block_disconnected = block_disconnected_LDKListen_jcall,
5468 .free = LDKListen_JCalls_free,
5472 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5473 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5474 *res_ptr = LDKListen_init(o);
5475 return (long)res_ptr;
5477 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5478 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5479 LDKu8slice block_ref;
5480 block_ref.datalen = *((uint32_t*)block);
5481 block_ref.data = (int8_t*)(block + 4);
5482 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5485 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5486 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5487 unsigned char header_arr[80];
5488 CHECK(*((uint32_t*)header) == 80);
5489 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5490 unsigned char (*header_ref)[80] = &header_arr;
5491 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5494 typedef struct LDKConfirm_JCalls {
5495 atomic_size_t refcnt;
5496 uint32_t transactions_confirmed_meth;
5497 uint32_t transaction_unconfirmed_meth;
5498 uint32_t best_block_updated_meth;
5499 uint32_t get_relevant_txids_meth;
5500 } LDKConfirm_JCalls;
5501 static void LDKConfirm_JCalls_free(void* this_arg) {
5502 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5504 js_free(j_calls->transactions_confirmed_meth);
5505 js_free(j_calls->transaction_unconfirmed_meth);
5506 js_free(j_calls->best_block_updated_meth);
5507 js_free(j_calls->get_relevant_txids_meth);
5511 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5512 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5513 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5514 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5515 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5516 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5517 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5518 for (size_t e = 0; e < txdata_var.datalen; e++) {
5519 LDKC2Tuple_usizeTransactionZ* txdata_conv_30_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5520 *txdata_conv_30_ref = txdata_var.data[e];
5521 txdata_arr_ptr[e] = (uint64_t)txdata_conv_30_ref;
5523 FREE(txdata_var.data);
5524 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5526 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5527 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5528 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5529 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5530 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5532 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5533 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5534 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5535 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5536 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5538 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5539 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5540 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5541 LDKCVec_TxidZ ret_constr;
5542 ret_constr.datalen = *((uint32_t*)ret);
5543 if (ret_constr.datalen > 0)
5544 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5546 ret_constr.data = NULL;
5547 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5548 for (size_t m = 0; m < ret_constr.datalen; m++) {
5549 int8_tArray ret_conv_12 = ret_vals[m];
5550 LDKThirtyTwoBytes ret_conv_12_ref;
5551 CHECK(*((uint32_t*)ret_conv_12) == 32);
5552 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5553 ret_constr.data[m] = ret_conv_12_ref;
5557 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5558 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5559 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5561 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5562 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5563 atomic_init(&calls->refcnt, 1);
5564 //TODO: Assign calls->o from o
5567 .this_arg = (void*) calls,
5568 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5569 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5570 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5571 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5572 .free = LDKConfirm_JCalls_free,
5576 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5577 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5578 *res_ptr = LDKConfirm_init(o);
5579 return (long)res_ptr;
5581 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5582 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5583 unsigned char header_arr[80];
5584 CHECK(*((uint32_t*)header) == 80);
5585 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5586 unsigned char (*header_ref)[80] = &header_arr;
5587 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5588 txdata_constr.datalen = *((uint32_t*)txdata);
5589 if (txdata_constr.datalen > 0)
5590 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5592 txdata_constr.data = NULL;
5593 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5594 for (size_t e = 0; e < txdata_constr.datalen; e++) {
5595 uint32_t txdata_conv_30 = txdata_vals[e];
5596 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
5597 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
5598 txdata_constr.data[e] = txdata_conv_30_conv;
5600 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5603 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5604 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5605 unsigned char txid_arr[32];
5606 CHECK(*((uint32_t*)txid) == 32);
5607 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5608 unsigned char (*txid_ref)[32] = &txid_arr;
5609 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5612 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5613 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5614 unsigned char header_arr[80];
5615 CHECK(*((uint32_t*)header) == 80);
5616 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5617 unsigned char (*header_ref)[80] = &header_arr;
5618 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5621 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5622 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5623 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5624 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5625 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5626 for (size_t m = 0; m < ret_var.datalen; m++) {
5627 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5628 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5629 ret_arr_ptr[m] = ret_conv_12_arr;
5635 typedef struct LDKPersist_JCalls {
5636 atomic_size_t refcnt;
5637 uint32_t persist_new_channel_meth;
5638 uint32_t update_persisted_channel_meth;
5639 } LDKPersist_JCalls;
5640 static void LDKPersist_JCalls_free(void* this_arg) {
5641 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5642 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5643 js_free(j_calls->persist_new_channel_meth);
5644 js_free(j_calls->update_persisted_channel_meth);
5648 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5649 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5650 LDKOutPoint id_var = id;
5651 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5652 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5653 uint64_t id_ref = (uint64_t)id_var.inner;
5654 if (id_var.is_owned) {
5657 LDKChannelMonitor data_var = *data;
5658 data_var = ChannelMonitor_clone(data);
5659 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5660 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5661 uint64_t data_ref = (uint64_t)data_var.inner;
5662 if (data_var.is_owned) {
5665 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
5666 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5667 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5670 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5671 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5672 LDKOutPoint id_var = id;
5673 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5674 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5675 uint64_t id_ref = (uint64_t)id_var.inner;
5676 if (id_var.is_owned) {
5679 LDKChannelMonitorUpdate update_var = *update;
5680 update_var = ChannelMonitorUpdate_clone(update);
5681 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5682 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5683 uint64_t update_ref = (uint64_t)update_var.inner;
5684 if (update_var.is_owned) {
5687 LDKChannelMonitor data_var = *data;
5688 data_var = ChannelMonitor_clone(data);
5689 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5690 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5691 uint64_t data_ref = (uint64_t)data_var.inner;
5692 if (data_var.is_owned) {
5695 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5696 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5697 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
5700 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
5701 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
5702 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5704 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
5705 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5706 atomic_init(&calls->refcnt, 1);
5707 //TODO: Assign calls->o from o
5710 .this_arg = (void*) calls,
5711 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5712 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5713 .free = LDKPersist_JCalls_free,
5717 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
5718 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5719 *res_ptr = LDKPersist_init(o);
5720 return (long)res_ptr;
5722 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
5723 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5724 LDKOutPoint id_conv;
5725 id_conv.inner = (void*)(id & (~1));
5726 id_conv.is_owned = (id & 1) || (id == 0);
5727 id_conv = OutPoint_clone(&id_conv);
5728 LDKChannelMonitor data_conv;
5729 data_conv.inner = (void*)(data & (~1));
5730 data_conv.is_owned = false;
5731 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5732 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5733 return (uint64_t)ret_conv;
5736 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
5737 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5738 LDKOutPoint id_conv;
5739 id_conv.inner = (void*)(id & (~1));
5740 id_conv.is_owned = (id & 1) || (id == 0);
5741 id_conv = OutPoint_clone(&id_conv);
5742 LDKChannelMonitorUpdate update_conv;
5743 update_conv.inner = (void*)(update & (~1));
5744 update_conv.is_owned = false;
5745 LDKChannelMonitor data_conv;
5746 data_conv.inner = (void*)(data & (~1));
5747 data_conv.is_owned = false;
5748 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5749 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5750 return (uint64_t)ret_conv;
5753 typedef struct LDKChannelMessageHandler_JCalls {
5754 atomic_size_t refcnt;
5755 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5756 uint32_t handle_open_channel_meth;
5757 uint32_t handle_accept_channel_meth;
5758 uint32_t handle_funding_created_meth;
5759 uint32_t handle_funding_signed_meth;
5760 uint32_t handle_funding_locked_meth;
5761 uint32_t handle_shutdown_meth;
5762 uint32_t handle_closing_signed_meth;
5763 uint32_t handle_update_add_htlc_meth;
5764 uint32_t handle_update_fulfill_htlc_meth;
5765 uint32_t handle_update_fail_htlc_meth;
5766 uint32_t handle_update_fail_malformed_htlc_meth;
5767 uint32_t handle_commitment_signed_meth;
5768 uint32_t handle_revoke_and_ack_meth;
5769 uint32_t handle_update_fee_meth;
5770 uint32_t handle_announcement_signatures_meth;
5771 uint32_t peer_disconnected_meth;
5772 uint32_t peer_connected_meth;
5773 uint32_t handle_channel_reestablish_meth;
5774 uint32_t handle_channel_update_meth;
5775 uint32_t handle_error_meth;
5776 } LDKChannelMessageHandler_JCalls;
5777 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5778 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5779 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5780 js_free(j_calls->handle_open_channel_meth);
5781 js_free(j_calls->handle_accept_channel_meth);
5782 js_free(j_calls->handle_funding_created_meth);
5783 js_free(j_calls->handle_funding_signed_meth);
5784 js_free(j_calls->handle_funding_locked_meth);
5785 js_free(j_calls->handle_shutdown_meth);
5786 js_free(j_calls->handle_closing_signed_meth);
5787 js_free(j_calls->handle_update_add_htlc_meth);
5788 js_free(j_calls->handle_update_fulfill_htlc_meth);
5789 js_free(j_calls->handle_update_fail_htlc_meth);
5790 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
5791 js_free(j_calls->handle_commitment_signed_meth);
5792 js_free(j_calls->handle_revoke_and_ack_meth);
5793 js_free(j_calls->handle_update_fee_meth);
5794 js_free(j_calls->handle_announcement_signatures_meth);
5795 js_free(j_calls->peer_disconnected_meth);
5796 js_free(j_calls->peer_connected_meth);
5797 js_free(j_calls->handle_channel_reestablish_meth);
5798 js_free(j_calls->handle_channel_update_meth);
5799 js_free(j_calls->handle_error_meth);
5803 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5804 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5805 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5806 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5807 LDKInitFeatures their_features_var = their_features;
5808 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5809 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5810 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5811 if (their_features_var.is_owned) {
5812 their_features_ref |= 1;
5814 LDKOpenChannel msg_var = *msg;
5815 msg_var = OpenChannel_clone(msg);
5816 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5817 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5818 uint64_t msg_ref = (uint64_t)msg_var.inner;
5819 if (msg_var.is_owned) {
5822 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5824 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5825 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5826 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5827 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5828 LDKInitFeatures their_features_var = their_features;
5829 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5830 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5831 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5832 if (their_features_var.is_owned) {
5833 their_features_ref |= 1;
5835 LDKAcceptChannel msg_var = *msg;
5836 msg_var = AcceptChannel_clone(msg);
5837 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5838 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5839 uint64_t msg_ref = (uint64_t)msg_var.inner;
5840 if (msg_var.is_owned) {
5843 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5845 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5846 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5847 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5848 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5849 LDKFundingCreated msg_var = *msg;
5850 msg_var = FundingCreated_clone(msg);
5851 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5852 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5853 uint64_t msg_ref = (uint64_t)msg_var.inner;
5854 if (msg_var.is_owned) {
5857 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5859 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5860 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5861 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5862 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5863 LDKFundingSigned msg_var = *msg;
5864 msg_var = FundingSigned_clone(msg);
5865 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5866 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5867 uint64_t msg_ref = (uint64_t)msg_var.inner;
5868 if (msg_var.is_owned) {
5871 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5873 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5874 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5875 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5876 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5877 LDKFundingLocked msg_var = *msg;
5878 msg_var = FundingLocked_clone(msg);
5879 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5880 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5881 uint64_t msg_ref = (uint64_t)msg_var.inner;
5882 if (msg_var.is_owned) {
5885 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5887 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5888 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5889 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5890 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5891 LDKInitFeatures their_features_var = *their_features;
5892 their_features_var = InitFeatures_clone(their_features);
5893 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5894 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5895 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
5896 if (their_features_var.is_owned) {
5897 their_features_ref |= 1;
5899 LDKShutdown msg_var = *msg;
5900 msg_var = Shutdown_clone(msg);
5901 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5902 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5903 uint64_t msg_ref = (uint64_t)msg_var.inner;
5904 if (msg_var.is_owned) {
5907 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5909 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5910 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5911 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5912 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5913 LDKClosingSigned msg_var = *msg;
5914 msg_var = ClosingSigned_clone(msg);
5915 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5916 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5917 uint64_t msg_ref = (uint64_t)msg_var.inner;
5918 if (msg_var.is_owned) {
5921 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5923 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5924 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5925 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5926 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5927 LDKUpdateAddHTLC msg_var = *msg;
5928 msg_var = UpdateAddHTLC_clone(msg);
5929 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5930 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5931 uint64_t msg_ref = (uint64_t)msg_var.inner;
5932 if (msg_var.is_owned) {
5935 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5937 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5938 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5939 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5940 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5941 LDKUpdateFulfillHTLC msg_var = *msg;
5942 msg_var = UpdateFulfillHTLC_clone(msg);
5943 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5944 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5945 uint64_t msg_ref = (uint64_t)msg_var.inner;
5946 if (msg_var.is_owned) {
5949 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5951 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5952 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5953 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5954 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5955 LDKUpdateFailHTLC msg_var = *msg;
5956 msg_var = UpdateFailHTLC_clone(msg);
5957 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5958 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5959 uint64_t msg_ref = (uint64_t)msg_var.inner;
5960 if (msg_var.is_owned) {
5963 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5965 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5966 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5967 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5968 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5969 LDKUpdateFailMalformedHTLC msg_var = *msg;
5970 msg_var = UpdateFailMalformedHTLC_clone(msg);
5971 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5972 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5973 uint64_t msg_ref = (uint64_t)msg_var.inner;
5974 if (msg_var.is_owned) {
5977 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5979 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5980 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5981 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5982 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5983 LDKCommitmentSigned msg_var = *msg;
5984 msg_var = CommitmentSigned_clone(msg);
5985 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5986 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5987 uint64_t msg_ref = (uint64_t)msg_var.inner;
5988 if (msg_var.is_owned) {
5991 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5993 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5994 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5995 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5996 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5997 LDKRevokeAndACK msg_var = *msg;
5998 msg_var = RevokeAndACK_clone(msg);
5999 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6000 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6001 uint64_t msg_ref = (uint64_t)msg_var.inner;
6002 if (msg_var.is_owned) {
6005 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6007 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6009 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6010 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6011 LDKUpdateFee msg_var = *msg;
6012 msg_var = UpdateFee_clone(msg);
6013 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6014 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6015 uint64_t msg_ref = (uint64_t)msg_var.inner;
6016 if (msg_var.is_owned) {
6019 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6021 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6022 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6023 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6024 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6025 LDKAnnouncementSignatures msg_var = *msg;
6026 msg_var = AnnouncementSignatures_clone(msg);
6027 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6028 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6029 uint64_t msg_ref = (uint64_t)msg_var.inner;
6030 if (msg_var.is_owned) {
6033 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6035 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6037 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6038 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6039 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6041 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6042 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6043 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6044 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6045 LDKInit msg_var = *msg;
6046 msg_var = Init_clone(msg);
6047 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6048 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6049 uint64_t msg_ref = (uint64_t)msg_var.inner;
6050 if (msg_var.is_owned) {
6053 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6055 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6056 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6057 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6058 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6059 LDKChannelReestablish msg_var = *msg;
6060 msg_var = ChannelReestablish_clone(msg);
6061 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6062 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6063 uint64_t msg_ref = (uint64_t)msg_var.inner;
6064 if (msg_var.is_owned) {
6067 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6069 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6070 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6071 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6072 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6073 LDKChannelUpdate msg_var = *msg;
6074 msg_var = ChannelUpdate_clone(msg);
6075 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6076 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6077 uint64_t msg_ref = (uint64_t)msg_var.inner;
6078 if (msg_var.is_owned) {
6081 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6083 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6084 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6085 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6086 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6087 LDKErrorMessage msg_var = *msg;
6088 msg_var = ErrorMessage_clone(msg);
6089 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6090 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6091 uint64_t msg_ref = (uint64_t)msg_var.inner;
6092 if (msg_var.is_owned) {
6095 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6097 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6098 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6099 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6100 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6102 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6103 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6104 atomic_init(&calls->refcnt, 1);
6105 //TODO: Assign calls->o from o
6107 LDKChannelMessageHandler ret = {
6108 .this_arg = (void*) calls,
6109 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6110 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6111 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6112 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6113 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6114 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6115 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6116 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6117 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6118 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6119 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6120 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6121 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6122 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6123 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6124 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6125 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6126 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6127 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6128 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6129 .free = LDKChannelMessageHandler_JCalls_free,
6130 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6132 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6135 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6136 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6137 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6138 return (long)res_ptr;
6140 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) {
6141 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6142 LDKPublicKey their_node_id_ref;
6143 CHECK(*((uint32_t*)their_node_id) == 33);
6144 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6145 LDKInitFeatures their_features_conv;
6146 their_features_conv.inner = (void*)(their_features & (~1));
6147 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6148 their_features_conv = InitFeatures_clone(&their_features_conv);
6149 LDKOpenChannel msg_conv;
6150 msg_conv.inner = (void*)(msg & (~1));
6151 msg_conv.is_owned = false;
6152 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6155 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) {
6156 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6157 LDKPublicKey their_node_id_ref;
6158 CHECK(*((uint32_t*)their_node_id) == 33);
6159 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6160 LDKInitFeatures their_features_conv;
6161 their_features_conv.inner = (void*)(their_features & (~1));
6162 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6163 their_features_conv = InitFeatures_clone(&their_features_conv);
6164 LDKAcceptChannel msg_conv;
6165 msg_conv.inner = (void*)(msg & (~1));
6166 msg_conv.is_owned = false;
6167 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6170 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6171 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6172 LDKPublicKey their_node_id_ref;
6173 CHECK(*((uint32_t*)their_node_id) == 33);
6174 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6175 LDKFundingCreated msg_conv;
6176 msg_conv.inner = (void*)(msg & (~1));
6177 msg_conv.is_owned = false;
6178 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6181 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6182 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6183 LDKPublicKey their_node_id_ref;
6184 CHECK(*((uint32_t*)their_node_id) == 33);
6185 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6186 LDKFundingSigned msg_conv;
6187 msg_conv.inner = (void*)(msg & (~1));
6188 msg_conv.is_owned = false;
6189 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6192 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6193 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6194 LDKPublicKey their_node_id_ref;
6195 CHECK(*((uint32_t*)their_node_id) == 33);
6196 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6197 LDKFundingLocked msg_conv;
6198 msg_conv.inner = (void*)(msg & (~1));
6199 msg_conv.is_owned = false;
6200 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6203 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6204 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6205 LDKPublicKey their_node_id_ref;
6206 CHECK(*((uint32_t*)their_node_id) == 33);
6207 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6208 LDKInitFeatures their_features_conv;
6209 their_features_conv.inner = (void*)(their_features & (~1));
6210 their_features_conv.is_owned = false;
6211 LDKShutdown msg_conv;
6212 msg_conv.inner = (void*)(msg & (~1));
6213 msg_conv.is_owned = false;
6214 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6217 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6218 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6219 LDKPublicKey their_node_id_ref;
6220 CHECK(*((uint32_t*)their_node_id) == 33);
6221 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6222 LDKClosingSigned msg_conv;
6223 msg_conv.inner = (void*)(msg & (~1));
6224 msg_conv.is_owned = false;
6225 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6228 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6229 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6230 LDKPublicKey their_node_id_ref;
6231 CHECK(*((uint32_t*)their_node_id) == 33);
6232 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6233 LDKUpdateAddHTLC msg_conv;
6234 msg_conv.inner = (void*)(msg & (~1));
6235 msg_conv.is_owned = false;
6236 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6239 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6240 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6241 LDKPublicKey their_node_id_ref;
6242 CHECK(*((uint32_t*)their_node_id) == 33);
6243 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6244 LDKUpdateFulfillHTLC msg_conv;
6245 msg_conv.inner = (void*)(msg & (~1));
6246 msg_conv.is_owned = false;
6247 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6250 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6251 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6252 LDKPublicKey their_node_id_ref;
6253 CHECK(*((uint32_t*)their_node_id) == 33);
6254 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6255 LDKUpdateFailHTLC msg_conv;
6256 msg_conv.inner = (void*)(msg & (~1));
6257 msg_conv.is_owned = false;
6258 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6261 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6262 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6263 LDKPublicKey their_node_id_ref;
6264 CHECK(*((uint32_t*)their_node_id) == 33);
6265 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6266 LDKUpdateFailMalformedHTLC msg_conv;
6267 msg_conv.inner = (void*)(msg & (~1));
6268 msg_conv.is_owned = false;
6269 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6272 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6273 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6274 LDKPublicKey their_node_id_ref;
6275 CHECK(*((uint32_t*)their_node_id) == 33);
6276 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6277 LDKCommitmentSigned msg_conv;
6278 msg_conv.inner = (void*)(msg & (~1));
6279 msg_conv.is_owned = false;
6280 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6283 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6284 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6285 LDKPublicKey their_node_id_ref;
6286 CHECK(*((uint32_t*)their_node_id) == 33);
6287 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6288 LDKRevokeAndACK msg_conv;
6289 msg_conv.inner = (void*)(msg & (~1));
6290 msg_conv.is_owned = false;
6291 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6294 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6295 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6296 LDKPublicKey their_node_id_ref;
6297 CHECK(*((uint32_t*)their_node_id) == 33);
6298 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6299 LDKUpdateFee msg_conv;
6300 msg_conv.inner = (void*)(msg & (~1));
6301 msg_conv.is_owned = false;
6302 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6305 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6306 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6307 LDKPublicKey their_node_id_ref;
6308 CHECK(*((uint32_t*)their_node_id) == 33);
6309 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6310 LDKAnnouncementSignatures msg_conv;
6311 msg_conv.inner = (void*)(msg & (~1));
6312 msg_conv.is_owned = false;
6313 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6316 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6317 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6318 LDKPublicKey their_node_id_ref;
6319 CHECK(*((uint32_t*)their_node_id) == 33);
6320 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6321 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6324 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6325 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((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);
6330 msg_conv.inner = (void*)(msg & (~1));
6331 msg_conv.is_owned = false;
6332 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6335 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6336 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6337 LDKPublicKey their_node_id_ref;
6338 CHECK(*((uint32_t*)their_node_id) == 33);
6339 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6340 LDKChannelReestablish msg_conv;
6341 msg_conv.inner = (void*)(msg & (~1));
6342 msg_conv.is_owned = false;
6343 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6346 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6347 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6348 LDKPublicKey their_node_id_ref;
6349 CHECK(*((uint32_t*)their_node_id) == 33);
6350 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6351 LDKChannelUpdate msg_conv;
6352 msg_conv.inner = (void*)(msg & (~1));
6353 msg_conv.is_owned = false;
6354 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6357 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6358 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6359 LDKPublicKey their_node_id_ref;
6360 CHECK(*((uint32_t*)their_node_id) == 33);
6361 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6362 LDKErrorMessage msg_conv;
6363 msg_conv.inner = (void*)(msg & (~1));
6364 msg_conv.is_owned = false;
6365 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6368 typedef struct LDKRoutingMessageHandler_JCalls {
6369 atomic_size_t refcnt;
6370 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6371 uint32_t handle_node_announcement_meth;
6372 uint32_t handle_channel_announcement_meth;
6373 uint32_t handle_channel_update_meth;
6374 uint32_t get_next_channel_announcements_meth;
6375 uint32_t get_next_node_announcements_meth;
6376 uint32_t sync_routing_table_meth;
6377 uint32_t handle_reply_channel_range_meth;
6378 uint32_t handle_reply_short_channel_ids_end_meth;
6379 uint32_t handle_query_channel_range_meth;
6380 uint32_t handle_query_short_channel_ids_meth;
6381 } LDKRoutingMessageHandler_JCalls;
6382 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6383 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6384 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6385 js_free(j_calls->handle_node_announcement_meth);
6386 js_free(j_calls->handle_channel_announcement_meth);
6387 js_free(j_calls->handle_channel_update_meth);
6388 js_free(j_calls->get_next_channel_announcements_meth);
6389 js_free(j_calls->get_next_node_announcements_meth);
6390 js_free(j_calls->sync_routing_table_meth);
6391 js_free(j_calls->handle_reply_channel_range_meth);
6392 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6393 js_free(j_calls->handle_query_channel_range_meth);
6394 js_free(j_calls->handle_query_short_channel_ids_meth);
6398 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6399 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6400 LDKNodeAnnouncement msg_var = *msg;
6401 msg_var = NodeAnnouncement_clone(msg);
6402 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6403 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6404 uint64_t msg_ref = (uint64_t)msg_var.inner;
6405 if (msg_var.is_owned) {
6408 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6409 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6410 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6413 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6414 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6415 LDKChannelAnnouncement msg_var = *msg;
6416 msg_var = ChannelAnnouncement_clone(msg);
6417 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6418 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6419 uint64_t msg_ref = (uint64_t)msg_var.inner;
6420 if (msg_var.is_owned) {
6423 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6424 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6425 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6428 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6429 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6430 LDKChannelUpdate msg_var = *msg;
6431 msg_var = ChannelUpdate_clone(msg);
6432 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6433 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6434 uint64_t msg_ref = (uint64_t)msg_var.inner;
6435 if (msg_var.is_owned) {
6438 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6439 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6440 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6443 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6444 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6445 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6446 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6447 ret_constr.datalen = *((uint32_t*)ret);
6448 if (ret_constr.datalen > 0)
6449 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6451 ret_constr.data = NULL;
6452 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6453 for (size_t l = 0; l < ret_constr.datalen; l++) {
6454 uint32_t ret_conv_63 = ret_vals[l];
6455 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
6456 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
6457 ret_constr.data[l] = ret_conv_63_conv;
6461 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6462 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6463 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6464 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6465 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6466 LDKCVec_NodeAnnouncementZ ret_constr;
6467 ret_constr.datalen = *((uint32_t*)ret);
6468 if (ret_constr.datalen > 0)
6469 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6471 ret_constr.data = NULL;
6472 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6473 for (size_t s = 0; s < ret_constr.datalen; s++) {
6474 uint32_t ret_conv_18 = ret_vals[s];
6475 LDKNodeAnnouncement ret_conv_18_conv;
6476 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6477 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6478 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6479 ret_constr.data[s] = ret_conv_18_conv;
6483 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6484 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6485 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6486 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6487 LDKInit init_var = *init;
6488 init_var = Init_clone(init);
6489 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6490 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6491 uint64_t init_ref = (uint64_t)init_var.inner;
6492 if (init_var.is_owned) {
6495 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6497 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6498 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6499 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6500 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6501 LDKReplyChannelRange msg_var = msg;
6502 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6503 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6504 uint64_t msg_ref = (uint64_t)msg_var.inner;
6505 if (msg_var.is_owned) {
6508 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6509 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6510 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6513 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6514 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6515 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6516 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6517 LDKReplyShortChannelIdsEnd msg_var = msg;
6518 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6519 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6520 uint64_t msg_ref = (uint64_t)msg_var.inner;
6521 if (msg_var.is_owned) {
6524 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6525 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6526 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6529 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6530 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6531 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6532 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6533 LDKQueryChannelRange msg_var = msg;
6534 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6535 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6536 uint64_t msg_ref = (uint64_t)msg_var.inner;
6537 if (msg_var.is_owned) {
6540 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6541 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6542 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6545 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6546 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6547 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6548 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6549 LDKQueryShortChannelIds msg_var = msg;
6550 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6551 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6552 uint64_t msg_ref = (uint64_t)msg_var.inner;
6553 if (msg_var.is_owned) {
6556 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6557 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6558 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6561 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6562 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6563 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6564 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6566 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6567 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6568 atomic_init(&calls->refcnt, 1);
6569 //TODO: Assign calls->o from o
6571 LDKRoutingMessageHandler ret = {
6572 .this_arg = (void*) calls,
6573 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6574 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6575 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6576 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6577 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6578 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6579 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6580 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6581 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6582 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6583 .free = LDKRoutingMessageHandler_JCalls_free,
6584 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6586 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6589 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6590 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6591 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6592 return (long)res_ptr;
6594 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6595 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6596 LDKNodeAnnouncement msg_conv;
6597 msg_conv.inner = (void*)(msg & (~1));
6598 msg_conv.is_owned = false;
6599 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6600 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6601 return (uint64_t)ret_conv;
6604 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6605 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6606 LDKChannelAnnouncement msg_conv;
6607 msg_conv.inner = (void*)(msg & (~1));
6608 msg_conv.is_owned = false;
6609 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6610 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6611 return (uint64_t)ret_conv;
6614 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6615 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6616 LDKChannelUpdate msg_conv;
6617 msg_conv.inner = (void*)(msg & (~1));
6618 msg_conv.is_owned = false;
6619 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6620 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6621 return (uint64_t)ret_conv;
6624 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6625 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6626 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6627 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6628 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6629 for (size_t l = 0; l < ret_var.datalen; l++) {
6630 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6631 *ret_conv_63_ref = ret_var.data[l];
6632 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
6638 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6639 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6640 LDKPublicKey starting_point_ref;
6641 CHECK(*((uint32_t*)starting_point) == 33);
6642 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6643 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6644 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6645 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6646 for (size_t s = 0; s < ret_var.datalen; s++) {
6647 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6648 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6649 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6650 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
6651 if (ret_conv_18_var.is_owned) {
6652 ret_conv_18_ref |= 1;
6654 ret_arr_ptr[s] = ret_conv_18_ref;
6660 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
6661 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6662 LDKPublicKey their_node_id_ref;
6663 CHECK(*((uint32_t*)their_node_id) == 33);
6664 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6666 init_conv.inner = (void*)(init & (~1));
6667 init_conv.is_owned = false;
6668 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6671 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6672 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6673 LDKPublicKey their_node_id_ref;
6674 CHECK(*((uint32_t*)their_node_id) == 33);
6675 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6676 LDKReplyChannelRange msg_conv;
6677 msg_conv.inner = (void*)(msg & (~1));
6678 msg_conv.is_owned = (msg & 1) || (msg == 0);
6679 msg_conv = ReplyChannelRange_clone(&msg_conv);
6680 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6681 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6682 return (uint64_t)ret_conv;
6685 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) {
6686 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6687 LDKPublicKey their_node_id_ref;
6688 CHECK(*((uint32_t*)their_node_id) == 33);
6689 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6690 LDKReplyShortChannelIdsEnd msg_conv;
6691 msg_conv.inner = (void*)(msg & (~1));
6692 msg_conv.is_owned = (msg & 1) || (msg == 0);
6693 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6694 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6695 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6696 return (uint64_t)ret_conv;
6699 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6700 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6701 LDKPublicKey their_node_id_ref;
6702 CHECK(*((uint32_t*)their_node_id) == 33);
6703 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6704 LDKQueryChannelRange msg_conv;
6705 msg_conv.inner = (void*)(msg & (~1));
6706 msg_conv.is_owned = (msg & 1) || (msg == 0);
6707 msg_conv = QueryChannelRange_clone(&msg_conv);
6708 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6709 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6710 return (uint64_t)ret_conv;
6713 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6714 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6715 LDKPublicKey their_node_id_ref;
6716 CHECK(*((uint32_t*)their_node_id) == 33);
6717 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6718 LDKQueryShortChannelIds msg_conv;
6719 msg_conv.inner = (void*)(msg & (~1));
6720 msg_conv.is_owned = (msg & 1) || (msg == 0);
6721 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6722 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6723 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6724 return (uint64_t)ret_conv;
6727 typedef struct LDKCustomMessageReader_JCalls {
6728 atomic_size_t refcnt;
6730 } LDKCustomMessageReader_JCalls;
6731 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
6732 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6733 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6734 js_free(j_calls->read_meth);
6738 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
6739 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
6740 LDKu8slice buffer_var = buffer;
6741 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6742 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
6743 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
6744 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
6745 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
6748 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
6749 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
6750 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6752 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
6753 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
6754 atomic_init(&calls->refcnt, 1);
6755 //TODO: Assign calls->o from o
6757 LDKCustomMessageReader ret = {
6758 .this_arg = (void*) calls,
6759 .read = read_LDKCustomMessageReader_jcall,
6760 .free = LDKCustomMessageReader_JCalls_free,
6764 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
6765 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
6766 *res_ptr = LDKCustomMessageReader_init(o);
6767 return (long)res_ptr;
6769 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
6770 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
6771 LDKu8slice buffer_ref;
6772 buffer_ref.datalen = *((uint32_t*)buffer);
6773 buffer_ref.data = (int8_t*)(buffer + 4);
6774 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
6775 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
6776 return (uint64_t)ret_conv;
6779 typedef struct LDKCustomMessageHandler_JCalls {
6780 atomic_size_t refcnt;
6781 LDKCustomMessageReader_JCalls* CustomMessageReader;
6782 uint32_t handle_custom_message_meth;
6783 uint32_t get_and_clear_pending_msg_meth;
6784 } LDKCustomMessageHandler_JCalls;
6785 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
6786 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6787 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6788 js_free(j_calls->handle_custom_message_meth);
6789 js_free(j_calls->get_and_clear_pending_msg_meth);
6793 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
6794 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6795 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
6797 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6798 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
6799 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
6800 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6801 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6804 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
6805 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
6806 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
6807 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
6808 ret_constr.datalen = *((uint32_t*)ret);
6809 if (ret_constr.datalen > 0)
6810 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
6812 ret_constr.data = NULL;
6813 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6814 for (size_t c = 0; c < ret_constr.datalen; c++) {
6815 uint32_t ret_conv_28 = ret_vals[c];
6816 LDKC2Tuple_PublicKeyTypeZ ret_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1);
6817 ret_conv_28_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1));
6818 ret_constr.data[c] = ret_conv_28_conv;
6822 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
6823 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
6824 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6825 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
6827 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
6828 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
6829 atomic_init(&calls->refcnt, 1);
6830 //TODO: Assign calls->o from o
6832 LDKCustomMessageHandler ret = {
6833 .this_arg = (void*) calls,
6834 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
6835 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
6836 .free = LDKCustomMessageHandler_JCalls_free,
6837 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
6839 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
6842 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
6843 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
6844 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
6845 return (long)res_ptr;
6847 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
6848 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
6849 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
6850 LDKPublicKey sender_node_id_ref;
6851 CHECK(*((uint32_t*)sender_node_id) == 33);
6852 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
6853 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6854 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
6855 return (uint64_t)ret_conv;
6858 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
6859 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
6860 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
6861 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6862 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6863 for (size_t c = 0; c < ret_var.datalen; c++) {
6864 LDKC2Tuple_PublicKeyTypeZ* ret_conv_28_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
6865 *ret_conv_28_ref = ret_var.data[c];
6866 ret_arr_ptr[c] = (uint64_t)ret_conv_28_ref;
6872 typedef struct LDKSocketDescriptor_JCalls {
6873 atomic_size_t refcnt;
6874 uint32_t send_data_meth;
6875 uint32_t disconnect_socket_meth;
6878 } LDKSocketDescriptor_JCalls;
6879 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6880 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6881 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6882 js_free(j_calls->send_data_meth);
6883 js_free(j_calls->disconnect_socket_meth);
6884 js_free(j_calls->eq_meth);
6885 js_free(j_calls->hash_meth);
6889 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6890 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6891 LDKu8slice data_var = data;
6892 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
6893 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
6894 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
6896 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6897 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6898 js_invoke_function_0(j_calls->disconnect_socket_meth);
6900 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6901 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6902 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6903 *other_arg_clone = SocketDescriptor_clone(other_arg);
6904 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
6906 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6907 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6908 return js_invoke_function_0(j_calls->hash_meth);
6910 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
6911 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
6912 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6914 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
6915 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6916 atomic_init(&calls->refcnt, 1);
6917 //TODO: Assign calls->o from o
6919 LDKSocketDescriptor ret = {
6920 .this_arg = (void*) calls,
6921 .send_data = send_data_LDKSocketDescriptor_jcall,
6922 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6923 .eq = eq_LDKSocketDescriptor_jcall,
6924 .hash = hash_LDKSocketDescriptor_jcall,
6925 .cloned = LDKSocketDescriptor_JCalls_cloned,
6926 .free = LDKSocketDescriptor_JCalls_free,
6930 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
6931 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6932 *res_ptr = LDKSocketDescriptor_init(o);
6933 return (long)res_ptr;
6935 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
6936 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6937 LDKu8slice data_ref;
6938 data_ref.datalen = *((uint32_t*)data);
6939 data_ref.data = (int8_t*)(data + 4);
6940 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6944 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
6945 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6946 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6949 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
6950 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6951 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6955 typedef struct LDKChannelManagerPersister_JCalls {
6956 atomic_size_t refcnt;
6957 uint32_t persist_manager_meth;
6958 } LDKChannelManagerPersister_JCalls;
6959 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
6960 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6961 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6962 js_free(j_calls->persist_manager_meth);
6966 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
6967 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
6968 LDKChannelManager channel_manager_var = *channel_manager;
6969 // Warning: we may need a move here but no clone is available for LDKChannelManager
6970 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6971 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6972 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
6973 if (channel_manager_var.is_owned) {
6974 channel_manager_ref |= 1;
6976 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
6977 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
6978 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
6981 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
6982 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
6983 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6985 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
6986 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
6987 atomic_init(&calls->refcnt, 1);
6988 //TODO: Assign calls->o from o
6990 LDKChannelManagerPersister ret = {
6991 .this_arg = (void*) calls,
6992 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
6993 .free = LDKChannelManagerPersister_JCalls_free,
6997 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
6998 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
6999 *res_ptr = LDKChannelManagerPersister_init(o);
7000 return (long)res_ptr;
7002 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7003 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
7004 LDKChannelManager channel_manager_conv;
7005 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7006 channel_manager_conv.is_owned = false;
7007 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7008 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7009 return (uint64_t)ret_conv;
7012 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7013 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7015 case LDKFallback_SegWitProgram: {
7016 uint8_t version_val = obj->seg_wit_program.version._0;
7017 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7018 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7019 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7020 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7022 case LDKFallback_PubKeyHash: {
7023 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7024 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7025 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7027 case LDKFallback_ScriptHash: {
7028 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7029 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7030 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7035 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7036 LDKStr ret_str = _ldk_get_compiled_version();
7037 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7042 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7043 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7044 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7049 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7050 LDKTransaction _res_ref;
7051 _res_ref.datalen = *((uint32_t*)_res);
7052 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7053 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7054 _res_ref.data_is_owned = true;
7055 Transaction_free(_res_ref);
7058 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7059 LDKCVec_u8Z script_pubkey_ref;
7060 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7061 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7062 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7063 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7064 *ret_ref = TxOut_new(script_pubkey_ref, value);
7065 return (uint64_t)ret_ref;
7068 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7069 if ((_res & 1) != 0) return;
7070 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
7072 TxOut_free(_res_conv);
7075 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7076 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7077 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7078 *ret_ref = TxOut_clone(orig_conv);
7079 return (uint64_t)ret_ref;
7082 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7083 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7087 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7089 CHECK(*((uint32_t*)o) == 32);
7090 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7091 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7092 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7093 return (uint64_t)ret_conv;
7096 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7097 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7098 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7099 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7100 return (uint64_t)ret_conv;
7103 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7104 if ((_res & 1) != 0) return;
7105 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
7107 CResult_SecretKeyErrorZ_free(_res_conv);
7110 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7112 CHECK(*((uint32_t*)o) == 33);
7113 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7114 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7115 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7116 return (uint64_t)ret_conv;
7119 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7120 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7121 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7122 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7123 return (uint64_t)ret_conv;
7126 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7127 if ((_res & 1) != 0) return;
7128 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
7130 CResult_PublicKeyErrorZ_free(_res_conv);
7133 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7134 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7135 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7136 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7137 return (uint64_t)ret_conv;
7140 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7141 LDKTxCreationKeys o_conv;
7142 o_conv.inner = (void*)(o & (~1));
7143 o_conv.is_owned = (o & 1) || (o == 0);
7144 o_conv = TxCreationKeys_clone(&o_conv);
7145 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7146 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7147 return (uint64_t)ret_conv;
7150 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7151 LDKDecodeError e_conv;
7152 e_conv.inner = (void*)(e & (~1));
7153 e_conv.is_owned = (e & 1) || (e == 0);
7154 e_conv = DecodeError_clone(&e_conv);
7155 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7156 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7157 return (uint64_t)ret_conv;
7160 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7161 if ((_res & 1) != 0) return;
7162 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7164 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7167 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7168 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7169 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7170 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7171 return (uint64_t)ret_conv;
7174 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7175 LDKChannelPublicKeys o_conv;
7176 o_conv.inner = (void*)(o & (~1));
7177 o_conv.is_owned = (o & 1) || (o == 0);
7178 o_conv = ChannelPublicKeys_clone(&o_conv);
7179 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7180 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7181 return (uint64_t)ret_conv;
7184 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7185 LDKDecodeError e_conv;
7186 e_conv.inner = (void*)(e & (~1));
7187 e_conv.is_owned = (e & 1) || (e == 0);
7188 e_conv = DecodeError_clone(&e_conv);
7189 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7190 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7191 return (uint64_t)ret_conv;
7194 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7195 if ((_res & 1) != 0) return;
7196 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7198 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7201 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7202 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7203 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7204 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7205 return (uint64_t)ret_conv;
7208 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7209 LDKTxCreationKeys o_conv;
7210 o_conv.inner = (void*)(o & (~1));
7211 o_conv.is_owned = (o & 1) || (o == 0);
7212 o_conv = TxCreationKeys_clone(&o_conv);
7213 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7214 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7215 return (uint64_t)ret_conv;
7218 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7219 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7220 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7221 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7222 return (uint64_t)ret_conv;
7225 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7226 if ((_res & 1) != 0) return;
7227 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
7229 CResult_TxCreationKeysErrorZ_free(_res_conv);
7232 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7233 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7234 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7235 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7236 return (uint64_t)ret_conv;
7239 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7240 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7241 *ret_copy = COption_u32Z_some(o);
7242 uint64_t ret_ref = (uint64_t)ret_copy;
7246 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7247 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7248 *ret_copy = COption_u32Z_none();
7249 uint64_t ret_ref = (uint64_t)ret_copy;
7253 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7254 if ((_res & 1) != 0) return;
7255 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
7257 COption_u32Z_free(_res_conv);
7260 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7261 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7262 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7263 *ret_copy = COption_u32Z_clone(orig_conv);
7264 uint64_t ret_ref = (uint64_t)ret_copy;
7268 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7269 LDKHTLCOutputInCommitment o_conv;
7270 o_conv.inner = (void*)(o & (~1));
7271 o_conv.is_owned = (o & 1) || (o == 0);
7272 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7273 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7274 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7275 return (uint64_t)ret_conv;
7278 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7279 LDKDecodeError e_conv;
7280 e_conv.inner = (void*)(e & (~1));
7281 e_conv.is_owned = (e & 1) || (e == 0);
7282 e_conv = DecodeError_clone(&e_conv);
7283 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7284 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7285 return (uint64_t)ret_conv;
7288 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7289 if ((_res & 1) != 0) return;
7290 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
7292 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7295 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7296 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7297 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7298 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7299 return (uint64_t)ret_conv;
7302 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7303 LDKCounterpartyChannelTransactionParameters o_conv;
7304 o_conv.inner = (void*)(o & (~1));
7305 o_conv.is_owned = (o & 1) || (o == 0);
7306 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7307 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7308 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7309 return (uint64_t)ret_conv;
7312 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7313 LDKDecodeError e_conv;
7314 e_conv.inner = (void*)(e & (~1));
7315 e_conv.is_owned = (e & 1) || (e == 0);
7316 e_conv = DecodeError_clone(&e_conv);
7317 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7318 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7319 return (uint64_t)ret_conv;
7322 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7323 if ((_res & 1) != 0) return;
7324 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7326 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7329 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7330 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7331 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7332 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7333 return (uint64_t)ret_conv;
7336 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7337 LDKChannelTransactionParameters o_conv;
7338 o_conv.inner = (void*)(o & (~1));
7339 o_conv.is_owned = (o & 1) || (o == 0);
7340 o_conv = ChannelTransactionParameters_clone(&o_conv);
7341 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7342 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7343 return (uint64_t)ret_conv;
7346 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7347 LDKDecodeError e_conv;
7348 e_conv.inner = (void*)(e & (~1));
7349 e_conv.is_owned = (e & 1) || (e == 0);
7350 e_conv = DecodeError_clone(&e_conv);
7351 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7352 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7353 return (uint64_t)ret_conv;
7356 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7357 if ((_res & 1) != 0) return;
7358 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7360 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7363 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7364 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7365 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7366 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7367 return (uint64_t)ret_conv;
7370 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7371 LDKCVec_SignatureZ _res_constr;
7372 _res_constr.datalen = *((uint32_t*)_res);
7373 if (_res_constr.datalen > 0)
7374 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7376 _res_constr.data = NULL;
7377 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7378 for (size_t m = 0; m < _res_constr.datalen; m++) {
7379 int8_tArray _res_conv_12 = _res_vals[m];
7380 LDKSignature _res_conv_12_ref;
7381 CHECK(*((uint32_t*)_res_conv_12) == 64);
7382 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7383 _res_constr.data[m] = _res_conv_12_ref;
7385 CVec_SignatureZ_free(_res_constr);
7388 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7389 LDKHolderCommitmentTransaction o_conv;
7390 o_conv.inner = (void*)(o & (~1));
7391 o_conv.is_owned = (o & 1) || (o == 0);
7392 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7393 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7394 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7395 return (uint64_t)ret_conv;
7398 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7399 LDKDecodeError e_conv;
7400 e_conv.inner = (void*)(e & (~1));
7401 e_conv.is_owned = (e & 1) || (e == 0);
7402 e_conv = DecodeError_clone(&e_conv);
7403 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7404 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7405 return (uint64_t)ret_conv;
7408 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7409 if ((_res & 1) != 0) return;
7410 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7412 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7415 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7416 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7417 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7418 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7419 return (uint64_t)ret_conv;
7422 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7423 LDKBuiltCommitmentTransaction o_conv;
7424 o_conv.inner = (void*)(o & (~1));
7425 o_conv.is_owned = (o & 1) || (o == 0);
7426 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7427 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7428 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7429 return (uint64_t)ret_conv;
7432 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7433 LDKDecodeError e_conv;
7434 e_conv.inner = (void*)(e & (~1));
7435 e_conv.is_owned = (e & 1) || (e == 0);
7436 e_conv = DecodeError_clone(&e_conv);
7437 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7438 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7439 return (uint64_t)ret_conv;
7442 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7443 if ((_res & 1) != 0) return;
7444 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7446 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7449 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7450 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7451 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7452 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7453 return (uint64_t)ret_conv;
7456 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7457 LDKTrustedClosingTransaction o_conv;
7458 o_conv.inner = (void*)(o & (~1));
7459 o_conv.is_owned = (o & 1) || (o == 0);
7460 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7461 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7462 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7463 return (uint64_t)ret_conv;
7466 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7467 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7468 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7469 return (uint64_t)ret_conv;
7472 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7473 if ((_res & 1) != 0) return;
7474 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
7476 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7479 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7480 LDKCommitmentTransaction o_conv;
7481 o_conv.inner = (void*)(o & (~1));
7482 o_conv.is_owned = (o & 1) || (o == 0);
7483 o_conv = CommitmentTransaction_clone(&o_conv);
7484 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7485 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7486 return (uint64_t)ret_conv;
7489 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7490 LDKDecodeError e_conv;
7491 e_conv.inner = (void*)(e & (~1));
7492 e_conv.is_owned = (e & 1) || (e == 0);
7493 e_conv = DecodeError_clone(&e_conv);
7494 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7495 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7496 return (uint64_t)ret_conv;
7499 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7500 if ((_res & 1) != 0) return;
7501 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7503 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7506 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7507 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7508 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7509 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7510 return (uint64_t)ret_conv;
7513 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7514 LDKTrustedCommitmentTransaction o_conv;
7515 o_conv.inner = (void*)(o & (~1));
7516 o_conv.is_owned = (o & 1) || (o == 0);
7517 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7518 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7519 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7520 return (uint64_t)ret_conv;
7523 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
7524 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7525 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7526 return (uint64_t)ret_conv;
7529 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
7530 if ((_res & 1) != 0) return;
7531 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7533 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7536 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
7537 LDKCVec_SignatureZ o_constr;
7538 o_constr.datalen = *((uint32_t*)o);
7539 if (o_constr.datalen > 0)
7540 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7542 o_constr.data = NULL;
7543 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7544 for (size_t m = 0; m < o_constr.datalen; m++) {
7545 int8_tArray o_conv_12 = o_vals[m];
7546 LDKSignature o_conv_12_ref;
7547 CHECK(*((uint32_t*)o_conv_12) == 64);
7548 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
7549 o_constr.data[m] = o_conv_12_ref;
7551 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7552 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7553 return (uint64_t)ret_conv;
7556 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
7557 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7558 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7559 return (uint64_t)ret_conv;
7562 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
7563 if ((_res & 1) != 0) return;
7564 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7566 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7569 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
7570 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7571 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7572 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7573 return (uint64_t)ret_conv;
7576 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
7577 LDKShutdownScript o_conv;
7578 o_conv.inner = (void*)(o & (~1));
7579 o_conv.is_owned = (o & 1) || (o == 0);
7580 o_conv = ShutdownScript_clone(&o_conv);
7581 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7582 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
7583 return (uint64_t)ret_conv;
7586 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
7587 LDKDecodeError e_conv;
7588 e_conv.inner = (void*)(e & (~1));
7589 e_conv.is_owned = (e & 1) || (e == 0);
7590 e_conv = DecodeError_clone(&e_conv);
7591 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7592 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
7593 return (uint64_t)ret_conv;
7596 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
7597 if ((_res & 1) != 0) return;
7598 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
7600 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
7603 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
7604 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
7605 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7606 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
7607 return (uint64_t)ret_conv;
7610 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
7611 LDKShutdownScript o_conv;
7612 o_conv.inner = (void*)(o & (~1));
7613 o_conv.is_owned = (o & 1) || (o == 0);
7614 o_conv = ShutdownScript_clone(&o_conv);
7615 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7616 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
7617 return (uint64_t)ret_conv;
7620 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
7621 LDKInvalidShutdownScript e_conv;
7622 e_conv.inner = (void*)(e & (~1));
7623 e_conv.is_owned = (e & 1) || (e == 0);
7624 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
7625 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
7626 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
7627 return (uint64_t)ret_conv;
7630 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
7631 if ((_res & 1) != 0) return;
7632 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
7634 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
7637 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
7638 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7639 *ret_conv = CResult_NoneErrorZ_ok();
7640 return (uint64_t)ret_conv;
7643 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
7644 LDKIOError e_conv = LDKIOError_from_js(e);
7645 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7646 *ret_conv = CResult_NoneErrorZ_err(e_conv);
7647 return (uint64_t)ret_conv;
7650 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
7651 if ((_res & 1) != 0) return;
7652 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
7654 CResult_NoneErrorZ_free(_res_conv);
7657 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
7658 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
7659 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7660 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
7661 return (uint64_t)ret_conv;
7664 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
7666 o_conv.inner = (void*)(o & (~1));
7667 o_conv.is_owned = (o & 1) || (o == 0);
7668 o_conv = RouteHop_clone(&o_conv);
7669 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7670 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
7671 return (uint64_t)ret_conv;
7674 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
7675 LDKDecodeError e_conv;
7676 e_conv.inner = (void*)(e & (~1));
7677 e_conv.is_owned = (e & 1) || (e == 0);
7678 e_conv = DecodeError_clone(&e_conv);
7679 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7680 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
7681 return (uint64_t)ret_conv;
7684 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
7685 if ((_res & 1) != 0) return;
7686 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
7688 CResult_RouteHopDecodeErrorZ_free(_res_conv);
7691 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
7692 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
7693 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
7694 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
7695 return (uint64_t)ret_conv;
7698 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7699 LDKCVec_RouteHopZ _res_constr;
7700 _res_constr.datalen = *((uint32_t*)_res);
7701 if (_res_constr.datalen > 0)
7702 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7704 _res_constr.data = NULL;
7705 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7706 for (size_t k = 0; k < _res_constr.datalen; k++) {
7707 uint32_t _res_conv_10 = _res_vals[k];
7708 LDKRouteHop _res_conv_10_conv;
7709 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7710 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7711 _res_constr.data[k] = _res_conv_10_conv;
7713 CVec_RouteHopZ_free(_res_constr);
7716 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7717 LDKCVec_CVec_RouteHopZZ _res_constr;
7718 _res_constr.datalen = *((uint32_t*)_res);
7719 if (_res_constr.datalen > 0)
7720 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7722 _res_constr.data = NULL;
7723 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7724 for (size_t m = 0; m < _res_constr.datalen; m++) {
7725 uint32_tArray _res_conv_12 = _res_vals[m];
7726 LDKCVec_RouteHopZ _res_conv_12_constr;
7727 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7728 if (_res_conv_12_constr.datalen > 0)
7729 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7731 _res_conv_12_constr.data = NULL;
7732 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7733 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7734 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7735 LDKRouteHop _res_conv_12_conv_10_conv;
7736 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7737 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7738 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7740 _res_constr.data[m] = _res_conv_12_constr;
7742 CVec_CVec_RouteHopZZ_free(_res_constr);
7745 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7747 o_conv.inner = (void*)(o & (~1));
7748 o_conv.is_owned = (o & 1) || (o == 0);
7749 o_conv = Route_clone(&o_conv);
7750 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7751 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7752 return (uint64_t)ret_conv;
7755 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7756 LDKDecodeError e_conv;
7757 e_conv.inner = (void*)(e & (~1));
7758 e_conv.is_owned = (e & 1) || (e == 0);
7759 e_conv = DecodeError_clone(&e_conv);
7760 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7761 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7762 return (uint64_t)ret_conv;
7765 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7766 if ((_res & 1) != 0) return;
7767 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7769 CResult_RouteDecodeErrorZ_free(_res_conv);
7772 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7773 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7774 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7775 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7776 return (uint64_t)ret_conv;
7779 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
7780 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7781 *ret_copy = COption_u64Z_some(o);
7782 uint64_t ret_ref = (uint64_t)ret_copy;
7786 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
7787 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7788 *ret_copy = COption_u64Z_none();
7789 uint64_t ret_ref = (uint64_t)ret_copy;
7793 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
7794 if ((_res & 1) != 0) return;
7795 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7797 COption_u64Z_free(_res_conv);
7800 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
7801 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7802 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7803 *ret_copy = COption_u64Z_clone(orig_conv);
7804 uint64_t ret_ref = (uint64_t)ret_copy;
7808 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7809 LDKCVec_ChannelDetailsZ _res_constr;
7810 _res_constr.datalen = *((uint32_t*)_res);
7811 if (_res_constr.datalen > 0)
7812 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7814 _res_constr.data = NULL;
7815 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7816 for (size_t q = 0; q < _res_constr.datalen; q++) {
7817 uint32_t _res_conv_16 = _res_vals[q];
7818 LDKChannelDetails _res_conv_16_conv;
7819 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7820 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7821 _res_constr.data[q] = _res_conv_16_conv;
7823 CVec_ChannelDetailsZ_free(_res_constr);
7826 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7827 LDKCVec_RouteHintZ _res_constr;
7828 _res_constr.datalen = *((uint32_t*)_res);
7829 if (_res_constr.datalen > 0)
7830 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7832 _res_constr.data = NULL;
7833 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7834 for (size_t l = 0; l < _res_constr.datalen; l++) {
7835 uint32_t _res_conv_11 = _res_vals[l];
7836 LDKRouteHint _res_conv_11_conv;
7837 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7838 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7839 _res_constr.data[l] = _res_conv_11_conv;
7841 CVec_RouteHintZ_free(_res_constr);
7844 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7846 o_conv.inner = (void*)(o & (~1));
7847 o_conv.is_owned = (o & 1) || (o == 0);
7848 o_conv = Route_clone(&o_conv);
7849 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7850 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7851 return (uint64_t)ret_conv;
7854 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7855 LDKLightningError e_conv;
7856 e_conv.inner = (void*)(e & (~1));
7857 e_conv.is_owned = (e & 1) || (e == 0);
7858 e_conv = LightningError_clone(&e_conv);
7859 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7860 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7861 return (uint64_t)ret_conv;
7864 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7865 if ((_res & 1) != 0) return;
7866 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7868 CResult_RouteLightningErrorZ_free(_res_conv);
7871 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7872 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7873 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7874 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7875 return (uint64_t)ret_conv;
7878 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7879 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7880 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
7881 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7882 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7883 return (uint64_t)ret_conv;
7886 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7887 LDKAccessError e_conv = LDKAccessError_from_js(e);
7888 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7889 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7890 return (uint64_t)ret_conv;
7893 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7894 if ((_res & 1) != 0) return;
7895 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7897 CResult_TxOutAccessErrorZ_free(_res_conv);
7900 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7901 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7902 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7903 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7904 return (uint64_t)ret_conv;
7907 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
7908 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
7909 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7910 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
7911 return (uint64_t)ret_ref;
7914 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
7915 LDKTransaction b_ref;
7916 b_ref.datalen = *((uint32_t*)b);
7917 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7918 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
7919 b_ref.data_is_owned = true;
7920 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7921 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7922 return (uint64_t)ret_ref;
7925 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
7926 if ((_res & 1) != 0) return;
7927 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7929 C2Tuple_usizeTransactionZ_free(_res_conv);
7932 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
7933 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7934 _res_constr.datalen = *((uint32_t*)_res);
7935 if (_res_constr.datalen > 0)
7936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7938 _res_constr.data = NULL;
7939 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7940 for (size_t e = 0; e < _res_constr.datalen; e++) {
7941 uint32_t _res_conv_30 = _res_vals[e];
7942 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
7943 FREE((void*)_res_conv_30);
7944 _res_constr.data[e] = _res_conv_30_conv;
7946 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7949 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
7950 LDKCVec_TxidZ _res_constr;
7951 _res_constr.datalen = *((uint32_t*)_res);
7952 if (_res_constr.datalen > 0)
7953 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7955 _res_constr.data = NULL;
7956 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7957 for (size_t m = 0; m < _res_constr.datalen; m++) {
7958 int8_tArray _res_conv_12 = _res_vals[m];
7959 LDKThirtyTwoBytes _res_conv_12_ref;
7960 CHECK(*((uint32_t*)_res_conv_12) == 32);
7961 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
7962 _res_constr.data[m] = _res_conv_12_ref;
7964 CVec_TxidZ_free(_res_constr);
7967 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
7968 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7969 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7970 return (uint64_t)ret_conv;
7973 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
7974 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
7975 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7976 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7977 return (uint64_t)ret_conv;
7980 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
7981 if ((_res & 1) != 0) return;
7982 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7984 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7987 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
7988 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7989 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7990 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7991 return (uint64_t)ret_conv;
7994 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
7995 LDKCVec_MonitorEventZ _res_constr;
7996 _res_constr.datalen = *((uint32_t*)_res);
7997 if (_res_constr.datalen > 0)
7998 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8000 _res_constr.data = NULL;
8001 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8002 for (size_t o = 0; o < _res_constr.datalen; o++) {
8003 uint32_t _res_conv_14 = _res_vals[o];
8004 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
8005 FREE((void*)_res_conv_14);
8006 _res_constr.data[o] = _res_conv_14_conv;
8008 CVec_MonitorEventZ_free(_res_constr);
8011 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8012 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
8013 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8014 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8015 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8016 uint64_t ret_ref = (uint64_t)ret_copy;
8020 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8021 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8022 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8023 uint64_t ret_ref = (uint64_t)ret_copy;
8027 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8028 if ((_res & 1) != 0) return;
8029 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
8031 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8034 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8035 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8036 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8037 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8038 uint64_t ret_ref = (uint64_t)ret_copy;
8042 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8043 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
8044 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8045 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8046 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8047 uint64_t ret_ref = (uint64_t)ret_copy;
8051 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8052 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8053 *ret_copy = COption_NetworkUpdateZ_none();
8054 uint64_t ret_ref = (uint64_t)ret_copy;
8058 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8059 if ((_res & 1) != 0) return;
8060 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
8062 COption_NetworkUpdateZ_free(_res_conv);
8065 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8066 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8067 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8068 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8069 uint64_t ret_ref = (uint64_t)ret_copy;
8073 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8074 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8075 _res_constr.datalen = *((uint32_t*)_res);
8076 if (_res_constr.datalen > 0)
8077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8079 _res_constr.data = NULL;
8080 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8081 for (size_t b = 0; b < _res_constr.datalen; b++) {
8082 uint32_t _res_conv_27 = _res_vals[b];
8083 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8084 FREE((void*)_res_conv_27);
8085 _res_constr.data[b] = _res_conv_27_conv;
8087 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8090 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8091 LDKCVec_MessageSendEventZ _res_constr;
8092 _res_constr.datalen = *((uint32_t*)_res);
8093 if (_res_constr.datalen > 0)
8094 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8096 _res_constr.data = NULL;
8097 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8098 for (size_t s = 0; s < _res_constr.datalen; s++) {
8099 uint32_t _res_conv_18 = _res_vals[s];
8100 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
8101 FREE((void*)_res_conv_18);
8102 _res_constr.data[s] = _res_conv_18_conv;
8104 CVec_MessageSendEventZ_free(_res_constr);
8107 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8108 LDKInitFeatures o_conv;
8109 o_conv.inner = (void*)(o & (~1));
8110 o_conv.is_owned = (o & 1) || (o == 0);
8111 o_conv = InitFeatures_clone(&o_conv);
8112 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8113 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8114 return (uint64_t)ret_conv;
8117 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8118 LDKDecodeError e_conv;
8119 e_conv.inner = (void*)(e & (~1));
8120 e_conv.is_owned = (e & 1) || (e == 0);
8121 e_conv = DecodeError_clone(&e_conv);
8122 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8123 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8124 return (uint64_t)ret_conv;
8127 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8128 if ((_res & 1) != 0) return;
8129 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8131 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8134 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8135 LDKNodeFeatures o_conv;
8136 o_conv.inner = (void*)(o & (~1));
8137 o_conv.is_owned = (o & 1) || (o == 0);
8138 o_conv = NodeFeatures_clone(&o_conv);
8139 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8140 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8141 return (uint64_t)ret_conv;
8144 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8145 LDKDecodeError e_conv;
8146 e_conv.inner = (void*)(e & (~1));
8147 e_conv.is_owned = (e & 1) || (e == 0);
8148 e_conv = DecodeError_clone(&e_conv);
8149 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8150 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8151 return (uint64_t)ret_conv;
8154 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8155 if ((_res & 1) != 0) return;
8156 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8158 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8161 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8162 LDKChannelFeatures o_conv;
8163 o_conv.inner = (void*)(o & (~1));
8164 o_conv.is_owned = (o & 1) || (o == 0);
8165 o_conv = ChannelFeatures_clone(&o_conv);
8166 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8167 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8168 return (uint64_t)ret_conv;
8171 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8172 LDKDecodeError e_conv;
8173 e_conv.inner = (void*)(e & (~1));
8174 e_conv.is_owned = (e & 1) || (e == 0);
8175 e_conv = DecodeError_clone(&e_conv);
8176 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8177 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8178 return (uint64_t)ret_conv;
8181 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8182 if ((_res & 1) != 0) return;
8183 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8185 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8188 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8189 LDKInvoiceFeatures o_conv;
8190 o_conv.inner = (void*)(o & (~1));
8191 o_conv.is_owned = (o & 1) || (o == 0);
8192 o_conv = InvoiceFeatures_clone(&o_conv);
8193 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8194 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8195 return (uint64_t)ret_conv;
8198 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8199 LDKDecodeError e_conv;
8200 e_conv.inner = (void*)(e & (~1));
8201 e_conv.is_owned = (e & 1) || (e == 0);
8202 e_conv = DecodeError_clone(&e_conv);
8203 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8204 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8205 return (uint64_t)ret_conv;
8208 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8209 if ((_res & 1) != 0) return;
8210 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8212 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8215 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8216 LDKDelayedPaymentOutputDescriptor o_conv;
8217 o_conv.inner = (void*)(o & (~1));
8218 o_conv.is_owned = (o & 1) || (o == 0);
8219 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8220 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8221 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8222 return (uint64_t)ret_conv;
8225 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8226 LDKDecodeError e_conv;
8227 e_conv.inner = (void*)(e & (~1));
8228 e_conv.is_owned = (e & 1) || (e == 0);
8229 e_conv = DecodeError_clone(&e_conv);
8230 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8231 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8232 return (uint64_t)ret_conv;
8235 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8236 if ((_res & 1) != 0) return;
8237 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8239 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8242 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8243 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8244 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8245 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8246 return (uint64_t)ret_conv;
8249 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8250 LDKStaticPaymentOutputDescriptor o_conv;
8251 o_conv.inner = (void*)(o & (~1));
8252 o_conv.is_owned = (o & 1) || (o == 0);
8253 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8254 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8255 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8256 return (uint64_t)ret_conv;
8259 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8260 LDKDecodeError e_conv;
8261 e_conv.inner = (void*)(e & (~1));
8262 e_conv.is_owned = (e & 1) || (e == 0);
8263 e_conv = DecodeError_clone(&e_conv);
8264 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8265 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8266 return (uint64_t)ret_conv;
8269 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8270 if ((_res & 1) != 0) return;
8271 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8273 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8276 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8277 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8278 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8279 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8280 return (uint64_t)ret_conv;
8283 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8284 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8285 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8286 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8287 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8288 return (uint64_t)ret_conv;
8291 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8292 LDKDecodeError e_conv;
8293 e_conv.inner = (void*)(e & (~1));
8294 e_conv.is_owned = (e & 1) || (e == 0);
8295 e_conv = DecodeError_clone(&e_conv);
8296 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8297 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8298 return (uint64_t)ret_conv;
8301 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8302 if ((_res & 1) != 0) return;
8303 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8305 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8308 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8309 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8310 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8311 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8312 return (uint64_t)ret_conv;
8315 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8316 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8317 *ret_conv = CResult_NoneNoneZ_ok();
8318 return (uint64_t)ret_conv;
8321 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8322 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8323 *ret_conv = CResult_NoneNoneZ_err();
8324 return (uint64_t)ret_conv;
8327 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8328 if ((_res & 1) != 0) return;
8329 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
8331 CResult_NoneNoneZ_free(_res_conv);
8334 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8335 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8336 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8337 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8338 return (uint64_t)ret_conv;
8341 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8342 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8343 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8344 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8345 return (uint64_t)ret_ref;
8348 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8350 CHECK(*((uint32_t*)a) == 64);
8351 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8352 LDKCVec_SignatureZ b_constr;
8353 b_constr.datalen = *((uint32_t*)b);
8354 if (b_constr.datalen > 0)
8355 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8357 b_constr.data = NULL;
8358 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8359 for (size_t m = 0; m < b_constr.datalen; m++) {
8360 int8_tArray b_conv_12 = b_vals[m];
8361 LDKSignature b_conv_12_ref;
8362 CHECK(*((uint32_t*)b_conv_12) == 64);
8363 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8364 b_constr.data[m] = b_conv_12_ref;
8366 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8367 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8368 return (uint64_t)ret_ref;
8371 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8372 if ((_res & 1) != 0) return;
8373 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8375 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8378 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8379 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8380 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8381 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8382 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8383 return (uint64_t)ret_conv;
8386 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8387 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8388 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8389 return (uint64_t)ret_conv;
8392 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8393 if ((_res & 1) != 0) return;
8394 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8396 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8399 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8400 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8401 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8402 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8403 return (uint64_t)ret_conv;
8406 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8408 CHECK(*((uint32_t*)o) == 64);
8409 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8410 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8411 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8412 return (uint64_t)ret_conv;
8415 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8416 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8417 *ret_conv = CResult_SignatureNoneZ_err();
8418 return (uint64_t)ret_conv;
8421 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8422 if ((_res & 1) != 0) return;
8423 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8425 CResult_SignatureNoneZ_free(_res_conv);
8428 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8429 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8430 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8431 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8432 return (uint64_t)ret_conv;
8435 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8436 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8437 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8438 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8439 return (uint64_t)ret_conv;
8442 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8443 LDKDecodeError e_conv;
8444 e_conv.inner = (void*)(e & (~1));
8445 e_conv.is_owned = (e & 1) || (e == 0);
8446 e_conv = DecodeError_clone(&e_conv);
8447 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8448 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8449 return (uint64_t)ret_conv;
8452 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8453 if ((_res & 1) != 0) return;
8454 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8456 CResult_SignDecodeErrorZ_free(_res_conv);
8459 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8460 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8461 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8462 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8463 return (uint64_t)ret_conv;
8466 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
8467 LDKCVec_u8Z _res_ref;
8468 _res_ref.datalen = *((uint32_t*)_res);
8469 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
8470 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8471 CVec_u8Z_free(_res_ref);
8474 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
8475 LDKRecoverableSignature arg_ref;
8476 CHECK(*((uint32_t*)arg) == 68);
8477 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
8478 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8479 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
8480 return (uint64_t)ret_conv;
8483 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
8484 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8485 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
8486 return (uint64_t)ret_conv;
8489 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
8490 if ((_res & 1) != 0) return;
8491 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
8493 CResult_RecoverableSignatureNoneZ_free(_res_conv);
8496 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
8497 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
8498 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8499 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
8500 return (uint64_t)ret_conv;
8503 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8504 LDKCVec_CVec_u8ZZ _res_constr;
8505 _res_constr.datalen = *((uint32_t*)_res);
8506 if (_res_constr.datalen > 0)
8507 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8509 _res_constr.data = NULL;
8510 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8511 for (size_t m = 0; m < _res_constr.datalen; m++) {
8512 int8_tArray _res_conv_12 = _res_vals[m];
8513 LDKCVec_u8Z _res_conv_12_ref;
8514 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8515 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8516 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8517 _res_constr.data[m] = _res_conv_12_ref;
8519 CVec_CVec_u8ZZ_free(_res_constr);
8522 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8523 LDKCVec_CVec_u8ZZ o_constr;
8524 o_constr.datalen = *((uint32_t*)o);
8525 if (o_constr.datalen > 0)
8526 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8528 o_constr.data = NULL;
8529 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8530 for (size_t m = 0; m < o_constr.datalen; m++) {
8531 int8_tArray o_conv_12 = o_vals[m];
8532 LDKCVec_u8Z o_conv_12_ref;
8533 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8534 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8535 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8536 o_constr.data[m] = o_conv_12_ref;
8538 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8539 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8540 return (uint64_t)ret_conv;
8543 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8544 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8545 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8546 return (uint64_t)ret_conv;
8549 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8550 if ((_res & 1) != 0) return;
8551 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8553 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8556 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8557 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8558 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8559 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8560 return (uint64_t)ret_conv;
8563 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8564 LDKInMemorySigner o_conv;
8565 o_conv.inner = (void*)(o & (~1));
8566 o_conv.is_owned = (o & 1) || (o == 0);
8567 o_conv = InMemorySigner_clone(&o_conv);
8568 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8569 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8570 return (uint64_t)ret_conv;
8573 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8574 LDKDecodeError e_conv;
8575 e_conv.inner = (void*)(e & (~1));
8576 e_conv.is_owned = (e & 1) || (e == 0);
8577 e_conv = DecodeError_clone(&e_conv);
8578 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8579 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8580 return (uint64_t)ret_conv;
8583 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8584 if ((_res & 1) != 0) return;
8585 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8587 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8590 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8591 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8592 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8593 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8594 return (uint64_t)ret_conv;
8597 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8598 LDKCVec_TxOutZ _res_constr;
8599 _res_constr.datalen = *((uint32_t*)_res);
8600 if (_res_constr.datalen > 0)
8601 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8603 _res_constr.data = NULL;
8604 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8605 for (size_t h = 0; h < _res_constr.datalen; h++) {
8606 uint32_t _res_conv_7 = _res_vals[h];
8607 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8608 FREE((void*)_res_conv_7);
8609 _res_constr.data[h] = _res_conv_7_conv;
8611 CVec_TxOutZ_free(_res_constr);
8614 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
8615 LDKTransaction o_ref;
8616 o_ref.datalen = *((uint32_t*)o);
8617 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8618 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
8619 o_ref.data_is_owned = true;
8620 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8621 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8622 return (uint64_t)ret_conv;
8625 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
8626 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8627 *ret_conv = CResult_TransactionNoneZ_err();
8628 return (uint64_t)ret_conv;
8631 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
8632 if ((_res & 1) != 0) return;
8633 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8635 CResult_TransactionNoneZ_free(_res_conv);
8638 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
8639 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
8640 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8641 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
8642 return (uint64_t)ret_conv;
8645 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
8646 LDKThirtyTwoBytes a_ref;
8647 CHECK(*((uint32_t*)a) == 32);
8648 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8649 LDKChannelMonitor b_conv;
8650 b_conv.inner = (void*)(b & (~1));
8651 b_conv.is_owned = (b & 1) || (b == 0);
8652 b_conv = ChannelMonitor_clone(&b_conv);
8653 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8654 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
8655 return (uint64_t)ret_ref;
8658 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
8659 if ((_res & 1) != 0) return;
8660 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
8662 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
8665 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
8666 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
8667 _res_constr.datalen = *((uint32_t*)_res);
8668 if (_res_constr.datalen > 0)
8669 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8671 _res_constr.data = NULL;
8672 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8673 for (size_t m = 0; m < _res_constr.datalen; m++) {
8674 uint32_t _res_conv_38 = _res_vals[m];
8675 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_38) & ~1);
8676 FREE((void*)_res_conv_38);
8677 _res_constr.data[m] = _res_conv_38_conv;
8679 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
8682 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
8683 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
8684 o_constr.datalen = *((uint32_t*)o);
8685 if (o_constr.datalen > 0)
8686 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
8688 o_constr.data = NULL;
8689 uint32_t* o_vals = (uint32_t*)(o + 4);
8690 for (size_t m = 0; m < o_constr.datalen; m++) {
8691 uint32_t o_conv_38 = o_vals[m];
8692 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_38_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_38) & ~1);
8693 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
8694 o_constr.data[m] = o_conv_38_conv;
8696 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8697 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
8698 return (uint64_t)ret_conv;
8701 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
8702 LDKIOError e_conv = LDKIOError_from_js(e);
8703 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
8704 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
8705 return (uint64_t)ret_conv;
8708 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
8709 if ((_res & 1) != 0) return;
8710 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
8712 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
8715 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
8716 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8717 *ret_copy = COption_u16Z_some(o);
8718 uint64_t ret_ref = (uint64_t)ret_copy;
8722 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
8723 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8724 *ret_copy = COption_u16Z_none();
8725 uint64_t ret_ref = (uint64_t)ret_copy;
8729 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
8730 if ((_res & 1) != 0) return;
8731 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
8733 COption_u16Z_free(_res_conv);
8736 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
8737 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
8738 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
8739 *ret_copy = COption_u16Z_clone(orig_conv);
8740 uint64_t ret_ref = (uint64_t)ret_copy;
8744 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
8745 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8746 *ret_conv = CResult_NoneAPIErrorZ_ok();
8747 return (uint64_t)ret_conv;
8750 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
8751 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8752 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
8753 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8754 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8755 return (uint64_t)ret_conv;
8758 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
8759 if ((_res & 1) != 0) return;
8760 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8762 CResult_NoneAPIErrorZ_free(_res_conv);
8765 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
8766 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8767 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8768 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8769 return (uint64_t)ret_conv;
8772 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
8773 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8774 _res_constr.datalen = *((uint32_t*)_res);
8775 if (_res_constr.datalen > 0)
8776 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8778 _res_constr.data = NULL;
8779 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8780 for (size_t w = 0; w < _res_constr.datalen; w++) {
8781 uint32_t _res_conv_22 = _res_vals[w];
8782 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8783 FREE((void*)_res_conv_22);
8784 _res_constr.data[w] = _res_conv_22_conv;
8786 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8789 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
8790 LDKCVec_APIErrorZ _res_constr;
8791 _res_constr.datalen = *((uint32_t*)_res);
8792 if (_res_constr.datalen > 0)
8793 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8795 _res_constr.data = NULL;
8796 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8797 for (size_t k = 0; k < _res_constr.datalen; k++) {
8798 uint32_t _res_conv_10 = _res_vals[k];
8799 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8800 FREE((void*)_res_conv_10);
8801 _res_constr.data[k] = _res_conv_10_conv;
8803 CVec_APIErrorZ_free(_res_constr);
8806 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
8807 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8808 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8809 return (uint64_t)ret_conv;
8812 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
8813 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8814 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
8815 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8816 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8817 return (uint64_t)ret_conv;
8820 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
8821 if ((_res & 1) != 0) return;
8822 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8824 CResult_NonePaymentSendFailureZ_free(_res_conv);
8827 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
8828 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8829 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8830 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8831 return (uint64_t)ret_conv;
8834 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
8835 LDKThirtyTwoBytes o_ref;
8836 CHECK(*((uint32_t*)o) == 32);
8837 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8838 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8839 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
8840 return (uint64_t)ret_conv;
8843 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
8844 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8845 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
8846 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8847 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
8848 return (uint64_t)ret_conv;
8851 void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
8852 if ((_res & 1) != 0) return;
8853 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8855 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
8858 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
8859 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
8860 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
8861 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
8862 return (uint64_t)ret_conv;
8865 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
8866 LDKCVec_NetAddressZ _res_constr;
8867 _res_constr.datalen = *((uint32_t*)_res);
8868 if (_res_constr.datalen > 0)
8869 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8871 _res_constr.data = NULL;
8872 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8873 for (size_t m = 0; m < _res_constr.datalen; m++) {
8874 uint32_t _res_conv_12 = _res_vals[m];
8875 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
8876 FREE((void*)_res_conv_12);
8877 _res_constr.data[m] = _res_conv_12_conv;
8879 CVec_NetAddressZ_free(_res_constr);
8882 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
8883 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
8884 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8885 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
8886 return (uint64_t)ret_ref;
8889 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
8890 LDKThirtyTwoBytes a_ref;
8891 CHECK(*((uint32_t*)a) == 32);
8892 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8893 LDKThirtyTwoBytes b_ref;
8894 CHECK(*((uint32_t*)b) == 32);
8895 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
8896 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
8897 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
8898 return (uint64_t)ret_ref;
8901 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
8902 if ((_res & 1) != 0) return;
8903 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
8905 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
8908 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
8909 LDKThirtyTwoBytes o_ref;
8910 CHECK(*((uint32_t*)o) == 32);
8911 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
8912 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8913 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
8914 return (uint64_t)ret_conv;
8917 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
8918 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8919 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
8920 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8921 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
8922 return (uint64_t)ret_conv;
8925 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
8926 if ((_res & 1) != 0) return;
8927 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
8929 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
8932 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
8933 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
8934 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
8935 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
8936 return (uint64_t)ret_conv;
8939 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
8940 LDKCVec_ChannelMonitorZ _res_constr;
8941 _res_constr.datalen = *((uint32_t*)_res);
8942 if (_res_constr.datalen > 0)
8943 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8945 _res_constr.data = NULL;
8946 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8947 for (size_t q = 0; q < _res_constr.datalen; q++) {
8948 uint32_t _res_conv_16 = _res_vals[q];
8949 LDKChannelMonitor _res_conv_16_conv;
8950 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8951 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8952 _res_constr.data[q] = _res_conv_16_conv;
8954 CVec_ChannelMonitorZ_free(_res_constr);
8957 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
8958 LDKThirtyTwoBytes a_ref;
8959 CHECK(*((uint32_t*)a) == 32);
8960 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
8961 LDKChannelManager b_conv;
8962 b_conv.inner = (void*)(b & (~1));
8963 b_conv.is_owned = (b & 1) || (b == 0);
8964 // Warning: we need a move here but no clone is available for LDKChannelManager
8965 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8966 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8967 return (uint64_t)ret_ref;
8970 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
8971 if ((_res & 1) != 0) return;
8972 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8974 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8977 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
8978 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8979 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
8980 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8981 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8982 return (uint64_t)ret_conv;
8985 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
8986 LDKDecodeError e_conv;
8987 e_conv.inner = (void*)(e & (~1));
8988 e_conv.is_owned = (e & 1) || (e == 0);
8989 e_conv = DecodeError_clone(&e_conv);
8990 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8991 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8992 return (uint64_t)ret_conv;
8995 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
8996 if ((_res & 1) != 0) return;
8997 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8999 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9002 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9003 LDKChannelConfig o_conv;
9004 o_conv.inner = (void*)(o & (~1));
9005 o_conv.is_owned = (o & 1) || (o == 0);
9006 o_conv = ChannelConfig_clone(&o_conv);
9007 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9008 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9009 return (uint64_t)ret_conv;
9012 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9013 LDKDecodeError e_conv;
9014 e_conv.inner = (void*)(e & (~1));
9015 e_conv.is_owned = (e & 1) || (e == 0);
9016 e_conv = DecodeError_clone(&e_conv);
9017 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9018 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9019 return (uint64_t)ret_conv;
9022 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9023 if ((_res & 1) != 0) return;
9024 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
9026 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9029 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9030 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9031 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9032 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9033 return (uint64_t)ret_conv;
9036 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9038 o_conv.inner = (void*)(o & (~1));
9039 o_conv.is_owned = (o & 1) || (o == 0);
9040 o_conv = OutPoint_clone(&o_conv);
9041 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9042 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9043 return (uint64_t)ret_conv;
9046 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9047 LDKDecodeError e_conv;
9048 e_conv.inner = (void*)(e & (~1));
9049 e_conv.is_owned = (e & 1) || (e == 0);
9050 e_conv = DecodeError_clone(&e_conv);
9051 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9052 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9053 return (uint64_t)ret_conv;
9056 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9057 if ((_res & 1) != 0) return;
9058 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
9060 CResult_OutPointDecodeErrorZ_free(_res_conv);
9063 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9064 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9065 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9066 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9067 return (uint64_t)ret_conv;
9070 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9071 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
9072 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9073 *ret_copy = COption_TypeZ_some(o_conv);
9074 uint64_t ret_ref = (uint64_t)ret_copy;
9078 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9079 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9080 *ret_copy = COption_TypeZ_none();
9081 uint64_t ret_ref = (uint64_t)ret_copy;
9085 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9086 if ((_res & 1) != 0) return;
9087 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
9089 COption_TypeZ_free(_res_conv);
9092 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9093 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9094 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9095 *ret_copy = COption_TypeZ_clone(orig_conv);
9096 uint64_t ret_ref = (uint64_t)ret_copy;
9100 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9101 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
9102 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9103 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9104 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9105 return (uint64_t)ret_conv;
9108 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9109 LDKDecodeError e_conv;
9110 e_conv.inner = (void*)(e & (~1));
9111 e_conv.is_owned = (e & 1) || (e == 0);
9112 e_conv = DecodeError_clone(&e_conv);
9113 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9114 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9115 return (uint64_t)ret_conv;
9118 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9119 if ((_res & 1) != 0) return;
9120 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9122 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9125 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9126 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9127 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9128 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9129 return (uint64_t)ret_conv;
9132 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9133 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9134 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9135 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9136 return (uint64_t)ret_conv;
9139 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9140 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9141 *ret_conv = CResult_SiPrefixNoneZ_err();
9142 return (uint64_t)ret_conv;
9145 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9146 if ((_res & 1) != 0) return;
9147 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
9149 CResult_SiPrefixNoneZ_free(_res_conv);
9152 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9153 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9154 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9155 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9156 return (uint64_t)ret_conv;
9159 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9161 o_conv.inner = (void*)(o & (~1));
9162 o_conv.is_owned = (o & 1) || (o == 0);
9163 o_conv = Invoice_clone(&o_conv);
9164 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9165 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9166 return (uint64_t)ret_conv;
9169 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9170 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9171 *ret_conv = CResult_InvoiceNoneZ_err();
9172 return (uint64_t)ret_conv;
9175 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9176 if ((_res & 1) != 0) return;
9177 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
9179 CResult_InvoiceNoneZ_free(_res_conv);
9182 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9183 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9184 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9185 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9186 return (uint64_t)ret_conv;
9189 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9190 LDKSignedRawInvoice o_conv;
9191 o_conv.inner = (void*)(o & (~1));
9192 o_conv.is_owned = (o & 1) || (o == 0);
9193 o_conv = SignedRawInvoice_clone(&o_conv);
9194 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9195 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9196 return (uint64_t)ret_conv;
9199 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9200 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9201 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9202 return (uint64_t)ret_conv;
9205 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9206 if ((_res & 1) != 0) return;
9207 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
9209 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9212 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9213 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9214 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9215 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9216 return (uint64_t)ret_conv;
9219 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9220 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
9221 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9222 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
9223 return (uint64_t)ret_ref;
9226 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
9227 LDKRawInvoice a_conv;
9228 a_conv.inner = (void*)(a & (~1));
9229 a_conv.is_owned = (a & 1) || (a == 0);
9230 a_conv = RawInvoice_clone(&a_conv);
9231 LDKThirtyTwoBytes b_ref;
9232 CHECK(*((uint32_t*)b) == 32);
9233 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9234 LDKInvoiceSignature c_conv;
9235 c_conv.inner = (void*)(c & (~1));
9236 c_conv.is_owned = (c & 1) || (c == 0);
9237 c_conv = InvoiceSignature_clone(&c_conv);
9238 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9239 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
9240 return (uint64_t)ret_ref;
9243 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
9244 if ((_res & 1) != 0) return;
9245 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
9247 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
9250 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
9251 LDKPayeePubKey o_conv;
9252 o_conv.inner = (void*)(o & (~1));
9253 o_conv.is_owned = (o & 1) || (o == 0);
9254 o_conv = PayeePubKey_clone(&o_conv);
9255 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9256 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
9257 return (uint64_t)ret_conv;
9260 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
9261 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9262 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9263 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
9264 return (uint64_t)ret_conv;
9267 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
9268 if ((_res & 1) != 0) return;
9269 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
9271 CResult_PayeePubKeyErrorZ_free(_res_conv);
9274 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
9275 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
9276 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9277 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
9278 return (uint64_t)ret_conv;
9281 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
9282 LDKCVec_PrivateRouteZ _res_constr;
9283 _res_constr.datalen = *((uint32_t*)_res);
9284 if (_res_constr.datalen > 0)
9285 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
9287 _res_constr.data = NULL;
9288 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9289 for (size_t o = 0; o < _res_constr.datalen; o++) {
9290 uint32_t _res_conv_14 = _res_vals[o];
9291 LDKPrivateRoute _res_conv_14_conv;
9292 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9293 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9294 _res_constr.data[o] = _res_conv_14_conv;
9296 CVec_PrivateRouteZ_free(_res_constr);
9299 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
9300 LDKPositiveTimestamp o_conv;
9301 o_conv.inner = (void*)(o & (~1));
9302 o_conv.is_owned = (o & 1) || (o == 0);
9303 o_conv = PositiveTimestamp_clone(&o_conv);
9304 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9305 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
9306 return (uint64_t)ret_conv;
9309 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
9310 LDKCreationError e_conv = LDKCreationError_from_js(e);
9311 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9312 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
9313 return (uint64_t)ret_conv;
9316 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
9317 if ((_res & 1) != 0) return;
9318 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
9320 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
9323 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
9324 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
9325 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9326 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
9327 return (uint64_t)ret_conv;
9330 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
9331 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9332 *ret_conv = CResult_NoneSemanticErrorZ_ok();
9333 return (uint64_t)ret_conv;
9336 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
9337 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9338 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9339 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
9340 return (uint64_t)ret_conv;
9343 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
9344 if ((_res & 1) != 0) return;
9345 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
9347 CResult_NoneSemanticErrorZ_free(_res_conv);
9350 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
9351 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
9352 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9353 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
9354 return (uint64_t)ret_conv;
9357 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
9359 o_conv.inner = (void*)(o & (~1));
9360 o_conv.is_owned = (o & 1) || (o == 0);
9361 o_conv = Invoice_clone(&o_conv);
9362 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9363 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
9364 return (uint64_t)ret_conv;
9367 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
9368 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9369 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9370 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
9371 return (uint64_t)ret_conv;
9374 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
9375 if ((_res & 1) != 0) return;
9376 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
9378 CResult_InvoiceSemanticErrorZ_free(_res_conv);
9381 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
9382 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
9383 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9384 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
9385 return (uint64_t)ret_conv;
9388 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
9389 LDKDescription o_conv;
9390 o_conv.inner = (void*)(o & (~1));
9391 o_conv.is_owned = (o & 1) || (o == 0);
9392 o_conv = Description_clone(&o_conv);
9393 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9394 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
9395 return (uint64_t)ret_conv;
9398 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
9399 LDKCreationError e_conv = LDKCreationError_from_js(e);
9400 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9401 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
9402 return (uint64_t)ret_conv;
9405 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
9406 if ((_res & 1) != 0) return;
9407 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
9409 CResult_DescriptionCreationErrorZ_free(_res_conv);
9412 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
9413 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
9414 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9415 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
9416 return (uint64_t)ret_conv;
9419 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
9420 LDKExpiryTime o_conv;
9421 o_conv.inner = (void*)(o & (~1));
9422 o_conv.is_owned = (o & 1) || (o == 0);
9423 o_conv = ExpiryTime_clone(&o_conv);
9424 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9425 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
9426 return (uint64_t)ret_conv;
9429 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
9430 LDKCreationError e_conv = LDKCreationError_from_js(e);
9431 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9432 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
9433 return (uint64_t)ret_conv;
9436 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
9437 if ((_res & 1) != 0) return;
9438 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
9440 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
9443 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
9444 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
9445 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9446 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
9447 return (uint64_t)ret_conv;
9450 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
9451 LDKPrivateRoute o_conv;
9452 o_conv.inner = (void*)(o & (~1));
9453 o_conv.is_owned = (o & 1) || (o == 0);
9454 o_conv = PrivateRoute_clone(&o_conv);
9455 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9456 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
9457 return (uint64_t)ret_conv;
9460 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
9461 LDKCreationError e_conv = LDKCreationError_from_js(e);
9462 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9463 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
9464 return (uint64_t)ret_conv;
9467 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
9468 if ((_res & 1) != 0) return;
9469 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
9471 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
9474 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
9475 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
9476 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9477 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
9478 return (uint64_t)ret_conv;
9481 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
9482 LDKStr o_conv = str_ref_to_owned_c(o);
9483 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9484 *ret_conv = CResult_StringErrorZ_ok(o_conv);
9485 return (uint64_t)ret_conv;
9488 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
9489 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9490 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9491 *ret_conv = CResult_StringErrorZ_err(e_conv);
9492 return (uint64_t)ret_conv;
9495 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
9496 if ((_res & 1) != 0) return;
9497 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
9499 CResult_StringErrorZ_free(_res_conv);
9502 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
9503 LDKChannelMonitorUpdate o_conv;
9504 o_conv.inner = (void*)(o & (~1));
9505 o_conv.is_owned = (o & 1) || (o == 0);
9506 o_conv = ChannelMonitorUpdate_clone(&o_conv);
9507 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9508 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
9509 return (uint64_t)ret_conv;
9512 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
9513 LDKDecodeError e_conv;
9514 e_conv.inner = (void*)(e & (~1));
9515 e_conv.is_owned = (e & 1) || (e == 0);
9516 e_conv = DecodeError_clone(&e_conv);
9517 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9518 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
9519 return (uint64_t)ret_conv;
9522 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
9523 if ((_res & 1) != 0) return;
9524 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9526 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
9529 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
9530 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
9531 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9532 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
9533 return (uint64_t)ret_conv;
9536 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
9537 LDKHTLCUpdate o_conv;
9538 o_conv.inner = (void*)(o & (~1));
9539 o_conv.is_owned = (o & 1) || (o == 0);
9540 o_conv = HTLCUpdate_clone(&o_conv);
9541 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9542 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
9543 return (uint64_t)ret_conv;
9546 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
9547 LDKDecodeError e_conv;
9548 e_conv.inner = (void*)(e & (~1));
9549 e_conv.is_owned = (e & 1) || (e == 0);
9550 e_conv = DecodeError_clone(&e_conv);
9551 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9552 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
9553 return (uint64_t)ret_conv;
9556 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
9557 if ((_res & 1) != 0) return;
9558 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9560 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
9563 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
9564 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
9565 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9566 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
9567 return (uint64_t)ret_conv;
9570 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
9571 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9572 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
9573 return (uint64_t)ret_conv;
9576 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
9577 LDKMonitorUpdateError e_conv;
9578 e_conv.inner = (void*)(e & (~1));
9579 e_conv.is_owned = (e & 1) || (e == 0);
9580 e_conv = MonitorUpdateError_clone(&e_conv);
9581 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9582 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
9583 return (uint64_t)ret_conv;
9586 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
9587 if ((_res & 1) != 0) return;
9588 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
9590 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
9593 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
9594 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
9595 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9596 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
9597 return (uint64_t)ret_conv;
9600 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
9601 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
9602 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9603 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
9604 return (uint64_t)ret_ref;
9607 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
9609 a_conv.inner = (void*)(a & (~1));
9610 a_conv.is_owned = (a & 1) || (a == 0);
9611 a_conv = OutPoint_clone(&a_conv);
9613 b_ref.datalen = *((uint32_t*)b);
9614 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9615 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9616 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9617 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
9618 return (uint64_t)ret_ref;
9621 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
9622 if ((_res & 1) != 0) return;
9623 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
9625 C2Tuple_OutPointScriptZ_free(_res_conv);
9628 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
9629 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
9630 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9631 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
9632 return (uint64_t)ret_ref;
9635 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
9637 b_ref.datalen = *((uint32_t*)b);
9638 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
9639 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
9640 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9641 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
9642 return (uint64_t)ret_ref;
9645 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
9646 if ((_res & 1) != 0) return;
9647 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
9649 C2Tuple_u32ScriptZ_free(_res_conv);
9652 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
9653 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
9654 _res_constr.datalen = *((uint32_t*)_res);
9655 if (_res_constr.datalen > 0)
9656 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9658 _res_constr.data = NULL;
9659 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9660 for (size_t e = 0; e < _res_constr.datalen; e++) {
9661 uint32_t _res_conv_30 = _res_vals[e];
9662 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
9663 FREE((void*)_res_conv_30);
9664 _res_constr.data[e] = _res_conv_30_conv;
9666 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
9669 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
9670 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
9671 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9672 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
9673 return (uint64_t)ret_ref;
9676 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
9677 LDKThirtyTwoBytes a_ref;
9678 CHECK(*((uint32_t*)a) == 32);
9679 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9680 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
9681 b_constr.datalen = *((uint32_t*)b);
9682 if (b_constr.datalen > 0)
9683 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
9685 b_constr.data = NULL;
9686 uint32_t* b_vals = (uint32_t*)(b + 4);
9687 for (size_t e = 0; e < b_constr.datalen; e++) {
9688 uint32_t b_conv_30 = b_vals[e];
9689 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
9690 b_conv_30_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1));
9691 b_constr.data[e] = b_conv_30_conv;
9693 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9694 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
9695 return (uint64_t)ret_ref;
9698 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
9699 if ((_res & 1) != 0) return;
9700 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
9702 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
9705 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
9706 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
9707 _res_constr.datalen = *((uint32_t*)_res);
9708 if (_res_constr.datalen > 0)
9709 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
9711 _res_constr.data = NULL;
9712 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9713 for (size_t c = 0; c < _res_constr.datalen; c++) {
9714 uint32_t _res_conv_54 = _res_vals[c];
9715 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
9716 FREE((void*)_res_conv_54);
9717 _res_constr.data[c] = _res_conv_54_conv;
9719 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
9722 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
9723 LDKCVec_EventZ _res_constr;
9724 _res_constr.datalen = *((uint32_t*)_res);
9725 if (_res_constr.datalen > 0)
9726 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
9728 _res_constr.data = NULL;
9729 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9730 for (size_t h = 0; h < _res_constr.datalen; h++) {
9731 uint32_t _res_conv_7 = _res_vals[h];
9732 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
9733 FREE((void*)_res_conv_7);
9734 _res_constr.data[h] = _res_conv_7_conv;
9736 CVec_EventZ_free(_res_constr);
9739 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
9740 LDKCVec_TransactionZ _res_constr;
9741 _res_constr.datalen = *((uint32_t*)_res);
9742 if (_res_constr.datalen > 0)
9743 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9745 _res_constr.data = NULL;
9746 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
9747 for (size_t m = 0; m < _res_constr.datalen; m++) {
9748 int8_tArray _res_conv_12 = _res_vals[m];
9749 LDKTransaction _res_conv_12_ref;
9750 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
9751 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
9752 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
9753 _res_conv_12_ref.data_is_owned = true;
9754 _res_constr.data[m] = _res_conv_12_ref;
9756 CVec_TransactionZ_free(_res_constr);
9759 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
9760 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
9761 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9762 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
9763 return (uint64_t)ret_ref;
9766 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
9767 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
9768 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
9769 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9770 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
9771 return (uint64_t)ret_ref;
9774 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
9775 if ((_res & 1) != 0) return;
9776 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
9778 C2Tuple_u32TxOutZ_free(_res_conv);
9781 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
9782 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
9783 _res_constr.datalen = *((uint32_t*)_res);
9784 if (_res_constr.datalen > 0)
9785 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9787 _res_constr.data = NULL;
9788 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9789 for (size_t z = 0; z < _res_constr.datalen; z++) {
9790 uint32_t _res_conv_25 = _res_vals[z];
9791 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
9792 FREE((void*)_res_conv_25);
9793 _res_constr.data[z] = _res_conv_25_conv;
9795 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
9798 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
9799 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
9800 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9801 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
9802 return (uint64_t)ret_ref;
9805 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
9806 LDKThirtyTwoBytes a_ref;
9807 CHECK(*((uint32_t*)a) == 32);
9808 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9809 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
9810 b_constr.datalen = *((uint32_t*)b);
9811 if (b_constr.datalen > 0)
9812 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
9814 b_constr.data = NULL;
9815 uint32_t* b_vals = (uint32_t*)(b + 4);
9816 for (size_t z = 0; z < b_constr.datalen; z++) {
9817 uint32_t b_conv_25 = b_vals[z];
9818 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
9819 b_conv_25_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1));
9820 b_constr.data[z] = b_conv_25_conv;
9822 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9823 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
9824 return (uint64_t)ret_ref;
9827 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
9828 if ((_res & 1) != 0) return;
9829 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
9831 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
9834 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
9835 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
9836 _res_constr.datalen = *((uint32_t*)_res);
9837 if (_res_constr.datalen > 0)
9838 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
9840 _res_constr.data = NULL;
9841 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9842 for (size_t x = 0; x < _res_constr.datalen; x++) {
9843 uint32_t _res_conv_49 = _res_vals[x];
9844 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
9845 FREE((void*)_res_conv_49);
9846 _res_constr.data[x] = _res_conv_49_conv;
9848 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
9851 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
9852 LDKCVec_BalanceZ _res_constr;
9853 _res_constr.datalen = *((uint32_t*)_res);
9854 if (_res_constr.datalen > 0)
9855 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
9857 _res_constr.data = NULL;
9858 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9859 for (size_t j = 0; j < _res_constr.datalen; j++) {
9860 uint32_t _res_conv_9 = _res_vals[j];
9861 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
9862 FREE((void*)_res_conv_9);
9863 _res_constr.data[j] = _res_conv_9_conv;
9865 CVec_BalanceZ_free(_res_constr);
9868 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
9869 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
9870 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
9871 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9872 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
9873 return (uint64_t)ret_conv;
9876 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
9877 LDKDecodeError e_conv;
9878 e_conv.inner = (void*)(e & (~1));
9879 e_conv.is_owned = (e & 1) || (e == 0);
9880 e_conv = DecodeError_clone(&e_conv);
9881 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9882 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
9883 return (uint64_t)ret_conv;
9886 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
9887 if ((_res & 1) != 0) return;
9888 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9890 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
9893 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
9894 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9895 *ret_conv = CResult_NoneLightningErrorZ_ok();
9896 return (uint64_t)ret_conv;
9899 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
9900 LDKLightningError e_conv;
9901 e_conv.inner = (void*)(e & (~1));
9902 e_conv.is_owned = (e & 1) || (e == 0);
9903 e_conv = LightningError_clone(&e_conv);
9904 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9905 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
9906 return (uint64_t)ret_conv;
9909 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
9910 if ((_res & 1) != 0) return;
9911 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
9913 CResult_NoneLightningErrorZ_free(_res_conv);
9916 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
9917 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
9918 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9919 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
9920 return (uint64_t)ret_conv;
9923 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
9924 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
9925 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9926 *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
9927 return (uint64_t)ret_ref;
9930 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
9932 CHECK(*((uint32_t*)a) == 33);
9933 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
9934 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
9935 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9936 *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
9937 return (uint64_t)ret_ref;
9940 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
9941 if ((_res & 1) != 0) return;
9942 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
9944 C2Tuple_PublicKeyTypeZ_free(_res_conv);
9947 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
9948 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
9949 _res_constr.datalen = *((uint32_t*)_res);
9950 if (_res_constr.datalen > 0)
9951 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9953 _res_constr.data = NULL;
9954 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9955 for (size_t c = 0; c < _res_constr.datalen; c++) {
9956 uint32_t _res_conv_28 = _res_vals[c];
9957 LDKC2Tuple_PublicKeyTypeZ _res_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_28) & ~1);
9958 FREE((void*)_res_conv_28);
9959 _res_constr.data[c] = _res_conv_28_conv;
9961 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
9964 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
9965 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9966 *ret_conv = CResult_boolLightningErrorZ_ok(o);
9967 return (uint64_t)ret_conv;
9970 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
9971 LDKLightningError e_conv;
9972 e_conv.inner = (void*)(e & (~1));
9973 e_conv.is_owned = (e & 1) || (e == 0);
9974 e_conv = LightningError_clone(&e_conv);
9975 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9976 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
9977 return (uint64_t)ret_conv;
9980 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
9981 if ((_res & 1) != 0) return;
9982 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
9984 CResult_boolLightningErrorZ_free(_res_conv);
9987 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
9988 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
9989 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9990 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
9991 return (uint64_t)ret_conv;
9994 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
9995 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
9996 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9997 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
9998 return (uint64_t)ret_ref;
10001 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10002 LDKChannelAnnouncement a_conv;
10003 a_conv.inner = (void*)(a & (~1));
10004 a_conv.is_owned = (a & 1) || (a == 0);
10005 a_conv = ChannelAnnouncement_clone(&a_conv);
10006 LDKChannelUpdate b_conv;
10007 b_conv.inner = (void*)(b & (~1));
10008 b_conv.is_owned = (b & 1) || (b == 0);
10009 b_conv = ChannelUpdate_clone(&b_conv);
10010 LDKChannelUpdate c_conv;
10011 c_conv.inner = (void*)(c & (~1));
10012 c_conv.is_owned = (c & 1) || (c == 0);
10013 c_conv = ChannelUpdate_clone(&c_conv);
10014 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10015 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10016 return (uint64_t)ret_ref;
10019 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10020 if ((_res & 1) != 0) return;
10021 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
10023 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10026 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10027 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10028 _res_constr.datalen = *((uint32_t*)_res);
10029 if (_res_constr.datalen > 0)
10030 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10032 _res_constr.data = NULL;
10033 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10034 for (size_t l = 0; l < _res_constr.datalen; l++) {
10035 uint32_t _res_conv_63 = _res_vals[l];
10036 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
10037 FREE((void*)_res_conv_63);
10038 _res_constr.data[l] = _res_conv_63_conv;
10040 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10043 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10044 LDKCVec_NodeAnnouncementZ _res_constr;
10045 _res_constr.datalen = *((uint32_t*)_res);
10046 if (_res_constr.datalen > 0)
10047 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10049 _res_constr.data = NULL;
10050 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10051 for (size_t s = 0; s < _res_constr.datalen; s++) {
10052 uint32_t _res_conv_18 = _res_vals[s];
10053 LDKNodeAnnouncement _res_conv_18_conv;
10054 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10055 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10056 _res_constr.data[s] = _res_conv_18_conv;
10058 CVec_NodeAnnouncementZ_free(_res_constr);
10061 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10062 LDKCVec_PublicKeyZ _res_constr;
10063 _res_constr.datalen = *((uint32_t*)_res);
10064 if (_res_constr.datalen > 0)
10065 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10067 _res_constr.data = NULL;
10068 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10069 for (size_t m = 0; m < _res_constr.datalen; m++) {
10070 int8_tArray _res_conv_12 = _res_vals[m];
10071 LDKPublicKey _res_conv_12_ref;
10072 CHECK(*((uint32_t*)_res_conv_12) == 33);
10073 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10074 _res_constr.data[m] = _res_conv_12_ref;
10076 CVec_PublicKeyZ_free(_res_constr);
10079 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10081 o_ref.datalen = *((uint32_t*)o);
10082 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10083 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10084 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10085 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10086 return (uint64_t)ret_conv;
10089 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10090 LDKPeerHandleError e_conv;
10091 e_conv.inner = (void*)(e & (~1));
10092 e_conv.is_owned = (e & 1) || (e == 0);
10093 e_conv = PeerHandleError_clone(&e_conv);
10094 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10095 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10096 return (uint64_t)ret_conv;
10099 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10100 if ((_res & 1) != 0) return;
10101 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10103 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10106 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10107 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10108 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10109 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10110 return (uint64_t)ret_conv;
10113 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10114 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10115 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10116 return (uint64_t)ret_conv;
10119 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10120 LDKPeerHandleError e_conv;
10121 e_conv.inner = (void*)(e & (~1));
10122 e_conv.is_owned = (e & 1) || (e == 0);
10123 e_conv = PeerHandleError_clone(&e_conv);
10124 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10125 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10126 return (uint64_t)ret_conv;
10129 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10130 if ((_res & 1) != 0) return;
10131 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10133 CResult_NonePeerHandleErrorZ_free(_res_conv);
10136 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10137 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10138 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10139 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
10140 return (uint64_t)ret_conv;
10143 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
10144 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10145 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
10146 return (uint64_t)ret_conv;
10149 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
10150 LDKPeerHandleError e_conv;
10151 e_conv.inner = (void*)(e & (~1));
10152 e_conv.is_owned = (e & 1) || (e == 0);
10153 e_conv = PeerHandleError_clone(&e_conv);
10154 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10155 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
10156 return (uint64_t)ret_conv;
10159 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
10160 if ((_res & 1) != 0) return;
10161 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10163 CResult_boolPeerHandleErrorZ_free(_res_conv);
10166 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
10167 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
10168 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10169 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
10170 return (uint64_t)ret_conv;
10173 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
10174 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
10175 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10176 *ret_copy = COption_AccessZ_some(o_conv);
10177 uint64_t ret_ref = (uint64_t)ret_copy;
10181 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
10182 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10183 *ret_copy = COption_AccessZ_none();
10184 uint64_t ret_ref = (uint64_t)ret_copy;
10188 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
10189 if ((_res & 1) != 0) return;
10190 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
10192 COption_AccessZ_free(_res_conv);
10195 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
10196 LDKDirectionalChannelInfo o_conv;
10197 o_conv.inner = (void*)(o & (~1));
10198 o_conv.is_owned = (o & 1) || (o == 0);
10199 o_conv = DirectionalChannelInfo_clone(&o_conv);
10200 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10201 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
10202 return (uint64_t)ret_conv;
10205 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
10206 LDKDecodeError e_conv;
10207 e_conv.inner = (void*)(e & (~1));
10208 e_conv.is_owned = (e & 1) || (e == 0);
10209 e_conv = DecodeError_clone(&e_conv);
10210 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10211 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
10212 return (uint64_t)ret_conv;
10215 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
10216 if ((_res & 1) != 0) return;
10217 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10219 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
10222 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10223 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
10224 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10225 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
10226 return (uint64_t)ret_conv;
10229 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
10230 LDKChannelInfo o_conv;
10231 o_conv.inner = (void*)(o & (~1));
10232 o_conv.is_owned = (o & 1) || (o == 0);
10233 o_conv = ChannelInfo_clone(&o_conv);
10234 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10235 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
10236 return (uint64_t)ret_conv;
10239 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
10240 LDKDecodeError e_conv;
10241 e_conv.inner = (void*)(e & (~1));
10242 e_conv.is_owned = (e & 1) || (e == 0);
10243 e_conv = DecodeError_clone(&e_conv);
10244 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10245 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
10246 return (uint64_t)ret_conv;
10249 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
10250 if ((_res & 1) != 0) return;
10251 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10253 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
10256 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10257 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
10258 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10259 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
10260 return (uint64_t)ret_conv;
10263 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
10264 LDKRoutingFees o_conv;
10265 o_conv.inner = (void*)(o & (~1));
10266 o_conv.is_owned = (o & 1) || (o == 0);
10267 o_conv = RoutingFees_clone(&o_conv);
10268 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10269 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
10270 return (uint64_t)ret_conv;
10273 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
10274 LDKDecodeError e_conv;
10275 e_conv.inner = (void*)(e & (~1));
10276 e_conv.is_owned = (e & 1) || (e == 0);
10277 e_conv = DecodeError_clone(&e_conv);
10278 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10279 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
10280 return (uint64_t)ret_conv;
10283 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
10284 if ((_res & 1) != 0) return;
10285 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10287 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
10290 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
10291 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
10292 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10293 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
10294 return (uint64_t)ret_conv;
10297 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
10298 LDKNodeAnnouncementInfo o_conv;
10299 o_conv.inner = (void*)(o & (~1));
10300 o_conv.is_owned = (o & 1) || (o == 0);
10301 o_conv = NodeAnnouncementInfo_clone(&o_conv);
10302 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10303 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
10304 return (uint64_t)ret_conv;
10307 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
10308 LDKDecodeError e_conv;
10309 e_conv.inner = (void*)(e & (~1));
10310 e_conv.is_owned = (e & 1) || (e == 0);
10311 e_conv = DecodeError_clone(&e_conv);
10312 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10313 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
10314 return (uint64_t)ret_conv;
10317 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
10318 if ((_res & 1) != 0) return;
10319 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10321 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
10324 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
10325 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
10326 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10327 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
10328 return (uint64_t)ret_conv;
10331 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
10332 LDKCVec_u64Z _res_constr;
10333 _res_constr.datalen = *((uint32_t*)_res);
10334 if (_res_constr.datalen > 0)
10335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10337 _res_constr.data = NULL;
10338 int64_t* _res_vals = (int64_t*)(_res + 4);
10339 for (size_t i = 0; i < _res_constr.datalen; i++) {
10340 int64_t _res_conv_8 = _res_vals[i];
10341 _res_constr.data[i] = _res_conv_8;
10343 CVec_u64Z_free(_res_constr);
10346 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
10347 LDKNodeInfo o_conv;
10348 o_conv.inner = (void*)(o & (~1));
10349 o_conv.is_owned = (o & 1) || (o == 0);
10350 o_conv = NodeInfo_clone(&o_conv);
10351 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10352 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
10353 return (uint64_t)ret_conv;
10356 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_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_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10362 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
10363 return (uint64_t)ret_conv;
10366 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
10367 if ((_res & 1) != 0) return;
10368 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10370 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
10373 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
10374 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
10375 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10376 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
10377 return (uint64_t)ret_conv;
10380 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
10381 LDKNetworkGraph o_conv;
10382 o_conv.inner = (void*)(o & (~1));
10383 o_conv.is_owned = (o & 1) || (o == 0);
10384 // Warning: we need a move here but no clone is available for LDKNetworkGraph
10385 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10386 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
10387 return (uint64_t)ret_conv;
10390 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_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_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10396 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
10397 return (uint64_t)ret_conv;
10400 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
10401 if ((_res & 1) != 0) return;
10402 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
10404 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
10407 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
10408 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10409 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10410 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10411 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
10412 return (uint64_t)ret_conv;
10415 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
10416 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10417 *ret_conv = CResult_NetAddressu8Z_err(e);
10418 return (uint64_t)ret_conv;
10421 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
10422 if ((_res & 1) != 0) return;
10423 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
10425 CResult_NetAddressu8Z_free(_res_conv);
10428 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
10429 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
10430 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
10431 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
10432 return (uint64_t)ret_conv;
10435 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
10436 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
10437 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
10438 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10439 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
10440 return (uint64_t)ret_conv;
10443 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
10444 LDKDecodeError e_conv;
10445 e_conv.inner = (void*)(e & (~1));
10446 e_conv.is_owned = (e & 1) || (e == 0);
10447 e_conv = DecodeError_clone(&e_conv);
10448 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10449 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
10450 return (uint64_t)ret_conv;
10453 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
10454 if ((_res & 1) != 0) return;
10455 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10457 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
10460 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
10461 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
10462 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10463 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
10464 return (uint64_t)ret_conv;
10467 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
10468 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
10469 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
10470 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10471 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
10472 return (uint64_t)ret_conv;
10475 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
10476 LDKDecodeError e_conv;
10477 e_conv.inner = (void*)(e & (~1));
10478 e_conv.is_owned = (e & 1) || (e == 0);
10479 e_conv = DecodeError_clone(&e_conv);
10480 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10481 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
10482 return (uint64_t)ret_conv;
10485 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
10486 if ((_res & 1) != 0) return;
10487 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
10489 CResult_NetAddressDecodeErrorZ_free(_res_conv);
10492 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
10493 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
10494 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
10495 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
10496 return (uint64_t)ret_conv;
10499 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
10500 LDKCVec_UpdateAddHTLCZ _res_constr;
10501 _res_constr.datalen = *((uint32_t*)_res);
10502 if (_res_constr.datalen > 0)
10503 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10505 _res_constr.data = NULL;
10506 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10507 for (size_t p = 0; p < _res_constr.datalen; p++) {
10508 uint32_t _res_conv_15 = _res_vals[p];
10509 LDKUpdateAddHTLC _res_conv_15_conv;
10510 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
10511 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
10512 _res_constr.data[p] = _res_conv_15_conv;
10514 CVec_UpdateAddHTLCZ_free(_res_constr);
10517 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
10518 LDKCVec_UpdateFulfillHTLCZ _res_constr;
10519 _res_constr.datalen = *((uint32_t*)_res);
10520 if (_res_constr.datalen > 0)
10521 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10523 _res_constr.data = NULL;
10524 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10525 for (size_t t = 0; t < _res_constr.datalen; t++) {
10526 uint32_t _res_conv_19 = _res_vals[t];
10527 LDKUpdateFulfillHTLC _res_conv_19_conv;
10528 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
10529 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
10530 _res_constr.data[t] = _res_conv_19_conv;
10532 CVec_UpdateFulfillHTLCZ_free(_res_constr);
10535 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
10536 LDKCVec_UpdateFailHTLCZ _res_constr;
10537 _res_constr.datalen = *((uint32_t*)_res);
10538 if (_res_constr.datalen > 0)
10539 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10541 _res_constr.data = NULL;
10542 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10543 for (size_t q = 0; q < _res_constr.datalen; q++) {
10544 uint32_t _res_conv_16 = _res_vals[q];
10545 LDKUpdateFailHTLC _res_conv_16_conv;
10546 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10547 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10548 _res_constr.data[q] = _res_conv_16_conv;
10550 CVec_UpdateFailHTLCZ_free(_res_constr);
10553 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
10554 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
10555 _res_constr.datalen = *((uint32_t*)_res);
10556 if (_res_constr.datalen > 0)
10557 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10559 _res_constr.data = NULL;
10560 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10561 for (size_t z = 0; z < _res_constr.datalen; z++) {
10562 uint32_t _res_conv_25 = _res_vals[z];
10563 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
10564 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
10565 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
10566 _res_constr.data[z] = _res_conv_25_conv;
10568 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
10571 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
10572 LDKAcceptChannel o_conv;
10573 o_conv.inner = (void*)(o & (~1));
10574 o_conv.is_owned = (o & 1) || (o == 0);
10575 o_conv = AcceptChannel_clone(&o_conv);
10576 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10577 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
10578 return (uint64_t)ret_conv;
10581 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
10582 LDKDecodeError e_conv;
10583 e_conv.inner = (void*)(e & (~1));
10584 e_conv.is_owned = (e & 1) || (e == 0);
10585 e_conv = DecodeError_clone(&e_conv);
10586 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10587 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
10588 return (uint64_t)ret_conv;
10591 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
10592 if ((_res & 1) != 0) return;
10593 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10595 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
10598 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
10599 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
10600 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
10601 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
10602 return (uint64_t)ret_conv;
10605 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
10606 LDKAnnouncementSignatures o_conv;
10607 o_conv.inner = (void*)(o & (~1));
10608 o_conv.is_owned = (o & 1) || (o == 0);
10609 o_conv = AnnouncementSignatures_clone(&o_conv);
10610 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10611 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
10612 return (uint64_t)ret_conv;
10615 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
10616 LDKDecodeError e_conv;
10617 e_conv.inner = (void*)(e & (~1));
10618 e_conv.is_owned = (e & 1) || (e == 0);
10619 e_conv = DecodeError_clone(&e_conv);
10620 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10621 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
10622 return (uint64_t)ret_conv;
10625 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
10626 if ((_res & 1) != 0) return;
10627 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10629 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
10632 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
10633 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
10634 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
10635 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
10636 return (uint64_t)ret_conv;
10639 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
10640 LDKChannelReestablish o_conv;
10641 o_conv.inner = (void*)(o & (~1));
10642 o_conv.is_owned = (o & 1) || (o == 0);
10643 o_conv = ChannelReestablish_clone(&o_conv);
10644 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10645 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
10646 return (uint64_t)ret_conv;
10649 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
10650 LDKDecodeError e_conv;
10651 e_conv.inner = (void*)(e & (~1));
10652 e_conv.is_owned = (e & 1) || (e == 0);
10653 e_conv = DecodeError_clone(&e_conv);
10654 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10655 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
10656 return (uint64_t)ret_conv;
10659 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
10660 if ((_res & 1) != 0) return;
10661 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
10663 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
10666 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
10667 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
10668 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10669 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
10670 return (uint64_t)ret_conv;
10673 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
10674 LDKClosingSigned o_conv;
10675 o_conv.inner = (void*)(o & (~1));
10676 o_conv.is_owned = (o & 1) || (o == 0);
10677 o_conv = ClosingSigned_clone(&o_conv);
10678 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10679 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
10680 return (uint64_t)ret_conv;
10683 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
10684 LDKDecodeError e_conv;
10685 e_conv.inner = (void*)(e & (~1));
10686 e_conv.is_owned = (e & 1) || (e == 0);
10687 e_conv = DecodeError_clone(&e_conv);
10688 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10689 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
10690 return (uint64_t)ret_conv;
10693 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
10694 if ((_res & 1) != 0) return;
10695 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10697 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
10700 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
10701 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
10702 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
10703 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
10704 return (uint64_t)ret_conv;
10707 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
10708 LDKClosingSignedFeeRange o_conv;
10709 o_conv.inner = (void*)(o & (~1));
10710 o_conv.is_owned = (o & 1) || (o == 0);
10711 o_conv = ClosingSignedFeeRange_clone(&o_conv);
10712 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10713 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
10714 return (uint64_t)ret_conv;
10717 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
10718 LDKDecodeError e_conv;
10719 e_conv.inner = (void*)(e & (~1));
10720 e_conv.is_owned = (e & 1) || (e == 0);
10721 e_conv = DecodeError_clone(&e_conv);
10722 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10723 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
10724 return (uint64_t)ret_conv;
10727 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
10728 if ((_res & 1) != 0) return;
10729 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10731 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
10734 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
10735 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
10736 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
10737 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
10738 return (uint64_t)ret_conv;
10741 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
10742 LDKCommitmentSigned o_conv;
10743 o_conv.inner = (void*)(o & (~1));
10744 o_conv.is_owned = (o & 1) || (o == 0);
10745 o_conv = CommitmentSigned_clone(&o_conv);
10746 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10747 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
10748 return (uint64_t)ret_conv;
10751 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
10752 LDKDecodeError e_conv;
10753 e_conv.inner = (void*)(e & (~1));
10754 e_conv.is_owned = (e & 1) || (e == 0);
10755 e_conv = DecodeError_clone(&e_conv);
10756 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10757 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
10758 return (uint64_t)ret_conv;
10761 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
10762 if ((_res & 1) != 0) return;
10763 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10765 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
10768 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
10769 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
10770 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
10771 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
10772 return (uint64_t)ret_conv;
10775 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
10776 LDKFundingCreated o_conv;
10777 o_conv.inner = (void*)(o & (~1));
10778 o_conv.is_owned = (o & 1) || (o == 0);
10779 o_conv = FundingCreated_clone(&o_conv);
10780 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10781 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
10782 return (uint64_t)ret_conv;
10785 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
10786 LDKDecodeError e_conv;
10787 e_conv.inner = (void*)(e & (~1));
10788 e_conv.is_owned = (e & 1) || (e == 0);
10789 e_conv = DecodeError_clone(&e_conv);
10790 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10791 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
10792 return (uint64_t)ret_conv;
10795 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
10796 if ((_res & 1) != 0) return;
10797 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10799 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
10802 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
10803 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
10804 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
10805 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
10806 return (uint64_t)ret_conv;
10809 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
10810 LDKFundingSigned o_conv;
10811 o_conv.inner = (void*)(o & (~1));
10812 o_conv.is_owned = (o & 1) || (o == 0);
10813 o_conv = FundingSigned_clone(&o_conv);
10814 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10815 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
10816 return (uint64_t)ret_conv;
10819 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
10820 LDKDecodeError e_conv;
10821 e_conv.inner = (void*)(e & (~1));
10822 e_conv.is_owned = (e & 1) || (e == 0);
10823 e_conv = DecodeError_clone(&e_conv);
10824 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10825 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
10826 return (uint64_t)ret_conv;
10829 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
10830 if ((_res & 1) != 0) return;
10831 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10833 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
10836 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
10837 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
10838 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
10839 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
10840 return (uint64_t)ret_conv;
10843 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
10844 LDKFundingLocked o_conv;
10845 o_conv.inner = (void*)(o & (~1));
10846 o_conv.is_owned = (o & 1) || (o == 0);
10847 o_conv = FundingLocked_clone(&o_conv);
10848 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10849 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
10850 return (uint64_t)ret_conv;
10853 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
10854 LDKDecodeError e_conv;
10855 e_conv.inner = (void*)(e & (~1));
10856 e_conv.is_owned = (e & 1) || (e == 0);
10857 e_conv = DecodeError_clone(&e_conv);
10858 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10859 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
10860 return (uint64_t)ret_conv;
10863 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
10864 if ((_res & 1) != 0) return;
10865 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
10867 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
10870 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
10871 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
10872 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
10873 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
10874 return (uint64_t)ret_conv;
10877 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
10879 o_conv.inner = (void*)(o & (~1));
10880 o_conv.is_owned = (o & 1) || (o == 0);
10881 o_conv = Init_clone(&o_conv);
10882 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10883 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
10884 return (uint64_t)ret_conv;
10887 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
10888 LDKDecodeError e_conv;
10889 e_conv.inner = (void*)(e & (~1));
10890 e_conv.is_owned = (e & 1) || (e == 0);
10891 e_conv = DecodeError_clone(&e_conv);
10892 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10893 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
10894 return (uint64_t)ret_conv;
10897 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
10898 if ((_res & 1) != 0) return;
10899 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
10901 CResult_InitDecodeErrorZ_free(_res_conv);
10904 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
10905 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
10906 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10907 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
10908 return (uint64_t)ret_conv;
10911 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
10912 LDKOpenChannel o_conv;
10913 o_conv.inner = (void*)(o & (~1));
10914 o_conv.is_owned = (o & 1) || (o == 0);
10915 o_conv = OpenChannel_clone(&o_conv);
10916 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10917 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
10918 return (uint64_t)ret_conv;
10921 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
10922 LDKDecodeError e_conv;
10923 e_conv.inner = (void*)(e & (~1));
10924 e_conv.is_owned = (e & 1) || (e == 0);
10925 e_conv = DecodeError_clone(&e_conv);
10926 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10927 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
10928 return (uint64_t)ret_conv;
10931 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
10932 if ((_res & 1) != 0) return;
10933 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
10935 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
10938 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
10939 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
10940 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
10941 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
10942 return (uint64_t)ret_conv;
10945 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
10946 LDKRevokeAndACK o_conv;
10947 o_conv.inner = (void*)(o & (~1));
10948 o_conv.is_owned = (o & 1) || (o == 0);
10949 o_conv = RevokeAndACK_clone(&o_conv);
10950 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10951 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
10952 return (uint64_t)ret_conv;
10955 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
10956 LDKDecodeError e_conv;
10957 e_conv.inner = (void*)(e & (~1));
10958 e_conv.is_owned = (e & 1) || (e == 0);
10959 e_conv = DecodeError_clone(&e_conv);
10960 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10961 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
10962 return (uint64_t)ret_conv;
10965 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
10966 if ((_res & 1) != 0) return;
10967 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
10969 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
10972 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
10973 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
10974 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
10975 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
10976 return (uint64_t)ret_conv;
10979 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
10980 LDKShutdown o_conv;
10981 o_conv.inner = (void*)(o & (~1));
10982 o_conv.is_owned = (o & 1) || (o == 0);
10983 o_conv = Shutdown_clone(&o_conv);
10984 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10985 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
10986 return (uint64_t)ret_conv;
10989 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
10990 LDKDecodeError e_conv;
10991 e_conv.inner = (void*)(e & (~1));
10992 e_conv.is_owned = (e & 1) || (e == 0);
10993 e_conv = DecodeError_clone(&e_conv);
10994 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
10995 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
10996 return (uint64_t)ret_conv;
10999 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
11000 if ((_res & 1) != 0) return;
11001 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
11003 CResult_ShutdownDecodeErrorZ_free(_res_conv);
11006 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
11007 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
11008 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11009 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
11010 return (uint64_t)ret_conv;
11013 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
11014 LDKUpdateFailHTLC o_conv;
11015 o_conv.inner = (void*)(o & (~1));
11016 o_conv.is_owned = (o & 1) || (o == 0);
11017 o_conv = UpdateFailHTLC_clone(&o_conv);
11018 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11019 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
11020 return (uint64_t)ret_conv;
11023 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
11024 LDKDecodeError e_conv;
11025 e_conv.inner = (void*)(e & (~1));
11026 e_conv.is_owned = (e & 1) || (e == 0);
11027 e_conv = DecodeError_clone(&e_conv);
11028 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11029 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
11030 return (uint64_t)ret_conv;
11033 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
11034 if ((_res & 1) != 0) return;
11035 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11037 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
11040 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
11041 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
11042 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11043 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
11044 return (uint64_t)ret_conv;
11047 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
11048 LDKUpdateFailMalformedHTLC o_conv;
11049 o_conv.inner = (void*)(o & (~1));
11050 o_conv.is_owned = (o & 1) || (o == 0);
11051 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
11052 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11053 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
11054 return (uint64_t)ret_conv;
11057 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
11058 LDKDecodeError e_conv;
11059 e_conv.inner = (void*)(e & (~1));
11060 e_conv.is_owned = (e & 1) || (e == 0);
11061 e_conv = DecodeError_clone(&e_conv);
11062 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11063 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
11064 return (uint64_t)ret_conv;
11067 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
11068 if ((_res & 1) != 0) return;
11069 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11071 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
11074 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
11075 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
11076 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11077 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
11078 return (uint64_t)ret_conv;
11081 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
11082 LDKUpdateFee o_conv;
11083 o_conv.inner = (void*)(o & (~1));
11084 o_conv.is_owned = (o & 1) || (o == 0);
11085 o_conv = UpdateFee_clone(&o_conv);
11086 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11087 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
11088 return (uint64_t)ret_conv;
11091 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
11092 LDKDecodeError e_conv;
11093 e_conv.inner = (void*)(e & (~1));
11094 e_conv.is_owned = (e & 1) || (e == 0);
11095 e_conv = DecodeError_clone(&e_conv);
11096 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11097 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
11098 return (uint64_t)ret_conv;
11101 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
11102 if ((_res & 1) != 0) return;
11103 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11105 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
11108 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
11109 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
11110 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11111 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
11112 return (uint64_t)ret_conv;
11115 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
11116 LDKUpdateFulfillHTLC o_conv;
11117 o_conv.inner = (void*)(o & (~1));
11118 o_conv.is_owned = (o & 1) || (o == 0);
11119 o_conv = UpdateFulfillHTLC_clone(&o_conv);
11120 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11121 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
11122 return (uint64_t)ret_conv;
11125 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
11126 LDKDecodeError e_conv;
11127 e_conv.inner = (void*)(e & (~1));
11128 e_conv.is_owned = (e & 1) || (e == 0);
11129 e_conv = DecodeError_clone(&e_conv);
11130 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11131 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
11132 return (uint64_t)ret_conv;
11135 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
11136 if ((_res & 1) != 0) return;
11137 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11139 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
11142 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
11143 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
11144 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11145 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
11146 return (uint64_t)ret_conv;
11149 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
11150 LDKUpdateAddHTLC o_conv;
11151 o_conv.inner = (void*)(o & (~1));
11152 o_conv.is_owned = (o & 1) || (o == 0);
11153 o_conv = UpdateAddHTLC_clone(&o_conv);
11154 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11155 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
11156 return (uint64_t)ret_conv;
11159 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
11160 LDKDecodeError e_conv;
11161 e_conv.inner = (void*)(e & (~1));
11162 e_conv.is_owned = (e & 1) || (e == 0);
11163 e_conv = DecodeError_clone(&e_conv);
11164 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11165 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
11166 return (uint64_t)ret_conv;
11169 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
11170 if ((_res & 1) != 0) return;
11171 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11173 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
11176 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
11177 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
11178 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11179 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
11180 return (uint64_t)ret_conv;
11183 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
11185 o_conv.inner = (void*)(o & (~1));
11186 o_conv.is_owned = (o & 1) || (o == 0);
11187 o_conv = Ping_clone(&o_conv);
11188 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11189 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
11190 return (uint64_t)ret_conv;
11193 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
11194 LDKDecodeError e_conv;
11195 e_conv.inner = (void*)(e & (~1));
11196 e_conv.is_owned = (e & 1) || (e == 0);
11197 e_conv = DecodeError_clone(&e_conv);
11198 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11199 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
11200 return (uint64_t)ret_conv;
11203 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
11204 if ((_res & 1) != 0) return;
11205 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
11207 CResult_PingDecodeErrorZ_free(_res_conv);
11210 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
11211 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
11212 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11213 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
11214 return (uint64_t)ret_conv;
11217 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
11219 o_conv.inner = (void*)(o & (~1));
11220 o_conv.is_owned = (o & 1) || (o == 0);
11221 o_conv = Pong_clone(&o_conv);
11222 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11223 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
11224 return (uint64_t)ret_conv;
11227 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
11228 LDKDecodeError e_conv;
11229 e_conv.inner = (void*)(e & (~1));
11230 e_conv.is_owned = (e & 1) || (e == 0);
11231 e_conv = DecodeError_clone(&e_conv);
11232 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11233 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
11234 return (uint64_t)ret_conv;
11237 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
11238 if ((_res & 1) != 0) return;
11239 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
11241 CResult_PongDecodeErrorZ_free(_res_conv);
11244 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
11245 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
11246 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11247 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
11248 return (uint64_t)ret_conv;
11251 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11252 LDKUnsignedChannelAnnouncement o_conv;
11253 o_conv.inner = (void*)(o & (~1));
11254 o_conv.is_owned = (o & 1) || (o == 0);
11255 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
11256 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11257 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
11258 return (uint64_t)ret_conv;
11261 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11262 LDKDecodeError e_conv;
11263 e_conv.inner = (void*)(e & (~1));
11264 e_conv.is_owned = (e & 1) || (e == 0);
11265 e_conv = DecodeError_clone(&e_conv);
11266 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11267 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
11268 return (uint64_t)ret_conv;
11271 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11272 if ((_res & 1) != 0) return;
11273 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11275 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
11278 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11279 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11280 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11281 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11282 return (uint64_t)ret_conv;
11285 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11286 LDKChannelAnnouncement o_conv;
11287 o_conv.inner = (void*)(o & (~1));
11288 o_conv.is_owned = (o & 1) || (o == 0);
11289 o_conv = ChannelAnnouncement_clone(&o_conv);
11290 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11291 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
11292 return (uint64_t)ret_conv;
11295 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11296 LDKDecodeError e_conv;
11297 e_conv.inner = (void*)(e & (~1));
11298 e_conv.is_owned = (e & 1) || (e == 0);
11299 e_conv = DecodeError_clone(&e_conv);
11300 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11301 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
11302 return (uint64_t)ret_conv;
11305 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11306 if ((_res & 1) != 0) return;
11307 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11309 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
11312 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11313 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11314 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11315 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11316 return (uint64_t)ret_conv;
11319 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11320 LDKUnsignedChannelUpdate o_conv;
11321 o_conv.inner = (void*)(o & (~1));
11322 o_conv.is_owned = (o & 1) || (o == 0);
11323 o_conv = UnsignedChannelUpdate_clone(&o_conv);
11324 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11325 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
11326 return (uint64_t)ret_conv;
11329 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
11330 LDKDecodeError e_conv;
11331 e_conv.inner = (void*)(e & (~1));
11332 e_conv.is_owned = (e & 1) || (e == 0);
11333 e_conv = DecodeError_clone(&e_conv);
11334 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11335 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
11336 return (uint64_t)ret_conv;
11339 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11340 if ((_res & 1) != 0) return;
11341 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11343 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
11346 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11347 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
11348 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11349 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
11350 return (uint64_t)ret_conv;
11353 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11354 LDKChannelUpdate o_conv;
11355 o_conv.inner = (void*)(o & (~1));
11356 o_conv.is_owned = (o & 1) || (o == 0);
11357 o_conv = ChannelUpdate_clone(&o_conv);
11358 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11359 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
11360 return (uint64_t)ret_conv;
11363 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
11364 LDKDecodeError e_conv;
11365 e_conv.inner = (void*)(e & (~1));
11366 e_conv.is_owned = (e & 1) || (e == 0);
11367 e_conv = DecodeError_clone(&e_conv);
11368 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11369 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
11370 return (uint64_t)ret_conv;
11373 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11374 if ((_res & 1) != 0) return;
11375 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11377 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
11380 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11381 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
11382 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11383 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
11384 return (uint64_t)ret_conv;
11387 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
11388 LDKErrorMessage o_conv;
11389 o_conv.inner = (void*)(o & (~1));
11390 o_conv.is_owned = (o & 1) || (o == 0);
11391 o_conv = ErrorMessage_clone(&o_conv);
11392 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11393 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
11394 return (uint64_t)ret_conv;
11397 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
11398 LDKDecodeError e_conv;
11399 e_conv.inner = (void*)(e & (~1));
11400 e_conv.is_owned = (e & 1) || (e == 0);
11401 e_conv = DecodeError_clone(&e_conv);
11402 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11403 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
11404 return (uint64_t)ret_conv;
11407 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
11408 if ((_res & 1) != 0) return;
11409 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
11411 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
11414 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
11415 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
11416 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11417 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
11418 return (uint64_t)ret_conv;
11421 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11422 LDKUnsignedNodeAnnouncement o_conv;
11423 o_conv.inner = (void*)(o & (~1));
11424 o_conv.is_owned = (o & 1) || (o == 0);
11425 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
11426 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11427 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
11428 return (uint64_t)ret_conv;
11431 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11432 LDKDecodeError e_conv;
11433 e_conv.inner = (void*)(e & (~1));
11434 e_conv.is_owned = (e & 1) || (e == 0);
11435 e_conv = DecodeError_clone(&e_conv);
11436 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11437 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
11438 return (uint64_t)ret_conv;
11441 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11442 if ((_res & 1) != 0) return;
11443 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11445 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
11448 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11449 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
11450 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11451 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
11452 return (uint64_t)ret_conv;
11455 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
11456 LDKNodeAnnouncement o_conv;
11457 o_conv.inner = (void*)(o & (~1));
11458 o_conv.is_owned = (o & 1) || (o == 0);
11459 o_conv = NodeAnnouncement_clone(&o_conv);
11460 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11461 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
11462 return (uint64_t)ret_conv;
11465 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
11466 LDKDecodeError e_conv;
11467 e_conv.inner = (void*)(e & (~1));
11468 e_conv.is_owned = (e & 1) || (e == 0);
11469 e_conv = DecodeError_clone(&e_conv);
11470 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11471 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
11472 return (uint64_t)ret_conv;
11475 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
11476 if ((_res & 1) != 0) return;
11477 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11479 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
11482 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11483 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
11484 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
11485 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
11486 return (uint64_t)ret_conv;
11489 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
11490 LDKQueryShortChannelIds o_conv;
11491 o_conv.inner = (void*)(o & (~1));
11492 o_conv.is_owned = (o & 1) || (o == 0);
11493 o_conv = QueryShortChannelIds_clone(&o_conv);
11494 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11495 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
11496 return (uint64_t)ret_conv;
11499 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
11500 LDKDecodeError e_conv;
11501 e_conv.inner = (void*)(e & (~1));
11502 e_conv.is_owned = (e & 1) || (e == 0);
11503 e_conv = DecodeError_clone(&e_conv);
11504 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11505 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
11506 return (uint64_t)ret_conv;
11509 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
11510 if ((_res & 1) != 0) return;
11511 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
11513 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
11516 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
11517 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
11518 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11519 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
11520 return (uint64_t)ret_conv;
11523 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
11524 LDKReplyShortChannelIdsEnd o_conv;
11525 o_conv.inner = (void*)(o & (~1));
11526 o_conv.is_owned = (o & 1) || (o == 0);
11527 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
11528 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11529 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
11530 return (uint64_t)ret_conv;
11533 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
11534 LDKDecodeError e_conv;
11535 e_conv.inner = (void*)(e & (~1));
11536 e_conv.is_owned = (e & 1) || (e == 0);
11537 e_conv = DecodeError_clone(&e_conv);
11538 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11539 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
11540 return (uint64_t)ret_conv;
11543 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
11544 if ((_res & 1) != 0) return;
11545 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
11547 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
11550 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
11551 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
11552 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11553 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
11554 return (uint64_t)ret_conv;
11557 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
11558 LDKQueryChannelRange o_conv;
11559 o_conv.inner = (void*)(o & (~1));
11560 o_conv.is_owned = (o & 1) || (o == 0);
11561 o_conv = QueryChannelRange_clone(&o_conv);
11562 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11563 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
11564 return (uint64_t)ret_conv;
11567 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
11568 LDKDecodeError e_conv;
11569 e_conv.inner = (void*)(e & (~1));
11570 e_conv.is_owned = (e & 1) || (e == 0);
11571 e_conv = DecodeError_clone(&e_conv);
11572 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11573 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
11574 return (uint64_t)ret_conv;
11577 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
11578 if ((_res & 1) != 0) return;
11579 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11581 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
11584 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11585 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
11586 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11587 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
11588 return (uint64_t)ret_conv;
11591 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
11592 LDKReplyChannelRange o_conv;
11593 o_conv.inner = (void*)(o & (~1));
11594 o_conv.is_owned = (o & 1) || (o == 0);
11595 o_conv = ReplyChannelRange_clone(&o_conv);
11596 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11597 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
11598 return (uint64_t)ret_conv;
11601 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
11602 LDKDecodeError e_conv;
11603 e_conv.inner = (void*)(e & (~1));
11604 e_conv.is_owned = (e & 1) || (e == 0);
11605 e_conv = DecodeError_clone(&e_conv);
11606 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11607 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
11608 return (uint64_t)ret_conv;
11611 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
11612 if ((_res & 1) != 0) return;
11613 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11615 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
11618 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
11619 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
11620 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11621 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
11622 return (uint64_t)ret_conv;
11625 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
11626 LDKGossipTimestampFilter o_conv;
11627 o_conv.inner = (void*)(o & (~1));
11628 o_conv.is_owned = (o & 1) || (o == 0);
11629 o_conv = GossipTimestampFilter_clone(&o_conv);
11630 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11631 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
11632 return (uint64_t)ret_conv;
11635 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
11636 LDKDecodeError e_conv;
11637 e_conv.inner = (void*)(e & (~1));
11638 e_conv.is_owned = (e & 1) || (e == 0);
11639 e_conv = DecodeError_clone(&e_conv);
11640 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11641 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
11642 return (uint64_t)ret_conv;
11645 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
11646 if ((_res & 1) != 0) return;
11647 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
11649 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
11652 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
11653 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
11654 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11655 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
11656 return (uint64_t)ret_conv;
11659 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
11661 o_conv.inner = (void*)(o & (~1));
11662 o_conv.is_owned = (o & 1) || (o == 0);
11663 o_conv = Invoice_clone(&o_conv);
11664 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11665 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
11666 return (uint64_t)ret_conv;
11669 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
11670 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
11671 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
11672 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11673 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
11674 return (uint64_t)ret_conv;
11677 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
11678 if ((_res & 1) != 0) return;
11679 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
11681 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
11684 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
11685 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
11686 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
11687 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
11688 return (uint64_t)ret_conv;
11691 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
11692 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
11693 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11694 *ret_copy = COption_FilterZ_some(o_conv);
11695 uint64_t ret_ref = (uint64_t)ret_copy;
11699 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
11700 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
11701 *ret_copy = COption_FilterZ_none();
11702 uint64_t ret_ref = (uint64_t)ret_copy;
11706 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
11707 if ((_res & 1) != 0) return;
11708 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
11710 COption_FilterZ_free(_res_conv);
11713 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
11714 if ((this_ptr & 1) != 0) return;
11715 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
11716 FREE((void*)this_ptr);
11717 PaymentPurpose_free(this_ptr_conv);
11720 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
11721 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
11722 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11723 *ret_copy = PaymentPurpose_clone(orig_conv);
11724 uint64_t ret_ref = (uint64_t)ret_copy;
11728 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
11729 LDKThirtyTwoBytes payment_preimage_ref;
11730 CHECK(*((uint32_t*)payment_preimage) == 32);
11731 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11732 LDKThirtyTwoBytes payment_secret_ref;
11733 CHECK(*((uint32_t*)payment_secret) == 32);
11734 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11735 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11736 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
11737 uint64_t ret_ref = (uint64_t)ret_copy;
11741 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
11742 LDKThirtyTwoBytes a_ref;
11743 CHECK(*((uint32_t*)a) == 32);
11744 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
11745 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11746 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
11747 uint64_t ret_ref = (uint64_t)ret_copy;
11751 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
11752 if ((this_ptr & 1) != 0) return;
11753 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
11754 FREE((void*)this_ptr);
11755 ClosureReason_free(this_ptr_conv);
11758 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
11759 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
11760 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11761 *ret_copy = ClosureReason_clone(orig_conv);
11762 uint64_t ret_ref = (uint64_t)ret_copy;
11766 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
11767 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
11768 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11769 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
11770 uint64_t ret_ref = (uint64_t)ret_copy;
11774 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
11775 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11776 *ret_copy = ClosureReason_holder_force_closed();
11777 uint64_t ret_ref = (uint64_t)ret_copy;
11781 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
11782 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11783 *ret_copy = ClosureReason_cooperative_closure();
11784 uint64_t ret_ref = (uint64_t)ret_copy;
11788 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
11789 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11790 *ret_copy = ClosureReason_commitment_tx_confirmed();
11791 uint64_t ret_ref = (uint64_t)ret_copy;
11795 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
11796 LDKStr err_conv = str_ref_to_owned_c(err);
11797 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11798 *ret_copy = ClosureReason_processing_error(err_conv);
11799 uint64_t ret_ref = (uint64_t)ret_copy;
11803 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
11804 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11805 *ret_copy = ClosureReason_disconnected_peer();
11806 uint64_t ret_ref = (uint64_t)ret_copy;
11810 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
11811 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
11812 *ret_copy = ClosureReason_outdated_channel_manager();
11813 uint64_t ret_ref = (uint64_t)ret_copy;
11817 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
11818 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
11819 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
11820 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11821 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11822 CVec_u8Z_free(ret_var);
11826 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
11827 if ((this_ptr & 1) != 0) return;
11828 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
11829 FREE((void*)this_ptr);
11830 Event_free(this_ptr_conv);
11833 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
11834 LDKEvent* orig_conv = (LDKEvent*)orig;
11835 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11836 *ret_copy = Event_clone(orig_conv);
11837 uint64_t ret_ref = (uint64_t)ret_copy;
11841 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) {
11842 LDKThirtyTwoBytes temporary_channel_id_ref;
11843 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11844 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
11845 LDKCVec_u8Z output_script_ref;
11846 output_script_ref.datalen = *((uint32_t*)output_script);
11847 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
11848 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
11849 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11850 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
11851 uint64_t ret_ref = (uint64_t)ret_copy;
11855 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
11856 LDKThirtyTwoBytes payment_hash_ref;
11857 CHECK(*((uint32_t*)payment_hash) == 32);
11858 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11859 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
11860 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
11861 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11862 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
11863 uint64_t ret_ref = (uint64_t)ret_copy;
11867 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) {
11868 LDKThirtyTwoBytes payment_preimage_ref;
11869 CHECK(*((uint32_t*)payment_preimage) == 32);
11870 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11871 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11872 *ret_copy = Event_payment_sent(payment_preimage_ref);
11873 uint64_t ret_ref = (uint64_t)ret_copy;
11877 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) {
11878 LDKThirtyTwoBytes payment_hash_ref;
11879 CHECK(*((uint32_t*)payment_hash) == 32);
11880 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11881 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
11882 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
11883 LDKCVec_RouteHopZ path_constr;
11884 path_constr.datalen = *((uint32_t*)path);
11885 if (path_constr.datalen > 0)
11886 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11888 path_constr.data = NULL;
11889 uint32_t* path_vals = (uint32_t*)(path + 4);
11890 for (size_t k = 0; k < path_constr.datalen; k++) {
11891 uint32_t path_conv_10 = path_vals[k];
11892 LDKRouteHop path_conv_10_conv;
11893 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
11894 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
11895 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11896 path_constr.data[k] = path_conv_10_conv;
11898 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11899 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
11900 uint64_t ret_ref = (uint64_t)ret_copy;
11904 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
11905 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11906 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
11907 uint64_t ret_ref = (uint64_t)ret_copy;
11911 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
11912 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
11913 outputs_constr.datalen = *((uint32_t*)outputs);
11914 if (outputs_constr.datalen > 0)
11915 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11917 outputs_constr.data = NULL;
11918 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
11919 for (size_t b = 0; b < outputs_constr.datalen; b++) {
11920 uint32_t outputs_conv_27 = outputs_vals[b];
11921 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
11922 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
11923 outputs_constr.data[b] = outputs_conv_27_conv;
11925 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11926 *ret_copy = Event_spendable_outputs(outputs_constr);
11927 uint64_t ret_ref = (uint64_t)ret_copy;
11931 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
11932 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
11933 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
11934 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11935 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
11936 uint64_t ret_ref = (uint64_t)ret_copy;
11940 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) {
11941 LDKThirtyTwoBytes channel_id_ref;
11942 CHECK(*((uint32_t*)channel_id) == 32);
11943 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
11944 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
11945 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
11946 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11947 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
11948 uint64_t ret_ref = (uint64_t)ret_copy;
11952 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
11953 LDKEvent* obj_conv = (LDKEvent*)obj;
11954 LDKCVec_u8Z ret_var = Event_write(obj_conv);
11955 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11956 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11957 CVec_u8Z_free(ret_var);
11961 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
11962 if ((this_ptr & 1) != 0) return;
11963 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
11964 FREE((void*)this_ptr);
11965 MessageSendEvent_free(this_ptr_conv);
11968 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
11969 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
11970 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11971 *ret_copy = MessageSendEvent_clone(orig_conv);
11972 uint64_t ret_ref = (uint64_t)ret_copy;
11976 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
11977 LDKPublicKey node_id_ref;
11978 CHECK(*((uint32_t*)node_id) == 33);
11979 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11980 LDKAcceptChannel msg_conv;
11981 msg_conv.inner = (void*)(msg & (~1));
11982 msg_conv.is_owned = (msg & 1) || (msg == 0);
11983 msg_conv = AcceptChannel_clone(&msg_conv);
11984 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11985 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
11986 uint64_t ret_ref = (uint64_t)ret_copy;
11990 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
11991 LDKPublicKey node_id_ref;
11992 CHECK(*((uint32_t*)node_id) == 33);
11993 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
11994 LDKOpenChannel msg_conv;
11995 msg_conv.inner = (void*)(msg & (~1));
11996 msg_conv.is_owned = (msg & 1) || (msg == 0);
11997 msg_conv = OpenChannel_clone(&msg_conv);
11998 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11999 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
12000 uint64_t ret_ref = (uint64_t)ret_copy;
12004 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
12005 LDKPublicKey node_id_ref;
12006 CHECK(*((uint32_t*)node_id) == 33);
12007 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12008 LDKFundingCreated msg_conv;
12009 msg_conv.inner = (void*)(msg & (~1));
12010 msg_conv.is_owned = (msg & 1) || (msg == 0);
12011 msg_conv = FundingCreated_clone(&msg_conv);
12012 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12013 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
12014 uint64_t ret_ref = (uint64_t)ret_copy;
12018 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
12019 LDKPublicKey node_id_ref;
12020 CHECK(*((uint32_t*)node_id) == 33);
12021 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12022 LDKFundingSigned msg_conv;
12023 msg_conv.inner = (void*)(msg & (~1));
12024 msg_conv.is_owned = (msg & 1) || (msg == 0);
12025 msg_conv = FundingSigned_clone(&msg_conv);
12026 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12027 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
12028 uint64_t ret_ref = (uint64_t)ret_copy;
12032 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
12033 LDKPublicKey node_id_ref;
12034 CHECK(*((uint32_t*)node_id) == 33);
12035 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12036 LDKFundingLocked msg_conv;
12037 msg_conv.inner = (void*)(msg & (~1));
12038 msg_conv.is_owned = (msg & 1) || (msg == 0);
12039 msg_conv = FundingLocked_clone(&msg_conv);
12040 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12041 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
12042 uint64_t ret_ref = (uint64_t)ret_copy;
12046 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
12047 LDKPublicKey node_id_ref;
12048 CHECK(*((uint32_t*)node_id) == 33);
12049 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12050 LDKAnnouncementSignatures msg_conv;
12051 msg_conv.inner = (void*)(msg & (~1));
12052 msg_conv.is_owned = (msg & 1) || (msg == 0);
12053 msg_conv = AnnouncementSignatures_clone(&msg_conv);
12054 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12055 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
12056 uint64_t ret_ref = (uint64_t)ret_copy;
12060 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
12061 LDKPublicKey node_id_ref;
12062 CHECK(*((uint32_t*)node_id) == 33);
12063 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12064 LDKCommitmentUpdate updates_conv;
12065 updates_conv.inner = (void*)(updates & (~1));
12066 updates_conv.is_owned = (updates & 1) || (updates == 0);
12067 updates_conv = CommitmentUpdate_clone(&updates_conv);
12068 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12069 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
12070 uint64_t ret_ref = (uint64_t)ret_copy;
12074 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
12075 LDKPublicKey node_id_ref;
12076 CHECK(*((uint32_t*)node_id) == 33);
12077 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12078 LDKRevokeAndACK msg_conv;
12079 msg_conv.inner = (void*)(msg & (~1));
12080 msg_conv.is_owned = (msg & 1) || (msg == 0);
12081 msg_conv = RevokeAndACK_clone(&msg_conv);
12082 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12083 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
12084 uint64_t ret_ref = (uint64_t)ret_copy;
12088 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
12089 LDKPublicKey node_id_ref;
12090 CHECK(*((uint32_t*)node_id) == 33);
12091 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12092 LDKClosingSigned msg_conv;
12093 msg_conv.inner = (void*)(msg & (~1));
12094 msg_conv.is_owned = (msg & 1) || (msg == 0);
12095 msg_conv = ClosingSigned_clone(&msg_conv);
12096 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12097 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
12098 uint64_t ret_ref = (uint64_t)ret_copy;
12102 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
12103 LDKPublicKey node_id_ref;
12104 CHECK(*((uint32_t*)node_id) == 33);
12105 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12106 LDKShutdown msg_conv;
12107 msg_conv.inner = (void*)(msg & (~1));
12108 msg_conv.is_owned = (msg & 1) || (msg == 0);
12109 msg_conv = Shutdown_clone(&msg_conv);
12110 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12111 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
12112 uint64_t ret_ref = (uint64_t)ret_copy;
12116 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
12117 LDKPublicKey node_id_ref;
12118 CHECK(*((uint32_t*)node_id) == 33);
12119 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12120 LDKChannelReestablish msg_conv;
12121 msg_conv.inner = (void*)(msg & (~1));
12122 msg_conv.is_owned = (msg & 1) || (msg == 0);
12123 msg_conv = ChannelReestablish_clone(&msg_conv);
12124 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12125 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
12126 uint64_t ret_ref = (uint64_t)ret_copy;
12130 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
12131 LDKChannelAnnouncement msg_conv;
12132 msg_conv.inner = (void*)(msg & (~1));
12133 msg_conv.is_owned = (msg & 1) || (msg == 0);
12134 msg_conv = ChannelAnnouncement_clone(&msg_conv);
12135 LDKChannelUpdate update_msg_conv;
12136 update_msg_conv.inner = (void*)(update_msg & (~1));
12137 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
12138 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
12139 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12140 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
12141 uint64_t ret_ref = (uint64_t)ret_copy;
12145 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
12146 LDKNodeAnnouncement msg_conv;
12147 msg_conv.inner = (void*)(msg & (~1));
12148 msg_conv.is_owned = (msg & 1) || (msg == 0);
12149 msg_conv = NodeAnnouncement_clone(&msg_conv);
12150 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12151 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
12152 uint64_t ret_ref = (uint64_t)ret_copy;
12156 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
12157 LDKChannelUpdate msg_conv;
12158 msg_conv.inner = (void*)(msg & (~1));
12159 msg_conv.is_owned = (msg & 1) || (msg == 0);
12160 msg_conv = ChannelUpdate_clone(&msg_conv);
12161 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12162 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
12163 uint64_t ret_ref = (uint64_t)ret_copy;
12167 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
12168 LDKPublicKey node_id_ref;
12169 CHECK(*((uint32_t*)node_id) == 33);
12170 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12171 LDKChannelUpdate msg_conv;
12172 msg_conv.inner = (void*)(msg & (~1));
12173 msg_conv.is_owned = (msg & 1) || (msg == 0);
12174 msg_conv = ChannelUpdate_clone(&msg_conv);
12175 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12176 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
12177 uint64_t ret_ref = (uint64_t)ret_copy;
12181 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
12182 LDKPublicKey node_id_ref;
12183 CHECK(*((uint32_t*)node_id) == 33);
12184 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12185 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
12186 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
12187 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12188 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
12189 uint64_t ret_ref = (uint64_t)ret_copy;
12193 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
12194 LDKPublicKey node_id_ref;
12195 CHECK(*((uint32_t*)node_id) == 33);
12196 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12197 LDKQueryChannelRange msg_conv;
12198 msg_conv.inner = (void*)(msg & (~1));
12199 msg_conv.is_owned = (msg & 1) || (msg == 0);
12200 msg_conv = QueryChannelRange_clone(&msg_conv);
12201 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12202 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
12203 uint64_t ret_ref = (uint64_t)ret_copy;
12207 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
12208 LDKPublicKey node_id_ref;
12209 CHECK(*((uint32_t*)node_id) == 33);
12210 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12211 LDKQueryShortChannelIds msg_conv;
12212 msg_conv.inner = (void*)(msg & (~1));
12213 msg_conv.is_owned = (msg & 1) || (msg == 0);
12214 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12215 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12216 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
12217 uint64_t ret_ref = (uint64_t)ret_copy;
12221 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
12222 LDKPublicKey node_id_ref;
12223 CHECK(*((uint32_t*)node_id) == 33);
12224 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12225 LDKReplyChannelRange msg_conv;
12226 msg_conv.inner = (void*)(msg & (~1));
12227 msg_conv.is_owned = (msg & 1) || (msg == 0);
12228 msg_conv = ReplyChannelRange_clone(&msg_conv);
12229 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12230 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
12231 uint64_t ret_ref = (uint64_t)ret_copy;
12235 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
12236 if ((this_ptr & 1) != 0) return;
12237 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12238 FREE((void*)this_ptr);
12239 MessageSendEventsProvider_free(this_ptr_conv);
12242 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
12243 if ((this_ptr & 1) != 0) return;
12244 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12245 FREE((void*)this_ptr);
12246 EventsProvider_free(this_ptr_conv);
12249 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
12250 if ((this_ptr & 1) != 0) return;
12251 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12252 FREE((void*)this_ptr);
12253 EventHandler_free(this_ptr_conv);
12256 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
12257 if ((this_ptr & 1) != 0) return;
12258 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12259 FREE((void*)this_ptr);
12260 APIError_free(this_ptr_conv);
12263 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
12264 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12265 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12266 *ret_copy = APIError_clone(orig_conv);
12267 uint64_t ret_ref = (uint64_t)ret_copy;
12271 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
12272 LDKStr err_conv = str_ref_to_owned_c(err);
12273 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12274 *ret_copy = APIError_apimisuse_error(err_conv);
12275 uint64_t ret_ref = (uint64_t)ret_copy;
12279 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
12280 LDKStr err_conv = str_ref_to_owned_c(err);
12281 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12282 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
12283 uint64_t ret_ref = (uint64_t)ret_copy;
12287 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
12288 LDKStr err_conv = str_ref_to_owned_c(err);
12289 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12290 *ret_copy = APIError_route_error(err_conv);
12291 uint64_t ret_ref = (uint64_t)ret_copy;
12295 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
12296 LDKStr err_conv = str_ref_to_owned_c(err);
12297 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12298 *ret_copy = APIError_channel_unavailable(err_conv);
12299 uint64_t ret_ref = (uint64_t)ret_copy;
12303 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
12304 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12305 *ret_copy = APIError_monitor_update_failed();
12306 uint64_t ret_ref = (uint64_t)ret_copy;
12310 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
12311 LDKShutdownScript script_conv;
12312 script_conv.inner = (void*)(script & (~1));
12313 script_conv.is_owned = (script & 1) || (script == 0);
12314 script_conv = ShutdownScript_clone(&script_conv);
12315 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12316 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
12317 uint64_t ret_ref = (uint64_t)ret_copy;
12321 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
12322 LDKu8slice msg_ref;
12323 msg_ref.datalen = *((uint32_t*)msg);
12324 msg_ref.data = (int8_t*)(msg + 4);
12325 unsigned char sk_arr[32];
12326 CHECK(*((uint32_t*)sk) == 32);
12327 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
12328 unsigned char (*sk_ref)[32] = &sk_arr;
12329 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12330 *ret_conv = sign(msg_ref, sk_ref);
12331 return (uint64_t)ret_conv;
12334 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
12335 LDKu8slice msg_ref;
12336 msg_ref.datalen = *((uint32_t*)msg);
12337 msg_ref.data = (int8_t*)(msg + 4);
12338 LDKStr sig_conv = str_ref_to_owned_c(sig);
12339 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12340 *ret_conv = recover_pk(msg_ref, sig_conv);
12341 return (uint64_t)ret_conv;
12344 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
12345 LDKu8slice msg_ref;
12346 msg_ref.datalen = *((uint32_t*)msg);
12347 msg_ref.data = (int8_t*)(msg + 4);
12348 LDKStr sig_conv = str_ref_to_owned_c(sig);
12349 LDKPublicKey pk_ref;
12350 CHECK(*((uint32_t*)pk) == 33);
12351 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
12352 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12356 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
12357 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12358 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
12362 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
12363 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
12367 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
12368 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
12372 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
12373 uint32_t ret_conv = LDKLevel_to_js(Level_info());
12377 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
12378 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
12382 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
12383 uint32_t ret_conv = LDKLevel_to_js(Level_error());
12387 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
12388 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12389 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12390 jboolean ret_val = Level_eq(a_conv, b_conv);
12394 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
12395 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
12396 int64_t ret_val = Level_hash(o_conv);
12400 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
12401 uint32_t ret_conv = LDKLevel_to_js(Level_max());
12405 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
12406 if ((this_ptr & 1) != 0) return;
12407 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
12408 FREE((void*)this_ptr);
12409 Logger_free(this_ptr_conv);
12412 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
12413 LDKChannelHandshakeConfig this_obj_conv;
12414 this_obj_conv.inner = (void*)(this_obj & (~1));
12415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12416 ChannelHandshakeConfig_free(this_obj_conv);
12419 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
12420 LDKChannelHandshakeConfig this_ptr_conv;
12421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12422 this_ptr_conv.is_owned = false;
12423 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
12427 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12428 LDKChannelHandshakeConfig this_ptr_conv;
12429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12430 this_ptr_conv.is_owned = false;
12431 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
12434 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
12435 LDKChannelHandshakeConfig this_ptr_conv;
12436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12437 this_ptr_conv.is_owned = false;
12438 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
12442 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
12443 LDKChannelHandshakeConfig this_ptr_conv;
12444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12445 this_ptr_conv.is_owned = false;
12446 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
12449 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
12450 LDKChannelHandshakeConfig this_ptr_conv;
12451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12452 this_ptr_conv.is_owned = false;
12453 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
12457 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12458 LDKChannelHandshakeConfig this_ptr_conv;
12459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12460 this_ptr_conv.is_owned = false;
12461 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
12464 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) {
12465 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
12466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12468 uint64_t ret_ref = (uint64_t)ret_var.inner;
12469 if (ret_var.is_owned) {
12475 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
12476 LDKChannelHandshakeConfig orig_conv;
12477 orig_conv.inner = (void*)(orig & (~1));
12478 orig_conv.is_owned = false;
12479 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
12480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12482 uint64_t ret_ref = (uint64_t)ret_var.inner;
12483 if (ret_var.is_owned) {
12489 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
12490 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
12491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12493 uint64_t ret_ref = (uint64_t)ret_var.inner;
12494 if (ret_var.is_owned) {
12500 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
12501 LDKChannelHandshakeLimits this_obj_conv;
12502 this_obj_conv.inner = (void*)(this_obj & (~1));
12503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12504 ChannelHandshakeLimits_free(this_obj_conv);
12507 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
12508 LDKChannelHandshakeLimits this_ptr_conv;
12509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12510 this_ptr_conv.is_owned = false;
12511 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
12515 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
12516 LDKChannelHandshakeLimits this_ptr_conv;
12517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12518 this_ptr_conv.is_owned = false;
12519 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
12522 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
12523 LDKChannelHandshakeLimits this_ptr_conv;
12524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12525 this_ptr_conv.is_owned = false;
12526 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
12530 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12531 LDKChannelHandshakeLimits this_ptr_conv;
12532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12533 this_ptr_conv.is_owned = false;
12534 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
12537 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12538 LDKChannelHandshakeLimits this_ptr_conv;
12539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12540 this_ptr_conv.is_owned = false;
12541 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
12545 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12546 LDKChannelHandshakeLimits this_ptr_conv;
12547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12548 this_ptr_conv.is_owned = false;
12549 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12552 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
12553 LDKChannelHandshakeLimits this_ptr_conv;
12554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12555 this_ptr_conv.is_owned = false;
12556 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
12560 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12561 LDKChannelHandshakeLimits this_ptr_conv;
12562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12563 this_ptr_conv.is_owned = false;
12564 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
12567 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
12568 LDKChannelHandshakeLimits this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
12575 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12576 LDKChannelHandshakeLimits this_ptr_conv;
12577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12578 this_ptr_conv.is_owned = false;
12579 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
12582 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
12583 LDKChannelHandshakeLimits this_ptr_conv;
12584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12585 this_ptr_conv.is_owned = false;
12586 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
12590 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
12591 LDKChannelHandshakeLimits this_ptr_conv;
12592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12593 this_ptr_conv.is_owned = false;
12594 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
12597 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
12598 LDKChannelHandshakeLimits this_ptr_conv;
12599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12600 this_ptr_conv.is_owned = false;
12601 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
12605 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
12606 LDKChannelHandshakeLimits this_ptr_conv;
12607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12608 this_ptr_conv.is_owned = false;
12609 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
12612 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
12613 LDKChannelHandshakeLimits this_ptr_conv;
12614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12615 this_ptr_conv.is_owned = false;
12616 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
12620 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
12621 LDKChannelHandshakeLimits this_ptr_conv;
12622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12623 this_ptr_conv.is_owned = false;
12624 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
12627 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) {
12628 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);
12629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12631 uint64_t ret_ref = (uint64_t)ret_var.inner;
12632 if (ret_var.is_owned) {
12638 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
12639 LDKChannelHandshakeLimits orig_conv;
12640 orig_conv.inner = (void*)(orig & (~1));
12641 orig_conv.is_owned = false;
12642 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
12643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12645 uint64_t ret_ref = (uint64_t)ret_var.inner;
12646 if (ret_var.is_owned) {
12652 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
12653 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
12654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12656 uint64_t ret_ref = (uint64_t)ret_var.inner;
12657 if (ret_var.is_owned) {
12663 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
12664 LDKChannelConfig this_obj_conv;
12665 this_obj_conv.inner = (void*)(this_obj & (~1));
12666 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12667 ChannelConfig_free(this_obj_conv);
12670 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
12671 LDKChannelConfig this_ptr_conv;
12672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12673 this_ptr_conv.is_owned = false;
12674 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
12678 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
12679 LDKChannelConfig this_ptr_conv;
12680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12681 this_ptr_conv.is_owned = false;
12682 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
12685 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
12686 LDKChannelConfig this_ptr_conv;
12687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12688 this_ptr_conv.is_owned = false;
12689 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
12693 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
12694 LDKChannelConfig this_ptr_conv;
12695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12696 this_ptr_conv.is_owned = false;
12697 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
12700 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
12701 LDKChannelConfig this_ptr_conv;
12702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12703 this_ptr_conv.is_owned = false;
12704 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
12708 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
12709 LDKChannelConfig this_ptr_conv;
12710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12711 this_ptr_conv.is_owned = false;
12712 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
12715 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
12716 LDKChannelConfig this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = false;
12719 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
12723 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
12724 LDKChannelConfig this_ptr_conv;
12725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12726 this_ptr_conv.is_owned = false;
12727 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
12730 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
12731 LDKChannelConfig this_ptr_conv;
12732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12733 this_ptr_conv.is_owned = false;
12734 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
12738 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
12739 LDKChannelConfig this_ptr_conv;
12740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12741 this_ptr_conv.is_owned = false;
12742 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
12745 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
12746 LDKChannelConfig this_ptr_conv;
12747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12748 this_ptr_conv.is_owned = false;
12749 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
12753 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
12754 LDKChannelConfig this_ptr_conv;
12755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12756 this_ptr_conv.is_owned = false;
12757 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
12760 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
12761 LDKChannelConfig this_ptr_conv;
12762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12763 this_ptr_conv.is_owned = false;
12764 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
12768 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
12769 LDKChannelConfig this_ptr_conv;
12770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12771 this_ptr_conv.is_owned = false;
12772 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
12775 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) {
12776 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);
12777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12779 uint64_t ret_ref = (uint64_t)ret_var.inner;
12780 if (ret_var.is_owned) {
12786 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
12787 LDKChannelConfig orig_conv;
12788 orig_conv.inner = (void*)(orig & (~1));
12789 orig_conv.is_owned = false;
12790 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
12791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12793 uint64_t ret_ref = (uint64_t)ret_var.inner;
12794 if (ret_var.is_owned) {
12800 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
12801 LDKChannelConfig ret_var = ChannelConfig_default();
12802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12804 uint64_t ret_ref = (uint64_t)ret_var.inner;
12805 if (ret_var.is_owned) {
12811 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
12812 LDKChannelConfig obj_conv;
12813 obj_conv.inner = (void*)(obj & (~1));
12814 obj_conv.is_owned = false;
12815 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
12816 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12817 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12818 CVec_u8Z_free(ret_var);
12822 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
12823 LDKu8slice ser_ref;
12824 ser_ref.datalen = *((uint32_t*)ser);
12825 ser_ref.data = (int8_t*)(ser + 4);
12826 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12827 *ret_conv = ChannelConfig_read(ser_ref);
12828 return (uint64_t)ret_conv;
12831 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
12832 LDKUserConfig this_obj_conv;
12833 this_obj_conv.inner = (void*)(this_obj & (~1));
12834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12835 UserConfig_free(this_obj_conv);
12838 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
12839 LDKUserConfig this_ptr_conv;
12840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12841 this_ptr_conv.is_owned = false;
12842 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
12843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12845 uint64_t ret_ref = (uint64_t)ret_var.inner;
12846 if (ret_var.is_owned) {
12852 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
12853 LDKUserConfig this_ptr_conv;
12854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12855 this_ptr_conv.is_owned = false;
12856 LDKChannelHandshakeConfig val_conv;
12857 val_conv.inner = (void*)(val & (~1));
12858 val_conv.is_owned = (val & 1) || (val == 0);
12859 val_conv = ChannelHandshakeConfig_clone(&val_conv);
12860 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
12863 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
12864 LDKUserConfig this_ptr_conv;
12865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12866 this_ptr_conv.is_owned = false;
12867 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
12868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12870 uint64_t ret_ref = (uint64_t)ret_var.inner;
12871 if (ret_var.is_owned) {
12877 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
12878 LDKUserConfig this_ptr_conv;
12879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12880 this_ptr_conv.is_owned = false;
12881 LDKChannelHandshakeLimits val_conv;
12882 val_conv.inner = (void*)(val & (~1));
12883 val_conv.is_owned = (val & 1) || (val == 0);
12884 val_conv = ChannelHandshakeLimits_clone(&val_conv);
12885 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
12888 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
12889 LDKUserConfig this_ptr_conv;
12890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12891 this_ptr_conv.is_owned = false;
12892 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
12893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12895 uint64_t ret_ref = (uint64_t)ret_var.inner;
12896 if (ret_var.is_owned) {
12902 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
12903 LDKUserConfig this_ptr_conv;
12904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12905 this_ptr_conv.is_owned = false;
12906 LDKChannelConfig val_conv;
12907 val_conv.inner = (void*)(val & (~1));
12908 val_conv.is_owned = (val & 1) || (val == 0);
12909 val_conv = ChannelConfig_clone(&val_conv);
12910 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
12913 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
12914 LDKUserConfig this_ptr_conv;
12915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12916 this_ptr_conv.is_owned = false;
12917 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
12921 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
12922 LDKUserConfig this_ptr_conv;
12923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12924 this_ptr_conv.is_owned = false;
12925 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
12928 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) {
12929 LDKChannelHandshakeConfig own_channel_config_arg_conv;
12930 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
12931 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
12932 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
12933 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
12934 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
12935 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
12936 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
12937 LDKChannelConfig channel_options_arg_conv;
12938 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
12939 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
12940 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
12941 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);
12942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12944 uint64_t ret_ref = (uint64_t)ret_var.inner;
12945 if (ret_var.is_owned) {
12951 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
12952 LDKUserConfig orig_conv;
12953 orig_conv.inner = (void*)(orig & (~1));
12954 orig_conv.is_owned = false;
12955 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
12956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12958 uint64_t ret_ref = (uint64_t)ret_var.inner;
12959 if (ret_var.is_owned) {
12965 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
12966 LDKUserConfig ret_var = UserConfig_default();
12967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12969 uint64_t ret_ref = (uint64_t)ret_var.inner;
12970 if (ret_var.is_owned) {
12976 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
12977 LDKBestBlock this_obj_conv;
12978 this_obj_conv.inner = (void*)(this_obj & (~1));
12979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12980 BestBlock_free(this_obj_conv);
12983 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
12984 LDKBestBlock orig_conv;
12985 orig_conv.inner = (void*)(orig & (~1));
12986 orig_conv.is_owned = false;
12987 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
12988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12990 uint64_t ret_ref = (uint64_t)ret_var.inner;
12991 if (ret_var.is_owned) {
12997 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
12998 LDKNetwork network_conv = LDKNetwork_from_js(network);
12999 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
13000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13002 uint64_t ret_ref = (uint64_t)ret_var.inner;
13003 if (ret_var.is_owned) {
13009 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
13010 LDKThirtyTwoBytes block_hash_ref;
13011 CHECK(*((uint32_t*)block_hash) == 32);
13012 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
13013 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
13014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13016 uint64_t ret_ref = (uint64_t)ret_var.inner;
13017 if (ret_var.is_owned) {
13023 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
13024 LDKBestBlock this_arg_conv;
13025 this_arg_conv.inner = (void*)(this_arg & (~1));
13026 this_arg_conv.is_owned = false;
13027 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13028 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
13032 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
13033 LDKBestBlock this_arg_conv;
13034 this_arg_conv.inner = (void*)(this_arg & (~1));
13035 this_arg_conv.is_owned = false;
13036 int32_t ret_val = BestBlock_height(&this_arg_conv);
13040 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
13041 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13042 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
13046 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
13047 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
13051 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
13052 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
13056 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
13057 if ((this_ptr & 1) != 0) return;
13058 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13059 FREE((void*)this_ptr);
13060 Access_free(this_ptr_conv);
13063 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
13064 if ((this_ptr & 1) != 0) return;
13065 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13066 FREE((void*)this_ptr);
13067 Listen_free(this_ptr_conv);
13070 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
13071 if ((this_ptr & 1) != 0) return;
13072 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13073 FREE((void*)this_ptr);
13074 Confirm_free(this_ptr_conv);
13077 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
13078 if ((this_ptr & 1) != 0) return;
13079 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13080 FREE((void*)this_ptr);
13081 Watch_free(this_ptr_conv);
13084 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
13085 if ((this_ptr & 1) != 0) return;
13086 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13087 FREE((void*)this_ptr);
13088 Filter_free(this_ptr_conv);
13091 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
13092 LDKWatchedOutput this_obj_conv;
13093 this_obj_conv.inner = (void*)(this_obj & (~1));
13094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13095 WatchedOutput_free(this_obj_conv);
13098 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
13099 LDKWatchedOutput this_ptr_conv;
13100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13101 this_ptr_conv.is_owned = false;
13102 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13103 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
13107 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
13108 LDKWatchedOutput this_ptr_conv;
13109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13110 this_ptr_conv.is_owned = false;
13111 LDKThirtyTwoBytes val_ref;
13112 CHECK(*((uint32_t*)val) == 32);
13113 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13114 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13117 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
13118 LDKWatchedOutput this_ptr_conv;
13119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13120 this_ptr_conv.is_owned = false;
13121 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13124 uint64_t ret_ref = (uint64_t)ret_var.inner;
13125 if (ret_var.is_owned) {
13131 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
13132 LDKWatchedOutput this_ptr_conv;
13133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13134 this_ptr_conv.is_owned = false;
13135 LDKOutPoint val_conv;
13136 val_conv.inner = (void*)(val & (~1));
13137 val_conv.is_owned = (val & 1) || (val == 0);
13138 val_conv = OutPoint_clone(&val_conv);
13139 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13142 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
13143 LDKWatchedOutput this_ptr_conv;
13144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13145 this_ptr_conv.is_owned = false;
13146 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13147 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13148 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13152 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
13153 LDKWatchedOutput this_ptr_conv;
13154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13155 this_ptr_conv.is_owned = false;
13156 LDKCVec_u8Z val_ref;
13157 val_ref.datalen = *((uint32_t*)val);
13158 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13159 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13160 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13163 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
13164 LDKThirtyTwoBytes block_hash_arg_ref;
13165 CHECK(*((uint32_t*)block_hash_arg) == 32);
13166 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
13167 LDKOutPoint outpoint_arg_conv;
13168 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13169 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13170 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13171 LDKCVec_u8Z script_pubkey_arg_ref;
13172 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
13173 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13174 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
13175 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13178 uint64_t ret_ref = (uint64_t)ret_var.inner;
13179 if (ret_var.is_owned) {
13185 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
13186 LDKWatchedOutput orig_conv;
13187 orig_conv.inner = (void*)(orig & (~1));
13188 orig_conv.is_owned = false;
13189 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13190 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13191 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13192 uint64_t ret_ref = (uint64_t)ret_var.inner;
13193 if (ret_var.is_owned) {
13199 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
13200 LDKWatchedOutput o_conv;
13201 o_conv.inner = (void*)(o & (~1));
13202 o_conv.is_owned = false;
13203 int64_t ret_val = WatchedOutput_hash(&o_conv);
13207 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
13208 if ((this_ptr & 1) != 0) return;
13209 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13210 FREE((void*)this_ptr);
13211 BroadcasterInterface_free(this_ptr_conv);
13214 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
13215 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13216 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
13220 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
13221 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
13225 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
13226 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
13230 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
13231 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
13235 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
13236 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
13237 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
13238 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
13242 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
13243 if ((this_ptr & 1) != 0) return;
13244 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13245 FREE((void*)this_ptr);
13246 FeeEstimator_free(this_ptr_conv);
13249 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
13250 LDKChainMonitor this_obj_conv;
13251 this_obj_conv.inner = (void*)(this_obj & (~1));
13252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13253 ChainMonitor_free(this_obj_conv);
13256 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
13257 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
13258 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
13259 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
13260 // Manually implement clone for Java trait instances
13262 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13263 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13264 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13265 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13266 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13269 uint64_t ret_ref = (uint64_t)ret_var.inner;
13270 if (ret_var.is_owned) {
13276 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
13277 LDKChainMonitor this_arg_conv;
13278 this_arg_conv.inner = (void*)(this_arg & (~1));
13279 this_arg_conv.is_owned = false;
13280 LDKCVec_ChannelDetailsZ ignored_channels_constr;
13281 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
13282 if (ignored_channels_constr.datalen > 0)
13283 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13285 ignored_channels_constr.data = NULL;
13286 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
13287 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
13288 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
13289 LDKChannelDetails ignored_channels_conv_16_conv;
13290 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
13291 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
13292 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
13293 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
13295 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
13296 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13297 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13298 for (size_t j = 0; j < ret_var.datalen; j++) {
13299 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13300 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
13301 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
13302 ret_arr_ptr[j] = ret_conv_9_ref;
13304 FREE(ret_var.data);
13308 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
13309 LDKChainMonitor this_arg_conv;
13310 this_arg_conv.inner = (void*)(this_arg & (~1));
13311 this_arg_conv.is_owned = false;
13312 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
13313 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
13314 return (uint64_t)ret_ret;
13317 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
13318 LDKChainMonitor this_arg_conv;
13319 this_arg_conv.inner = (void*)(this_arg & (~1));
13320 this_arg_conv.is_owned = false;
13321 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13322 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
13323 return (uint64_t)ret_ret;
13326 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
13327 LDKChainMonitor this_arg_conv;
13328 this_arg_conv.inner = (void*)(this_arg & (~1));
13329 this_arg_conv.is_owned = false;
13330 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
13331 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
13332 return (uint64_t)ret_ret;
13335 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
13336 LDKChainMonitor this_arg_conv;
13337 this_arg_conv.inner = (void*)(this_arg & (~1));
13338 this_arg_conv.is_owned = false;
13339 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13340 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13341 return (uint64_t)ret_ret;
13344 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
13345 LDKChannelMonitorUpdate this_obj_conv;
13346 this_obj_conv.inner = (void*)(this_obj & (~1));
13347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13348 ChannelMonitorUpdate_free(this_obj_conv);
13351 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
13352 LDKChannelMonitorUpdate this_ptr_conv;
13353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13354 this_ptr_conv.is_owned = false;
13355 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13359 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
13360 LDKChannelMonitorUpdate this_ptr_conv;
13361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13362 this_ptr_conv.is_owned = false;
13363 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13366 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
13367 LDKChannelMonitorUpdate orig_conv;
13368 orig_conv.inner = (void*)(orig & (~1));
13369 orig_conv.is_owned = false;
13370 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13373 uint64_t ret_ref = (uint64_t)ret_var.inner;
13374 if (ret_var.is_owned) {
13380 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
13381 LDKChannelMonitorUpdate obj_conv;
13382 obj_conv.inner = (void*)(obj & (~1));
13383 obj_conv.is_owned = false;
13384 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13385 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13386 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13387 CVec_u8Z_free(ret_var);
13391 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
13392 LDKu8slice ser_ref;
13393 ser_ref.datalen = *((uint32_t*)ser);
13394 ser_ref.data = (int8_t*)(ser + 4);
13395 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13396 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13397 return (uint64_t)ret_conv;
13400 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
13401 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13402 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
13406 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
13407 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
13411 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
13412 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
13416 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
13417 LDKMonitorUpdateError this_obj_conv;
13418 this_obj_conv.inner = (void*)(this_obj & (~1));
13419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13420 MonitorUpdateError_free(this_obj_conv);
13423 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
13424 LDKMonitorUpdateError orig_conv;
13425 orig_conv.inner = (void*)(orig & (~1));
13426 orig_conv.is_owned = false;
13427 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13430 uint64_t ret_ref = (uint64_t)ret_var.inner;
13431 if (ret_var.is_owned) {
13437 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
13438 if ((this_ptr & 1) != 0) return;
13439 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13440 FREE((void*)this_ptr);
13441 MonitorEvent_free(this_ptr_conv);
13444 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
13445 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13446 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13447 *ret_copy = MonitorEvent_clone(orig_conv);
13448 uint64_t ret_ref = (uint64_t)ret_copy;
13452 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
13453 LDKHTLCUpdate a_conv;
13454 a_conv.inner = (void*)(a & (~1));
13455 a_conv.is_owned = (a & 1) || (a == 0);
13456 a_conv = HTLCUpdate_clone(&a_conv);
13457 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13458 *ret_copy = MonitorEvent_htlcevent(a_conv);
13459 uint64_t ret_ref = (uint64_t)ret_copy;
13463 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
13464 LDKOutPoint a_conv;
13465 a_conv.inner = (void*)(a & (~1));
13466 a_conv.is_owned = (a & 1) || (a == 0);
13467 a_conv = OutPoint_clone(&a_conv);
13468 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13469 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
13470 uint64_t ret_ref = (uint64_t)ret_copy;
13474 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
13475 LDKHTLCUpdate this_obj_conv;
13476 this_obj_conv.inner = (void*)(this_obj & (~1));
13477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13478 HTLCUpdate_free(this_obj_conv);
13481 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
13482 LDKHTLCUpdate orig_conv;
13483 orig_conv.inner = (void*)(orig & (~1));
13484 orig_conv.is_owned = false;
13485 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13488 uint64_t ret_ref = (uint64_t)ret_var.inner;
13489 if (ret_var.is_owned) {
13495 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
13496 LDKHTLCUpdate obj_conv;
13497 obj_conv.inner = (void*)(obj & (~1));
13498 obj_conv.is_owned = false;
13499 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13500 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13501 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13502 CVec_u8Z_free(ret_var);
13506 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
13507 LDKu8slice ser_ref;
13508 ser_ref.datalen = *((uint32_t*)ser);
13509 ser_ref.data = (int8_t*)(ser + 4);
13510 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13511 *ret_conv = HTLCUpdate_read(ser_ref);
13512 return (uint64_t)ret_conv;
13515 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
13516 if ((this_ptr & 1) != 0) return;
13517 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
13518 FREE((void*)this_ptr);
13519 Balance_free(this_ptr_conv);
13522 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
13523 LDKBalance* orig_conv = (LDKBalance*)orig;
13524 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13525 *ret_copy = Balance_clone(orig_conv);
13526 uint64_t ret_ref = (uint64_t)ret_copy;
13530 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
13531 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13532 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
13533 uint64_t ret_ref = (uint64_t)ret_copy;
13537 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
13538 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13539 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
13540 uint64_t ret_ref = (uint64_t)ret_copy;
13544 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
13545 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13546 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
13547 uint64_t ret_ref = (uint64_t)ret_copy;
13551 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
13552 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13553 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
13554 uint64_t ret_ref = (uint64_t)ret_copy;
13558 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
13559 LDKBalance* a_conv = (LDKBalance*)a;
13560 LDKBalance* b_conv = (LDKBalance*)b;
13561 jboolean ret_val = Balance_eq(a_conv, b_conv);
13565 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
13566 LDKChannelMonitor this_obj_conv;
13567 this_obj_conv.inner = (void*)(this_obj & (~1));
13568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13569 ChannelMonitor_free(this_obj_conv);
13572 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
13573 LDKChannelMonitor orig_conv;
13574 orig_conv.inner = (void*)(orig & (~1));
13575 orig_conv.is_owned = false;
13576 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13579 uint64_t ret_ref = (uint64_t)ret_var.inner;
13580 if (ret_var.is_owned) {
13586 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
13587 LDKChannelMonitor obj_conv;
13588 obj_conv.inner = (void*)(obj & (~1));
13589 obj_conv.is_owned = false;
13590 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13591 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13592 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13593 CVec_u8Z_free(ret_var);
13597 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) {
13598 LDKChannelMonitor this_arg_conv;
13599 this_arg_conv.inner = (void*)(this_arg & (~1));
13600 this_arg_conv.is_owned = false;
13601 LDKChannelMonitorUpdate updates_conv;
13602 updates_conv.inner = (void*)(updates & (~1));
13603 updates_conv.is_owned = false;
13604 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13605 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13606 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13607 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13608 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13609 return (uint64_t)ret_conv;
13612 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
13613 LDKChannelMonitor this_arg_conv;
13614 this_arg_conv.inner = (void*)(this_arg & (~1));
13615 this_arg_conv.is_owned = false;
13616 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13620 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
13621 LDKChannelMonitor this_arg_conv;
13622 this_arg_conv.inner = (void*)(this_arg & (~1));
13623 this_arg_conv.is_owned = false;
13624 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13625 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13626 return (uint64_t)ret_ref;
13629 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
13630 LDKChannelMonitor this_arg_conv;
13631 this_arg_conv.inner = (void*)(this_arg & (~1));
13632 this_arg_conv.is_owned = false;
13633 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13634 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13635 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13636 for (size_t c = 0; c < ret_var.datalen; c++) {
13637 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13638 *ret_conv_54_ref = ret_var.data[c];
13639 ret_arr_ptr[c] = (uint64_t)ret_conv_54_ref;
13641 FREE(ret_var.data);
13645 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
13646 LDKChannelMonitor this_arg_conv;
13647 this_arg_conv.inner = (void*)(this_arg & (~1));
13648 this_arg_conv.is_owned = false;
13649 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
13650 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
13653 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
13654 LDKChannelMonitor this_arg_conv;
13655 this_arg_conv.inner = (void*)(this_arg & (~1));
13656 this_arg_conv.is_owned = false;
13657 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
13658 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13659 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13660 for (size_t o = 0; o < ret_var.datalen; o++) {
13661 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13662 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
13663 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
13664 ret_arr_ptr[o] = ret_conv_14_ref;
13666 FREE(ret_var.data);
13670 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
13671 LDKChannelMonitor this_arg_conv;
13672 this_arg_conv.inner = (void*)(this_arg & (~1));
13673 this_arg_conv.is_owned = false;
13674 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
13675 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13676 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13677 for (size_t h = 0; h < ret_var.datalen; h++) {
13678 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13679 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
13680 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
13681 ret_arr_ptr[h] = ret_conv_7_ref;
13683 FREE(ret_var.data);
13687 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
13688 LDKChannelMonitor this_arg_conv;
13689 this_arg_conv.inner = (void*)(this_arg & (~1));
13690 this_arg_conv.is_owned = false;
13691 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13692 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
13693 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
13694 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
13695 for (size_t m = 0; m < ret_var.datalen; m++) {
13696 LDKTransaction ret_conv_12_var = ret_var.data[m];
13697 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13698 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
13699 Transaction_free(ret_conv_12_var);
13700 ret_arr_ptr[m] = ret_conv_12_arr;
13702 FREE(ret_var.data);
13706 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) {
13707 LDKChannelMonitor this_arg_conv;
13708 this_arg_conv.inner = (void*)(this_arg & (~1));
13709 this_arg_conv.is_owned = false;
13710 unsigned char header_arr[80];
13711 CHECK(*((uint32_t*)header) == 80);
13712 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13713 unsigned char (*header_ref)[80] = &header_arr;
13714 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13715 txdata_constr.datalen = *((uint32_t*)txdata);
13716 if (txdata_constr.datalen > 0)
13717 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13719 txdata_constr.data = NULL;
13720 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13721 for (size_t e = 0; e < txdata_constr.datalen; e++) {
13722 uint32_t txdata_conv_30 = txdata_vals[e];
13723 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
13724 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
13725 txdata_constr.data[e] = txdata_conv_30_conv;
13727 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13728 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13729 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13730 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);
13731 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13732 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13733 for (size_t x = 0; x < ret_var.datalen; x++) {
13734 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13735 *ret_conv_49_ref = ret_var.data[x];
13736 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13738 FREE(ret_var.data);
13742 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) {
13743 LDKChannelMonitor this_arg_conv;
13744 this_arg_conv.inner = (void*)(this_arg & (~1));
13745 this_arg_conv.is_owned = false;
13746 unsigned char header_arr[80];
13747 CHECK(*((uint32_t*)header) == 80);
13748 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13749 unsigned char (*header_ref)[80] = &header_arr;
13750 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13751 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13752 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13753 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
13756 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) {
13757 LDKChannelMonitor this_arg_conv;
13758 this_arg_conv.inner = (void*)(this_arg & (~1));
13759 this_arg_conv.is_owned = false;
13760 unsigned char header_arr[80];
13761 CHECK(*((uint32_t*)header) == 80);
13762 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13763 unsigned char (*header_ref)[80] = &header_arr;
13764 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13765 txdata_constr.datalen = *((uint32_t*)txdata);
13766 if (txdata_constr.datalen > 0)
13767 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13769 txdata_constr.data = NULL;
13770 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
13771 for (size_t e = 0; e < txdata_constr.datalen; e++) {
13772 uint32_t txdata_conv_30 = txdata_vals[e];
13773 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
13774 txdata_conv_30_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1));
13775 txdata_constr.data[e] = txdata_conv_30_conv;
13777 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13778 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13779 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13780 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);
13781 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13782 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13783 for (size_t x = 0; x < ret_var.datalen; x++) {
13784 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13785 *ret_conv_49_ref = ret_var.data[x];
13786 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13788 FREE(ret_var.data);
13792 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) {
13793 LDKChannelMonitor this_arg_conv;
13794 this_arg_conv.inner = (void*)(this_arg & (~1));
13795 this_arg_conv.is_owned = false;
13796 unsigned char txid_arr[32];
13797 CHECK(*((uint32_t*)txid) == 32);
13798 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
13799 unsigned char (*txid_ref)[32] = &txid_arr;
13800 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13801 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13802 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13803 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
13806 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) {
13807 LDKChannelMonitor this_arg_conv;
13808 this_arg_conv.inner = (void*)(this_arg & (~1));
13809 this_arg_conv.is_owned = false;
13810 unsigned char header_arr[80];
13811 CHECK(*((uint32_t*)header) == 80);
13812 memcpy(header_arr, (uint8_t*)(header + 4), 80);
13813 unsigned char (*header_ref)[80] = &header_arr;
13814 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13815 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13816 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13817 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
13818 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13819 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13820 for (size_t x = 0; x < ret_var.datalen; x++) {
13821 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13822 *ret_conv_49_ref = ret_var.data[x];
13823 ret_arr_ptr[x] = (uint64_t)ret_conv_49_ref;
13825 FREE(ret_var.data);
13829 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
13830 LDKChannelMonitor this_arg_conv;
13831 this_arg_conv.inner = (void*)(this_arg & (~1));
13832 this_arg_conv.is_owned = false;
13833 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
13834 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
13835 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
13836 for (size_t m = 0; m < ret_var.datalen; m++) {
13837 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13838 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
13839 ret_arr_ptr[m] = ret_conv_12_arr;
13841 FREE(ret_var.data);
13845 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
13846 LDKChannelMonitor this_arg_conv;
13847 this_arg_conv.inner = (void*)(this_arg & (~1));
13848 this_arg_conv.is_owned = false;
13849 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
13850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13852 uint64_t ret_ref = (uint64_t)ret_var.inner;
13853 if (ret_var.is_owned) {
13859 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
13860 LDKChannelMonitor this_arg_conv;
13861 this_arg_conv.inner = (void*)(this_arg & (~1));
13862 this_arg_conv.is_owned = false;
13863 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
13864 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
13865 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
13866 for (size_t j = 0; j < ret_var.datalen; j++) {
13867 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
13868 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
13869 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
13870 ret_arr_ptr[j] = ret_conv_9_ref;
13872 FREE(ret_var.data);
13876 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
13877 if ((this_ptr & 1) != 0) return;
13878 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
13879 FREE((void*)this_ptr);
13880 Persist_free(this_ptr_conv);
13883 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
13884 LDKu8slice ser_ref;
13885 ser_ref.datalen = *((uint32_t*)ser);
13886 ser_ref.data = (int8_t*)(ser + 4);
13887 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
13888 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13889 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
13890 return (uint64_t)ret_conv;
13893 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
13894 LDKOutPoint this_obj_conv;
13895 this_obj_conv.inner = (void*)(this_obj & (~1));
13896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13897 OutPoint_free(this_obj_conv);
13900 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
13901 LDKOutPoint this_ptr_conv;
13902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13903 this_ptr_conv.is_owned = false;
13904 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13905 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
13909 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
13910 LDKOutPoint this_ptr_conv;
13911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13912 this_ptr_conv.is_owned = false;
13913 LDKThirtyTwoBytes val_ref;
13914 CHECK(*((uint32_t*)val) == 32);
13915 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13916 OutPoint_set_txid(&this_ptr_conv, val_ref);
13919 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
13920 LDKOutPoint this_ptr_conv;
13921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13922 this_ptr_conv.is_owned = false;
13923 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
13927 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
13928 LDKOutPoint this_ptr_conv;
13929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13930 this_ptr_conv.is_owned = false;
13931 OutPoint_set_index(&this_ptr_conv, val);
13934 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
13935 LDKThirtyTwoBytes txid_arg_ref;
13936 CHECK(*((uint32_t*)txid_arg) == 32);
13937 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
13938 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
13939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13941 uint64_t ret_ref = (uint64_t)ret_var.inner;
13942 if (ret_var.is_owned) {
13948 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
13949 LDKOutPoint orig_conv;
13950 orig_conv.inner = (void*)(orig & (~1));
13951 orig_conv.is_owned = false;
13952 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
13953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13955 uint64_t ret_ref = (uint64_t)ret_var.inner;
13956 if (ret_var.is_owned) {
13962 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
13963 LDKOutPoint a_conv;
13964 a_conv.inner = (void*)(a & (~1));
13965 a_conv.is_owned = false;
13966 LDKOutPoint b_conv;
13967 b_conv.inner = (void*)(b & (~1));
13968 b_conv.is_owned = false;
13969 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
13973 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
13974 LDKOutPoint o_conv;
13975 o_conv.inner = (void*)(o & (~1));
13976 o_conv.is_owned = false;
13977 int64_t ret_val = OutPoint_hash(&o_conv);
13981 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
13982 LDKOutPoint this_arg_conv;
13983 this_arg_conv.inner = (void*)(this_arg & (~1));
13984 this_arg_conv.is_owned = false;
13985 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13986 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
13990 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
13991 LDKOutPoint obj_conv;
13992 obj_conv.inner = (void*)(obj & (~1));
13993 obj_conv.is_owned = false;
13994 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
13995 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13996 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13997 CVec_u8Z_free(ret_var);
14001 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
14002 LDKu8slice ser_ref;
14003 ser_ref.datalen = *((uint32_t*)ser);
14004 ser_ref.data = (int8_t*)(ser + 4);
14005 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14006 *ret_conv = OutPoint_read(ser_ref);
14007 return (uint64_t)ret_conv;
14010 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
14011 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14012 this_obj_conv.inner = (void*)(this_obj & (~1));
14013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14014 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14017 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14018 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14020 this_ptr_conv.is_owned = false;
14021 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14024 uint64_t ret_ref = (uint64_t)ret_var.inner;
14025 if (ret_var.is_owned) {
14031 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14032 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14034 this_ptr_conv.is_owned = false;
14035 LDKOutPoint val_conv;
14036 val_conv.inner = (void*)(val & (~1));
14037 val_conv.is_owned = (val & 1) || (val == 0);
14038 val_conv = OutPoint_clone(&val_conv);
14039 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14042 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
14043 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14045 this_ptr_conv.is_owned = false;
14046 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14047 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14051 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14052 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14054 this_ptr_conv.is_owned = false;
14055 LDKPublicKey val_ref;
14056 CHECK(*((uint32_t*)val) == 33);
14057 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14058 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14061 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
14062 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14064 this_ptr_conv.is_owned = false;
14065 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14069 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
14070 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14072 this_ptr_conv.is_owned = false;
14073 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14076 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14077 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14079 this_ptr_conv.is_owned = false;
14080 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14081 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14082 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14085 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
14086 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14088 this_ptr_conv.is_owned = false;
14089 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14090 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
14094 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
14095 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14097 this_ptr_conv.is_owned = false;
14098 LDKPublicKey val_ref;
14099 CHECK(*((uint32_t*)val) == 33);
14100 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14101 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14104 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14105 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14107 this_ptr_conv.is_owned = false;
14108 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14109 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14113 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14114 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14116 this_ptr_conv.is_owned = false;
14117 LDKThirtyTwoBytes val_ref;
14118 CHECK(*((uint32_t*)val) == 32);
14119 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14120 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14123 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14124 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14126 this_ptr_conv.is_owned = false;
14127 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14131 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14132 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14134 this_ptr_conv.is_owned = false;
14135 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14138 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) {
14139 LDKOutPoint outpoint_arg_conv;
14140 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14141 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14142 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14143 LDKPublicKey per_commitment_point_arg_ref;
14144 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
14145 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
14146 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14147 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14148 LDKPublicKey revocation_pubkey_arg_ref;
14149 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
14150 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
14151 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14152 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14153 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14154 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);
14155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14157 uint64_t ret_ref = (uint64_t)ret_var.inner;
14158 if (ret_var.is_owned) {
14164 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
14165 LDKDelayedPaymentOutputDescriptor orig_conv;
14166 orig_conv.inner = (void*)(orig & (~1));
14167 orig_conv.is_owned = false;
14168 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14171 uint64_t ret_ref = (uint64_t)ret_var.inner;
14172 if (ret_var.is_owned) {
14178 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
14179 LDKDelayedPaymentOutputDescriptor obj_conv;
14180 obj_conv.inner = (void*)(obj & (~1));
14181 obj_conv.is_owned = false;
14182 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14183 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14184 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14185 CVec_u8Z_free(ret_var);
14189 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
14190 LDKu8slice ser_ref;
14191 ser_ref.datalen = *((uint32_t*)ser);
14192 ser_ref.data = (int8_t*)(ser + 4);
14193 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14194 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14195 return (uint64_t)ret_conv;
14198 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
14199 LDKStaticPaymentOutputDescriptor this_obj_conv;
14200 this_obj_conv.inner = (void*)(this_obj & (~1));
14201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14202 StaticPaymentOutputDescriptor_free(this_obj_conv);
14205 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14206 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14208 this_ptr_conv.is_owned = false;
14209 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14212 uint64_t ret_ref = (uint64_t)ret_var.inner;
14213 if (ret_var.is_owned) {
14219 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14220 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14222 this_ptr_conv.is_owned = false;
14223 LDKOutPoint val_conv;
14224 val_conv.inner = (void*)(val & (~1));
14225 val_conv.is_owned = (val & 1) || (val == 0);
14226 val_conv = OutPoint_clone(&val_conv);
14227 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14230 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14231 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14233 this_ptr_conv.is_owned = false;
14234 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14235 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14236 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14239 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14240 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14242 this_ptr_conv.is_owned = false;
14243 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14244 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14248 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14249 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14251 this_ptr_conv.is_owned = false;
14252 LDKThirtyTwoBytes val_ref;
14253 CHECK(*((uint32_t*)val) == 32);
14254 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14255 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14258 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14259 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14261 this_ptr_conv.is_owned = false;
14262 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14266 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14267 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14269 this_ptr_conv.is_owned = false;
14270 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14273 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) {
14274 LDKOutPoint outpoint_arg_conv;
14275 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14276 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14277 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14278 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14279 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14280 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14281 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14282 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14283 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14286 uint64_t ret_ref = (uint64_t)ret_var.inner;
14287 if (ret_var.is_owned) {
14293 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
14294 LDKStaticPaymentOutputDescriptor orig_conv;
14295 orig_conv.inner = (void*)(orig & (~1));
14296 orig_conv.is_owned = false;
14297 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14300 uint64_t ret_ref = (uint64_t)ret_var.inner;
14301 if (ret_var.is_owned) {
14307 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
14308 LDKStaticPaymentOutputDescriptor obj_conv;
14309 obj_conv.inner = (void*)(obj & (~1));
14310 obj_conv.is_owned = false;
14311 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14312 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14313 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14314 CVec_u8Z_free(ret_var);
14318 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
14319 LDKu8slice ser_ref;
14320 ser_ref.datalen = *((uint32_t*)ser);
14321 ser_ref.data = (int8_t*)(ser + 4);
14322 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14323 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14324 return (uint64_t)ret_conv;
14327 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
14328 if ((this_ptr & 1) != 0) return;
14329 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14330 FREE((void*)this_ptr);
14331 SpendableOutputDescriptor_free(this_ptr_conv);
14334 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
14335 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14336 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14337 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14338 uint64_t ret_ref = (uint64_t)ret_copy;
14342 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
14343 LDKOutPoint outpoint_conv;
14344 outpoint_conv.inner = (void*)(outpoint & (~1));
14345 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
14346 outpoint_conv = OutPoint_clone(&outpoint_conv);
14347 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
14348 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
14349 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14350 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
14351 uint64_t ret_ref = (uint64_t)ret_copy;
14355 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
14356 LDKDelayedPaymentOutputDescriptor a_conv;
14357 a_conv.inner = (void*)(a & (~1));
14358 a_conv.is_owned = (a & 1) || (a == 0);
14359 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
14360 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14361 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
14362 uint64_t ret_ref = (uint64_t)ret_copy;
14366 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
14367 LDKStaticPaymentOutputDescriptor a_conv;
14368 a_conv.inner = (void*)(a & (~1));
14369 a_conv.is_owned = (a & 1) || (a == 0);
14370 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
14371 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14372 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
14373 uint64_t ret_ref = (uint64_t)ret_copy;
14377 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
14378 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14379 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14380 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14381 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14382 CVec_u8Z_free(ret_var);
14386 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
14387 LDKu8slice ser_ref;
14388 ser_ref.datalen = *((uint32_t*)ser);
14389 ser_ref.data = (int8_t*)(ser + 4);
14390 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14391 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14392 return (uint64_t)ret_conv;
14395 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
14396 if ((this_ptr & 1) != 0) return;
14397 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14398 FREE((void*)this_ptr);
14399 BaseSign_free(this_ptr_conv);
14402 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
14403 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14404 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14405 *ret_ret = Sign_clone(orig_conv);
14406 return (uint64_t)ret_ret;
14409 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
14410 if ((this_ptr & 1) != 0) return;
14411 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14412 FREE((void*)this_ptr);
14413 Sign_free(this_ptr_conv);
14416 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
14417 if ((this_ptr & 1) != 0) return;
14418 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14419 FREE((void*)this_ptr);
14420 KeysInterface_free(this_ptr_conv);
14423 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
14424 LDKInMemorySigner this_obj_conv;
14425 this_obj_conv.inner = (void*)(this_obj & (~1));
14426 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14427 InMemorySigner_free(this_obj_conv);
14430 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
14431 LDKInMemorySigner this_ptr_conv;
14432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14433 this_ptr_conv.is_owned = false;
14434 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14435 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
14439 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
14440 LDKInMemorySigner this_ptr_conv;
14441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14442 this_ptr_conv.is_owned = false;
14443 LDKSecretKey val_ref;
14444 CHECK(*((uint32_t*)val) == 32);
14445 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14446 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14449 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
14450 LDKInMemorySigner this_ptr_conv;
14451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14452 this_ptr_conv.is_owned = false;
14453 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14454 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
14458 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
14459 LDKInMemorySigner this_ptr_conv;
14460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14461 this_ptr_conv.is_owned = false;
14462 LDKSecretKey val_ref;
14463 CHECK(*((uint32_t*)val) == 32);
14464 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14465 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14468 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
14469 LDKInMemorySigner this_ptr_conv;
14470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14471 this_ptr_conv.is_owned = false;
14472 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14473 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
14477 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
14478 LDKInMemorySigner this_ptr_conv;
14479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14480 this_ptr_conv.is_owned = false;
14481 LDKSecretKey val_ref;
14482 CHECK(*((uint32_t*)val) == 32);
14483 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14484 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14487 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
14488 LDKInMemorySigner this_ptr_conv;
14489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14490 this_ptr_conv.is_owned = false;
14491 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14492 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
14496 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
14497 LDKInMemorySigner this_ptr_conv;
14498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14499 this_ptr_conv.is_owned = false;
14500 LDKSecretKey val_ref;
14501 CHECK(*((uint32_t*)val) == 32);
14502 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14503 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14506 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
14507 LDKInMemorySigner this_ptr_conv;
14508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14509 this_ptr_conv.is_owned = false;
14510 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14511 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
14515 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
14516 LDKInMemorySigner this_ptr_conv;
14517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14518 this_ptr_conv.is_owned = false;
14519 LDKSecretKey val_ref;
14520 CHECK(*((uint32_t*)val) == 32);
14521 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
14522 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14525 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
14526 LDKInMemorySigner this_ptr_conv;
14527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14528 this_ptr_conv.is_owned = false;
14529 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14530 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
14534 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
14535 LDKInMemorySigner this_ptr_conv;
14536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14537 this_ptr_conv.is_owned = false;
14538 LDKThirtyTwoBytes val_ref;
14539 CHECK(*((uint32_t*)val) == 32);
14540 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14541 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14544 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
14545 LDKInMemorySigner orig_conv;
14546 orig_conv.inner = (void*)(orig & (~1));
14547 orig_conv.is_owned = false;
14548 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14551 uint64_t ret_ref = (uint64_t)ret_var.inner;
14552 if (ret_var.is_owned) {
14558 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) {
14559 LDKSecretKey funding_key_ref;
14560 CHECK(*((uint32_t*)funding_key) == 32);
14561 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
14562 LDKSecretKey revocation_base_key_ref;
14563 CHECK(*((uint32_t*)revocation_base_key) == 32);
14564 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
14565 LDKSecretKey payment_key_ref;
14566 CHECK(*((uint32_t*)payment_key) == 32);
14567 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
14568 LDKSecretKey delayed_payment_base_key_ref;
14569 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
14570 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
14571 LDKSecretKey htlc_base_key_ref;
14572 CHECK(*((uint32_t*)htlc_base_key) == 32);
14573 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
14574 LDKThirtyTwoBytes commitment_seed_ref;
14575 CHECK(*((uint32_t*)commitment_seed) == 32);
14576 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
14577 LDKThirtyTwoBytes channel_keys_id_ref;
14578 CHECK(*((uint32_t*)channel_keys_id) == 32);
14579 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
14580 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);
14581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14583 uint64_t ret_ref = (uint64_t)ret_var.inner;
14584 if (ret_var.is_owned) {
14590 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
14591 LDKInMemorySigner this_arg_conv;
14592 this_arg_conv.inner = (void*)(this_arg & (~1));
14593 this_arg_conv.is_owned = false;
14594 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14597 uint64_t ret_ref = (uint64_t)ret_var.inner;
14598 if (ret_var.is_owned) {
14604 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
14605 LDKInMemorySigner this_arg_conv;
14606 this_arg_conv.inner = (void*)(this_arg & (~1));
14607 this_arg_conv.is_owned = false;
14608 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14612 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
14613 LDKInMemorySigner this_arg_conv;
14614 this_arg_conv.inner = (void*)(this_arg & (~1));
14615 this_arg_conv.is_owned = false;
14616 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14620 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
14621 LDKInMemorySigner this_arg_conv;
14622 this_arg_conv.inner = (void*)(this_arg & (~1));
14623 this_arg_conv.is_owned = false;
14624 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14628 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
14629 LDKInMemorySigner this_arg_conv;
14630 this_arg_conv.inner = (void*)(this_arg & (~1));
14631 this_arg_conv.is_owned = false;
14632 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14635 uint64_t ret_ref = (uint64_t)ret_var.inner;
14636 if (ret_var.is_owned) {
14642 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
14643 LDKInMemorySigner this_arg_conv;
14644 this_arg_conv.inner = (void*)(this_arg & (~1));
14645 this_arg_conv.is_owned = false;
14646 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
14647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14649 uint64_t ret_ref = (uint64_t)ret_var.inner;
14650 if (ret_var.is_owned) {
14656 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) {
14657 LDKInMemorySigner this_arg_conv;
14658 this_arg_conv.inner = (void*)(this_arg & (~1));
14659 this_arg_conv.is_owned = false;
14660 LDKTransaction spend_tx_ref;
14661 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14662 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14663 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14664 spend_tx_ref.data_is_owned = true;
14665 LDKStaticPaymentOutputDescriptor descriptor_conv;
14666 descriptor_conv.inner = (void*)(descriptor & (~1));
14667 descriptor_conv.is_owned = false;
14668 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14669 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14670 return (uint64_t)ret_conv;
14673 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) {
14674 LDKInMemorySigner this_arg_conv;
14675 this_arg_conv.inner = (void*)(this_arg & (~1));
14676 this_arg_conv.is_owned = false;
14677 LDKTransaction spend_tx_ref;
14678 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
14679 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
14680 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
14681 spend_tx_ref.data_is_owned = true;
14682 LDKDelayedPaymentOutputDescriptor descriptor_conv;
14683 descriptor_conv.inner = (void*)(descriptor & (~1));
14684 descriptor_conv.is_owned = false;
14685 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14686 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
14687 return (uint64_t)ret_conv;
14690 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
14691 LDKInMemorySigner this_arg_conv;
14692 this_arg_conv.inner = (void*)(this_arg & (~1));
14693 this_arg_conv.is_owned = false;
14694 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
14695 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
14696 return (uint64_t)ret_ret;
14699 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
14700 LDKInMemorySigner this_arg_conv;
14701 this_arg_conv.inner = (void*)(this_arg & (~1));
14702 this_arg_conv.is_owned = false;
14703 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
14704 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
14705 return (uint64_t)ret_ret;
14708 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
14709 LDKInMemorySigner obj_conv;
14710 obj_conv.inner = (void*)(obj & (~1));
14711 obj_conv.is_owned = false;
14712 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
14713 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14714 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14715 CVec_u8Z_free(ret_var);
14719 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
14720 LDKu8slice ser_ref;
14721 ser_ref.datalen = *((uint32_t*)ser);
14722 ser_ref.data = (int8_t*)(ser + 4);
14723 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14724 *ret_conv = InMemorySigner_read(ser_ref);
14725 return (uint64_t)ret_conv;
14728 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
14729 LDKKeysManager this_obj_conv;
14730 this_obj_conv.inner = (void*)(this_obj & (~1));
14731 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14732 KeysManager_free(this_obj_conv);
14735 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
14736 unsigned char seed_arr[32];
14737 CHECK(*((uint32_t*)seed) == 32);
14738 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
14739 unsigned char (*seed_ref)[32] = &seed_arr;
14740 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
14741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14743 uint64_t ret_ref = (uint64_t)ret_var.inner;
14744 if (ret_var.is_owned) {
14750 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
14751 LDKKeysManager this_arg_conv;
14752 this_arg_conv.inner = (void*)(this_arg & (~1));
14753 this_arg_conv.is_owned = false;
14754 unsigned char params_arr[32];
14755 CHECK(*((uint32_t*)params) == 32);
14756 memcpy(params_arr, (uint8_t*)(params + 4), 32);
14757 unsigned char (*params_ref)[32] = ¶ms_arr;
14758 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
14759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14761 uint64_t ret_ref = (uint64_t)ret_var.inner;
14762 if (ret_var.is_owned) {
14768 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) {
14769 LDKKeysManager this_arg_conv;
14770 this_arg_conv.inner = (void*)(this_arg & (~1));
14771 this_arg_conv.is_owned = false;
14772 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
14773 descriptors_constr.datalen = *((uint32_t*)descriptors);
14774 if (descriptors_constr.datalen > 0)
14775 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14777 descriptors_constr.data = NULL;
14778 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
14779 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
14780 uint32_t descriptors_conv_27 = descriptors_vals[b];
14781 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
14782 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
14783 descriptors_constr.data[b] = descriptors_conv_27_conv;
14785 LDKCVec_TxOutZ outputs_constr;
14786 outputs_constr.datalen = *((uint32_t*)outputs);
14787 if (outputs_constr.datalen > 0)
14788 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14790 outputs_constr.data = NULL;
14791 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
14792 for (size_t h = 0; h < outputs_constr.datalen; h++) {
14793 uint32_t outputs_conv_7 = outputs_vals[h];
14794 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
14795 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
14796 outputs_constr.data[h] = outputs_conv_7_conv;
14798 LDKCVec_u8Z change_destination_script_ref;
14799 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
14800 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
14801 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
14802 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14803 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
14804 return (uint64_t)ret_conv;
14807 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
14808 LDKKeysManager this_arg_conv;
14809 this_arg_conv.inner = (void*)(this_arg & (~1));
14810 this_arg_conv.is_owned = false;
14811 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
14812 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
14813 return (uint64_t)ret_ret;
14816 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
14817 LDKChannelManager this_obj_conv;
14818 this_obj_conv.inner = (void*)(this_obj & (~1));
14819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14820 ChannelManager_free(this_obj_conv);
14823 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
14824 LDKChainParameters this_obj_conv;
14825 this_obj_conv.inner = (void*)(this_obj & (~1));
14826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14827 ChainParameters_free(this_obj_conv);
14830 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
14831 LDKChainParameters this_ptr_conv;
14832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14833 this_ptr_conv.is_owned = false;
14834 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
14838 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
14839 LDKChainParameters this_ptr_conv;
14840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14841 this_ptr_conv.is_owned = false;
14842 LDKNetwork val_conv = LDKNetwork_from_js(val);
14843 ChainParameters_set_network(&this_ptr_conv, val_conv);
14846 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
14847 LDKChainParameters this_ptr_conv;
14848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14849 this_ptr_conv.is_owned = false;
14850 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
14851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14853 uint64_t ret_ref = (uint64_t)ret_var.inner;
14854 if (ret_var.is_owned) {
14860 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
14861 LDKChainParameters this_ptr_conv;
14862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14863 this_ptr_conv.is_owned = false;
14864 LDKBestBlock val_conv;
14865 val_conv.inner = (void*)(val & (~1));
14866 val_conv.is_owned = (val & 1) || (val == 0);
14867 val_conv = BestBlock_clone(&val_conv);
14868 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
14871 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
14872 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
14873 LDKBestBlock best_block_arg_conv;
14874 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
14875 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
14876 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
14877 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
14878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14880 uint64_t ret_ref = (uint64_t)ret_var.inner;
14881 if (ret_var.is_owned) {
14887 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
14888 LDKChainParameters orig_conv;
14889 orig_conv.inner = (void*)(orig & (~1));
14890 orig_conv.is_owned = false;
14891 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
14892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14894 uint64_t ret_ref = (uint64_t)ret_var.inner;
14895 if (ret_var.is_owned) {
14901 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
14902 LDKCounterpartyForwardingInfo this_obj_conv;
14903 this_obj_conv.inner = (void*)(this_obj & (~1));
14904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14905 CounterpartyForwardingInfo_free(this_obj_conv);
14908 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
14909 LDKCounterpartyForwardingInfo this_ptr_conv;
14910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14911 this_ptr_conv.is_owned = false;
14912 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
14916 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14917 LDKCounterpartyForwardingInfo this_ptr_conv;
14918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14919 this_ptr_conv.is_owned = false;
14920 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
14923 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
14924 LDKCounterpartyForwardingInfo this_ptr_conv;
14925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14926 this_ptr_conv.is_owned = false;
14927 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
14931 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14932 LDKCounterpartyForwardingInfo this_ptr_conv;
14933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14934 this_ptr_conv.is_owned = false;
14935 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
14938 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
14939 LDKCounterpartyForwardingInfo this_ptr_conv;
14940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14941 this_ptr_conv.is_owned = false;
14942 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
14946 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14947 LDKCounterpartyForwardingInfo this_ptr_conv;
14948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14949 this_ptr_conv.is_owned = false;
14950 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
14953 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
14954 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
14955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14957 uint64_t ret_ref = (uint64_t)ret_var.inner;
14958 if (ret_var.is_owned) {
14964 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
14965 LDKCounterpartyForwardingInfo orig_conv;
14966 orig_conv.inner = (void*)(orig & (~1));
14967 orig_conv.is_owned = false;
14968 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
14969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14971 uint64_t ret_ref = (uint64_t)ret_var.inner;
14972 if (ret_var.is_owned) {
14978 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
14979 LDKChannelCounterparty this_obj_conv;
14980 this_obj_conv.inner = (void*)(this_obj & (~1));
14981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14982 ChannelCounterparty_free(this_obj_conv);
14985 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
14986 LDKChannelCounterparty this_ptr_conv;
14987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14988 this_ptr_conv.is_owned = false;
14989 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14990 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
14994 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
14995 LDKChannelCounterparty this_ptr_conv;
14996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14997 this_ptr_conv.is_owned = false;
14998 LDKPublicKey val_ref;
14999 CHECK(*((uint32_t*)val) == 33);
15000 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15001 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
15004 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
15005 LDKChannelCounterparty this_ptr_conv;
15006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15007 this_ptr_conv.is_owned = false;
15008 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
15009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15011 uint64_t ret_ref = (uint64_t)ret_var.inner;
15012 if (ret_var.is_owned) {
15018 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
15019 LDKChannelCounterparty this_ptr_conv;
15020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15021 this_ptr_conv.is_owned = false;
15022 LDKInitFeatures val_conv;
15023 val_conv.inner = (void*)(val & (~1));
15024 val_conv.is_owned = (val & 1) || (val == 0);
15025 val_conv = InitFeatures_clone(&val_conv);
15026 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
15029 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15030 LDKChannelCounterparty this_ptr_conv;
15031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15032 this_ptr_conv.is_owned = false;
15033 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
15037 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
15038 LDKChannelCounterparty this_ptr_conv;
15039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15040 this_ptr_conv.is_owned = false;
15041 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
15044 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
15045 LDKChannelCounterparty this_ptr_conv;
15046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15047 this_ptr_conv.is_owned = false;
15048 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
15049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15051 uint64_t ret_ref = (uint64_t)ret_var.inner;
15052 if (ret_var.is_owned) {
15058 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
15059 LDKChannelCounterparty this_ptr_conv;
15060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15061 this_ptr_conv.is_owned = false;
15062 LDKCounterpartyForwardingInfo val_conv;
15063 val_conv.inner = (void*)(val & (~1));
15064 val_conv.is_owned = (val & 1) || (val == 0);
15065 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
15066 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
15069 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
15070 LDKPublicKey node_id_arg_ref;
15071 CHECK(*((uint32_t*)node_id_arg) == 33);
15072 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
15073 LDKInitFeatures features_arg_conv;
15074 features_arg_conv.inner = (void*)(features_arg & (~1));
15075 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15076 features_arg_conv = InitFeatures_clone(&features_arg_conv);
15077 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
15078 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
15079 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
15080 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
15081 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
15082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15084 uint64_t ret_ref = (uint64_t)ret_var.inner;
15085 if (ret_var.is_owned) {
15091 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
15092 LDKChannelCounterparty orig_conv;
15093 orig_conv.inner = (void*)(orig & (~1));
15094 orig_conv.is_owned = false;
15095 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
15096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15098 uint64_t ret_ref = (uint64_t)ret_var.inner;
15099 if (ret_var.is_owned) {
15105 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
15106 LDKChannelDetails this_obj_conv;
15107 this_obj_conv.inner = (void*)(this_obj & (~1));
15108 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15109 ChannelDetails_free(this_obj_conv);
15112 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
15113 LDKChannelDetails this_ptr_conv;
15114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15115 this_ptr_conv.is_owned = false;
15116 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15117 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
15121 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15122 LDKChannelDetails this_ptr_conv;
15123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15124 this_ptr_conv.is_owned = false;
15125 LDKThirtyTwoBytes val_ref;
15126 CHECK(*((uint32_t*)val) == 32);
15127 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15128 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15131 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
15132 LDKChannelDetails this_ptr_conv;
15133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15134 this_ptr_conv.is_owned = false;
15135 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
15136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15138 uint64_t ret_ref = (uint64_t)ret_var.inner;
15139 if (ret_var.is_owned) {
15145 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
15146 LDKChannelDetails this_ptr_conv;
15147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15148 this_ptr_conv.is_owned = false;
15149 LDKChannelCounterparty val_conv;
15150 val_conv.inner = (void*)(val & (~1));
15151 val_conv.is_owned = (val & 1) || (val == 0);
15152 val_conv = ChannelCounterparty_clone(&val_conv);
15153 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
15156 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
15157 LDKChannelDetails this_ptr_conv;
15158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15159 this_ptr_conv.is_owned = false;
15160 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15163 uint64_t ret_ref = (uint64_t)ret_var.inner;
15164 if (ret_var.is_owned) {
15170 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
15171 LDKChannelDetails this_ptr_conv;
15172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15173 this_ptr_conv.is_owned = false;
15174 LDKOutPoint val_conv;
15175 val_conv.inner = (void*)(val & (~1));
15176 val_conv.is_owned = (val & 1) || (val == 0);
15177 val_conv = OutPoint_clone(&val_conv);
15178 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15181 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
15182 LDKChannelDetails this_ptr_conv;
15183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15184 this_ptr_conv.is_owned = false;
15185 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15186 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15187 uint64_t ret_ref = (uint64_t)ret_copy;
15191 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
15192 LDKChannelDetails this_ptr_conv;
15193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15194 this_ptr_conv.is_owned = false;
15195 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15196 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15197 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15200 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
15201 LDKChannelDetails this_ptr_conv;
15202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15203 this_ptr_conv.is_owned = false;
15204 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15208 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15209 LDKChannelDetails this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15215 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15216 LDKChannelDetails this_ptr_conv;
15217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15218 this_ptr_conv.is_owned = false;
15219 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15220 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
15221 uint64_t ret_ref = (uint64_t)ret_copy;
15225 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
15226 LDKChannelDetails this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15230 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15231 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
15234 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
15235 LDKChannelDetails this_ptr_conv;
15236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15237 this_ptr_conv.is_owned = false;
15238 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15242 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
15243 LDKChannelDetails this_ptr_conv;
15244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15245 this_ptr_conv.is_owned = false;
15246 ChannelDetails_set_user_id(&this_ptr_conv, val);
15249 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
15250 LDKChannelDetails this_ptr_conv;
15251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15252 this_ptr_conv.is_owned = false;
15253 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15257 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15258 LDKChannelDetails this_ptr_conv;
15259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15260 this_ptr_conv.is_owned = false;
15261 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15264 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
15265 LDKChannelDetails this_ptr_conv;
15266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15267 this_ptr_conv.is_owned = false;
15268 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15272 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
15273 LDKChannelDetails this_ptr_conv;
15274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15275 this_ptr_conv.is_owned = false;
15276 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15279 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
15280 LDKChannelDetails this_ptr_conv;
15281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15282 this_ptr_conv.is_owned = false;
15283 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15284 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
15285 uint64_t ret_ref = (uint64_t)ret_copy;
15289 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
15290 LDKChannelDetails this_ptr_conv;
15291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15292 this_ptr_conv.is_owned = false;
15293 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
15294 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
15295 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
15298 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
15299 LDKChannelDetails this_ptr_conv;
15300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15301 this_ptr_conv.is_owned = false;
15302 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15303 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
15304 uint64_t ret_ref = (uint64_t)ret_copy;
15308 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
15309 LDKChannelDetails this_ptr_conv;
15310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15311 this_ptr_conv.is_owned = false;
15312 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
15313 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
15314 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
15317 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
15318 LDKChannelDetails this_ptr_conv;
15319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15320 this_ptr_conv.is_owned = false;
15321 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15325 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
15326 LDKChannelDetails this_ptr_conv;
15327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15328 this_ptr_conv.is_owned = false;
15329 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15332 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
15333 LDKChannelDetails this_ptr_conv;
15334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15335 this_ptr_conv.is_owned = false;
15336 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15340 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
15341 LDKChannelDetails this_ptr_conv;
15342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15343 this_ptr_conv.is_owned = false;
15344 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15347 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
15348 LDKChannelDetails this_ptr_conv;
15349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15350 this_ptr_conv.is_owned = false;
15351 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15355 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
15356 LDKChannelDetails this_ptr_conv;
15357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15358 this_ptr_conv.is_owned = false;
15359 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15362 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
15363 LDKChannelDetails this_ptr_conv;
15364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15365 this_ptr_conv.is_owned = false;
15366 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15370 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
15371 LDKChannelDetails this_ptr_conv;
15372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15373 this_ptr_conv.is_owned = false;
15374 ChannelDetails_set_is_public(&this_ptr_conv, val);
15377 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) {
15378 LDKThirtyTwoBytes channel_id_arg_ref;
15379 CHECK(*((uint32_t*)channel_id_arg) == 32);
15380 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
15381 LDKChannelCounterparty counterparty_arg_conv;
15382 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
15383 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
15384 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
15385 LDKOutPoint funding_txo_arg_conv;
15386 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
15387 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
15388 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
15389 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
15390 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
15391 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
15392 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
15393 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
15394 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
15395 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
15396 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);
15397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15399 uint64_t ret_ref = (uint64_t)ret_var.inner;
15400 if (ret_var.is_owned) {
15406 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
15407 LDKChannelDetails orig_conv;
15408 orig_conv.inner = (void*)(orig & (~1));
15409 orig_conv.is_owned = false;
15410 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15413 uint64_t ret_ref = (uint64_t)ret_var.inner;
15414 if (ret_var.is_owned) {
15420 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
15421 if ((this_ptr & 1) != 0) return;
15422 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15423 FREE((void*)this_ptr);
15424 PaymentSendFailure_free(this_ptr_conv);
15427 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
15428 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15429 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15430 *ret_copy = PaymentSendFailure_clone(orig_conv);
15431 uint64_t ret_ref = (uint64_t)ret_copy;
15435 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
15436 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
15437 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
15438 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15439 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
15440 uint64_t ret_ref = (uint64_t)ret_copy;
15444 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
15445 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15446 a_constr.datalen = *((uint32_t*)a);
15447 if (a_constr.datalen > 0)
15448 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15450 a_constr.data = NULL;
15451 uint32_t* a_vals = (uint32_t*)(a + 4);
15452 for (size_t w = 0; w < a_constr.datalen; w++) {
15453 uint32_t a_conv_22 = a_vals[w];
15454 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15455 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15456 a_constr.data[w] = a_conv_22_conv;
15458 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15459 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
15460 uint64_t ret_ref = (uint64_t)ret_copy;
15464 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
15465 LDKCVec_APIErrorZ a_constr;
15466 a_constr.datalen = *((uint32_t*)a);
15467 if (a_constr.datalen > 0)
15468 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15470 a_constr.data = NULL;
15471 uint32_t* a_vals = (uint32_t*)(a + 4);
15472 for (size_t k = 0; k < a_constr.datalen; k++) {
15473 uint32_t a_conv_10 = a_vals[k];
15474 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
15475 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
15476 a_constr.data[k] = a_conv_10_conv;
15478 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15479 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
15480 uint64_t ret_ref = (uint64_t)ret_copy;
15484 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
15485 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
15486 a_constr.datalen = *((uint32_t*)a);
15487 if (a_constr.datalen > 0)
15488 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15490 a_constr.data = NULL;
15491 uint32_t* a_vals = (uint32_t*)(a + 4);
15492 for (size_t w = 0; w < a_constr.datalen; w++) {
15493 uint32_t a_conv_22 = a_vals[w];
15494 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
15495 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
15496 a_constr.data[w] = a_conv_22_conv;
15498 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15499 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
15500 uint64_t ret_ref = (uint64_t)ret_copy;
15504 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) {
15505 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15506 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15507 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15508 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15509 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15510 LDKUserConfig config_conv;
15511 config_conv.inner = (void*)(config & (~1));
15512 config_conv.is_owned = (config & 1) || (config == 0);
15513 config_conv = UserConfig_clone(&config_conv);
15514 LDKChainParameters params_conv;
15515 params_conv.inner = (void*)(params & (~1));
15516 params_conv.is_owned = (params & 1) || (params == 0);
15517 params_conv = ChainParameters_clone(¶ms_conv);
15518 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15521 uint64_t ret_ref = (uint64_t)ret_var.inner;
15522 if (ret_var.is_owned) {
15528 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
15529 LDKChannelManager this_arg_conv;
15530 this_arg_conv.inner = (void*)(this_arg & (~1));
15531 this_arg_conv.is_owned = false;
15532 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15535 uint64_t ret_ref = (uint64_t)ret_var.inner;
15536 if (ret_var.is_owned) {
15542 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) {
15543 LDKChannelManager this_arg_conv;
15544 this_arg_conv.inner = (void*)(this_arg & (~1));
15545 this_arg_conv.is_owned = false;
15546 LDKPublicKey their_network_key_ref;
15547 CHECK(*((uint32_t*)their_network_key) == 33);
15548 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
15549 LDKUserConfig override_config_conv;
15550 override_config_conv.inner = (void*)(override_config & (~1));
15551 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15552 override_config_conv = UserConfig_clone(&override_config_conv);
15553 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15554 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15555 return (uint64_t)ret_conv;
15558 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
15559 LDKChannelManager this_arg_conv;
15560 this_arg_conv.inner = (void*)(this_arg & (~1));
15561 this_arg_conv.is_owned = false;
15562 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15563 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15564 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15565 for (size_t q = 0; q < ret_var.datalen; q++) {
15566 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15567 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15568 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15569 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15570 if (ret_conv_16_var.is_owned) {
15571 ret_conv_16_ref |= 1;
15573 ret_arr_ptr[q] = ret_conv_16_ref;
15575 FREE(ret_var.data);
15579 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
15580 LDKChannelManager this_arg_conv;
15581 this_arg_conv.inner = (void*)(this_arg & (~1));
15582 this_arg_conv.is_owned = false;
15583 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15584 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
15585 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
15586 for (size_t q = 0; q < ret_var.datalen; q++) {
15587 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15588 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15589 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15590 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15591 if (ret_conv_16_var.is_owned) {
15592 ret_conv_16_ref |= 1;
15594 ret_arr_ptr[q] = ret_conv_16_ref;
15596 FREE(ret_var.data);
15600 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15601 LDKChannelManager this_arg_conv;
15602 this_arg_conv.inner = (void*)(this_arg & (~1));
15603 this_arg_conv.is_owned = false;
15604 unsigned char channel_id_arr[32];
15605 CHECK(*((uint32_t*)channel_id) == 32);
15606 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15607 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15608 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15609 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15610 return (uint64_t)ret_conv;
15613 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) {
15614 LDKChannelManager this_arg_conv;
15615 this_arg_conv.inner = (void*)(this_arg & (~1));
15616 this_arg_conv.is_owned = false;
15617 unsigned char channel_id_arr[32];
15618 CHECK(*((uint32_t*)channel_id) == 32);
15619 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15620 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15621 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15622 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
15623 return (uint64_t)ret_conv;
15626 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
15627 LDKChannelManager this_arg_conv;
15628 this_arg_conv.inner = (void*)(this_arg & (~1));
15629 this_arg_conv.is_owned = false;
15630 unsigned char channel_id_arr[32];
15631 CHECK(*((uint32_t*)channel_id) == 32);
15632 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
15633 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15634 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15635 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15636 return (uint64_t)ret_conv;
15639 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
15640 LDKChannelManager this_arg_conv;
15641 this_arg_conv.inner = (void*)(this_arg & (~1));
15642 this_arg_conv.is_owned = false;
15643 ChannelManager_force_close_all_channels(&this_arg_conv);
15646 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
15647 LDKChannelManager this_arg_conv;
15648 this_arg_conv.inner = (void*)(this_arg & (~1));
15649 this_arg_conv.is_owned = false;
15650 LDKRoute route_conv;
15651 route_conv.inner = (void*)(route & (~1));
15652 route_conv.is_owned = false;
15653 LDKThirtyTwoBytes payment_hash_ref;
15654 CHECK(*((uint32_t*)payment_hash) == 32);
15655 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15656 LDKThirtyTwoBytes payment_secret_ref;
15657 CHECK(*((uint32_t*)payment_secret) == 32);
15658 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
15659 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15660 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15661 return (uint64_t)ret_conv;
15664 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
15665 LDKChannelManager this_arg_conv;
15666 this_arg_conv.inner = (void*)(this_arg & (~1));
15667 this_arg_conv.is_owned = false;
15668 LDKRoute route_conv;
15669 route_conv.inner = (void*)(route & (~1));
15670 route_conv.is_owned = false;
15671 LDKThirtyTwoBytes payment_preimage_ref;
15672 CHECK(*((uint32_t*)payment_preimage) == 32);
15673 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15674 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
15675 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
15676 return (uint64_t)ret_conv;
15679 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
15680 LDKChannelManager this_arg_conv;
15681 this_arg_conv.inner = (void*)(this_arg & (~1));
15682 this_arg_conv.is_owned = false;
15683 unsigned char temporary_channel_id_arr[32];
15684 CHECK(*((uint32_t*)temporary_channel_id) == 32);
15685 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
15686 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15687 LDKTransaction funding_transaction_ref;
15688 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
15689 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15690 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
15691 funding_transaction_ref.data_is_owned = true;
15692 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15693 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15694 return (uint64_t)ret_conv;
15697 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
15698 LDKChannelManager this_arg_conv;
15699 this_arg_conv.inner = (void*)(this_arg & (~1));
15700 this_arg_conv.is_owned = false;
15701 LDKThreeBytes rgb_ref;
15702 CHECK(*((uint32_t*)rgb) == 3);
15703 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
15704 LDKThirtyTwoBytes alias_ref;
15705 CHECK(*((uint32_t*)alias) == 32);
15706 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
15707 LDKCVec_NetAddressZ addresses_constr;
15708 addresses_constr.datalen = *((uint32_t*)addresses);
15709 if (addresses_constr.datalen > 0)
15710 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15712 addresses_constr.data = NULL;
15713 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
15714 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15715 uint32_t addresses_conv_12 = addresses_vals[m];
15716 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15717 addresses_constr.data[m] = addresses_conv_12_conv;
15719 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15722 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
15723 LDKChannelManager this_arg_conv;
15724 this_arg_conv.inner = (void*)(this_arg & (~1));
15725 this_arg_conv.is_owned = false;
15726 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15729 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
15730 LDKChannelManager this_arg_conv;
15731 this_arg_conv.inner = (void*)(this_arg & (~1));
15732 this_arg_conv.is_owned = false;
15733 ChannelManager_timer_tick_occurred(&this_arg_conv);
15736 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
15737 LDKChannelManager this_arg_conv;
15738 this_arg_conv.inner = (void*)(this_arg & (~1));
15739 this_arg_conv.is_owned = false;
15740 unsigned char payment_hash_arr[32];
15741 CHECK(*((uint32_t*)payment_hash) == 32);
15742 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
15743 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15744 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15748 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
15749 LDKChannelManager this_arg_conv;
15750 this_arg_conv.inner = (void*)(this_arg & (~1));
15751 this_arg_conv.is_owned = false;
15752 LDKThirtyTwoBytes payment_preimage_ref;
15753 CHECK(*((uint32_t*)payment_preimage) == 32);
15754 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
15755 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15759 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
15760 LDKChannelManager this_arg_conv;
15761 this_arg_conv.inner = (void*)(this_arg & (~1));
15762 this_arg_conv.is_owned = false;
15763 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15764 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
15768 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
15769 LDKChannelManager this_arg_conv;
15770 this_arg_conv.inner = (void*)(this_arg & (~1));
15771 this_arg_conv.is_owned = false;
15772 LDKOutPoint funding_txo_conv;
15773 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15774 funding_txo_conv.is_owned = false;
15775 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15778 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) {
15779 LDKChannelManager this_arg_conv;
15780 this_arg_conv.inner = (void*)(this_arg & (~1));
15781 this_arg_conv.is_owned = false;
15782 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15783 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15784 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15785 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15786 return (uint64_t)ret_ref;
15789 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) {
15790 LDKChannelManager this_arg_conv;
15791 this_arg_conv.inner = (void*)(this_arg & (~1));
15792 this_arg_conv.is_owned = false;
15793 LDKThirtyTwoBytes payment_hash_ref;
15794 CHECK(*((uint32_t*)payment_hash) == 32);
15795 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
15796 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15797 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
15798 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15799 *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);
15800 return (uint64_t)ret_conv;
15803 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
15804 LDKChannelManager this_arg_conv;
15805 this_arg_conv.inner = (void*)(this_arg & (~1));
15806 this_arg_conv.is_owned = false;
15807 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15808 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15809 return (uint64_t)ret_ret;
15812 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
15813 LDKChannelManager this_arg_conv;
15814 this_arg_conv.inner = (void*)(this_arg & (~1));
15815 this_arg_conv.is_owned = false;
15816 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15817 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15818 return (uint64_t)ret_ret;
15821 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
15822 LDKChannelManager this_arg_conv;
15823 this_arg_conv.inner = (void*)(this_arg & (~1));
15824 this_arg_conv.is_owned = false;
15825 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
15826 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
15827 return (uint64_t)ret_ret;
15830 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
15831 LDKChannelManager this_arg_conv;
15832 this_arg_conv.inner = (void*)(this_arg & (~1));
15833 this_arg_conv.is_owned = false;
15834 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15835 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
15836 return (uint64_t)ret_ret;
15839 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
15840 LDKChannelManager this_arg_conv;
15841 this_arg_conv.inner = (void*)(this_arg & (~1));
15842 this_arg_conv.is_owned = false;
15843 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15847 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
15848 LDKChannelManager this_arg_conv;
15849 this_arg_conv.inner = (void*)(this_arg & (~1));
15850 this_arg_conv.is_owned = false;
15851 ChannelManager_await_persistable_update(&this_arg_conv);
15854 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
15855 LDKChannelManager this_arg_conv;
15856 this_arg_conv.inner = (void*)(this_arg & (~1));
15857 this_arg_conv.is_owned = false;
15858 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
15859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15861 uint64_t ret_ref = (uint64_t)ret_var.inner;
15862 if (ret_var.is_owned) {
15868 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
15869 LDKChannelManager this_arg_conv;
15870 this_arg_conv.inner = (void*)(this_arg & (~1));
15871 this_arg_conv.is_owned = false;
15872 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15873 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15874 return (uint64_t)ret_ret;
15877 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
15878 LDKChannelManager obj_conv;
15879 obj_conv.inner = (void*)(obj & (~1));
15880 obj_conv.is_owned = false;
15881 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15882 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15883 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15884 CVec_u8Z_free(ret_var);
15888 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
15889 LDKChannelManagerReadArgs this_obj_conv;
15890 this_obj_conv.inner = (void*)(this_obj & (~1));
15891 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15892 ChannelManagerReadArgs_free(this_obj_conv);
15895 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
15896 LDKChannelManagerReadArgs this_ptr_conv;
15897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15898 this_ptr_conv.is_owned = false;
15899 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15903 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
15904 LDKChannelManagerReadArgs this_ptr_conv;
15905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15906 this_ptr_conv.is_owned = false;
15907 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15908 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15911 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
15912 LDKChannelManagerReadArgs this_ptr_conv;
15913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15914 this_ptr_conv.is_owned = false;
15915 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15919 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
15920 LDKChannelManagerReadArgs this_ptr_conv;
15921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15922 this_ptr_conv.is_owned = false;
15923 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
15924 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
15927 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
15928 LDKChannelManagerReadArgs this_ptr_conv;
15929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15930 this_ptr_conv.is_owned = false;
15931 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
15935 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
15936 LDKChannelManagerReadArgs this_ptr_conv;
15937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15938 this_ptr_conv.is_owned = false;
15939 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
15940 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
15943 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
15944 LDKChannelManagerReadArgs this_ptr_conv;
15945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15946 this_ptr_conv.is_owned = false;
15947 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
15951 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
15952 LDKChannelManagerReadArgs this_ptr_conv;
15953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15954 this_ptr_conv.is_owned = false;
15955 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
15956 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
15959 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
15960 LDKChannelManagerReadArgs this_ptr_conv;
15961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15962 this_ptr_conv.is_owned = false;
15963 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
15967 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
15968 LDKChannelManagerReadArgs this_ptr_conv;
15969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15970 this_ptr_conv.is_owned = false;
15971 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
15972 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
15975 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
15976 LDKChannelManagerReadArgs this_ptr_conv;
15977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15978 this_ptr_conv.is_owned = false;
15979 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_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_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
15990 LDKChannelManagerReadArgs this_ptr_conv;
15991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15992 this_ptr_conv.is_owned = false;
15993 LDKUserConfig val_conv;
15994 val_conv.inner = (void*)(val & (~1));
15995 val_conv.is_owned = (val & 1) || (val == 0);
15996 val_conv = UserConfig_clone(&val_conv);
15997 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16000 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) {
16001 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16002 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16003 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16004 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16005 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16006 LDKUserConfig default_config_conv;
16007 default_config_conv.inner = (void*)(default_config & (~1));
16008 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16009 default_config_conv = UserConfig_clone(&default_config_conv);
16010 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16011 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
16012 if (channel_monitors_constr.datalen > 0)
16013 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16015 channel_monitors_constr.data = NULL;
16016 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
16017 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16018 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
16019 LDKChannelMonitor channel_monitors_conv_16_conv;
16020 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16021 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16022 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16024 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);
16025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16027 uint64_t ret_ref = (uint64_t)ret_var.inner;
16028 if (ret_var.is_owned) {
16034 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
16035 LDKu8slice ser_ref;
16036 ser_ref.datalen = *((uint32_t*)ser);
16037 ser_ref.data = (int8_t*)(ser + 4);
16038 LDKChannelManagerReadArgs arg_conv;
16039 arg_conv.inner = (void*)(arg & (~1));
16040 arg_conv.is_owned = (arg & 1) || (arg == 0);
16041 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16042 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16043 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16044 return (uint64_t)ret_conv;
16047 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
16048 LDKDecodeError this_obj_conv;
16049 this_obj_conv.inner = (void*)(this_obj & (~1));
16050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16051 DecodeError_free(this_obj_conv);
16054 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
16055 LDKDecodeError orig_conv;
16056 orig_conv.inner = (void*)(orig & (~1));
16057 orig_conv.is_owned = false;
16058 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16061 uint64_t ret_ref = (uint64_t)ret_var.inner;
16062 if (ret_var.is_owned) {
16068 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
16069 LDKInit this_obj_conv;
16070 this_obj_conv.inner = (void*)(this_obj & (~1));
16071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16072 Init_free(this_obj_conv);
16075 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
16076 LDKInit this_ptr_conv;
16077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16078 this_ptr_conv.is_owned = false;
16079 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16082 uint64_t ret_ref = (uint64_t)ret_var.inner;
16083 if (ret_var.is_owned) {
16089 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
16090 LDKInit this_ptr_conv;
16091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16092 this_ptr_conv.is_owned = false;
16093 LDKInitFeatures val_conv;
16094 val_conv.inner = (void*)(val & (~1));
16095 val_conv.is_owned = (val & 1) || (val == 0);
16096 val_conv = InitFeatures_clone(&val_conv);
16097 Init_set_features(&this_ptr_conv, val_conv);
16100 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
16101 LDKInitFeatures features_arg_conv;
16102 features_arg_conv.inner = (void*)(features_arg & (~1));
16103 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16104 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16105 LDKInit ret_var = Init_new(features_arg_conv);
16106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16108 uint64_t ret_ref = (uint64_t)ret_var.inner;
16109 if (ret_var.is_owned) {
16115 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
16117 orig_conv.inner = (void*)(orig & (~1));
16118 orig_conv.is_owned = false;
16119 LDKInit ret_var = Init_clone(&orig_conv);
16120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16122 uint64_t ret_ref = (uint64_t)ret_var.inner;
16123 if (ret_var.is_owned) {
16129 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
16130 LDKErrorMessage this_obj_conv;
16131 this_obj_conv.inner = (void*)(this_obj & (~1));
16132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16133 ErrorMessage_free(this_obj_conv);
16136 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
16137 LDKErrorMessage this_ptr_conv;
16138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16139 this_ptr_conv.is_owned = false;
16140 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16141 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
16145 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16146 LDKErrorMessage this_ptr_conv;
16147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16148 this_ptr_conv.is_owned = false;
16149 LDKThirtyTwoBytes val_ref;
16150 CHECK(*((uint32_t*)val) == 32);
16151 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16152 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16155 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
16156 LDKErrorMessage this_ptr_conv;
16157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16158 this_ptr_conv.is_owned = false;
16159 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16160 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16165 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
16166 LDKErrorMessage this_ptr_conv;
16167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16168 this_ptr_conv.is_owned = false;
16169 LDKStr val_conv = str_ref_to_owned_c(val);
16170 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16173 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
16174 LDKThirtyTwoBytes channel_id_arg_ref;
16175 CHECK(*((uint32_t*)channel_id_arg) == 32);
16176 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16177 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
16178 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16181 uint64_t ret_ref = (uint64_t)ret_var.inner;
16182 if (ret_var.is_owned) {
16188 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
16189 LDKErrorMessage orig_conv;
16190 orig_conv.inner = (void*)(orig & (~1));
16191 orig_conv.is_owned = false;
16192 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16195 uint64_t ret_ref = (uint64_t)ret_var.inner;
16196 if (ret_var.is_owned) {
16202 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
16203 LDKPing this_obj_conv;
16204 this_obj_conv.inner = (void*)(this_obj & (~1));
16205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16206 Ping_free(this_obj_conv);
16209 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
16210 LDKPing this_ptr_conv;
16211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16212 this_ptr_conv.is_owned = false;
16213 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16217 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
16218 LDKPing this_ptr_conv;
16219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16220 this_ptr_conv.is_owned = false;
16221 Ping_set_ponglen(&this_ptr_conv, val);
16224 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
16225 LDKPing this_ptr_conv;
16226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16227 this_ptr_conv.is_owned = false;
16228 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16232 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
16233 LDKPing this_ptr_conv;
16234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16235 this_ptr_conv.is_owned = false;
16236 Ping_set_byteslen(&this_ptr_conv, val);
16239 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
16240 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16243 uint64_t ret_ref = (uint64_t)ret_var.inner;
16244 if (ret_var.is_owned) {
16250 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
16252 orig_conv.inner = (void*)(orig & (~1));
16253 orig_conv.is_owned = false;
16254 LDKPing ret_var = Ping_clone(&orig_conv);
16255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16257 uint64_t ret_ref = (uint64_t)ret_var.inner;
16258 if (ret_var.is_owned) {
16264 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
16265 LDKPong this_obj_conv;
16266 this_obj_conv.inner = (void*)(this_obj & (~1));
16267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16268 Pong_free(this_obj_conv);
16271 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
16272 LDKPong this_ptr_conv;
16273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16274 this_ptr_conv.is_owned = false;
16275 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16279 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
16280 LDKPong this_ptr_conv;
16281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16282 this_ptr_conv.is_owned = false;
16283 Pong_set_byteslen(&this_ptr_conv, val);
16286 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
16287 LDKPong ret_var = Pong_new(byteslen_arg);
16288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16290 uint64_t ret_ref = (uint64_t)ret_var.inner;
16291 if (ret_var.is_owned) {
16297 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
16299 orig_conv.inner = (void*)(orig & (~1));
16300 orig_conv.is_owned = false;
16301 LDKPong ret_var = Pong_clone(&orig_conv);
16302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16304 uint64_t ret_ref = (uint64_t)ret_var.inner;
16305 if (ret_var.is_owned) {
16311 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
16312 LDKOpenChannel this_obj_conv;
16313 this_obj_conv.inner = (void*)(this_obj & (~1));
16314 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16315 OpenChannel_free(this_obj_conv);
16318 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
16319 LDKOpenChannel this_ptr_conv;
16320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16321 this_ptr_conv.is_owned = false;
16322 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16323 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
16327 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
16328 LDKOpenChannel this_ptr_conv;
16329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16330 this_ptr_conv.is_owned = false;
16331 LDKThirtyTwoBytes val_ref;
16332 CHECK(*((uint32_t*)val) == 32);
16333 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16334 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16337 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
16338 LDKOpenChannel this_ptr_conv;
16339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16340 this_ptr_conv.is_owned = false;
16341 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16342 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16346 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16347 LDKOpenChannel this_ptr_conv;
16348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16349 this_ptr_conv.is_owned = false;
16350 LDKThirtyTwoBytes val_ref;
16351 CHECK(*((uint32_t*)val) == 32);
16352 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16353 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16356 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
16357 LDKOpenChannel this_ptr_conv;
16358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16359 this_ptr_conv.is_owned = false;
16360 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16364 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
16365 LDKOpenChannel this_ptr_conv;
16366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16367 this_ptr_conv.is_owned = false;
16368 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16371 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
16372 LDKOpenChannel this_ptr_conv;
16373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16374 this_ptr_conv.is_owned = false;
16375 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16379 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
16380 LDKOpenChannel this_ptr_conv;
16381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16382 this_ptr_conv.is_owned = false;
16383 OpenChannel_set_push_msat(&this_ptr_conv, val);
16386 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16387 LDKOpenChannel this_ptr_conv;
16388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16389 this_ptr_conv.is_owned = false;
16390 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16394 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16395 LDKOpenChannel this_ptr_conv;
16396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16397 this_ptr_conv.is_owned = false;
16398 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16401 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16402 LDKOpenChannel this_ptr_conv;
16403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16404 this_ptr_conv.is_owned = false;
16405 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16409 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16410 LDKOpenChannel this_ptr_conv;
16411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16412 this_ptr_conv.is_owned = false;
16413 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16416 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16417 LDKOpenChannel this_ptr_conv;
16418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16419 this_ptr_conv.is_owned = false;
16420 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16424 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16425 LDKOpenChannel this_ptr_conv;
16426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16427 this_ptr_conv.is_owned = false;
16428 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16431 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16432 LDKOpenChannel this_ptr_conv;
16433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16434 this_ptr_conv.is_owned = false;
16435 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16439 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16440 LDKOpenChannel this_ptr_conv;
16441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16442 this_ptr_conv.is_owned = false;
16443 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16446 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
16447 LDKOpenChannel this_ptr_conv;
16448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16449 this_ptr_conv.is_owned = false;
16450 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16454 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
16455 LDKOpenChannel this_ptr_conv;
16456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16457 this_ptr_conv.is_owned = false;
16458 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16461 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
16462 LDKOpenChannel this_ptr_conv;
16463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16464 this_ptr_conv.is_owned = false;
16465 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16469 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16470 LDKOpenChannel this_ptr_conv;
16471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16472 this_ptr_conv.is_owned = false;
16473 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16476 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16477 LDKOpenChannel this_ptr_conv;
16478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16479 this_ptr_conv.is_owned = false;
16480 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16484 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16485 LDKOpenChannel this_ptr_conv;
16486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16487 this_ptr_conv.is_owned = false;
16488 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16491 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
16492 LDKOpenChannel this_ptr_conv;
16493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16494 this_ptr_conv.is_owned = false;
16495 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16496 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16500 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16501 LDKOpenChannel this_ptr_conv;
16502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16503 this_ptr_conv.is_owned = false;
16504 LDKPublicKey val_ref;
16505 CHECK(*((uint32_t*)val) == 33);
16506 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16507 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16510 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
16511 LDKOpenChannel this_ptr_conv;
16512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16513 this_ptr_conv.is_owned = false;
16514 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16515 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16519 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16520 LDKOpenChannel this_ptr_conv;
16521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16522 this_ptr_conv.is_owned = false;
16523 LDKPublicKey val_ref;
16524 CHECK(*((uint32_t*)val) == 33);
16525 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16526 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16529 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
16530 LDKOpenChannel this_ptr_conv;
16531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16532 this_ptr_conv.is_owned = false;
16533 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16534 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
16538 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16539 LDKOpenChannel this_ptr_conv;
16540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16541 this_ptr_conv.is_owned = false;
16542 LDKPublicKey val_ref;
16543 CHECK(*((uint32_t*)val) == 33);
16544 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16545 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16548 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
16549 LDKOpenChannel this_ptr_conv;
16550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16551 this_ptr_conv.is_owned = false;
16552 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16553 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16557 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16558 LDKOpenChannel this_ptr_conv;
16559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16560 this_ptr_conv.is_owned = false;
16561 LDKPublicKey val_ref;
16562 CHECK(*((uint32_t*)val) == 33);
16563 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16564 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16567 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
16568 LDKOpenChannel this_ptr_conv;
16569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16570 this_ptr_conv.is_owned = false;
16571 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16572 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16576 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16577 LDKOpenChannel this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 LDKPublicKey val_ref;
16581 CHECK(*((uint32_t*)val) == 33);
16582 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16583 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16586 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
16587 LDKOpenChannel this_ptr_conv;
16588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16589 this_ptr_conv.is_owned = false;
16590 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16591 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16595 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16596 LDKOpenChannel this_ptr_conv;
16597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16598 this_ptr_conv.is_owned = false;
16599 LDKPublicKey val_ref;
16600 CHECK(*((uint32_t*)val) == 33);
16601 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16602 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16605 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
16606 LDKOpenChannel this_ptr_conv;
16607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16608 this_ptr_conv.is_owned = false;
16609 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16613 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
16614 LDKOpenChannel this_ptr_conv;
16615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16616 this_ptr_conv.is_owned = false;
16617 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16620 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
16621 LDKOpenChannel orig_conv;
16622 orig_conv.inner = (void*)(orig & (~1));
16623 orig_conv.is_owned = false;
16624 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16627 uint64_t ret_ref = (uint64_t)ret_var.inner;
16628 if (ret_var.is_owned) {
16634 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
16635 LDKAcceptChannel this_obj_conv;
16636 this_obj_conv.inner = (void*)(this_obj & (~1));
16637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16638 AcceptChannel_free(this_obj_conv);
16641 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
16642 LDKAcceptChannel this_ptr_conv;
16643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16644 this_ptr_conv.is_owned = false;
16645 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16646 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
16650 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16651 LDKAcceptChannel this_ptr_conv;
16652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16653 this_ptr_conv.is_owned = false;
16654 LDKThirtyTwoBytes val_ref;
16655 CHECK(*((uint32_t*)val) == 32);
16656 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16657 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16660 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
16661 LDKAcceptChannel this_ptr_conv;
16662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16663 this_ptr_conv.is_owned = false;
16664 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16668 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
16669 LDKAcceptChannel this_ptr_conv;
16670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16671 this_ptr_conv.is_owned = false;
16672 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16675 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
16676 LDKAcceptChannel this_ptr_conv;
16677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16678 this_ptr_conv.is_owned = false;
16679 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16683 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
16684 LDKAcceptChannel this_ptr_conv;
16685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16686 this_ptr_conv.is_owned = false;
16687 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16690 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
16691 LDKAcceptChannel this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16698 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
16699 LDKAcceptChannel this_ptr_conv;
16700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16701 this_ptr_conv.is_owned = false;
16702 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16705 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
16706 LDKAcceptChannel this_ptr_conv;
16707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16708 this_ptr_conv.is_owned = false;
16709 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16713 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
16714 LDKAcceptChannel this_ptr_conv;
16715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16716 this_ptr_conv.is_owned = false;
16717 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16720 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
16721 LDKAcceptChannel this_ptr_conv;
16722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16723 this_ptr_conv.is_owned = false;
16724 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16728 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
16729 LDKAcceptChannel this_ptr_conv;
16730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16731 this_ptr_conv.is_owned = false;
16732 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16735 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
16736 LDKAcceptChannel this_ptr_conv;
16737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16738 this_ptr_conv.is_owned = false;
16739 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16743 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
16744 LDKAcceptChannel this_ptr_conv;
16745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16746 this_ptr_conv.is_owned = false;
16747 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16750 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
16751 LDKAcceptChannel this_ptr_conv;
16752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16753 this_ptr_conv.is_owned = false;
16754 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16758 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
16759 LDKAcceptChannel this_ptr_conv;
16760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16761 this_ptr_conv.is_owned = false;
16762 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16765 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
16766 LDKAcceptChannel this_ptr_conv;
16767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16768 this_ptr_conv.is_owned = false;
16769 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16770 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16774 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16775 LDKAcceptChannel this_ptr_conv;
16776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16777 this_ptr_conv.is_owned = false;
16778 LDKPublicKey val_ref;
16779 CHECK(*((uint32_t*)val) == 33);
16780 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16781 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16784 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
16785 LDKAcceptChannel this_ptr_conv;
16786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16787 this_ptr_conv.is_owned = false;
16788 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16789 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16793 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16794 LDKAcceptChannel this_ptr_conv;
16795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16796 this_ptr_conv.is_owned = false;
16797 LDKPublicKey val_ref;
16798 CHECK(*((uint32_t*)val) == 33);
16799 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16800 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16803 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
16804 LDKAcceptChannel this_ptr_conv;
16805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16806 this_ptr_conv.is_owned = false;
16807 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16808 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
16812 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16813 LDKAcceptChannel this_ptr_conv;
16814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16815 this_ptr_conv.is_owned = false;
16816 LDKPublicKey val_ref;
16817 CHECK(*((uint32_t*)val) == 33);
16818 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16819 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16822 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
16823 LDKAcceptChannel this_ptr_conv;
16824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16825 this_ptr_conv.is_owned = false;
16826 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16827 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16831 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16832 LDKAcceptChannel this_ptr_conv;
16833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16834 this_ptr_conv.is_owned = false;
16835 LDKPublicKey val_ref;
16836 CHECK(*((uint32_t*)val) == 33);
16837 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16838 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16841 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
16842 LDKAcceptChannel this_ptr_conv;
16843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16844 this_ptr_conv.is_owned = false;
16845 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16846 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16850 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16851 LDKAcceptChannel this_ptr_conv;
16852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16853 this_ptr_conv.is_owned = false;
16854 LDKPublicKey val_ref;
16855 CHECK(*((uint32_t*)val) == 33);
16856 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16857 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16860 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
16861 LDKAcceptChannel this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16865 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16869 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16870 LDKAcceptChannel this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 LDKPublicKey val_ref;
16874 CHECK(*((uint32_t*)val) == 33);
16875 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16876 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16879 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
16880 LDKAcceptChannel orig_conv;
16881 orig_conv.inner = (void*)(orig & (~1));
16882 orig_conv.is_owned = false;
16883 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16886 uint64_t ret_ref = (uint64_t)ret_var.inner;
16887 if (ret_var.is_owned) {
16893 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
16894 LDKFundingCreated this_obj_conv;
16895 this_obj_conv.inner = (void*)(this_obj & (~1));
16896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16897 FundingCreated_free(this_obj_conv);
16900 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
16901 LDKFundingCreated this_ptr_conv;
16902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16903 this_ptr_conv.is_owned = false;
16904 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16905 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
16909 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
16910 LDKFundingCreated this_ptr_conv;
16911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16912 this_ptr_conv.is_owned = false;
16913 LDKThirtyTwoBytes val_ref;
16914 CHECK(*((uint32_t*)val) == 32);
16915 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16916 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
16919 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
16920 LDKFundingCreated this_ptr_conv;
16921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16922 this_ptr_conv.is_owned = false;
16923 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16924 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
16928 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
16929 LDKFundingCreated this_ptr_conv;
16930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16931 this_ptr_conv.is_owned = false;
16932 LDKThirtyTwoBytes val_ref;
16933 CHECK(*((uint32_t*)val) == 32);
16934 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16935 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
16938 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
16939 LDKFundingCreated this_ptr_conv;
16940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16941 this_ptr_conv.is_owned = false;
16942 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
16946 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
16947 LDKFundingCreated this_ptr_conv;
16948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16949 this_ptr_conv.is_owned = false;
16950 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
16953 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
16954 LDKFundingCreated this_ptr_conv;
16955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16956 this_ptr_conv.is_owned = false;
16957 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16958 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
16962 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
16963 LDKFundingCreated this_ptr_conv;
16964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16965 this_ptr_conv.is_owned = false;
16966 LDKSignature val_ref;
16967 CHECK(*((uint32_t*)val) == 64);
16968 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16969 FundingCreated_set_signature(&this_ptr_conv, val_ref);
16972 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) {
16973 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
16974 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
16975 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
16976 LDKThirtyTwoBytes funding_txid_arg_ref;
16977 CHECK(*((uint32_t*)funding_txid_arg) == 32);
16978 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
16979 LDKSignature signature_arg_ref;
16980 CHECK(*((uint32_t*)signature_arg) == 64);
16981 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
16982 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
16983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16985 uint64_t ret_ref = (uint64_t)ret_var.inner;
16986 if (ret_var.is_owned) {
16992 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
16993 LDKFundingCreated orig_conv;
16994 orig_conv.inner = (void*)(orig & (~1));
16995 orig_conv.is_owned = false;
16996 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
16997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16999 uint64_t ret_ref = (uint64_t)ret_var.inner;
17000 if (ret_var.is_owned) {
17006 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
17007 LDKFundingSigned this_obj_conv;
17008 this_obj_conv.inner = (void*)(this_obj & (~1));
17009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17010 FundingSigned_free(this_obj_conv);
17013 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
17014 LDKFundingSigned this_ptr_conv;
17015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17016 this_ptr_conv.is_owned = false;
17017 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17018 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
17022 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17023 LDKFundingSigned this_ptr_conv;
17024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17025 this_ptr_conv.is_owned = false;
17026 LDKThirtyTwoBytes val_ref;
17027 CHECK(*((uint32_t*)val) == 32);
17028 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17029 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17032 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
17033 LDKFundingSigned this_ptr_conv;
17034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17035 this_ptr_conv.is_owned = false;
17036 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17037 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17041 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17042 LDKFundingSigned this_ptr_conv;
17043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17044 this_ptr_conv.is_owned = false;
17045 LDKSignature val_ref;
17046 CHECK(*((uint32_t*)val) == 64);
17047 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17048 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17051 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
17052 LDKThirtyTwoBytes channel_id_arg_ref;
17053 CHECK(*((uint32_t*)channel_id_arg) == 32);
17054 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17055 LDKSignature signature_arg_ref;
17056 CHECK(*((uint32_t*)signature_arg) == 64);
17057 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17058 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17061 uint64_t ret_ref = (uint64_t)ret_var.inner;
17062 if (ret_var.is_owned) {
17068 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
17069 LDKFundingSigned orig_conv;
17070 orig_conv.inner = (void*)(orig & (~1));
17071 orig_conv.is_owned = false;
17072 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17075 uint64_t ret_ref = (uint64_t)ret_var.inner;
17076 if (ret_var.is_owned) {
17082 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
17083 LDKFundingLocked this_obj_conv;
17084 this_obj_conv.inner = (void*)(this_obj & (~1));
17085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17086 FundingLocked_free(this_obj_conv);
17089 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
17090 LDKFundingLocked this_ptr_conv;
17091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17092 this_ptr_conv.is_owned = false;
17093 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17094 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
17098 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17099 LDKFundingLocked this_ptr_conv;
17100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17101 this_ptr_conv.is_owned = false;
17102 LDKThirtyTwoBytes val_ref;
17103 CHECK(*((uint32_t*)val) == 32);
17104 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17105 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17108 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
17109 LDKFundingLocked this_ptr_conv;
17110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17111 this_ptr_conv.is_owned = false;
17112 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17113 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17117 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17118 LDKFundingLocked this_ptr_conv;
17119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17120 this_ptr_conv.is_owned = false;
17121 LDKPublicKey val_ref;
17122 CHECK(*((uint32_t*)val) == 33);
17123 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17124 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17127 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
17128 LDKThirtyTwoBytes channel_id_arg_ref;
17129 CHECK(*((uint32_t*)channel_id_arg) == 32);
17130 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17131 LDKPublicKey next_per_commitment_point_arg_ref;
17132 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17133 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17134 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17137 uint64_t ret_ref = (uint64_t)ret_var.inner;
17138 if (ret_var.is_owned) {
17144 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
17145 LDKFundingLocked orig_conv;
17146 orig_conv.inner = (void*)(orig & (~1));
17147 orig_conv.is_owned = false;
17148 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17151 uint64_t ret_ref = (uint64_t)ret_var.inner;
17152 if (ret_var.is_owned) {
17158 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
17159 LDKShutdown this_obj_conv;
17160 this_obj_conv.inner = (void*)(this_obj & (~1));
17161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17162 Shutdown_free(this_obj_conv);
17165 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
17166 LDKShutdown this_ptr_conv;
17167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17168 this_ptr_conv.is_owned = false;
17169 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17170 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
17174 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17175 LDKShutdown this_ptr_conv;
17176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17177 this_ptr_conv.is_owned = false;
17178 LDKThirtyTwoBytes val_ref;
17179 CHECK(*((uint32_t*)val) == 32);
17180 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17181 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17184 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
17185 LDKShutdown this_ptr_conv;
17186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17187 this_ptr_conv.is_owned = false;
17188 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17189 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17190 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17194 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
17195 LDKShutdown this_ptr_conv;
17196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17197 this_ptr_conv.is_owned = false;
17198 LDKCVec_u8Z val_ref;
17199 val_ref.datalen = *((uint32_t*)val);
17200 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17201 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17202 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17205 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17206 LDKThirtyTwoBytes channel_id_arg_ref;
17207 CHECK(*((uint32_t*)channel_id_arg) == 32);
17208 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17209 LDKCVec_u8Z scriptpubkey_arg_ref;
17210 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
17211 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17212 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
17213 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17216 uint64_t ret_ref = (uint64_t)ret_var.inner;
17217 if (ret_var.is_owned) {
17223 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
17224 LDKShutdown orig_conv;
17225 orig_conv.inner = (void*)(orig & (~1));
17226 orig_conv.is_owned = false;
17227 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17230 uint64_t ret_ref = (uint64_t)ret_var.inner;
17231 if (ret_var.is_owned) {
17237 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
17238 LDKClosingSignedFeeRange this_obj_conv;
17239 this_obj_conv.inner = (void*)(this_obj & (~1));
17240 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17241 ClosingSignedFeeRange_free(this_obj_conv);
17244 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
17245 LDKClosingSignedFeeRange this_ptr_conv;
17246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17247 this_ptr_conv.is_owned = false;
17248 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
17252 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
17253 LDKClosingSignedFeeRange this_ptr_conv;
17254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17255 this_ptr_conv.is_owned = false;
17256 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
17259 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
17260 LDKClosingSignedFeeRange this_ptr_conv;
17261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17262 this_ptr_conv.is_owned = false;
17263 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
17267 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17268 LDKClosingSignedFeeRange this_ptr_conv;
17269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17270 this_ptr_conv.is_owned = false;
17271 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
17274 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
17275 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
17276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17278 uint64_t ret_ref = (uint64_t)ret_var.inner;
17279 if (ret_var.is_owned) {
17285 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
17286 LDKClosingSignedFeeRange orig_conv;
17287 orig_conv.inner = (void*)(orig & (~1));
17288 orig_conv.is_owned = false;
17289 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
17290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17292 uint64_t ret_ref = (uint64_t)ret_var.inner;
17293 if (ret_var.is_owned) {
17299 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
17300 LDKClosingSigned this_obj_conv;
17301 this_obj_conv.inner = (void*)(this_obj & (~1));
17302 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17303 ClosingSigned_free(this_obj_conv);
17306 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
17307 LDKClosingSigned this_ptr_conv;
17308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17309 this_ptr_conv.is_owned = false;
17310 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17311 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
17315 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17316 LDKClosingSigned this_ptr_conv;
17317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17318 this_ptr_conv.is_owned = false;
17319 LDKThirtyTwoBytes val_ref;
17320 CHECK(*((uint32_t*)val) == 32);
17321 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17322 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17325 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
17326 LDKClosingSigned this_ptr_conv;
17327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17328 this_ptr_conv.is_owned = false;
17329 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17333 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
17334 LDKClosingSigned this_ptr_conv;
17335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17336 this_ptr_conv.is_owned = false;
17337 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17340 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
17341 LDKClosingSigned this_ptr_conv;
17342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17343 this_ptr_conv.is_owned = false;
17344 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17345 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17349 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17350 LDKClosingSigned this_ptr_conv;
17351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17352 this_ptr_conv.is_owned = false;
17353 LDKSignature val_ref;
17354 CHECK(*((uint32_t*)val) == 64);
17355 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17356 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17359 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
17360 LDKClosingSigned this_ptr_conv;
17361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17362 this_ptr_conv.is_owned = false;
17363 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
17364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17366 uint64_t ret_ref = (uint64_t)ret_var.inner;
17367 if (ret_var.is_owned) {
17373 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
17374 LDKClosingSigned this_ptr_conv;
17375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17376 this_ptr_conv.is_owned = false;
17377 LDKClosingSignedFeeRange val_conv;
17378 val_conv.inner = (void*)(val & (~1));
17379 val_conv.is_owned = (val & 1) || (val == 0);
17380 val_conv = ClosingSignedFeeRange_clone(&val_conv);
17381 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
17384 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) {
17385 LDKThirtyTwoBytes channel_id_arg_ref;
17386 CHECK(*((uint32_t*)channel_id_arg) == 32);
17387 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17388 LDKSignature signature_arg_ref;
17389 CHECK(*((uint32_t*)signature_arg) == 64);
17390 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17391 LDKClosingSignedFeeRange fee_range_arg_conv;
17392 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
17393 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
17394 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
17395 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
17396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17398 uint64_t ret_ref = (uint64_t)ret_var.inner;
17399 if (ret_var.is_owned) {
17405 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
17406 LDKClosingSigned orig_conv;
17407 orig_conv.inner = (void*)(orig & (~1));
17408 orig_conv.is_owned = false;
17409 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17412 uint64_t ret_ref = (uint64_t)ret_var.inner;
17413 if (ret_var.is_owned) {
17419 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
17420 LDKUpdateAddHTLC this_obj_conv;
17421 this_obj_conv.inner = (void*)(this_obj & (~1));
17422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17423 UpdateAddHTLC_free(this_obj_conv);
17426 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
17427 LDKUpdateAddHTLC this_ptr_conv;
17428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17429 this_ptr_conv.is_owned = false;
17430 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17431 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
17435 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17436 LDKUpdateAddHTLC this_ptr_conv;
17437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17438 this_ptr_conv.is_owned = false;
17439 LDKThirtyTwoBytes val_ref;
17440 CHECK(*((uint32_t*)val) == 32);
17441 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17442 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17445 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
17446 LDKUpdateAddHTLC this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17453 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17454 LDKUpdateAddHTLC this_ptr_conv;
17455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17456 this_ptr_conv.is_owned = false;
17457 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17460 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
17461 LDKUpdateAddHTLC this_ptr_conv;
17462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17463 this_ptr_conv.is_owned = false;
17464 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17468 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
17469 LDKUpdateAddHTLC this_ptr_conv;
17470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17471 this_ptr_conv.is_owned = false;
17472 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17475 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
17476 LDKUpdateAddHTLC this_ptr_conv;
17477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17478 this_ptr_conv.is_owned = false;
17479 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17480 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
17484 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
17485 LDKUpdateAddHTLC this_ptr_conv;
17486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17487 this_ptr_conv.is_owned = false;
17488 LDKThirtyTwoBytes val_ref;
17489 CHECK(*((uint32_t*)val) == 32);
17490 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17491 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17494 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
17495 LDKUpdateAddHTLC this_ptr_conv;
17496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17497 this_ptr_conv.is_owned = false;
17498 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17502 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
17503 LDKUpdateAddHTLC this_ptr_conv;
17504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17505 this_ptr_conv.is_owned = false;
17506 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17509 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
17510 LDKUpdateAddHTLC orig_conv;
17511 orig_conv.inner = (void*)(orig & (~1));
17512 orig_conv.is_owned = false;
17513 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17516 uint64_t ret_ref = (uint64_t)ret_var.inner;
17517 if (ret_var.is_owned) {
17523 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
17524 LDKUpdateFulfillHTLC this_obj_conv;
17525 this_obj_conv.inner = (void*)(this_obj & (~1));
17526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17527 UpdateFulfillHTLC_free(this_obj_conv);
17530 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
17531 LDKUpdateFulfillHTLC this_ptr_conv;
17532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17533 this_ptr_conv.is_owned = false;
17534 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17535 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
17539 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17540 LDKUpdateFulfillHTLC this_ptr_conv;
17541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17542 this_ptr_conv.is_owned = false;
17543 LDKThirtyTwoBytes val_ref;
17544 CHECK(*((uint32_t*)val) == 32);
17545 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17546 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17549 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
17550 LDKUpdateFulfillHTLC this_ptr_conv;
17551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17552 this_ptr_conv.is_owned = false;
17553 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17557 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17558 LDKUpdateFulfillHTLC this_ptr_conv;
17559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17560 this_ptr_conv.is_owned = false;
17561 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17564 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
17565 LDKUpdateFulfillHTLC this_ptr_conv;
17566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17567 this_ptr_conv.is_owned = false;
17568 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17569 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
17573 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
17574 LDKUpdateFulfillHTLC this_ptr_conv;
17575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17576 this_ptr_conv.is_owned = false;
17577 LDKThirtyTwoBytes val_ref;
17578 CHECK(*((uint32_t*)val) == 32);
17579 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17580 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17583 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
17584 LDKThirtyTwoBytes channel_id_arg_ref;
17585 CHECK(*((uint32_t*)channel_id_arg) == 32);
17586 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17587 LDKThirtyTwoBytes payment_preimage_arg_ref;
17588 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
17589 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
17590 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17593 uint64_t ret_ref = (uint64_t)ret_var.inner;
17594 if (ret_var.is_owned) {
17600 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
17601 LDKUpdateFulfillHTLC orig_conv;
17602 orig_conv.inner = (void*)(orig & (~1));
17603 orig_conv.is_owned = false;
17604 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17607 uint64_t ret_ref = (uint64_t)ret_var.inner;
17608 if (ret_var.is_owned) {
17614 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
17615 LDKUpdateFailHTLC this_obj_conv;
17616 this_obj_conv.inner = (void*)(this_obj & (~1));
17617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17618 UpdateFailHTLC_free(this_obj_conv);
17621 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
17622 LDKUpdateFailHTLC this_ptr_conv;
17623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17624 this_ptr_conv.is_owned = false;
17625 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17626 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
17630 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17631 LDKUpdateFailHTLC this_ptr_conv;
17632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17633 this_ptr_conv.is_owned = false;
17634 LDKThirtyTwoBytes val_ref;
17635 CHECK(*((uint32_t*)val) == 32);
17636 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17637 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17640 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
17641 LDKUpdateFailHTLC this_ptr_conv;
17642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17643 this_ptr_conv.is_owned = false;
17644 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17648 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17649 LDKUpdateFailHTLC this_ptr_conv;
17650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17651 this_ptr_conv.is_owned = false;
17652 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17655 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
17656 LDKUpdateFailHTLC orig_conv;
17657 orig_conv.inner = (void*)(orig & (~1));
17658 orig_conv.is_owned = false;
17659 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17662 uint64_t ret_ref = (uint64_t)ret_var.inner;
17663 if (ret_var.is_owned) {
17669 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
17670 LDKUpdateFailMalformedHTLC this_obj_conv;
17671 this_obj_conv.inner = (void*)(this_obj & (~1));
17672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17673 UpdateFailMalformedHTLC_free(this_obj_conv);
17676 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
17677 LDKUpdateFailMalformedHTLC this_ptr_conv;
17678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17679 this_ptr_conv.is_owned = false;
17680 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17681 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
17685 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17686 LDKUpdateFailMalformedHTLC this_ptr_conv;
17687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17688 this_ptr_conv.is_owned = false;
17689 LDKThirtyTwoBytes val_ref;
17690 CHECK(*((uint32_t*)val) == 32);
17691 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17692 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17695 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
17696 LDKUpdateFailMalformedHTLC this_ptr_conv;
17697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17698 this_ptr_conv.is_owned = false;
17699 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17703 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
17704 LDKUpdateFailMalformedHTLC this_ptr_conv;
17705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17706 this_ptr_conv.is_owned = false;
17707 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17710 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
17711 LDKUpdateFailMalformedHTLC this_ptr_conv;
17712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17713 this_ptr_conv.is_owned = false;
17714 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17718 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
17719 LDKUpdateFailMalformedHTLC this_ptr_conv;
17720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17721 this_ptr_conv.is_owned = false;
17722 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17725 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
17726 LDKUpdateFailMalformedHTLC orig_conv;
17727 orig_conv.inner = (void*)(orig & (~1));
17728 orig_conv.is_owned = false;
17729 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_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_CommitmentSigned_free(uint32_t this_obj) {
17740 LDKCommitmentSigned this_obj_conv;
17741 this_obj_conv.inner = (void*)(this_obj & (~1));
17742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17743 CommitmentSigned_free(this_obj_conv);
17746 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
17747 LDKCommitmentSigned this_ptr_conv;
17748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17749 this_ptr_conv.is_owned = false;
17750 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17751 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
17755 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17756 LDKCommitmentSigned this_ptr_conv;
17757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17758 this_ptr_conv.is_owned = false;
17759 LDKThirtyTwoBytes val_ref;
17760 CHECK(*((uint32_t*)val) == 32);
17761 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17762 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17765 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
17766 LDKCommitmentSigned this_ptr_conv;
17767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17768 this_ptr_conv.is_owned = false;
17769 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17770 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
17774 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17775 LDKCommitmentSigned this_ptr_conv;
17776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17777 this_ptr_conv.is_owned = false;
17778 LDKSignature val_ref;
17779 CHECK(*((uint32_t*)val) == 64);
17780 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17781 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17784 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
17785 LDKCommitmentSigned this_ptr_conv;
17786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17787 this_ptr_conv.is_owned = false;
17788 LDKCVec_SignatureZ val_constr;
17789 val_constr.datalen = *((uint32_t*)val);
17790 if (val_constr.datalen > 0)
17791 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17793 val_constr.data = NULL;
17794 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17795 for (size_t m = 0; m < val_constr.datalen; m++) {
17796 int8_tArray val_conv_12 = val_vals[m];
17797 LDKSignature val_conv_12_ref;
17798 CHECK(*((uint32_t*)val_conv_12) == 64);
17799 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17800 val_constr.data[m] = val_conv_12_ref;
17802 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17805 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
17806 LDKThirtyTwoBytes channel_id_arg_ref;
17807 CHECK(*((uint32_t*)channel_id_arg) == 32);
17808 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17809 LDKSignature signature_arg_ref;
17810 CHECK(*((uint32_t*)signature_arg) == 64);
17811 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17812 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17813 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
17814 if (htlc_signatures_arg_constr.datalen > 0)
17815 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17817 htlc_signatures_arg_constr.data = NULL;
17818 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
17819 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
17820 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
17821 LDKSignature htlc_signatures_arg_conv_12_ref;
17822 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
17823 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
17824 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
17826 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17829 uint64_t ret_ref = (uint64_t)ret_var.inner;
17830 if (ret_var.is_owned) {
17836 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
17837 LDKCommitmentSigned orig_conv;
17838 orig_conv.inner = (void*)(orig & (~1));
17839 orig_conv.is_owned = false;
17840 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17843 uint64_t ret_ref = (uint64_t)ret_var.inner;
17844 if (ret_var.is_owned) {
17850 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
17851 LDKRevokeAndACK this_obj_conv;
17852 this_obj_conv.inner = (void*)(this_obj & (~1));
17853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17854 RevokeAndACK_free(this_obj_conv);
17857 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
17858 LDKRevokeAndACK this_ptr_conv;
17859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17860 this_ptr_conv.is_owned = false;
17861 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17862 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
17866 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17867 LDKRevokeAndACK this_ptr_conv;
17868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17869 this_ptr_conv.is_owned = false;
17870 LDKThirtyTwoBytes val_ref;
17871 CHECK(*((uint32_t*)val) == 32);
17872 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17873 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17876 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
17877 LDKRevokeAndACK this_ptr_conv;
17878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17879 this_ptr_conv.is_owned = false;
17880 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17881 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
17885 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
17886 LDKRevokeAndACK this_ptr_conv;
17887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17888 this_ptr_conv.is_owned = false;
17889 LDKThirtyTwoBytes val_ref;
17890 CHECK(*((uint32_t*)val) == 32);
17891 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17892 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17895 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
17896 LDKRevokeAndACK this_ptr_conv;
17897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17898 this_ptr_conv.is_owned = false;
17899 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17900 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17904 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17905 LDKRevokeAndACK this_ptr_conv;
17906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17907 this_ptr_conv.is_owned = false;
17908 LDKPublicKey val_ref;
17909 CHECK(*((uint32_t*)val) == 33);
17910 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17911 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17914 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) {
17915 LDKThirtyTwoBytes channel_id_arg_ref;
17916 CHECK(*((uint32_t*)channel_id_arg) == 32);
17917 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17918 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17919 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
17920 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
17921 LDKPublicKey next_per_commitment_point_arg_ref;
17922 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17923 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17924 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17927 uint64_t ret_ref = (uint64_t)ret_var.inner;
17928 if (ret_var.is_owned) {
17934 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
17935 LDKRevokeAndACK orig_conv;
17936 orig_conv.inner = (void*)(orig & (~1));
17937 orig_conv.is_owned = false;
17938 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17941 uint64_t ret_ref = (uint64_t)ret_var.inner;
17942 if (ret_var.is_owned) {
17948 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
17949 LDKUpdateFee this_obj_conv;
17950 this_obj_conv.inner = (void*)(this_obj & (~1));
17951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17952 UpdateFee_free(this_obj_conv);
17955 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
17956 LDKUpdateFee this_ptr_conv;
17957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17958 this_ptr_conv.is_owned = false;
17959 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17960 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
17964 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17965 LDKUpdateFee this_ptr_conv;
17966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17967 this_ptr_conv.is_owned = false;
17968 LDKThirtyTwoBytes val_ref;
17969 CHECK(*((uint32_t*)val) == 32);
17970 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17971 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17974 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
17975 LDKUpdateFee this_ptr_conv;
17976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17977 this_ptr_conv.is_owned = false;
17978 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
17982 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
17983 LDKUpdateFee this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
17989 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
17990 LDKThirtyTwoBytes channel_id_arg_ref;
17991 CHECK(*((uint32_t*)channel_id_arg) == 32);
17992 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17993 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
17994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17996 uint64_t ret_ref = (uint64_t)ret_var.inner;
17997 if (ret_var.is_owned) {
18003 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
18004 LDKUpdateFee orig_conv;
18005 orig_conv.inner = (void*)(orig & (~1));
18006 orig_conv.is_owned = false;
18007 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18010 uint64_t ret_ref = (uint64_t)ret_var.inner;
18011 if (ret_var.is_owned) {
18017 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
18018 LDKDataLossProtect this_obj_conv;
18019 this_obj_conv.inner = (void*)(this_obj & (~1));
18020 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18021 DataLossProtect_free(this_obj_conv);
18024 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
18025 LDKDataLossProtect this_ptr_conv;
18026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18027 this_ptr_conv.is_owned = false;
18028 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18029 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
18033 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18034 LDKDataLossProtect this_ptr_conv;
18035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18036 this_ptr_conv.is_owned = false;
18037 LDKThirtyTwoBytes val_ref;
18038 CHECK(*((uint32_t*)val) == 32);
18039 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18040 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18043 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
18044 LDKDataLossProtect this_ptr_conv;
18045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18046 this_ptr_conv.is_owned = false;
18047 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18048 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18052 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18053 LDKDataLossProtect this_ptr_conv;
18054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18055 this_ptr_conv.is_owned = false;
18056 LDKPublicKey val_ref;
18057 CHECK(*((uint32_t*)val) == 33);
18058 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18059 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18062 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
18063 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18064 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
18065 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
18066 LDKPublicKey my_current_per_commitment_point_arg_ref;
18067 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
18068 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
18069 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18072 uint64_t ret_ref = (uint64_t)ret_var.inner;
18073 if (ret_var.is_owned) {
18079 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
18080 LDKDataLossProtect orig_conv;
18081 orig_conv.inner = (void*)(orig & (~1));
18082 orig_conv.is_owned = false;
18083 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18086 uint64_t ret_ref = (uint64_t)ret_var.inner;
18087 if (ret_var.is_owned) {
18093 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
18094 LDKChannelReestablish this_obj_conv;
18095 this_obj_conv.inner = (void*)(this_obj & (~1));
18096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18097 ChannelReestablish_free(this_obj_conv);
18100 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
18101 LDKChannelReestablish this_ptr_conv;
18102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18103 this_ptr_conv.is_owned = false;
18104 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18105 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
18109 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18110 LDKChannelReestablish this_ptr_conv;
18111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18112 this_ptr_conv.is_owned = false;
18113 LDKThirtyTwoBytes val_ref;
18114 CHECK(*((uint32_t*)val) == 32);
18115 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18116 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18119 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
18120 LDKChannelReestablish this_ptr_conv;
18121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18122 this_ptr_conv.is_owned = false;
18123 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18127 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
18128 LDKChannelReestablish this_ptr_conv;
18129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18130 this_ptr_conv.is_owned = false;
18131 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18134 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
18135 LDKChannelReestablish this_ptr_conv;
18136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18137 this_ptr_conv.is_owned = false;
18138 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18142 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
18143 LDKChannelReestablish this_ptr_conv;
18144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18145 this_ptr_conv.is_owned = false;
18146 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18149 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
18150 LDKChannelReestablish orig_conv;
18151 orig_conv.inner = (void*)(orig & (~1));
18152 orig_conv.is_owned = false;
18153 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18156 uint64_t ret_ref = (uint64_t)ret_var.inner;
18157 if (ret_var.is_owned) {
18163 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
18164 LDKAnnouncementSignatures this_obj_conv;
18165 this_obj_conv.inner = (void*)(this_obj & (~1));
18166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18167 AnnouncementSignatures_free(this_obj_conv);
18170 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
18171 LDKAnnouncementSignatures this_ptr_conv;
18172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18173 this_ptr_conv.is_owned = false;
18174 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18175 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
18179 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18180 LDKAnnouncementSignatures this_ptr_conv;
18181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18182 this_ptr_conv.is_owned = false;
18183 LDKThirtyTwoBytes val_ref;
18184 CHECK(*((uint32_t*)val) == 32);
18185 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18186 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18189 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
18190 LDKAnnouncementSignatures this_ptr_conv;
18191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18192 this_ptr_conv.is_owned = false;
18193 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18197 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18198 LDKAnnouncementSignatures this_ptr_conv;
18199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18200 this_ptr_conv.is_owned = false;
18201 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18204 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
18205 LDKAnnouncementSignatures this_ptr_conv;
18206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18207 this_ptr_conv.is_owned = false;
18208 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18209 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
18213 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
18214 LDKAnnouncementSignatures this_ptr_conv;
18215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18216 this_ptr_conv.is_owned = false;
18217 LDKSignature val_ref;
18218 CHECK(*((uint32_t*)val) == 64);
18219 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18220 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18223 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
18224 LDKAnnouncementSignatures this_ptr_conv;
18225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18226 this_ptr_conv.is_owned = false;
18227 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18228 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
18232 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
18233 LDKAnnouncementSignatures this_ptr_conv;
18234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18235 this_ptr_conv.is_owned = false;
18236 LDKSignature val_ref;
18237 CHECK(*((uint32_t*)val) == 64);
18238 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18239 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18242 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) {
18243 LDKThirtyTwoBytes channel_id_arg_ref;
18244 CHECK(*((uint32_t*)channel_id_arg) == 32);
18245 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18246 LDKSignature node_signature_arg_ref;
18247 CHECK(*((uint32_t*)node_signature_arg) == 64);
18248 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
18249 LDKSignature bitcoin_signature_arg_ref;
18250 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
18251 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
18252 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18255 uint64_t ret_ref = (uint64_t)ret_var.inner;
18256 if (ret_var.is_owned) {
18262 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
18263 LDKAnnouncementSignatures orig_conv;
18264 orig_conv.inner = (void*)(orig & (~1));
18265 orig_conv.is_owned = false;
18266 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18269 uint64_t ret_ref = (uint64_t)ret_var.inner;
18270 if (ret_var.is_owned) {
18276 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
18277 if ((this_ptr & 1) != 0) return;
18278 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18279 FREE((void*)this_ptr);
18280 NetAddress_free(this_ptr_conv);
18283 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
18284 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18285 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18286 *ret_copy = NetAddress_clone(orig_conv);
18287 uint64_t ret_ref = (uint64_t)ret_copy;
18291 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
18292 LDKFourBytes addr_ref;
18293 CHECK(*((uint32_t*)addr) == 4);
18294 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
18295 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18296 *ret_copy = NetAddress_ipv4(addr_ref, port);
18297 uint64_t ret_ref = (uint64_t)ret_copy;
18301 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
18302 LDKSixteenBytes addr_ref;
18303 CHECK(*((uint32_t*)addr) == 16);
18304 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
18305 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18306 *ret_copy = NetAddress_ipv6(addr_ref, port);
18307 uint64_t ret_ref = (uint64_t)ret_copy;
18311 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
18312 LDKTenBytes addr_ref;
18313 CHECK(*((uint32_t*)addr) == 10);
18314 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
18315 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18316 *ret_copy = NetAddress_onion_v2(addr_ref, port);
18317 uint64_t ret_ref = (uint64_t)ret_copy;
18321 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
18322 LDKThirtyTwoBytes ed25519_pubkey_ref;
18323 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
18324 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
18325 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18326 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
18327 uint64_t ret_ref = (uint64_t)ret_copy;
18331 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
18332 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18333 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18334 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18335 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18336 CVec_u8Z_free(ret_var);
18340 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
18341 LDKu8slice ser_ref;
18342 ser_ref.datalen = *((uint32_t*)ser);
18343 ser_ref.data = (int8_t*)(ser + 4);
18344 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18345 *ret_conv = Result_read(ser_ref);
18346 return (uint64_t)ret_conv;
18349 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
18350 LDKu8slice ser_ref;
18351 ser_ref.datalen = *((uint32_t*)ser);
18352 ser_ref.data = (int8_t*)(ser + 4);
18353 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18354 *ret_conv = NetAddress_read(ser_ref);
18355 return (uint64_t)ret_conv;
18358 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
18359 LDKUnsignedNodeAnnouncement this_obj_conv;
18360 this_obj_conv.inner = (void*)(this_obj & (~1));
18361 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18362 UnsignedNodeAnnouncement_free(this_obj_conv);
18365 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
18366 LDKUnsignedNodeAnnouncement this_ptr_conv;
18367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18368 this_ptr_conv.is_owned = false;
18369 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18372 uint64_t ret_ref = (uint64_t)ret_var.inner;
18373 if (ret_var.is_owned) {
18379 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18380 LDKUnsignedNodeAnnouncement this_ptr_conv;
18381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18382 this_ptr_conv.is_owned = false;
18383 LDKNodeFeatures val_conv;
18384 val_conv.inner = (void*)(val & (~1));
18385 val_conv.is_owned = (val & 1) || (val == 0);
18386 val_conv = NodeFeatures_clone(&val_conv);
18387 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18390 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
18391 LDKUnsignedNodeAnnouncement this_ptr_conv;
18392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18393 this_ptr_conv.is_owned = false;
18394 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18398 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
18399 LDKUnsignedNodeAnnouncement this_ptr_conv;
18400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18401 this_ptr_conv.is_owned = false;
18402 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18405 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
18406 LDKUnsignedNodeAnnouncement this_ptr_conv;
18407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18408 this_ptr_conv.is_owned = false;
18409 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18410 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
18414 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
18415 LDKUnsignedNodeAnnouncement this_ptr_conv;
18416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18417 this_ptr_conv.is_owned = false;
18418 LDKPublicKey val_ref;
18419 CHECK(*((uint32_t*)val) == 33);
18420 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18421 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18424 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
18425 LDKUnsignedNodeAnnouncement this_ptr_conv;
18426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18427 this_ptr_conv.is_owned = false;
18428 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18429 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
18433 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
18434 LDKUnsignedNodeAnnouncement this_ptr_conv;
18435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18436 this_ptr_conv.is_owned = false;
18437 LDKThreeBytes val_ref;
18438 CHECK(*((uint32_t*)val) == 3);
18439 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18440 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18443 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
18444 LDKUnsignedNodeAnnouncement this_ptr_conv;
18445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18446 this_ptr_conv.is_owned = false;
18447 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18448 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
18452 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
18453 LDKUnsignedNodeAnnouncement this_ptr_conv;
18454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18455 this_ptr_conv.is_owned = false;
18456 LDKThirtyTwoBytes val_ref;
18457 CHECK(*((uint32_t*)val) == 32);
18458 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18459 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18462 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18463 LDKUnsignedNodeAnnouncement this_ptr_conv;
18464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18465 this_ptr_conv.is_owned = false;
18466 LDKCVec_NetAddressZ val_constr;
18467 val_constr.datalen = *((uint32_t*)val);
18468 if (val_constr.datalen > 0)
18469 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18471 val_constr.data = NULL;
18472 uint32_t* val_vals = (uint32_t*)(val + 4);
18473 for (size_t m = 0; m < val_constr.datalen; m++) {
18474 uint32_t val_conv_12 = val_vals[m];
18475 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18476 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18477 val_constr.data[m] = val_conv_12_conv;
18479 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18482 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
18483 LDKUnsignedNodeAnnouncement orig_conv;
18484 orig_conv.inner = (void*)(orig & (~1));
18485 orig_conv.is_owned = false;
18486 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18489 uint64_t ret_ref = (uint64_t)ret_var.inner;
18490 if (ret_var.is_owned) {
18496 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
18497 LDKNodeAnnouncement this_obj_conv;
18498 this_obj_conv.inner = (void*)(this_obj & (~1));
18499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18500 NodeAnnouncement_free(this_obj_conv);
18503 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
18504 LDKNodeAnnouncement this_ptr_conv;
18505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18506 this_ptr_conv.is_owned = false;
18507 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18508 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
18512 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
18513 LDKNodeAnnouncement this_ptr_conv;
18514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18515 this_ptr_conv.is_owned = false;
18516 LDKSignature val_ref;
18517 CHECK(*((uint32_t*)val) == 64);
18518 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18519 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18522 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
18523 LDKNodeAnnouncement this_ptr_conv;
18524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18525 this_ptr_conv.is_owned = false;
18526 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18529 uint64_t ret_ref = (uint64_t)ret_var.inner;
18530 if (ret_var.is_owned) {
18536 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
18537 LDKNodeAnnouncement this_ptr_conv;
18538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18539 this_ptr_conv.is_owned = false;
18540 LDKUnsignedNodeAnnouncement val_conv;
18541 val_conv.inner = (void*)(val & (~1));
18542 val_conv.is_owned = (val & 1) || (val == 0);
18543 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18544 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18547 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
18548 LDKSignature signature_arg_ref;
18549 CHECK(*((uint32_t*)signature_arg) == 64);
18550 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18551 LDKUnsignedNodeAnnouncement contents_arg_conv;
18552 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18553 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18554 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18555 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18558 uint64_t ret_ref = (uint64_t)ret_var.inner;
18559 if (ret_var.is_owned) {
18565 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
18566 LDKNodeAnnouncement orig_conv;
18567 orig_conv.inner = (void*)(orig & (~1));
18568 orig_conv.is_owned = false;
18569 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18572 uint64_t ret_ref = (uint64_t)ret_var.inner;
18573 if (ret_var.is_owned) {
18579 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
18580 LDKUnsignedChannelAnnouncement this_obj_conv;
18581 this_obj_conv.inner = (void*)(this_obj & (~1));
18582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18583 UnsignedChannelAnnouncement_free(this_obj_conv);
18586 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
18587 LDKUnsignedChannelAnnouncement this_ptr_conv;
18588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18589 this_ptr_conv.is_owned = false;
18590 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18593 uint64_t ret_ref = (uint64_t)ret_var.inner;
18594 if (ret_var.is_owned) {
18600 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
18601 LDKUnsignedChannelAnnouncement this_ptr_conv;
18602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18603 this_ptr_conv.is_owned = false;
18604 LDKChannelFeatures val_conv;
18605 val_conv.inner = (void*)(val & (~1));
18606 val_conv.is_owned = (val & 1) || (val == 0);
18607 val_conv = ChannelFeatures_clone(&val_conv);
18608 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18611 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
18612 LDKUnsignedChannelAnnouncement this_ptr_conv;
18613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18614 this_ptr_conv.is_owned = false;
18615 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18616 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
18620 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18621 LDKUnsignedChannelAnnouncement this_ptr_conv;
18622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18623 this_ptr_conv.is_owned = false;
18624 LDKThirtyTwoBytes val_ref;
18625 CHECK(*((uint32_t*)val) == 32);
18626 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18627 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18630 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
18631 LDKUnsignedChannelAnnouncement this_ptr_conv;
18632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18633 this_ptr_conv.is_owned = false;
18634 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18638 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18639 LDKUnsignedChannelAnnouncement this_ptr_conv;
18640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18641 this_ptr_conv.is_owned = false;
18642 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18645 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
18646 LDKUnsignedChannelAnnouncement this_ptr_conv;
18647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18648 this_ptr_conv.is_owned = false;
18649 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18650 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
18654 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
18655 LDKUnsignedChannelAnnouncement this_ptr_conv;
18656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18657 this_ptr_conv.is_owned = false;
18658 LDKPublicKey val_ref;
18659 CHECK(*((uint32_t*)val) == 33);
18660 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18661 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18664 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
18665 LDKUnsignedChannelAnnouncement this_ptr_conv;
18666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18667 this_ptr_conv.is_owned = false;
18668 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18669 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
18673 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
18674 LDKUnsignedChannelAnnouncement this_ptr_conv;
18675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18676 this_ptr_conv.is_owned = false;
18677 LDKPublicKey val_ref;
18678 CHECK(*((uint32_t*)val) == 33);
18679 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18680 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18683 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
18684 LDKUnsignedChannelAnnouncement this_ptr_conv;
18685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18686 this_ptr_conv.is_owned = false;
18687 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18688 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
18692 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
18693 LDKUnsignedChannelAnnouncement this_ptr_conv;
18694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18695 this_ptr_conv.is_owned = false;
18696 LDKPublicKey val_ref;
18697 CHECK(*((uint32_t*)val) == 33);
18698 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18699 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18702 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
18703 LDKUnsignedChannelAnnouncement this_ptr_conv;
18704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18705 this_ptr_conv.is_owned = false;
18706 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18707 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
18711 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
18712 LDKUnsignedChannelAnnouncement this_ptr_conv;
18713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18714 this_ptr_conv.is_owned = false;
18715 LDKPublicKey val_ref;
18716 CHECK(*((uint32_t*)val) == 33);
18717 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18718 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18721 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
18722 LDKUnsignedChannelAnnouncement orig_conv;
18723 orig_conv.inner = (void*)(orig & (~1));
18724 orig_conv.is_owned = false;
18725 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18728 uint64_t ret_ref = (uint64_t)ret_var.inner;
18729 if (ret_var.is_owned) {
18735 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
18736 LDKChannelAnnouncement this_obj_conv;
18737 this_obj_conv.inner = (void*)(this_obj & (~1));
18738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18739 ChannelAnnouncement_free(this_obj_conv);
18742 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
18743 LDKChannelAnnouncement this_ptr_conv;
18744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18745 this_ptr_conv.is_owned = false;
18746 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18747 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
18751 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
18752 LDKChannelAnnouncement this_ptr_conv;
18753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18754 this_ptr_conv.is_owned = false;
18755 LDKSignature val_ref;
18756 CHECK(*((uint32_t*)val) == 64);
18757 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18758 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18761 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
18762 LDKChannelAnnouncement this_ptr_conv;
18763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18764 this_ptr_conv.is_owned = false;
18765 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18766 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
18770 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
18771 LDKChannelAnnouncement this_ptr_conv;
18772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18773 this_ptr_conv.is_owned = false;
18774 LDKSignature val_ref;
18775 CHECK(*((uint32_t*)val) == 64);
18776 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18777 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18780 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
18781 LDKChannelAnnouncement this_ptr_conv;
18782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18783 this_ptr_conv.is_owned = false;
18784 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18785 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
18789 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
18790 LDKChannelAnnouncement this_ptr_conv;
18791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18792 this_ptr_conv.is_owned = false;
18793 LDKSignature val_ref;
18794 CHECK(*((uint32_t*)val) == 64);
18795 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18796 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18799 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
18800 LDKChannelAnnouncement this_ptr_conv;
18801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18802 this_ptr_conv.is_owned = false;
18803 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18804 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
18808 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
18809 LDKChannelAnnouncement this_ptr_conv;
18810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18811 this_ptr_conv.is_owned = false;
18812 LDKSignature val_ref;
18813 CHECK(*((uint32_t*)val) == 64);
18814 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18815 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18818 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
18819 LDKChannelAnnouncement this_ptr_conv;
18820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18821 this_ptr_conv.is_owned = false;
18822 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18825 uint64_t ret_ref = (uint64_t)ret_var.inner;
18826 if (ret_var.is_owned) {
18832 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
18833 LDKChannelAnnouncement this_ptr_conv;
18834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18835 this_ptr_conv.is_owned = false;
18836 LDKUnsignedChannelAnnouncement val_conv;
18837 val_conv.inner = (void*)(val & (~1));
18838 val_conv.is_owned = (val & 1) || (val == 0);
18839 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18840 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18843 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) {
18844 LDKSignature node_signature_1_arg_ref;
18845 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
18846 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
18847 LDKSignature node_signature_2_arg_ref;
18848 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
18849 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
18850 LDKSignature bitcoin_signature_1_arg_ref;
18851 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
18852 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
18853 LDKSignature bitcoin_signature_2_arg_ref;
18854 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
18855 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
18856 LDKUnsignedChannelAnnouncement contents_arg_conv;
18857 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18858 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18859 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18860 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);
18861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18863 uint64_t ret_ref = (uint64_t)ret_var.inner;
18864 if (ret_var.is_owned) {
18870 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
18871 LDKChannelAnnouncement orig_conv;
18872 orig_conv.inner = (void*)(orig & (~1));
18873 orig_conv.is_owned = false;
18874 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18877 uint64_t ret_ref = (uint64_t)ret_var.inner;
18878 if (ret_var.is_owned) {
18884 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
18885 LDKUnsignedChannelUpdate this_obj_conv;
18886 this_obj_conv.inner = (void*)(this_obj & (~1));
18887 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18888 UnsignedChannelUpdate_free(this_obj_conv);
18891 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
18892 LDKUnsignedChannelUpdate this_ptr_conv;
18893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18894 this_ptr_conv.is_owned = false;
18895 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18896 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
18900 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
18901 LDKUnsignedChannelUpdate this_ptr_conv;
18902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18903 this_ptr_conv.is_owned = false;
18904 LDKThirtyTwoBytes val_ref;
18905 CHECK(*((uint32_t*)val) == 32);
18906 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18907 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18910 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
18911 LDKUnsignedChannelUpdate this_ptr_conv;
18912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18913 this_ptr_conv.is_owned = false;
18914 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18918 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18919 LDKUnsignedChannelUpdate this_ptr_conv;
18920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18921 this_ptr_conv.is_owned = false;
18922 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18925 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
18926 LDKUnsignedChannelUpdate this_ptr_conv;
18927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18928 this_ptr_conv.is_owned = false;
18929 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18933 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
18934 LDKUnsignedChannelUpdate this_ptr_conv;
18935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18936 this_ptr_conv.is_owned = false;
18937 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18940 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
18941 LDKUnsignedChannelUpdate this_ptr_conv;
18942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18943 this_ptr_conv.is_owned = false;
18944 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18948 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
18949 LDKUnsignedChannelUpdate this_ptr_conv;
18950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18951 this_ptr_conv.is_owned = false;
18952 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18955 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
18956 LDKUnsignedChannelUpdate this_ptr_conv;
18957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18958 this_ptr_conv.is_owned = false;
18959 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18963 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18964 LDKUnsignedChannelUpdate this_ptr_conv;
18965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18966 this_ptr_conv.is_owned = false;
18967 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18970 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
18971 LDKUnsignedChannelUpdate this_ptr_conv;
18972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18973 this_ptr_conv.is_owned = false;
18974 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18978 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18979 LDKUnsignedChannelUpdate this_ptr_conv;
18980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18981 this_ptr_conv.is_owned = false;
18982 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18985 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
18986 LDKUnsignedChannelUpdate this_ptr_conv;
18987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18988 this_ptr_conv.is_owned = false;
18989 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18993 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
18994 LDKUnsignedChannelUpdate this_ptr_conv;
18995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18996 this_ptr_conv.is_owned = false;
18997 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19000 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
19001 LDKUnsignedChannelUpdate this_ptr_conv;
19002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19003 this_ptr_conv.is_owned = false;
19004 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19008 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
19009 LDKUnsignedChannelUpdate this_ptr_conv;
19010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19011 this_ptr_conv.is_owned = false;
19012 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19015 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
19016 LDKUnsignedChannelUpdate orig_conv;
19017 orig_conv.inner = (void*)(orig & (~1));
19018 orig_conv.is_owned = false;
19019 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19022 uint64_t ret_ref = (uint64_t)ret_var.inner;
19023 if (ret_var.is_owned) {
19029 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
19030 LDKChannelUpdate this_obj_conv;
19031 this_obj_conv.inner = (void*)(this_obj & (~1));
19032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19033 ChannelUpdate_free(this_obj_conv);
19036 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
19037 LDKChannelUpdate this_ptr_conv;
19038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19039 this_ptr_conv.is_owned = false;
19040 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19041 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
19045 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
19046 LDKChannelUpdate this_ptr_conv;
19047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19048 this_ptr_conv.is_owned = false;
19049 LDKSignature val_ref;
19050 CHECK(*((uint32_t*)val) == 64);
19051 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19052 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19055 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
19056 LDKChannelUpdate this_ptr_conv;
19057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19058 this_ptr_conv.is_owned = false;
19059 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19062 uint64_t ret_ref = (uint64_t)ret_var.inner;
19063 if (ret_var.is_owned) {
19069 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
19070 LDKChannelUpdate this_ptr_conv;
19071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19072 this_ptr_conv.is_owned = false;
19073 LDKUnsignedChannelUpdate val_conv;
19074 val_conv.inner = (void*)(val & (~1));
19075 val_conv.is_owned = (val & 1) || (val == 0);
19076 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19077 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19080 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
19081 LDKSignature signature_arg_ref;
19082 CHECK(*((uint32_t*)signature_arg) == 64);
19083 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19084 LDKUnsignedChannelUpdate contents_arg_conv;
19085 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19086 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19087 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19088 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19091 uint64_t ret_ref = (uint64_t)ret_var.inner;
19092 if (ret_var.is_owned) {
19098 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
19099 LDKChannelUpdate orig_conv;
19100 orig_conv.inner = (void*)(orig & (~1));
19101 orig_conv.is_owned = false;
19102 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19105 uint64_t ret_ref = (uint64_t)ret_var.inner;
19106 if (ret_var.is_owned) {
19112 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
19113 LDKQueryChannelRange this_obj_conv;
19114 this_obj_conv.inner = (void*)(this_obj & (~1));
19115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19116 QueryChannelRange_free(this_obj_conv);
19119 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
19120 LDKQueryChannelRange this_ptr_conv;
19121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19122 this_ptr_conv.is_owned = false;
19123 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19124 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
19128 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19129 LDKQueryChannelRange this_ptr_conv;
19130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19131 this_ptr_conv.is_owned = false;
19132 LDKThirtyTwoBytes val_ref;
19133 CHECK(*((uint32_t*)val) == 32);
19134 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19135 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19138 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
19139 LDKQueryChannelRange this_ptr_conv;
19140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19141 this_ptr_conv.is_owned = false;
19142 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19146 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19147 LDKQueryChannelRange this_ptr_conv;
19148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19149 this_ptr_conv.is_owned = false;
19150 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19153 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19154 LDKQueryChannelRange this_ptr_conv;
19155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19156 this_ptr_conv.is_owned = false;
19157 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19161 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19162 LDKQueryChannelRange this_ptr_conv;
19163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19164 this_ptr_conv.is_owned = false;
19165 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19168 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
19169 LDKThirtyTwoBytes chain_hash_arg_ref;
19170 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19171 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19172 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19175 uint64_t ret_ref = (uint64_t)ret_var.inner;
19176 if (ret_var.is_owned) {
19182 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
19183 LDKQueryChannelRange orig_conv;
19184 orig_conv.inner = (void*)(orig & (~1));
19185 orig_conv.is_owned = false;
19186 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19189 uint64_t ret_ref = (uint64_t)ret_var.inner;
19190 if (ret_var.is_owned) {
19196 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
19197 LDKReplyChannelRange this_obj_conv;
19198 this_obj_conv.inner = (void*)(this_obj & (~1));
19199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19200 ReplyChannelRange_free(this_obj_conv);
19203 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
19204 LDKReplyChannelRange this_ptr_conv;
19205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19206 this_ptr_conv.is_owned = false;
19207 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19208 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
19212 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19213 LDKReplyChannelRange this_ptr_conv;
19214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19215 this_ptr_conv.is_owned = false;
19216 LDKThirtyTwoBytes val_ref;
19217 CHECK(*((uint32_t*)val) == 32);
19218 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19219 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19222 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
19223 LDKReplyChannelRange this_ptr_conv;
19224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19225 this_ptr_conv.is_owned = false;
19226 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19230 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19231 LDKReplyChannelRange this_ptr_conv;
19232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19233 this_ptr_conv.is_owned = false;
19234 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19237 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19238 LDKReplyChannelRange this_ptr_conv;
19239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19240 this_ptr_conv.is_owned = false;
19241 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19245 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19246 LDKReplyChannelRange this_ptr_conv;
19247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19248 this_ptr_conv.is_owned = false;
19249 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19252 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
19253 LDKReplyChannelRange this_ptr_conv;
19254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19255 this_ptr_conv.is_owned = false;
19256 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19260 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
19261 LDKReplyChannelRange this_ptr_conv;
19262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19263 this_ptr_conv.is_owned = false;
19264 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19267 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19268 LDKReplyChannelRange this_ptr_conv;
19269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19270 this_ptr_conv.is_owned = false;
19271 LDKCVec_u64Z val_constr;
19272 val_constr.datalen = *((uint32_t*)val);
19273 if (val_constr.datalen > 0)
19274 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19276 val_constr.data = NULL;
19277 int64_t* val_vals = (int64_t*)(val + 4);
19278 for (size_t i = 0; i < val_constr.datalen; i++) {
19279 int64_t val_conv_8 = val_vals[i];
19280 val_constr.data[i] = val_conv_8;
19282 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19285 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) {
19286 LDKThirtyTwoBytes chain_hash_arg_ref;
19287 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19288 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19289 LDKCVec_u64Z short_channel_ids_arg_constr;
19290 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19291 if (short_channel_ids_arg_constr.datalen > 0)
19292 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19294 short_channel_ids_arg_constr.data = NULL;
19295 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19296 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19297 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19298 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19300 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19303 uint64_t ret_ref = (uint64_t)ret_var.inner;
19304 if (ret_var.is_owned) {
19310 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
19311 LDKReplyChannelRange orig_conv;
19312 orig_conv.inner = (void*)(orig & (~1));
19313 orig_conv.is_owned = false;
19314 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19315 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19316 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19317 uint64_t ret_ref = (uint64_t)ret_var.inner;
19318 if (ret_var.is_owned) {
19324 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
19325 LDKQueryShortChannelIds this_obj_conv;
19326 this_obj_conv.inner = (void*)(this_obj & (~1));
19327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19328 QueryShortChannelIds_free(this_obj_conv);
19331 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
19332 LDKQueryShortChannelIds this_ptr_conv;
19333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19334 this_ptr_conv.is_owned = false;
19335 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19336 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
19340 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19341 LDKQueryShortChannelIds this_ptr_conv;
19342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19343 this_ptr_conv.is_owned = false;
19344 LDKThirtyTwoBytes val_ref;
19345 CHECK(*((uint32_t*)val) == 32);
19346 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19347 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19350 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
19351 LDKQueryShortChannelIds this_ptr_conv;
19352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19353 this_ptr_conv.is_owned = false;
19354 LDKCVec_u64Z val_constr;
19355 val_constr.datalen = *((uint32_t*)val);
19356 if (val_constr.datalen > 0)
19357 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19359 val_constr.data = NULL;
19360 int64_t* val_vals = (int64_t*)(val + 4);
19361 for (size_t i = 0; i < val_constr.datalen; i++) {
19362 int64_t val_conv_8 = val_vals[i];
19363 val_constr.data[i] = val_conv_8;
19365 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19368 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
19369 LDKThirtyTwoBytes chain_hash_arg_ref;
19370 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19371 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19372 LDKCVec_u64Z short_channel_ids_arg_constr;
19373 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
19374 if (short_channel_ids_arg_constr.datalen > 0)
19375 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19377 short_channel_ids_arg_constr.data = NULL;
19378 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
19379 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
19380 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
19381 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
19383 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19386 uint64_t ret_ref = (uint64_t)ret_var.inner;
19387 if (ret_var.is_owned) {
19393 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
19394 LDKQueryShortChannelIds orig_conv;
19395 orig_conv.inner = (void*)(orig & (~1));
19396 orig_conv.is_owned = false;
19397 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19400 uint64_t ret_ref = (uint64_t)ret_var.inner;
19401 if (ret_var.is_owned) {
19407 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
19408 LDKReplyShortChannelIdsEnd this_obj_conv;
19409 this_obj_conv.inner = (void*)(this_obj & (~1));
19410 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19411 ReplyShortChannelIdsEnd_free(this_obj_conv);
19414 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
19415 LDKReplyShortChannelIdsEnd this_ptr_conv;
19416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19417 this_ptr_conv.is_owned = false;
19418 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19419 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
19423 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19424 LDKReplyShortChannelIdsEnd this_ptr_conv;
19425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19426 this_ptr_conv.is_owned = false;
19427 LDKThirtyTwoBytes val_ref;
19428 CHECK(*((uint32_t*)val) == 32);
19429 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19430 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19433 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
19434 LDKReplyShortChannelIdsEnd this_ptr_conv;
19435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19436 this_ptr_conv.is_owned = false;
19437 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19441 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
19442 LDKReplyShortChannelIdsEnd this_ptr_conv;
19443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19444 this_ptr_conv.is_owned = false;
19445 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19448 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
19449 LDKThirtyTwoBytes chain_hash_arg_ref;
19450 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19451 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19452 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19455 uint64_t ret_ref = (uint64_t)ret_var.inner;
19456 if (ret_var.is_owned) {
19462 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
19463 LDKReplyShortChannelIdsEnd orig_conv;
19464 orig_conv.inner = (void*)(orig & (~1));
19465 orig_conv.is_owned = false;
19466 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19469 uint64_t ret_ref = (uint64_t)ret_var.inner;
19470 if (ret_var.is_owned) {
19476 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
19477 LDKGossipTimestampFilter this_obj_conv;
19478 this_obj_conv.inner = (void*)(this_obj & (~1));
19479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19480 GossipTimestampFilter_free(this_obj_conv);
19483 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
19484 LDKGossipTimestampFilter this_ptr_conv;
19485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19486 this_ptr_conv.is_owned = false;
19487 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19488 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
19492 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19493 LDKGossipTimestampFilter this_ptr_conv;
19494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19495 this_ptr_conv.is_owned = false;
19496 LDKThirtyTwoBytes val_ref;
19497 CHECK(*((uint32_t*)val) == 32);
19498 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19499 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19502 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
19503 LDKGossipTimestampFilter this_ptr_conv;
19504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19505 this_ptr_conv.is_owned = false;
19506 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19510 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
19511 LDKGossipTimestampFilter this_ptr_conv;
19512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19513 this_ptr_conv.is_owned = false;
19514 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19517 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
19518 LDKGossipTimestampFilter this_ptr_conv;
19519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19520 this_ptr_conv.is_owned = false;
19521 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19525 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
19526 LDKGossipTimestampFilter this_ptr_conv;
19527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19528 this_ptr_conv.is_owned = false;
19529 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19532 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
19533 LDKThirtyTwoBytes chain_hash_arg_ref;
19534 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19535 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19536 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19539 uint64_t ret_ref = (uint64_t)ret_var.inner;
19540 if (ret_var.is_owned) {
19546 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
19547 LDKGossipTimestampFilter orig_conv;
19548 orig_conv.inner = (void*)(orig & (~1));
19549 orig_conv.is_owned = false;
19550 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19553 uint64_t ret_ref = (uint64_t)ret_var.inner;
19554 if (ret_var.is_owned) {
19560 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
19561 if ((this_ptr & 1) != 0) return;
19562 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19563 FREE((void*)this_ptr);
19564 ErrorAction_free(this_ptr_conv);
19567 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
19568 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19569 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19570 *ret_copy = ErrorAction_clone(orig_conv);
19571 uint64_t ret_ref = (uint64_t)ret_copy;
19575 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
19576 LDKErrorMessage msg_conv;
19577 msg_conv.inner = (void*)(msg & (~1));
19578 msg_conv.is_owned = (msg & 1) || (msg == 0);
19579 msg_conv = ErrorMessage_clone(&msg_conv);
19580 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19581 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
19582 uint64_t ret_ref = (uint64_t)ret_copy;
19586 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
19587 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19588 *ret_copy = ErrorAction_ignore_error();
19589 uint64_t ret_ref = (uint64_t)ret_copy;
19593 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
19594 LDKLevel a_conv = LDKLevel_from_js(a);
19595 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19596 *ret_copy = ErrorAction_ignore_and_log(a_conv);
19597 uint64_t ret_ref = (uint64_t)ret_copy;
19601 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
19602 LDKErrorMessage msg_conv;
19603 msg_conv.inner = (void*)(msg & (~1));
19604 msg_conv.is_owned = (msg & 1) || (msg == 0);
19605 msg_conv = ErrorMessage_clone(&msg_conv);
19606 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19607 *ret_copy = ErrorAction_send_error_message(msg_conv);
19608 uint64_t ret_ref = (uint64_t)ret_copy;
19612 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
19613 LDKLightningError this_obj_conv;
19614 this_obj_conv.inner = (void*)(this_obj & (~1));
19615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19616 LightningError_free(this_obj_conv);
19619 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
19620 LDKLightningError this_ptr_conv;
19621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19622 this_ptr_conv.is_owned = false;
19623 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19624 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
19629 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
19630 LDKLightningError this_ptr_conv;
19631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19632 this_ptr_conv.is_owned = false;
19633 LDKStr val_conv = str_ref_to_owned_c(val);
19634 LightningError_set_err(&this_ptr_conv, val_conv);
19637 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
19638 LDKLightningError this_ptr_conv;
19639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19640 this_ptr_conv.is_owned = false;
19641 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19642 *ret_copy = LightningError_get_action(&this_ptr_conv);
19643 uint64_t ret_ref = (uint64_t)ret_copy;
19647 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
19648 LDKLightningError this_ptr_conv;
19649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19650 this_ptr_conv.is_owned = false;
19651 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19652 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
19653 LightningError_set_action(&this_ptr_conv, val_conv);
19656 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
19657 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
19658 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19659 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
19660 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19663 uint64_t ret_ref = (uint64_t)ret_var.inner;
19664 if (ret_var.is_owned) {
19670 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
19671 LDKLightningError orig_conv;
19672 orig_conv.inner = (void*)(orig & (~1));
19673 orig_conv.is_owned = false;
19674 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19675 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19676 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19677 uint64_t ret_ref = (uint64_t)ret_var.inner;
19678 if (ret_var.is_owned) {
19684 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
19685 LDKCommitmentUpdate this_obj_conv;
19686 this_obj_conv.inner = (void*)(this_obj & (~1));
19687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19688 CommitmentUpdate_free(this_obj_conv);
19691 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
19692 LDKCommitmentUpdate this_ptr_conv;
19693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19694 this_ptr_conv.is_owned = false;
19695 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
19696 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19697 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19698 for (size_t p = 0; p < ret_var.datalen; p++) {
19699 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
19700 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19701 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19702 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
19703 if (ret_conv_15_var.is_owned) {
19704 ret_conv_15_ref |= 1;
19706 ret_arr_ptr[p] = ret_conv_15_ref;
19708 FREE(ret_var.data);
19712 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
19713 LDKCommitmentUpdate this_ptr_conv;
19714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19715 this_ptr_conv.is_owned = false;
19716 LDKCVec_UpdateAddHTLCZ val_constr;
19717 val_constr.datalen = *((uint32_t*)val);
19718 if (val_constr.datalen > 0)
19719 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19721 val_constr.data = NULL;
19722 uint32_t* val_vals = (uint32_t*)(val + 4);
19723 for (size_t p = 0; p < val_constr.datalen; p++) {
19724 uint32_t val_conv_15 = val_vals[p];
19725 LDKUpdateAddHTLC val_conv_15_conv;
19726 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19727 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19728 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19729 val_constr.data[p] = val_conv_15_conv;
19731 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19734 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
19735 LDKCommitmentUpdate this_ptr_conv;
19736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19737 this_ptr_conv.is_owned = false;
19738 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
19739 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19740 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19741 for (size_t t = 0; t < ret_var.datalen; t++) {
19742 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
19743 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19744 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19745 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
19746 if (ret_conv_19_var.is_owned) {
19747 ret_conv_19_ref |= 1;
19749 ret_arr_ptr[t] = ret_conv_19_ref;
19751 FREE(ret_var.data);
19755 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
19756 LDKCommitmentUpdate this_ptr_conv;
19757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19758 this_ptr_conv.is_owned = false;
19759 LDKCVec_UpdateFulfillHTLCZ val_constr;
19760 val_constr.datalen = *((uint32_t*)val);
19761 if (val_constr.datalen > 0)
19762 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19764 val_constr.data = NULL;
19765 uint32_t* val_vals = (uint32_t*)(val + 4);
19766 for (size_t t = 0; t < val_constr.datalen; t++) {
19767 uint32_t val_conv_19 = val_vals[t];
19768 LDKUpdateFulfillHTLC val_conv_19_conv;
19769 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19770 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19771 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19772 val_constr.data[t] = val_conv_19_conv;
19774 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19777 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
19778 LDKCommitmentUpdate this_ptr_conv;
19779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19780 this_ptr_conv.is_owned = false;
19781 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
19782 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19783 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19784 for (size_t q = 0; q < ret_var.datalen; q++) {
19785 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
19786 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19787 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19788 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
19789 if (ret_conv_16_var.is_owned) {
19790 ret_conv_16_ref |= 1;
19792 ret_arr_ptr[q] = ret_conv_16_ref;
19794 FREE(ret_var.data);
19798 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
19799 LDKCommitmentUpdate this_ptr_conv;
19800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19801 this_ptr_conv.is_owned = false;
19802 LDKCVec_UpdateFailHTLCZ val_constr;
19803 val_constr.datalen = *((uint32_t*)val);
19804 if (val_constr.datalen > 0)
19805 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19807 val_constr.data = NULL;
19808 uint32_t* val_vals = (uint32_t*)(val + 4);
19809 for (size_t q = 0; q < val_constr.datalen; q++) {
19810 uint32_t val_conv_16 = val_vals[q];
19811 LDKUpdateFailHTLC val_conv_16_conv;
19812 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19813 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19814 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19815 val_constr.data[q] = val_conv_16_conv;
19817 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19820 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
19821 LDKCommitmentUpdate this_ptr_conv;
19822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19823 this_ptr_conv.is_owned = false;
19824 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
19825 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
19826 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19827 for (size_t z = 0; z < ret_var.datalen; z++) {
19828 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
19829 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19830 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19831 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
19832 if (ret_conv_25_var.is_owned) {
19833 ret_conv_25_ref |= 1;
19835 ret_arr_ptr[z] = ret_conv_25_ref;
19837 FREE(ret_var.data);
19841 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
19842 LDKCommitmentUpdate this_ptr_conv;
19843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19844 this_ptr_conv.is_owned = false;
19845 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19846 val_constr.datalen = *((uint32_t*)val);
19847 if (val_constr.datalen > 0)
19848 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19850 val_constr.data = NULL;
19851 uint32_t* val_vals = (uint32_t*)(val + 4);
19852 for (size_t z = 0; z < val_constr.datalen; z++) {
19853 uint32_t val_conv_25 = val_vals[z];
19854 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19855 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19856 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19857 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19858 val_constr.data[z] = val_conv_25_conv;
19860 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19863 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
19864 LDKCommitmentUpdate this_ptr_conv;
19865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19866 this_ptr_conv.is_owned = false;
19867 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
19868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19870 uint64_t ret_ref = (uint64_t)ret_var.inner;
19871 if (ret_var.is_owned) {
19877 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
19878 LDKCommitmentUpdate this_ptr_conv;
19879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19880 this_ptr_conv.is_owned = false;
19881 LDKUpdateFee val_conv;
19882 val_conv.inner = (void*)(val & (~1));
19883 val_conv.is_owned = (val & 1) || (val == 0);
19884 val_conv = UpdateFee_clone(&val_conv);
19885 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19888 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
19889 LDKCommitmentUpdate this_ptr_conv;
19890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19891 this_ptr_conv.is_owned = false;
19892 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19895 uint64_t ret_ref = (uint64_t)ret_var.inner;
19896 if (ret_var.is_owned) {
19902 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
19903 LDKCommitmentUpdate this_ptr_conv;
19904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19905 this_ptr_conv.is_owned = false;
19906 LDKCommitmentSigned val_conv;
19907 val_conv.inner = (void*)(val & (~1));
19908 val_conv.is_owned = (val & 1) || (val == 0);
19909 val_conv = CommitmentSigned_clone(&val_conv);
19910 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19913 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) {
19914 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19915 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
19916 if (update_add_htlcs_arg_constr.datalen > 0)
19917 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19919 update_add_htlcs_arg_constr.data = NULL;
19920 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
19921 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19922 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19923 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19924 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19925 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19926 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19927 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19929 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19930 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
19931 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19932 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19934 update_fulfill_htlcs_arg_constr.data = NULL;
19935 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
19936 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19937 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19938 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19939 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19940 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19941 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19942 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19944 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19945 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
19946 if (update_fail_htlcs_arg_constr.datalen > 0)
19947 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19949 update_fail_htlcs_arg_constr.data = NULL;
19950 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
19951 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19952 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19953 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19954 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19955 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19956 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19957 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19959 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19960 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
19961 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19962 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19964 update_fail_malformed_htlcs_arg_constr.data = NULL;
19965 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
19966 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19967 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19968 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19969 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19970 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);
19971 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19972 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19974 LDKUpdateFee update_fee_arg_conv;
19975 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19976 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19977 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19978 LDKCommitmentSigned commitment_signed_arg_conv;
19979 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19980 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19981 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19982 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);
19983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19985 uint64_t ret_ref = (uint64_t)ret_var.inner;
19986 if (ret_var.is_owned) {
19992 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
19993 LDKCommitmentUpdate orig_conv;
19994 orig_conv.inner = (void*)(orig & (~1));
19995 orig_conv.is_owned = false;
19996 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19999 uint64_t ret_ref = (uint64_t)ret_var.inner;
20000 if (ret_var.is_owned) {
20006 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
20007 if ((this_ptr & 1) != 0) return;
20008 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20009 FREE((void*)this_ptr);
20010 ChannelMessageHandler_free(this_ptr_conv);
20013 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
20014 if ((this_ptr & 1) != 0) return;
20015 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20016 FREE((void*)this_ptr);
20017 RoutingMessageHandler_free(this_ptr_conv);
20020 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
20021 LDKAcceptChannel obj_conv;
20022 obj_conv.inner = (void*)(obj & (~1));
20023 obj_conv.is_owned = false;
20024 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20025 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20026 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20027 CVec_u8Z_free(ret_var);
20031 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
20032 LDKu8slice ser_ref;
20033 ser_ref.datalen = *((uint32_t*)ser);
20034 ser_ref.data = (int8_t*)(ser + 4);
20035 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20036 *ret_conv = AcceptChannel_read(ser_ref);
20037 return (uint64_t)ret_conv;
20040 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
20041 LDKAnnouncementSignatures obj_conv;
20042 obj_conv.inner = (void*)(obj & (~1));
20043 obj_conv.is_owned = false;
20044 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20045 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20046 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20047 CVec_u8Z_free(ret_var);
20051 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
20052 LDKu8slice ser_ref;
20053 ser_ref.datalen = *((uint32_t*)ser);
20054 ser_ref.data = (int8_t*)(ser + 4);
20055 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20056 *ret_conv = AnnouncementSignatures_read(ser_ref);
20057 return (uint64_t)ret_conv;
20060 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
20061 LDKChannelReestablish obj_conv;
20062 obj_conv.inner = (void*)(obj & (~1));
20063 obj_conv.is_owned = false;
20064 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20065 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20066 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20067 CVec_u8Z_free(ret_var);
20071 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
20072 LDKu8slice ser_ref;
20073 ser_ref.datalen = *((uint32_t*)ser);
20074 ser_ref.data = (int8_t*)(ser + 4);
20075 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20076 *ret_conv = ChannelReestablish_read(ser_ref);
20077 return (uint64_t)ret_conv;
20080 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
20081 LDKClosingSigned obj_conv;
20082 obj_conv.inner = (void*)(obj & (~1));
20083 obj_conv.is_owned = false;
20084 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20085 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20086 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20087 CVec_u8Z_free(ret_var);
20091 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
20092 LDKu8slice ser_ref;
20093 ser_ref.datalen = *((uint32_t*)ser);
20094 ser_ref.data = (int8_t*)(ser + 4);
20095 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20096 *ret_conv = ClosingSigned_read(ser_ref);
20097 return (uint64_t)ret_conv;
20100 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
20101 LDKClosingSignedFeeRange obj_conv;
20102 obj_conv.inner = (void*)(obj & (~1));
20103 obj_conv.is_owned = false;
20104 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
20105 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20106 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20107 CVec_u8Z_free(ret_var);
20111 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
20112 LDKu8slice ser_ref;
20113 ser_ref.datalen = *((uint32_t*)ser);
20114 ser_ref.data = (int8_t*)(ser + 4);
20115 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20116 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
20117 return (uint64_t)ret_conv;
20120 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
20121 LDKCommitmentSigned obj_conv;
20122 obj_conv.inner = (void*)(obj & (~1));
20123 obj_conv.is_owned = false;
20124 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20125 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20126 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20127 CVec_u8Z_free(ret_var);
20131 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
20132 LDKu8slice ser_ref;
20133 ser_ref.datalen = *((uint32_t*)ser);
20134 ser_ref.data = (int8_t*)(ser + 4);
20135 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20136 *ret_conv = CommitmentSigned_read(ser_ref);
20137 return (uint64_t)ret_conv;
20140 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
20141 LDKFundingCreated obj_conv;
20142 obj_conv.inner = (void*)(obj & (~1));
20143 obj_conv.is_owned = false;
20144 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20145 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20146 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20147 CVec_u8Z_free(ret_var);
20151 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
20152 LDKu8slice ser_ref;
20153 ser_ref.datalen = *((uint32_t*)ser);
20154 ser_ref.data = (int8_t*)(ser + 4);
20155 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20156 *ret_conv = FundingCreated_read(ser_ref);
20157 return (uint64_t)ret_conv;
20160 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
20161 LDKFundingSigned obj_conv;
20162 obj_conv.inner = (void*)(obj & (~1));
20163 obj_conv.is_owned = false;
20164 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20165 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20166 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20167 CVec_u8Z_free(ret_var);
20171 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
20172 LDKu8slice ser_ref;
20173 ser_ref.datalen = *((uint32_t*)ser);
20174 ser_ref.data = (int8_t*)(ser + 4);
20175 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20176 *ret_conv = FundingSigned_read(ser_ref);
20177 return (uint64_t)ret_conv;
20180 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
20181 LDKFundingLocked obj_conv;
20182 obj_conv.inner = (void*)(obj & (~1));
20183 obj_conv.is_owned = false;
20184 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20185 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20186 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20187 CVec_u8Z_free(ret_var);
20191 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
20192 LDKu8slice ser_ref;
20193 ser_ref.datalen = *((uint32_t*)ser);
20194 ser_ref.data = (int8_t*)(ser + 4);
20195 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20196 *ret_conv = FundingLocked_read(ser_ref);
20197 return (uint64_t)ret_conv;
20200 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
20202 obj_conv.inner = (void*)(obj & (~1));
20203 obj_conv.is_owned = false;
20204 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20205 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20206 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20207 CVec_u8Z_free(ret_var);
20211 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
20212 LDKu8slice ser_ref;
20213 ser_ref.datalen = *((uint32_t*)ser);
20214 ser_ref.data = (int8_t*)(ser + 4);
20215 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20216 *ret_conv = Init_read(ser_ref);
20217 return (uint64_t)ret_conv;
20220 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
20221 LDKOpenChannel obj_conv;
20222 obj_conv.inner = (void*)(obj & (~1));
20223 obj_conv.is_owned = false;
20224 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20225 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20226 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20227 CVec_u8Z_free(ret_var);
20231 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
20232 LDKu8slice ser_ref;
20233 ser_ref.datalen = *((uint32_t*)ser);
20234 ser_ref.data = (int8_t*)(ser + 4);
20235 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20236 *ret_conv = OpenChannel_read(ser_ref);
20237 return (uint64_t)ret_conv;
20240 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
20241 LDKRevokeAndACK obj_conv;
20242 obj_conv.inner = (void*)(obj & (~1));
20243 obj_conv.is_owned = false;
20244 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20245 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20246 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20247 CVec_u8Z_free(ret_var);
20251 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
20252 LDKu8slice ser_ref;
20253 ser_ref.datalen = *((uint32_t*)ser);
20254 ser_ref.data = (int8_t*)(ser + 4);
20255 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20256 *ret_conv = RevokeAndACK_read(ser_ref);
20257 return (uint64_t)ret_conv;
20260 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
20261 LDKShutdown obj_conv;
20262 obj_conv.inner = (void*)(obj & (~1));
20263 obj_conv.is_owned = false;
20264 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20265 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20266 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20267 CVec_u8Z_free(ret_var);
20271 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
20272 LDKu8slice ser_ref;
20273 ser_ref.datalen = *((uint32_t*)ser);
20274 ser_ref.data = (int8_t*)(ser + 4);
20275 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20276 *ret_conv = Shutdown_read(ser_ref);
20277 return (uint64_t)ret_conv;
20280 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
20281 LDKUpdateFailHTLC obj_conv;
20282 obj_conv.inner = (void*)(obj & (~1));
20283 obj_conv.is_owned = false;
20284 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20285 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20286 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20287 CVec_u8Z_free(ret_var);
20291 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
20292 LDKu8slice ser_ref;
20293 ser_ref.datalen = *((uint32_t*)ser);
20294 ser_ref.data = (int8_t*)(ser + 4);
20295 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20296 *ret_conv = UpdateFailHTLC_read(ser_ref);
20297 return (uint64_t)ret_conv;
20300 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
20301 LDKUpdateFailMalformedHTLC obj_conv;
20302 obj_conv.inner = (void*)(obj & (~1));
20303 obj_conv.is_owned = false;
20304 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20305 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20306 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20307 CVec_u8Z_free(ret_var);
20311 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
20312 LDKu8slice ser_ref;
20313 ser_ref.datalen = *((uint32_t*)ser);
20314 ser_ref.data = (int8_t*)(ser + 4);
20315 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20316 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20317 return (uint64_t)ret_conv;
20320 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
20321 LDKUpdateFee obj_conv;
20322 obj_conv.inner = (void*)(obj & (~1));
20323 obj_conv.is_owned = false;
20324 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20325 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20326 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20327 CVec_u8Z_free(ret_var);
20331 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
20332 LDKu8slice ser_ref;
20333 ser_ref.datalen = *((uint32_t*)ser);
20334 ser_ref.data = (int8_t*)(ser + 4);
20335 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20336 *ret_conv = UpdateFee_read(ser_ref);
20337 return (uint64_t)ret_conv;
20340 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
20341 LDKUpdateFulfillHTLC obj_conv;
20342 obj_conv.inner = (void*)(obj & (~1));
20343 obj_conv.is_owned = false;
20344 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20345 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20346 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20347 CVec_u8Z_free(ret_var);
20351 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
20352 LDKu8slice ser_ref;
20353 ser_ref.datalen = *((uint32_t*)ser);
20354 ser_ref.data = (int8_t*)(ser + 4);
20355 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20356 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20357 return (uint64_t)ret_conv;
20360 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
20361 LDKUpdateAddHTLC obj_conv;
20362 obj_conv.inner = (void*)(obj & (~1));
20363 obj_conv.is_owned = false;
20364 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20365 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20366 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20367 CVec_u8Z_free(ret_var);
20371 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
20372 LDKu8slice ser_ref;
20373 ser_ref.datalen = *((uint32_t*)ser);
20374 ser_ref.data = (int8_t*)(ser + 4);
20375 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20376 *ret_conv = UpdateAddHTLC_read(ser_ref);
20377 return (uint64_t)ret_conv;
20380 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
20382 obj_conv.inner = (void*)(obj & (~1));
20383 obj_conv.is_owned = false;
20384 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20385 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20386 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20387 CVec_u8Z_free(ret_var);
20391 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
20392 LDKu8slice ser_ref;
20393 ser_ref.datalen = *((uint32_t*)ser);
20394 ser_ref.data = (int8_t*)(ser + 4);
20395 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20396 *ret_conv = Ping_read(ser_ref);
20397 return (uint64_t)ret_conv;
20400 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
20402 obj_conv.inner = (void*)(obj & (~1));
20403 obj_conv.is_owned = false;
20404 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20405 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20406 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20407 CVec_u8Z_free(ret_var);
20411 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
20412 LDKu8slice ser_ref;
20413 ser_ref.datalen = *((uint32_t*)ser);
20414 ser_ref.data = (int8_t*)(ser + 4);
20415 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20416 *ret_conv = Pong_read(ser_ref);
20417 return (uint64_t)ret_conv;
20420 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
20421 LDKUnsignedChannelAnnouncement obj_conv;
20422 obj_conv.inner = (void*)(obj & (~1));
20423 obj_conv.is_owned = false;
20424 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20425 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20426 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20427 CVec_u8Z_free(ret_var);
20431 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
20432 LDKu8slice ser_ref;
20433 ser_ref.datalen = *((uint32_t*)ser);
20434 ser_ref.data = (int8_t*)(ser + 4);
20435 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20436 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20437 return (uint64_t)ret_conv;
20440 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
20441 LDKChannelAnnouncement obj_conv;
20442 obj_conv.inner = (void*)(obj & (~1));
20443 obj_conv.is_owned = false;
20444 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20445 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20446 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20447 CVec_u8Z_free(ret_var);
20451 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
20452 LDKu8slice ser_ref;
20453 ser_ref.datalen = *((uint32_t*)ser);
20454 ser_ref.data = (int8_t*)(ser + 4);
20455 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20456 *ret_conv = ChannelAnnouncement_read(ser_ref);
20457 return (uint64_t)ret_conv;
20460 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
20461 LDKUnsignedChannelUpdate obj_conv;
20462 obj_conv.inner = (void*)(obj & (~1));
20463 obj_conv.is_owned = false;
20464 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20465 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20466 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20467 CVec_u8Z_free(ret_var);
20471 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
20472 LDKu8slice ser_ref;
20473 ser_ref.datalen = *((uint32_t*)ser);
20474 ser_ref.data = (int8_t*)(ser + 4);
20475 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20476 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20477 return (uint64_t)ret_conv;
20480 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
20481 LDKChannelUpdate obj_conv;
20482 obj_conv.inner = (void*)(obj & (~1));
20483 obj_conv.is_owned = false;
20484 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20485 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20486 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20487 CVec_u8Z_free(ret_var);
20491 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
20492 LDKu8slice ser_ref;
20493 ser_ref.datalen = *((uint32_t*)ser);
20494 ser_ref.data = (int8_t*)(ser + 4);
20495 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20496 *ret_conv = ChannelUpdate_read(ser_ref);
20497 return (uint64_t)ret_conv;
20500 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
20501 LDKErrorMessage obj_conv;
20502 obj_conv.inner = (void*)(obj & (~1));
20503 obj_conv.is_owned = false;
20504 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20505 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20506 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20507 CVec_u8Z_free(ret_var);
20511 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
20512 LDKu8slice ser_ref;
20513 ser_ref.datalen = *((uint32_t*)ser);
20514 ser_ref.data = (int8_t*)(ser + 4);
20515 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20516 *ret_conv = ErrorMessage_read(ser_ref);
20517 return (uint64_t)ret_conv;
20520 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
20521 LDKUnsignedNodeAnnouncement obj_conv;
20522 obj_conv.inner = (void*)(obj & (~1));
20523 obj_conv.is_owned = false;
20524 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20525 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20526 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20527 CVec_u8Z_free(ret_var);
20531 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
20532 LDKu8slice ser_ref;
20533 ser_ref.datalen = *((uint32_t*)ser);
20534 ser_ref.data = (int8_t*)(ser + 4);
20535 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20536 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20537 return (uint64_t)ret_conv;
20540 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
20541 LDKNodeAnnouncement obj_conv;
20542 obj_conv.inner = (void*)(obj & (~1));
20543 obj_conv.is_owned = false;
20544 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20545 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20546 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20547 CVec_u8Z_free(ret_var);
20551 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
20552 LDKu8slice ser_ref;
20553 ser_ref.datalen = *((uint32_t*)ser);
20554 ser_ref.data = (int8_t*)(ser + 4);
20555 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20556 *ret_conv = NodeAnnouncement_read(ser_ref);
20557 return (uint64_t)ret_conv;
20560 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
20561 LDKu8slice ser_ref;
20562 ser_ref.datalen = *((uint32_t*)ser);
20563 ser_ref.data = (int8_t*)(ser + 4);
20564 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20565 *ret_conv = QueryShortChannelIds_read(ser_ref);
20566 return (uint64_t)ret_conv;
20569 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
20570 LDKQueryShortChannelIds obj_conv;
20571 obj_conv.inner = (void*)(obj & (~1));
20572 obj_conv.is_owned = false;
20573 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20574 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20575 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20576 CVec_u8Z_free(ret_var);
20580 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
20581 LDKReplyShortChannelIdsEnd obj_conv;
20582 obj_conv.inner = (void*)(obj & (~1));
20583 obj_conv.is_owned = false;
20584 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20585 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20586 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20587 CVec_u8Z_free(ret_var);
20591 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
20592 LDKu8slice ser_ref;
20593 ser_ref.datalen = *((uint32_t*)ser);
20594 ser_ref.data = (int8_t*)(ser + 4);
20595 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20596 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20597 return (uint64_t)ret_conv;
20600 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
20601 LDKQueryChannelRange this_arg_conv;
20602 this_arg_conv.inner = (void*)(this_arg & (~1));
20603 this_arg_conv.is_owned = false;
20604 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20608 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
20609 LDKQueryChannelRange obj_conv;
20610 obj_conv.inner = (void*)(obj & (~1));
20611 obj_conv.is_owned = false;
20612 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20613 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20614 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20615 CVec_u8Z_free(ret_var);
20619 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
20620 LDKu8slice ser_ref;
20621 ser_ref.datalen = *((uint32_t*)ser);
20622 ser_ref.data = (int8_t*)(ser + 4);
20623 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20624 *ret_conv = QueryChannelRange_read(ser_ref);
20625 return (uint64_t)ret_conv;
20628 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
20629 LDKu8slice ser_ref;
20630 ser_ref.datalen = *((uint32_t*)ser);
20631 ser_ref.data = (int8_t*)(ser + 4);
20632 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20633 *ret_conv = ReplyChannelRange_read(ser_ref);
20634 return (uint64_t)ret_conv;
20637 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
20638 LDKReplyChannelRange obj_conv;
20639 obj_conv.inner = (void*)(obj & (~1));
20640 obj_conv.is_owned = false;
20641 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20642 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20643 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20644 CVec_u8Z_free(ret_var);
20648 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
20649 LDKGossipTimestampFilter obj_conv;
20650 obj_conv.inner = (void*)(obj & (~1));
20651 obj_conv.is_owned = false;
20652 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20653 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20654 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20655 CVec_u8Z_free(ret_var);
20659 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
20660 LDKu8slice ser_ref;
20661 ser_ref.datalen = *((uint32_t*)ser);
20662 ser_ref.data = (int8_t*)(ser + 4);
20663 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20664 *ret_conv = GossipTimestampFilter_read(ser_ref);
20665 return (uint64_t)ret_conv;
20668 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
20669 if ((this_ptr & 1) != 0) return;
20670 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
20671 FREE((void*)this_ptr);
20672 CustomMessageHandler_free(this_ptr_conv);
20675 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
20676 LDKIgnoringMessageHandler this_obj_conv;
20677 this_obj_conv.inner = (void*)(this_obj & (~1));
20678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20679 IgnoringMessageHandler_free(this_obj_conv);
20682 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
20683 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20686 uint64_t ret_ref = (uint64_t)ret_var.inner;
20687 if (ret_var.is_owned) {
20693 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20694 LDKIgnoringMessageHandler this_arg_conv;
20695 this_arg_conv.inner = (void*)(this_arg & (~1));
20696 this_arg_conv.is_owned = false;
20697 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20698 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20699 return (uint64_t)ret_ret;
20702 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
20703 LDKIgnoringMessageHandler this_arg_conv;
20704 this_arg_conv.inner = (void*)(this_arg & (~1));
20705 this_arg_conv.is_owned = false;
20706 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20707 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20708 return (uint64_t)ret_ret;
20711 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
20712 LDKIgnoringMessageHandler this_arg_conv;
20713 this_arg_conv.inner = (void*)(this_arg & (~1));
20714 this_arg_conv.is_owned = false;
20715 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
20716 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
20717 return (uint64_t)ret_ret;
20720 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
20721 LDKIgnoringMessageHandler this_arg_conv;
20722 this_arg_conv.inner = (void*)(this_arg & (~1));
20723 this_arg_conv.is_owned = false;
20724 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
20725 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
20726 return (uint64_t)ret_ret;
20729 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
20730 LDKErroringMessageHandler this_obj_conv;
20731 this_obj_conv.inner = (void*)(this_obj & (~1));
20732 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20733 ErroringMessageHandler_free(this_obj_conv);
20736 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
20737 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20740 uint64_t ret_ref = (uint64_t)ret_var.inner;
20741 if (ret_var.is_owned) {
20747 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
20748 LDKErroringMessageHandler this_arg_conv;
20749 this_arg_conv.inner = (void*)(this_arg & (~1));
20750 this_arg_conv.is_owned = false;
20751 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20752 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20753 return (uint64_t)ret_ret;
20756 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
20757 LDKErroringMessageHandler this_arg_conv;
20758 this_arg_conv.inner = (void*)(this_arg & (~1));
20759 this_arg_conv.is_owned = false;
20760 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20761 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20762 return (uint64_t)ret_ret;
20765 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
20766 LDKMessageHandler this_obj_conv;
20767 this_obj_conv.inner = (void*)(this_obj & (~1));
20768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20769 MessageHandler_free(this_obj_conv);
20772 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
20773 LDKMessageHandler this_ptr_conv;
20774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20775 this_ptr_conv.is_owned = false;
20776 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20780 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
20781 LDKMessageHandler this_ptr_conv;
20782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20783 this_ptr_conv.is_owned = false;
20784 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20785 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20788 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
20789 LDKMessageHandler this_ptr_conv;
20790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20791 this_ptr_conv.is_owned = false;
20792 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20796 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
20797 LDKMessageHandler this_ptr_conv;
20798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20799 this_ptr_conv.is_owned = false;
20800 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20801 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20804 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
20805 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20806 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20807 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20810 uint64_t ret_ref = (uint64_t)ret_var.inner;
20811 if (ret_var.is_owned) {
20817 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
20818 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20819 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20820 *ret_ret = SocketDescriptor_clone(orig_conv);
20821 return (uint64_t)ret_ret;
20824 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
20825 if ((this_ptr & 1) != 0) return;
20826 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20827 FREE((void*)this_ptr);
20828 SocketDescriptor_free(this_ptr_conv);
20831 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
20832 LDKPeerHandleError this_obj_conv;
20833 this_obj_conv.inner = (void*)(this_obj & (~1));
20834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20835 PeerHandleError_free(this_obj_conv);
20838 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
20839 LDKPeerHandleError this_ptr_conv;
20840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20841 this_ptr_conv.is_owned = false;
20842 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20846 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
20847 LDKPeerHandleError this_ptr_conv;
20848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20849 this_ptr_conv.is_owned = false;
20850 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20853 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
20854 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20857 uint64_t ret_ref = (uint64_t)ret_var.inner;
20858 if (ret_var.is_owned) {
20864 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
20865 LDKPeerHandleError orig_conv;
20866 orig_conv.inner = (void*)(orig & (~1));
20867 orig_conv.is_owned = false;
20868 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
20869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20871 uint64_t ret_ref = (uint64_t)ret_var.inner;
20872 if (ret_var.is_owned) {
20878 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
20879 LDKPeerManager this_obj_conv;
20880 this_obj_conv.inner = (void*)(this_obj & (~1));
20881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20882 PeerManager_free(this_obj_conv);
20885 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
20886 LDKMessageHandler message_handler_conv;
20887 message_handler_conv.inner = (void*)(message_handler & (~1));
20888 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20889 // Warning: we need a move here but no clone is available for LDKMessageHandler
20890 LDKSecretKey our_node_secret_ref;
20891 CHECK(*((uint32_t*)our_node_secret) == 32);
20892 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
20893 unsigned char ephemeral_random_data_arr[32];
20894 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
20895 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
20896 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20897 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20898 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
20899 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
20900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20902 uint64_t ret_ref = (uint64_t)ret_var.inner;
20903 if (ret_var.is_owned) {
20909 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
20910 LDKPeerManager this_arg_conv;
20911 this_arg_conv.inner = (void*)(this_arg & (~1));
20912 this_arg_conv.is_owned = false;
20913 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20914 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
20915 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
20916 for (size_t m = 0; m < ret_var.datalen; m++) {
20917 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
20918 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
20919 ret_arr_ptr[m] = ret_conv_12_arr;
20921 FREE(ret_var.data);
20925 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
20926 LDKPeerManager this_arg_conv;
20927 this_arg_conv.inner = (void*)(this_arg & (~1));
20928 this_arg_conv.is_owned = false;
20929 LDKPublicKey their_node_id_ref;
20930 CHECK(*((uint32_t*)their_node_id) == 33);
20931 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
20932 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20933 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20934 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20935 return (uint64_t)ret_conv;
20938 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
20939 LDKPeerManager this_arg_conv;
20940 this_arg_conv.inner = (void*)(this_arg & (~1));
20941 this_arg_conv.is_owned = false;
20942 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20943 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20944 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20945 return (uint64_t)ret_conv;
20948 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
20949 LDKPeerManager this_arg_conv;
20950 this_arg_conv.inner = (void*)(this_arg & (~1));
20951 this_arg_conv.is_owned = false;
20952 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20953 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20954 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20955 return (uint64_t)ret_conv;
20958 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
20959 LDKPeerManager this_arg_conv;
20960 this_arg_conv.inner = (void*)(this_arg & (~1));
20961 this_arg_conv.is_owned = false;
20962 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20963 LDKu8slice data_ref;
20964 data_ref.datalen = *((uint32_t*)data);
20965 data_ref.data = (int8_t*)(data + 4);
20966 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20967 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20968 return (uint64_t)ret_conv;
20971 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
20972 LDKPeerManager this_arg_conv;
20973 this_arg_conv.inner = (void*)(this_arg & (~1));
20974 this_arg_conv.is_owned = false;
20975 PeerManager_process_events(&this_arg_conv);
20978 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
20979 LDKPeerManager this_arg_conv;
20980 this_arg_conv.inner = (void*)(this_arg & (~1));
20981 this_arg_conv.is_owned = false;
20982 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20983 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20986 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
20987 LDKPeerManager this_arg_conv;
20988 this_arg_conv.inner = (void*)(this_arg & (~1));
20989 this_arg_conv.is_owned = false;
20990 LDKPublicKey node_id_ref;
20991 CHECK(*((uint32_t*)node_id) == 33);
20992 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
20993 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20996 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
20997 LDKPeerManager this_arg_conv;
20998 this_arg_conv.inner = (void*)(this_arg & (~1));
20999 this_arg_conv.is_owned = false;
21000 PeerManager_timer_tick_occurred(&this_arg_conv);
21003 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
21004 unsigned char commitment_seed_arr[32];
21005 CHECK(*((uint32_t*)commitment_seed) == 32);
21006 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
21007 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21008 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21009 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
21013 int8_tArray __attribute__((visibility("default"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
21014 LDKCVec_u8Z to_holder_script_ref;
21015 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
21016 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
21017 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
21018 LDKCVec_u8Z to_counterparty_script_ref;
21019 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
21020 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
21021 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
21022 LDKOutPoint funding_outpoint_conv;
21023 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
21024 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
21025 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
21026 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
21027 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21028 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21029 Transaction_free(ret_var);
21033 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
21034 LDKPublicKey per_commitment_point_ref;
21035 CHECK(*((uint32_t*)per_commitment_point) == 33);
21036 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21037 unsigned char base_secret_arr[32];
21038 CHECK(*((uint32_t*)base_secret) == 32);
21039 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
21040 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21041 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21042 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21043 return (uint64_t)ret_conv;
21046 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
21047 LDKPublicKey per_commitment_point_ref;
21048 CHECK(*((uint32_t*)per_commitment_point) == 33);
21049 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21050 LDKPublicKey base_point_ref;
21051 CHECK(*((uint32_t*)base_point) == 33);
21052 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
21053 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21054 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21055 return (uint64_t)ret_conv;
21058 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
21059 unsigned char per_commitment_secret_arr[32];
21060 CHECK(*((uint32_t*)per_commitment_secret) == 32);
21061 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
21062 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21063 unsigned char countersignatory_revocation_base_secret_arr[32];
21064 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
21065 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
21066 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21067 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21068 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21069 return (uint64_t)ret_conv;
21072 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
21073 LDKPublicKey per_commitment_point_ref;
21074 CHECK(*((uint32_t*)per_commitment_point) == 33);
21075 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21076 LDKPublicKey countersignatory_revocation_base_point_ref;
21077 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
21078 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
21079 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21080 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21081 return (uint64_t)ret_conv;
21084 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
21085 LDKTxCreationKeys this_obj_conv;
21086 this_obj_conv.inner = (void*)(this_obj & (~1));
21087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21088 TxCreationKeys_free(this_obj_conv);
21091 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
21092 LDKTxCreationKeys this_ptr_conv;
21093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21094 this_ptr_conv.is_owned = false;
21095 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21096 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
21100 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
21101 LDKTxCreationKeys this_ptr_conv;
21102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21103 this_ptr_conv.is_owned = false;
21104 LDKPublicKey val_ref;
21105 CHECK(*((uint32_t*)val) == 33);
21106 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21107 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21110 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
21111 LDKTxCreationKeys this_ptr_conv;
21112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21113 this_ptr_conv.is_owned = false;
21114 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21115 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
21119 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
21120 LDKTxCreationKeys this_ptr_conv;
21121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21122 this_ptr_conv.is_owned = false;
21123 LDKPublicKey val_ref;
21124 CHECK(*((uint32_t*)val) == 33);
21125 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21126 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21129 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
21130 LDKTxCreationKeys this_ptr_conv;
21131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21132 this_ptr_conv.is_owned = false;
21133 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21134 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
21138 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
21139 LDKTxCreationKeys this_ptr_conv;
21140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21141 this_ptr_conv.is_owned = false;
21142 LDKPublicKey val_ref;
21143 CHECK(*((uint32_t*)val) == 33);
21144 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21145 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21148 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
21149 LDKTxCreationKeys this_ptr_conv;
21150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21151 this_ptr_conv.is_owned = false;
21152 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21153 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
21157 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
21158 LDKTxCreationKeys this_ptr_conv;
21159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21160 this_ptr_conv.is_owned = false;
21161 LDKPublicKey val_ref;
21162 CHECK(*((uint32_t*)val) == 33);
21163 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21164 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21167 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
21168 LDKTxCreationKeys this_ptr_conv;
21169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21170 this_ptr_conv.is_owned = false;
21171 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21172 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
21176 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
21177 LDKTxCreationKeys this_ptr_conv;
21178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21179 this_ptr_conv.is_owned = false;
21180 LDKPublicKey val_ref;
21181 CHECK(*((uint32_t*)val) == 33);
21182 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21183 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21186 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) {
21187 LDKPublicKey per_commitment_point_arg_ref;
21188 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
21189 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
21190 LDKPublicKey revocation_key_arg_ref;
21191 CHECK(*((uint32_t*)revocation_key_arg) == 33);
21192 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
21193 LDKPublicKey broadcaster_htlc_key_arg_ref;
21194 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
21195 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
21196 LDKPublicKey countersignatory_htlc_key_arg_ref;
21197 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
21198 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
21199 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21200 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
21201 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
21202 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);
21203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21205 uint64_t ret_ref = (uint64_t)ret_var.inner;
21206 if (ret_var.is_owned) {
21212 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
21213 LDKTxCreationKeys orig_conv;
21214 orig_conv.inner = (void*)(orig & (~1));
21215 orig_conv.is_owned = false;
21216 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21219 uint64_t ret_ref = (uint64_t)ret_var.inner;
21220 if (ret_var.is_owned) {
21226 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
21227 LDKTxCreationKeys obj_conv;
21228 obj_conv.inner = (void*)(obj & (~1));
21229 obj_conv.is_owned = false;
21230 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21231 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21232 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21233 CVec_u8Z_free(ret_var);
21237 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
21238 LDKu8slice ser_ref;
21239 ser_ref.datalen = *((uint32_t*)ser);
21240 ser_ref.data = (int8_t*)(ser + 4);
21241 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21242 *ret_conv = TxCreationKeys_read(ser_ref);
21243 return (uint64_t)ret_conv;
21246 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
21247 LDKChannelPublicKeys this_obj_conv;
21248 this_obj_conv.inner = (void*)(this_obj & (~1));
21249 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21250 ChannelPublicKeys_free(this_obj_conv);
21253 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
21254 LDKChannelPublicKeys this_ptr_conv;
21255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21256 this_ptr_conv.is_owned = false;
21257 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21258 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
21262 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
21263 LDKChannelPublicKeys this_ptr_conv;
21264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21265 this_ptr_conv.is_owned = false;
21266 LDKPublicKey val_ref;
21267 CHECK(*((uint32_t*)val) == 33);
21268 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21269 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21272 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
21273 LDKChannelPublicKeys this_ptr_conv;
21274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21275 this_ptr_conv.is_owned = false;
21276 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21277 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
21281 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
21282 LDKChannelPublicKeys this_ptr_conv;
21283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21284 this_ptr_conv.is_owned = false;
21285 LDKPublicKey val_ref;
21286 CHECK(*((uint32_t*)val) == 33);
21287 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21288 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21291 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
21292 LDKChannelPublicKeys this_ptr_conv;
21293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21294 this_ptr_conv.is_owned = false;
21295 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21296 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
21300 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
21301 LDKChannelPublicKeys this_ptr_conv;
21302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21303 this_ptr_conv.is_owned = false;
21304 LDKPublicKey val_ref;
21305 CHECK(*((uint32_t*)val) == 33);
21306 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21307 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21310 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
21311 LDKChannelPublicKeys this_ptr_conv;
21312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21313 this_ptr_conv.is_owned = false;
21314 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21315 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
21319 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
21320 LDKChannelPublicKeys this_ptr_conv;
21321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21322 this_ptr_conv.is_owned = false;
21323 LDKPublicKey val_ref;
21324 CHECK(*((uint32_t*)val) == 33);
21325 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21326 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21329 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
21330 LDKChannelPublicKeys this_ptr_conv;
21331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21332 this_ptr_conv.is_owned = false;
21333 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21334 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
21338 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
21339 LDKChannelPublicKeys this_ptr_conv;
21340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21341 this_ptr_conv.is_owned = false;
21342 LDKPublicKey val_ref;
21343 CHECK(*((uint32_t*)val) == 33);
21344 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21345 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21348 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) {
21349 LDKPublicKey funding_pubkey_arg_ref;
21350 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
21351 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
21352 LDKPublicKey revocation_basepoint_arg_ref;
21353 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
21354 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
21355 LDKPublicKey payment_point_arg_ref;
21356 CHECK(*((uint32_t*)payment_point_arg) == 33);
21357 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
21358 LDKPublicKey delayed_payment_basepoint_arg_ref;
21359 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
21360 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
21361 LDKPublicKey htlc_basepoint_arg_ref;
21362 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
21363 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
21364 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);
21365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21367 uint64_t ret_ref = (uint64_t)ret_var.inner;
21368 if (ret_var.is_owned) {
21374 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
21375 LDKChannelPublicKeys orig_conv;
21376 orig_conv.inner = (void*)(orig & (~1));
21377 orig_conv.is_owned = false;
21378 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21381 uint64_t ret_ref = (uint64_t)ret_var.inner;
21382 if (ret_var.is_owned) {
21388 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
21389 LDKChannelPublicKeys obj_conv;
21390 obj_conv.inner = (void*)(obj & (~1));
21391 obj_conv.is_owned = false;
21392 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21393 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21394 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21395 CVec_u8Z_free(ret_var);
21399 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
21400 LDKu8slice ser_ref;
21401 ser_ref.datalen = *((uint32_t*)ser);
21402 ser_ref.data = (int8_t*)(ser + 4);
21403 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21404 *ret_conv = ChannelPublicKeys_read(ser_ref);
21405 return (uint64_t)ret_conv;
21408 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) {
21409 LDKPublicKey per_commitment_point_ref;
21410 CHECK(*((uint32_t*)per_commitment_point) == 33);
21411 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21412 LDKPublicKey broadcaster_delayed_payment_base_ref;
21413 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
21414 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
21415 LDKPublicKey broadcaster_htlc_base_ref;
21416 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
21417 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
21418 LDKPublicKey countersignatory_revocation_base_ref;
21419 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
21420 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
21421 LDKPublicKey countersignatory_htlc_base_ref;
21422 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
21423 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
21424 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21425 *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);
21426 return (uint64_t)ret_conv;
21429 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
21430 LDKPublicKey per_commitment_point_ref;
21431 CHECK(*((uint32_t*)per_commitment_point) == 33);
21432 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21433 LDKChannelPublicKeys broadcaster_keys_conv;
21434 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21435 broadcaster_keys_conv.is_owned = false;
21436 LDKChannelPublicKeys countersignatory_keys_conv;
21437 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21438 countersignatory_keys_conv.is_owned = false;
21439 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21440 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21441 return (uint64_t)ret_conv;
21444 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
21445 LDKPublicKey revocation_key_ref;
21446 CHECK(*((uint32_t*)revocation_key) == 33);
21447 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21448 LDKPublicKey broadcaster_delayed_payment_key_ref;
21449 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21450 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21451 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21452 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21453 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21454 CVec_u8Z_free(ret_var);
21458 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
21459 LDKHTLCOutputInCommitment this_obj_conv;
21460 this_obj_conv.inner = (void*)(this_obj & (~1));
21461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21462 HTLCOutputInCommitment_free(this_obj_conv);
21465 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
21466 LDKHTLCOutputInCommitment this_ptr_conv;
21467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21468 this_ptr_conv.is_owned = false;
21469 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21473 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
21474 LDKHTLCOutputInCommitment this_ptr_conv;
21475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21476 this_ptr_conv.is_owned = false;
21477 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21480 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
21481 LDKHTLCOutputInCommitment this_ptr_conv;
21482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21483 this_ptr_conv.is_owned = false;
21484 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21488 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
21489 LDKHTLCOutputInCommitment this_ptr_conv;
21490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21491 this_ptr_conv.is_owned = false;
21492 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21495 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
21496 LDKHTLCOutputInCommitment this_ptr_conv;
21497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21498 this_ptr_conv.is_owned = false;
21499 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21503 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
21504 LDKHTLCOutputInCommitment this_ptr_conv;
21505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21506 this_ptr_conv.is_owned = false;
21507 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21510 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
21511 LDKHTLCOutputInCommitment this_ptr_conv;
21512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21513 this_ptr_conv.is_owned = false;
21514 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21515 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
21519 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
21520 LDKHTLCOutputInCommitment this_ptr_conv;
21521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21522 this_ptr_conv.is_owned = false;
21523 LDKThirtyTwoBytes val_ref;
21524 CHECK(*((uint32_t*)val) == 32);
21525 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
21526 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21529 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
21530 LDKHTLCOutputInCommitment this_ptr_conv;
21531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21532 this_ptr_conv.is_owned = false;
21533 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21534 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21535 uint64_t ret_ref = (uint64_t)ret_copy;
21539 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
21540 LDKHTLCOutputInCommitment this_ptr_conv;
21541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21542 this_ptr_conv.is_owned = false;
21543 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21544 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21545 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21548 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) {
21549 LDKThirtyTwoBytes payment_hash_arg_ref;
21550 CHECK(*((uint32_t*)payment_hash_arg) == 32);
21551 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
21552 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21553 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
21554 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21557 uint64_t ret_ref = (uint64_t)ret_var.inner;
21558 if (ret_var.is_owned) {
21564 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
21565 LDKHTLCOutputInCommitment orig_conv;
21566 orig_conv.inner = (void*)(orig & (~1));
21567 orig_conv.is_owned = false;
21568 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21571 uint64_t ret_ref = (uint64_t)ret_var.inner;
21572 if (ret_var.is_owned) {
21578 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
21579 LDKHTLCOutputInCommitment obj_conv;
21580 obj_conv.inner = (void*)(obj & (~1));
21581 obj_conv.is_owned = false;
21582 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21583 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21584 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21585 CVec_u8Z_free(ret_var);
21589 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
21590 LDKu8slice ser_ref;
21591 ser_ref.datalen = *((uint32_t*)ser);
21592 ser_ref.data = (int8_t*)(ser + 4);
21593 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21594 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21595 return (uint64_t)ret_conv;
21598 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
21599 LDKHTLCOutputInCommitment htlc_conv;
21600 htlc_conv.inner = (void*)(htlc & (~1));
21601 htlc_conv.is_owned = false;
21602 LDKTxCreationKeys keys_conv;
21603 keys_conv.inner = (void*)(keys & (~1));
21604 keys_conv.is_owned = false;
21605 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21606 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21607 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21608 CVec_u8Z_free(ret_var);
21612 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
21613 LDKPublicKey broadcaster_ref;
21614 CHECK(*((uint32_t*)broadcaster) == 33);
21615 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
21616 LDKPublicKey countersignatory_ref;
21617 CHECK(*((uint32_t*)countersignatory) == 33);
21618 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
21619 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21620 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21621 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21622 CVec_u8Z_free(ret_var);
21626 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) {
21627 unsigned char commitment_txid_arr[32];
21628 CHECK(*((uint32_t*)commitment_txid) == 32);
21629 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
21630 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21631 LDKHTLCOutputInCommitment htlc_conv;
21632 htlc_conv.inner = (void*)(htlc & (~1));
21633 htlc_conv.is_owned = false;
21634 LDKPublicKey broadcaster_delayed_payment_key_ref;
21635 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
21636 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
21637 LDKPublicKey revocation_key_ref;
21638 CHECK(*((uint32_t*)revocation_key) == 33);
21639 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
21640 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21641 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21642 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21643 Transaction_free(ret_var);
21647 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
21648 LDKChannelTransactionParameters this_obj_conv;
21649 this_obj_conv.inner = (void*)(this_obj & (~1));
21650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21651 ChannelTransactionParameters_free(this_obj_conv);
21654 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
21655 LDKChannelTransactionParameters this_ptr_conv;
21656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21657 this_ptr_conv.is_owned = false;
21658 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21661 uint64_t ret_ref = (uint64_t)ret_var.inner;
21662 if (ret_var.is_owned) {
21668 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
21669 LDKChannelTransactionParameters this_ptr_conv;
21670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21671 this_ptr_conv.is_owned = false;
21672 LDKChannelPublicKeys val_conv;
21673 val_conv.inner = (void*)(val & (~1));
21674 val_conv.is_owned = (val & 1) || (val == 0);
21675 val_conv = ChannelPublicKeys_clone(&val_conv);
21676 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21679 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
21680 LDKChannelTransactionParameters this_ptr_conv;
21681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21682 this_ptr_conv.is_owned = false;
21683 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21687 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
21688 LDKChannelTransactionParameters this_ptr_conv;
21689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21690 this_ptr_conv.is_owned = false;
21691 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21694 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
21695 LDKChannelTransactionParameters this_ptr_conv;
21696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21697 this_ptr_conv.is_owned = false;
21698 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21702 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
21703 LDKChannelTransactionParameters this_ptr_conv;
21704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21705 this_ptr_conv.is_owned = false;
21706 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21709 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
21710 LDKChannelTransactionParameters this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21716 uint64_t ret_ref = (uint64_t)ret_var.inner;
21717 if (ret_var.is_owned) {
21723 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
21724 LDKChannelTransactionParameters this_ptr_conv;
21725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21726 this_ptr_conv.is_owned = false;
21727 LDKCounterpartyChannelTransactionParameters val_conv;
21728 val_conv.inner = (void*)(val & (~1));
21729 val_conv.is_owned = (val & 1) || (val == 0);
21730 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21731 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21734 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
21735 LDKChannelTransactionParameters this_ptr_conv;
21736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21737 this_ptr_conv.is_owned = false;
21738 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21741 uint64_t ret_ref = (uint64_t)ret_var.inner;
21742 if (ret_var.is_owned) {
21748 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
21749 LDKChannelTransactionParameters this_ptr_conv;
21750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21751 this_ptr_conv.is_owned = false;
21752 LDKOutPoint val_conv;
21753 val_conv.inner = (void*)(val & (~1));
21754 val_conv.is_owned = (val & 1) || (val == 0);
21755 val_conv = OutPoint_clone(&val_conv);
21756 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21759 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) {
21760 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21761 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21762 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21763 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21764 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21765 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21766 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21767 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21768 LDKOutPoint funding_outpoint_arg_conv;
21769 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21770 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21771 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21772 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);
21773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21775 uint64_t ret_ref = (uint64_t)ret_var.inner;
21776 if (ret_var.is_owned) {
21782 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
21783 LDKChannelTransactionParameters orig_conv;
21784 orig_conv.inner = (void*)(orig & (~1));
21785 orig_conv.is_owned = false;
21786 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21789 uint64_t ret_ref = (uint64_t)ret_var.inner;
21790 if (ret_var.is_owned) {
21796 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
21797 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21798 this_obj_conv.inner = (void*)(this_obj & (~1));
21799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21800 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21803 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
21804 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21806 this_ptr_conv.is_owned = false;
21807 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21810 uint64_t ret_ref = (uint64_t)ret_var.inner;
21811 if (ret_var.is_owned) {
21817 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
21818 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21820 this_ptr_conv.is_owned = false;
21821 LDKChannelPublicKeys val_conv;
21822 val_conv.inner = (void*)(val & (~1));
21823 val_conv.is_owned = (val & 1) || (val == 0);
21824 val_conv = ChannelPublicKeys_clone(&val_conv);
21825 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21828 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
21829 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21831 this_ptr_conv.is_owned = false;
21832 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21836 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
21837 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21839 this_ptr_conv.is_owned = false;
21840 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21843 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
21844 LDKChannelPublicKeys pubkeys_arg_conv;
21845 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21846 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21847 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21848 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21851 uint64_t ret_ref = (uint64_t)ret_var.inner;
21852 if (ret_var.is_owned) {
21858 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
21859 LDKCounterpartyChannelTransactionParameters orig_conv;
21860 orig_conv.inner = (void*)(orig & (~1));
21861 orig_conv.is_owned = false;
21862 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21865 uint64_t ret_ref = (uint64_t)ret_var.inner;
21866 if (ret_var.is_owned) {
21872 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
21873 LDKChannelTransactionParameters this_arg_conv;
21874 this_arg_conv.inner = (void*)(this_arg & (~1));
21875 this_arg_conv.is_owned = false;
21876 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21880 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
21881 LDKChannelTransactionParameters this_arg_conv;
21882 this_arg_conv.inner = (void*)(this_arg & (~1));
21883 this_arg_conv.is_owned = false;
21884 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21887 uint64_t ret_ref = (uint64_t)ret_var.inner;
21888 if (ret_var.is_owned) {
21894 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
21895 LDKChannelTransactionParameters this_arg_conv;
21896 this_arg_conv.inner = (void*)(this_arg & (~1));
21897 this_arg_conv.is_owned = false;
21898 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21901 uint64_t ret_ref = (uint64_t)ret_var.inner;
21902 if (ret_var.is_owned) {
21908 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
21909 LDKCounterpartyChannelTransactionParameters obj_conv;
21910 obj_conv.inner = (void*)(obj & (~1));
21911 obj_conv.is_owned = false;
21912 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21913 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21914 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21915 CVec_u8Z_free(ret_var);
21919 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
21920 LDKu8slice ser_ref;
21921 ser_ref.datalen = *((uint32_t*)ser);
21922 ser_ref.data = (int8_t*)(ser + 4);
21923 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21924 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21925 return (uint64_t)ret_conv;
21928 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
21929 LDKChannelTransactionParameters obj_conv;
21930 obj_conv.inner = (void*)(obj & (~1));
21931 obj_conv.is_owned = false;
21932 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21933 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21934 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21935 CVec_u8Z_free(ret_var);
21939 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
21940 LDKu8slice ser_ref;
21941 ser_ref.datalen = *((uint32_t*)ser);
21942 ser_ref.data = (int8_t*)(ser + 4);
21943 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21944 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21945 return (uint64_t)ret_conv;
21948 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
21949 LDKDirectedChannelTransactionParameters this_obj_conv;
21950 this_obj_conv.inner = (void*)(this_obj & (~1));
21951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21952 DirectedChannelTransactionParameters_free(this_obj_conv);
21955 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
21956 LDKDirectedChannelTransactionParameters this_arg_conv;
21957 this_arg_conv.inner = (void*)(this_arg & (~1));
21958 this_arg_conv.is_owned = false;
21959 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21960 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21961 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21962 uint64_t ret_ref = (uint64_t)ret_var.inner;
21963 if (ret_var.is_owned) {
21969 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
21970 LDKDirectedChannelTransactionParameters this_arg_conv;
21971 this_arg_conv.inner = (void*)(this_arg & (~1));
21972 this_arg_conv.is_owned = false;
21973 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21974 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21975 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21976 uint64_t ret_ref = (uint64_t)ret_var.inner;
21977 if (ret_var.is_owned) {
21983 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
21984 LDKDirectedChannelTransactionParameters this_arg_conv;
21985 this_arg_conv.inner = (void*)(this_arg & (~1));
21986 this_arg_conv.is_owned = false;
21987 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21991 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
21992 LDKDirectedChannelTransactionParameters this_arg_conv;
21993 this_arg_conv.inner = (void*)(this_arg & (~1));
21994 this_arg_conv.is_owned = false;
21995 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
21999 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
22000 LDKDirectedChannelTransactionParameters this_arg_conv;
22001 this_arg_conv.inner = (void*)(this_arg & (~1));
22002 this_arg_conv.is_owned = false;
22003 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
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 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
22014 LDKHolderCommitmentTransaction this_obj_conv;
22015 this_obj_conv.inner = (void*)(this_obj & (~1));
22016 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22017 HolderCommitmentTransaction_free(this_obj_conv);
22020 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
22021 LDKHolderCommitmentTransaction this_ptr_conv;
22022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22023 this_ptr_conv.is_owned = false;
22024 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22025 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
22029 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
22030 LDKHolderCommitmentTransaction this_ptr_conv;
22031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22032 this_ptr_conv.is_owned = false;
22033 LDKSignature val_ref;
22034 CHECK(*((uint32_t*)val) == 64);
22035 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
22036 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22039 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
22040 LDKHolderCommitmentTransaction this_ptr_conv;
22041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22042 this_ptr_conv.is_owned = false;
22043 LDKCVec_SignatureZ val_constr;
22044 val_constr.datalen = *((uint32_t*)val);
22045 if (val_constr.datalen > 0)
22046 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22048 val_constr.data = NULL;
22049 int8_tArray* val_vals = (int8_tArray*)(val + 4);
22050 for (size_t m = 0; m < val_constr.datalen; m++) {
22051 int8_tArray val_conv_12 = val_vals[m];
22052 LDKSignature val_conv_12_ref;
22053 CHECK(*((uint32_t*)val_conv_12) == 64);
22054 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
22055 val_constr.data[m] = val_conv_12_ref;
22057 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22060 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
22061 LDKHolderCommitmentTransaction orig_conv;
22062 orig_conv.inner = (void*)(orig & (~1));
22063 orig_conv.is_owned = false;
22064 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22067 uint64_t ret_ref = (uint64_t)ret_var.inner;
22068 if (ret_var.is_owned) {
22074 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
22075 LDKHolderCommitmentTransaction obj_conv;
22076 obj_conv.inner = (void*)(obj & (~1));
22077 obj_conv.is_owned = false;
22078 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22079 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22080 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22081 CVec_u8Z_free(ret_var);
22085 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
22086 LDKu8slice ser_ref;
22087 ser_ref.datalen = *((uint32_t*)ser);
22088 ser_ref.data = (int8_t*)(ser + 4);
22089 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22090 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22091 return (uint64_t)ret_conv;
22094 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) {
22095 LDKCommitmentTransaction commitment_tx_conv;
22096 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22097 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22098 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22099 LDKSignature counterparty_sig_ref;
22100 CHECK(*((uint32_t*)counterparty_sig) == 64);
22101 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
22102 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22103 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
22104 if (counterparty_htlc_sigs_constr.datalen > 0)
22105 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22107 counterparty_htlc_sigs_constr.data = NULL;
22108 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
22109 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
22110 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
22111 LDKSignature counterparty_htlc_sigs_conv_12_ref;
22112 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
22113 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
22114 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
22116 LDKPublicKey holder_funding_key_ref;
22117 CHECK(*((uint32_t*)holder_funding_key) == 33);
22118 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
22119 LDKPublicKey counterparty_funding_key_ref;
22120 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
22121 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
22122 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22125 uint64_t ret_ref = (uint64_t)ret_var.inner;
22126 if (ret_var.is_owned) {
22132 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
22133 LDKBuiltCommitmentTransaction this_obj_conv;
22134 this_obj_conv.inner = (void*)(this_obj & (~1));
22135 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22136 BuiltCommitmentTransaction_free(this_obj_conv);
22139 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
22140 LDKBuiltCommitmentTransaction this_ptr_conv;
22141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22142 this_ptr_conv.is_owned = false;
22143 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22144 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22145 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22146 Transaction_free(ret_var);
22150 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
22151 LDKBuiltCommitmentTransaction this_ptr_conv;
22152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22153 this_ptr_conv.is_owned = false;
22154 LDKTransaction val_ref;
22155 val_ref.datalen = *((uint32_t*)val);
22156 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22157 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22158 val_ref.data_is_owned = true;
22159 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22162 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
22163 LDKBuiltCommitmentTransaction this_ptr_conv;
22164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22165 this_ptr_conv.is_owned = false;
22166 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22167 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
22171 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
22172 LDKBuiltCommitmentTransaction this_ptr_conv;
22173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22174 this_ptr_conv.is_owned = false;
22175 LDKThirtyTwoBytes val_ref;
22176 CHECK(*((uint32_t*)val) == 32);
22177 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22178 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22181 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
22182 LDKTransaction transaction_arg_ref;
22183 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
22184 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22185 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
22186 transaction_arg_ref.data_is_owned = true;
22187 LDKThirtyTwoBytes txid_arg_ref;
22188 CHECK(*((uint32_t*)txid_arg) == 32);
22189 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
22190 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22193 uint64_t ret_ref = (uint64_t)ret_var.inner;
22194 if (ret_var.is_owned) {
22200 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
22201 LDKBuiltCommitmentTransaction orig_conv;
22202 orig_conv.inner = (void*)(orig & (~1));
22203 orig_conv.is_owned = false;
22204 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22207 uint64_t ret_ref = (uint64_t)ret_var.inner;
22208 if (ret_var.is_owned) {
22214 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
22215 LDKBuiltCommitmentTransaction obj_conv;
22216 obj_conv.inner = (void*)(obj & (~1));
22217 obj_conv.is_owned = false;
22218 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22219 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22220 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22221 CVec_u8Z_free(ret_var);
22225 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
22226 LDKu8slice ser_ref;
22227 ser_ref.datalen = *((uint32_t*)ser);
22228 ser_ref.data = (int8_t*)(ser + 4);
22229 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22230 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22231 return (uint64_t)ret_conv;
22234 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22235 LDKBuiltCommitmentTransaction this_arg_conv;
22236 this_arg_conv.inner = (void*)(this_arg & (~1));
22237 this_arg_conv.is_owned = false;
22238 LDKu8slice funding_redeemscript_ref;
22239 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22240 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22241 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22242 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22246 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) {
22247 LDKBuiltCommitmentTransaction this_arg_conv;
22248 this_arg_conv.inner = (void*)(this_arg & (~1));
22249 this_arg_conv.is_owned = false;
22250 unsigned char funding_key_arr[32];
22251 CHECK(*((uint32_t*)funding_key) == 32);
22252 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22253 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22254 LDKu8slice funding_redeemscript_ref;
22255 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22256 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22257 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22258 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22262 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
22263 LDKClosingTransaction this_obj_conv;
22264 this_obj_conv.inner = (void*)(this_obj & (~1));
22265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22266 ClosingTransaction_free(this_obj_conv);
22269 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
22270 LDKCVec_u8Z to_holder_script_ref;
22271 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
22272 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
22273 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
22274 LDKCVec_u8Z to_counterparty_script_ref;
22275 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
22276 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
22277 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
22278 LDKOutPoint funding_outpoint_conv;
22279 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22280 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22281 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22282 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
22283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22285 uint64_t ret_ref = (uint64_t)ret_var.inner;
22286 if (ret_var.is_owned) {
22292 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
22293 LDKClosingTransaction this_arg_conv;
22294 this_arg_conv.inner = (void*)(this_arg & (~1));
22295 this_arg_conv.is_owned = false;
22296 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
22297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22299 uint64_t ret_ref = (uint64_t)ret_var.inner;
22300 if (ret_var.is_owned) {
22306 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
22307 LDKClosingTransaction this_arg_conv;
22308 this_arg_conv.inner = (void*)(this_arg & (~1));
22309 this_arg_conv.is_owned = false;
22310 LDKOutPoint funding_outpoint_conv;
22311 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
22312 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
22313 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
22314 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
22315 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
22316 return (uint64_t)ret_conv;
22319 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
22320 LDKClosingTransaction this_arg_conv;
22321 this_arg_conv.inner = (void*)(this_arg & (~1));
22322 this_arg_conv.is_owned = false;
22323 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
22327 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
22328 LDKClosingTransaction this_arg_conv;
22329 this_arg_conv.inner = (void*)(this_arg & (~1));
22330 this_arg_conv.is_owned = false;
22331 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
22335 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
22336 LDKClosingTransaction this_arg_conv;
22337 this_arg_conv.inner = (void*)(this_arg & (~1));
22338 this_arg_conv.is_owned = false;
22339 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
22340 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22341 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22345 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
22346 LDKClosingTransaction this_arg_conv;
22347 this_arg_conv.inner = (void*)(this_arg & (~1));
22348 this_arg_conv.is_owned = false;
22349 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
22350 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22351 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22355 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
22356 LDKTrustedClosingTransaction this_obj_conv;
22357 this_obj_conv.inner = (void*)(this_obj & (~1));
22358 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22359 TrustedClosingTransaction_free(this_obj_conv);
22362 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
22363 LDKTrustedClosingTransaction this_arg_conv;
22364 this_arg_conv.inner = (void*)(this_arg & (~1));
22365 this_arg_conv.is_owned = false;
22366 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
22367 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22368 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22369 Transaction_free(ret_var);
22373 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22374 LDKTrustedClosingTransaction this_arg_conv;
22375 this_arg_conv.inner = (void*)(this_arg & (~1));
22376 this_arg_conv.is_owned = false;
22377 LDKu8slice funding_redeemscript_ref;
22378 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22379 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22380 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22381 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
22385 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22386 LDKTrustedClosingTransaction this_arg_conv;
22387 this_arg_conv.inner = (void*)(this_arg & (~1));
22388 this_arg_conv.is_owned = false;
22389 unsigned char funding_key_arr[32];
22390 CHECK(*((uint32_t*)funding_key) == 32);
22391 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
22392 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22393 LDKu8slice funding_redeemscript_ref;
22394 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
22395 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
22396 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22397 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
22401 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
22402 LDKCommitmentTransaction this_obj_conv;
22403 this_obj_conv.inner = (void*)(this_obj & (~1));
22404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22405 CommitmentTransaction_free(this_obj_conv);
22408 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
22409 LDKCommitmentTransaction orig_conv;
22410 orig_conv.inner = (void*)(orig & (~1));
22411 orig_conv.is_owned = false;
22412 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22415 uint64_t ret_ref = (uint64_t)ret_var.inner;
22416 if (ret_var.is_owned) {
22422 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
22423 LDKCommitmentTransaction obj_conv;
22424 obj_conv.inner = (void*)(obj & (~1));
22425 obj_conv.is_owned = false;
22426 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22427 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22428 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22429 CVec_u8Z_free(ret_var);
22433 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
22434 LDKu8slice ser_ref;
22435 ser_ref.datalen = *((uint32_t*)ser);
22436 ser_ref.data = (int8_t*)(ser + 4);
22437 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22438 *ret_conv = CommitmentTransaction_read(ser_ref);
22439 return (uint64_t)ret_conv;
22442 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
22443 LDKCommitmentTransaction this_arg_conv;
22444 this_arg_conv.inner = (void*)(this_arg & (~1));
22445 this_arg_conv.is_owned = false;
22446 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22450 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
22451 LDKCommitmentTransaction this_arg_conv;
22452 this_arg_conv.inner = (void*)(this_arg & (~1));
22453 this_arg_conv.is_owned = false;
22454 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22458 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
22459 LDKCommitmentTransaction this_arg_conv;
22460 this_arg_conv.inner = (void*)(this_arg & (~1));
22461 this_arg_conv.is_owned = false;
22462 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22466 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
22467 LDKCommitmentTransaction this_arg_conv;
22468 this_arg_conv.inner = (void*)(this_arg & (~1));
22469 this_arg_conv.is_owned = false;
22470 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22474 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
22475 LDKCommitmentTransaction this_arg_conv;
22476 this_arg_conv.inner = (void*)(this_arg & (~1));
22477 this_arg_conv.is_owned = false;
22478 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22479 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22480 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22481 uint64_t ret_ref = (uint64_t)ret_var.inner;
22482 if (ret_var.is_owned) {
22488 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22489 LDKCommitmentTransaction this_arg_conv;
22490 this_arg_conv.inner = (void*)(this_arg & (~1));
22491 this_arg_conv.is_owned = false;
22492 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22493 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22494 channel_parameters_conv.is_owned = false;
22495 LDKChannelPublicKeys broadcaster_keys_conv;
22496 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22497 broadcaster_keys_conv.is_owned = false;
22498 LDKChannelPublicKeys countersignatory_keys_conv;
22499 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22500 countersignatory_keys_conv.is_owned = false;
22501 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22502 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22503 return (uint64_t)ret_conv;
22506 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
22507 LDKTrustedCommitmentTransaction this_obj_conv;
22508 this_obj_conv.inner = (void*)(this_obj & (~1));
22509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22510 TrustedCommitmentTransaction_free(this_obj_conv);
22513 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
22514 LDKTrustedCommitmentTransaction this_arg_conv;
22515 this_arg_conv.inner = (void*)(this_arg & (~1));
22516 this_arg_conv.is_owned = false;
22517 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22518 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
22522 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
22523 LDKTrustedCommitmentTransaction this_arg_conv;
22524 this_arg_conv.inner = (void*)(this_arg & (~1));
22525 this_arg_conv.is_owned = false;
22526 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22529 uint64_t ret_ref = (uint64_t)ret_var.inner;
22530 if (ret_var.is_owned) {
22536 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
22537 LDKTrustedCommitmentTransaction this_arg_conv;
22538 this_arg_conv.inner = (void*)(this_arg & (~1));
22539 this_arg_conv.is_owned = false;
22540 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22543 uint64_t ret_ref = (uint64_t)ret_var.inner;
22544 if (ret_var.is_owned) {
22550 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
22551 LDKTrustedCommitmentTransaction this_arg_conv;
22552 this_arg_conv.inner = (void*)(this_arg & (~1));
22553 this_arg_conv.is_owned = false;
22554 unsigned char htlc_base_key_arr[32];
22555 CHECK(*((uint32_t*)htlc_base_key) == 32);
22556 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
22557 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22558 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22559 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22560 channel_parameters_conv.is_owned = false;
22561 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22562 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22563 return (uint64_t)ret_conv;
22566 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) {
22567 LDKPublicKey broadcaster_payment_basepoint_ref;
22568 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
22569 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
22570 LDKPublicKey countersignatory_payment_basepoint_ref;
22571 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
22572 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
22573 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22577 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
22578 LDKInitFeatures a_conv;
22579 a_conv.inner = (void*)(a & (~1));
22580 a_conv.is_owned = false;
22581 LDKInitFeatures b_conv;
22582 b_conv.inner = (void*)(b & (~1));
22583 b_conv.is_owned = false;
22584 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22588 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
22589 LDKNodeFeatures a_conv;
22590 a_conv.inner = (void*)(a & (~1));
22591 a_conv.is_owned = false;
22592 LDKNodeFeatures b_conv;
22593 b_conv.inner = (void*)(b & (~1));
22594 b_conv.is_owned = false;
22595 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22599 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
22600 LDKChannelFeatures a_conv;
22601 a_conv.inner = (void*)(a & (~1));
22602 a_conv.is_owned = false;
22603 LDKChannelFeatures b_conv;
22604 b_conv.inner = (void*)(b & (~1));
22605 b_conv.is_owned = false;
22606 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22610 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
22611 LDKInvoiceFeatures a_conv;
22612 a_conv.inner = (void*)(a & (~1));
22613 a_conv.is_owned = false;
22614 LDKInvoiceFeatures b_conv;
22615 b_conv.inner = (void*)(b & (~1));
22616 b_conv.is_owned = false;
22617 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22621 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
22622 LDKInitFeatures orig_conv;
22623 orig_conv.inner = (void*)(orig & (~1));
22624 orig_conv.is_owned = false;
22625 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22626 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22627 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22628 uint64_t ret_ref = (uint64_t)ret_var.inner;
22629 if (ret_var.is_owned) {
22635 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
22636 LDKNodeFeatures orig_conv;
22637 orig_conv.inner = (void*)(orig & (~1));
22638 orig_conv.is_owned = false;
22639 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22642 uint64_t ret_ref = (uint64_t)ret_var.inner;
22643 if (ret_var.is_owned) {
22649 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
22650 LDKChannelFeatures orig_conv;
22651 orig_conv.inner = (void*)(orig & (~1));
22652 orig_conv.is_owned = false;
22653 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22656 uint64_t ret_ref = (uint64_t)ret_var.inner;
22657 if (ret_var.is_owned) {
22663 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
22664 LDKInvoiceFeatures orig_conv;
22665 orig_conv.inner = (void*)(orig & (~1));
22666 orig_conv.is_owned = false;
22667 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22670 uint64_t ret_ref = (uint64_t)ret_var.inner;
22671 if (ret_var.is_owned) {
22677 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
22678 LDKInitFeatures this_obj_conv;
22679 this_obj_conv.inner = (void*)(this_obj & (~1));
22680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22681 InitFeatures_free(this_obj_conv);
22684 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
22685 LDKNodeFeatures this_obj_conv;
22686 this_obj_conv.inner = (void*)(this_obj & (~1));
22687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22688 NodeFeatures_free(this_obj_conv);
22691 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
22692 LDKChannelFeatures this_obj_conv;
22693 this_obj_conv.inner = (void*)(this_obj & (~1));
22694 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22695 ChannelFeatures_free(this_obj_conv);
22698 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
22699 LDKInvoiceFeatures this_obj_conv;
22700 this_obj_conv.inner = (void*)(this_obj & (~1));
22701 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22702 InvoiceFeatures_free(this_obj_conv);
22705 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
22706 LDKInitFeatures ret_var = InitFeatures_empty();
22707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22709 uint64_t ret_ref = (uint64_t)ret_var.inner;
22710 if (ret_var.is_owned) {
22716 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
22717 LDKInitFeatures ret_var = InitFeatures_known();
22718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22720 uint64_t ret_ref = (uint64_t)ret_var.inner;
22721 if (ret_var.is_owned) {
22727 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
22728 LDKInitFeatures this_arg_conv;
22729 this_arg_conv.inner = (void*)(this_arg & (~1));
22730 this_arg_conv.is_owned = false;
22731 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
22735 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
22736 LDKNodeFeatures ret_var = NodeFeatures_empty();
22737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22739 uint64_t ret_ref = (uint64_t)ret_var.inner;
22740 if (ret_var.is_owned) {
22746 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
22747 LDKNodeFeatures ret_var = NodeFeatures_known();
22748 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22749 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22750 uint64_t ret_ref = (uint64_t)ret_var.inner;
22751 if (ret_var.is_owned) {
22757 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
22758 LDKNodeFeatures this_arg_conv;
22759 this_arg_conv.inner = (void*)(this_arg & (~1));
22760 this_arg_conv.is_owned = false;
22761 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
22765 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
22766 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22769 uint64_t ret_ref = (uint64_t)ret_var.inner;
22770 if (ret_var.is_owned) {
22776 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
22777 LDKChannelFeatures ret_var = ChannelFeatures_known();
22778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22780 uint64_t ret_ref = (uint64_t)ret_var.inner;
22781 if (ret_var.is_owned) {
22787 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
22788 LDKChannelFeatures this_arg_conv;
22789 this_arg_conv.inner = (void*)(this_arg & (~1));
22790 this_arg_conv.is_owned = false;
22791 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
22795 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
22796 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22799 uint64_t ret_ref = (uint64_t)ret_var.inner;
22800 if (ret_var.is_owned) {
22806 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
22807 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22810 uint64_t ret_ref = (uint64_t)ret_var.inner;
22811 if (ret_var.is_owned) {
22817 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
22818 LDKInvoiceFeatures this_arg_conv;
22819 this_arg_conv.inner = (void*)(this_arg & (~1));
22820 this_arg_conv.is_owned = false;
22821 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
22825 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
22826 LDKInitFeatures this_arg_conv;
22827 this_arg_conv.inner = (void*)(this_arg & (~1));
22828 this_arg_conv.is_owned = false;
22829 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22833 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
22834 LDKNodeFeatures this_arg_conv;
22835 this_arg_conv.inner = (void*)(this_arg & (~1));
22836 this_arg_conv.is_owned = false;
22837 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22841 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
22842 LDKInvoiceFeatures this_arg_conv;
22843 this_arg_conv.inner = (void*)(this_arg & (~1));
22844 this_arg_conv.is_owned = false;
22845 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22849 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
22850 LDKInitFeatures obj_conv;
22851 obj_conv.inner = (void*)(obj & (~1));
22852 obj_conv.is_owned = false;
22853 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22854 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22855 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22856 CVec_u8Z_free(ret_var);
22860 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
22861 LDKNodeFeatures obj_conv;
22862 obj_conv.inner = (void*)(obj & (~1));
22863 obj_conv.is_owned = false;
22864 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22865 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22866 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22867 CVec_u8Z_free(ret_var);
22871 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
22872 LDKChannelFeatures obj_conv;
22873 obj_conv.inner = (void*)(obj & (~1));
22874 obj_conv.is_owned = false;
22875 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22876 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22877 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22878 CVec_u8Z_free(ret_var);
22882 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
22883 LDKInvoiceFeatures obj_conv;
22884 obj_conv.inner = (void*)(obj & (~1));
22885 obj_conv.is_owned = false;
22886 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22887 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22888 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22889 CVec_u8Z_free(ret_var);
22893 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
22894 LDKu8slice ser_ref;
22895 ser_ref.datalen = *((uint32_t*)ser);
22896 ser_ref.data = (int8_t*)(ser + 4);
22897 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22898 *ret_conv = InitFeatures_read(ser_ref);
22899 return (uint64_t)ret_conv;
22902 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
22903 LDKu8slice ser_ref;
22904 ser_ref.datalen = *((uint32_t*)ser);
22905 ser_ref.data = (int8_t*)(ser + 4);
22906 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22907 *ret_conv = NodeFeatures_read(ser_ref);
22908 return (uint64_t)ret_conv;
22911 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
22912 LDKu8slice ser_ref;
22913 ser_ref.datalen = *((uint32_t*)ser);
22914 ser_ref.data = (int8_t*)(ser + 4);
22915 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22916 *ret_conv = ChannelFeatures_read(ser_ref);
22917 return (uint64_t)ret_conv;
22920 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
22921 LDKu8slice ser_ref;
22922 ser_ref.datalen = *((uint32_t*)ser);
22923 ser_ref.data = (int8_t*)(ser + 4);
22924 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22925 *ret_conv = InvoiceFeatures_read(ser_ref);
22926 return (uint64_t)ret_conv;
22929 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
22930 LDKShutdownScript this_obj_conv;
22931 this_obj_conv.inner = (void*)(this_obj & (~1));
22932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22933 ShutdownScript_free(this_obj_conv);
22936 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
22937 LDKShutdownScript orig_conv;
22938 orig_conv.inner = (void*)(orig & (~1));
22939 orig_conv.is_owned = false;
22940 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
22941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22943 uint64_t ret_ref = (uint64_t)ret_var.inner;
22944 if (ret_var.is_owned) {
22950 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
22951 LDKInvalidShutdownScript this_obj_conv;
22952 this_obj_conv.inner = (void*)(this_obj & (~1));
22953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22954 InvalidShutdownScript_free(this_obj_conv);
22957 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
22958 LDKInvalidShutdownScript this_ptr_conv;
22959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22960 this_ptr_conv.is_owned = false;
22961 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
22962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22967 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
22968 LDKInvalidShutdownScript this_ptr_conv;
22969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22970 this_ptr_conv.is_owned = false;
22971 LDKCVec_u8Z val_ref;
22972 val_ref.datalen = *((uint32_t*)val);
22973 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22974 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22975 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
22978 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
22979 LDKCVec_u8Z script_arg_ref;
22980 script_arg_ref.datalen = *((uint32_t*)script_arg);
22981 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22982 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
22983 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
22984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22986 uint64_t ret_ref = (uint64_t)ret_var.inner;
22987 if (ret_var.is_owned) {
22993 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
22994 LDKShutdownScript obj_conv;
22995 obj_conv.inner = (void*)(obj & (~1));
22996 obj_conv.is_owned = false;
22997 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
22998 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22999 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23000 CVec_u8Z_free(ret_var);
23004 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
23005 LDKu8slice ser_ref;
23006 ser_ref.datalen = *((uint32_t*)ser);
23007 ser_ref.data = (int8_t*)(ser + 4);
23008 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
23009 *ret_conv = ShutdownScript_read(ser_ref);
23010 return (uint64_t)ret_conv;
23013 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
23014 unsigned char pubkey_hash_arr[20];
23015 CHECK(*((uint32_t*)pubkey_hash) == 20);
23016 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23017 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23018 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
23019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23021 uint64_t ret_ref = (uint64_t)ret_var.inner;
23022 if (ret_var.is_owned) {
23028 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
23029 unsigned char script_hash_arr[20];
23030 CHECK(*((uint32_t*)script_hash) == 20);
23031 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
23032 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
23033 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
23034 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23035 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23036 uint64_t ret_ref = (uint64_t)ret_var.inner;
23037 if (ret_var.is_owned) {
23043 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
23044 unsigned char pubkey_hash_arr[20];
23045 CHECK(*((uint32_t*)pubkey_hash) == 20);
23046 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23047 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23048 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
23049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23051 uint64_t ret_ref = (uint64_t)ret_var.inner;
23052 if (ret_var.is_owned) {
23058 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
23059 unsigned char script_hash_arr[32];
23060 CHECK(*((uint32_t*)script_hash) == 32);
23061 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
23062 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
23063 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
23064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23066 uint64_t ret_ref = (uint64_t)ret_var.inner;
23067 if (ret_var.is_owned) {
23073 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
23074 LDKu8slice program_ref;
23075 program_ref.datalen = *((uint32_t*)program);
23076 program_ref.data = (int8_t*)(program + 4);
23077 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
23078 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
23079 return (uint64_t)ret_conv;
23082 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
23083 LDKShutdownScript this_arg_conv;
23084 this_arg_conv.inner = (void*)(this_arg & (~1));
23085 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23086 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
23087 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
23088 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23089 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23090 CVec_u8Z_free(ret_var);
23094 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
23095 LDKShutdownScript this_arg_conv;
23096 this_arg_conv.inner = (void*)(this_arg & (~1));
23097 this_arg_conv.is_owned = false;
23098 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23099 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
23103 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
23104 LDKShutdownScript this_arg_conv;
23105 this_arg_conv.inner = (void*)(this_arg & (~1));
23106 this_arg_conv.is_owned = false;
23107 LDKInitFeatures features_conv;
23108 features_conv.inner = (void*)(features & (~1));
23109 features_conv.is_owned = false;
23110 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
23114 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
23115 if ((this_ptr & 1) != 0) return;
23116 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
23117 FREE((void*)this_ptr);
23118 CustomMessageReader_free(this_ptr_conv);
23121 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
23122 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
23123 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
23124 *ret_ret = Type_clone(orig_conv);
23125 return (uint64_t)ret_ret;
23128 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
23129 if ((this_ptr & 1) != 0) return;
23130 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
23131 FREE((void*)this_ptr);
23132 Type_free(this_ptr_conv);
23135 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
23136 LDKRouteHop this_obj_conv;
23137 this_obj_conv.inner = (void*)(this_obj & (~1));
23138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23139 RouteHop_free(this_obj_conv);
23142 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
23143 LDKRouteHop this_ptr_conv;
23144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23145 this_ptr_conv.is_owned = false;
23146 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23147 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
23151 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
23152 LDKRouteHop this_ptr_conv;
23153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23154 this_ptr_conv.is_owned = false;
23155 LDKPublicKey val_ref;
23156 CHECK(*((uint32_t*)val) == 33);
23157 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23158 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
23161 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
23162 LDKRouteHop this_ptr_conv;
23163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23164 this_ptr_conv.is_owned = false;
23165 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
23166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23168 uint64_t ret_ref = (uint64_t)ret_var.inner;
23169 if (ret_var.is_owned) {
23175 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
23176 LDKRouteHop this_ptr_conv;
23177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23178 this_ptr_conv.is_owned = false;
23179 LDKNodeFeatures val_conv;
23180 val_conv.inner = (void*)(val & (~1));
23181 val_conv.is_owned = (val & 1) || (val == 0);
23182 val_conv = NodeFeatures_clone(&val_conv);
23183 RouteHop_set_node_features(&this_ptr_conv, val_conv);
23186 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
23187 LDKRouteHop this_ptr_conv;
23188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23189 this_ptr_conv.is_owned = false;
23190 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23194 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23195 LDKRouteHop this_ptr_conv;
23196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23197 this_ptr_conv.is_owned = false;
23198 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23201 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
23202 LDKRouteHop this_ptr_conv;
23203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23204 this_ptr_conv.is_owned = false;
23205 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23208 uint64_t ret_ref = (uint64_t)ret_var.inner;
23209 if (ret_var.is_owned) {
23215 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
23216 LDKRouteHop this_ptr_conv;
23217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23218 this_ptr_conv.is_owned = false;
23219 LDKChannelFeatures val_conv;
23220 val_conv.inner = (void*)(val & (~1));
23221 val_conv.is_owned = (val & 1) || (val == 0);
23222 val_conv = ChannelFeatures_clone(&val_conv);
23223 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23226 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
23227 LDKRouteHop this_ptr_conv;
23228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23229 this_ptr_conv.is_owned = false;
23230 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23234 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
23235 LDKRouteHop this_ptr_conv;
23236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23237 this_ptr_conv.is_owned = false;
23238 RouteHop_set_fee_msat(&this_ptr_conv, val);
23241 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23242 LDKRouteHop this_ptr_conv;
23243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23244 this_ptr_conv.is_owned = false;
23245 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23249 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
23250 LDKRouteHop this_ptr_conv;
23251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23252 this_ptr_conv.is_owned = false;
23253 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23256 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) {
23257 LDKPublicKey pubkey_arg_ref;
23258 CHECK(*((uint32_t*)pubkey_arg) == 33);
23259 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
23260 LDKNodeFeatures node_features_arg_conv;
23261 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23262 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23263 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23264 LDKChannelFeatures channel_features_arg_conv;
23265 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23266 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23267 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23268 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);
23269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23271 uint64_t ret_ref = (uint64_t)ret_var.inner;
23272 if (ret_var.is_owned) {
23278 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
23279 LDKRouteHop orig_conv;
23280 orig_conv.inner = (void*)(orig & (~1));
23281 orig_conv.is_owned = false;
23282 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23285 uint64_t ret_ref = (uint64_t)ret_var.inner;
23286 if (ret_var.is_owned) {
23292 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
23293 LDKRouteHop o_conv;
23294 o_conv.inner = (void*)(o & (~1));
23295 o_conv.is_owned = false;
23296 int64_t ret_val = RouteHop_hash(&o_conv);
23300 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
23301 LDKRouteHop a_conv;
23302 a_conv.inner = (void*)(a & (~1));
23303 a_conv.is_owned = false;
23304 LDKRouteHop b_conv;
23305 b_conv.inner = (void*)(b & (~1));
23306 b_conv.is_owned = false;
23307 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
23311 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
23312 LDKRouteHop obj_conv;
23313 obj_conv.inner = (void*)(obj & (~1));
23314 obj_conv.is_owned = false;
23315 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23316 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23317 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23318 CVec_u8Z_free(ret_var);
23322 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
23323 LDKu8slice ser_ref;
23324 ser_ref.datalen = *((uint32_t*)ser);
23325 ser_ref.data = (int8_t*)(ser + 4);
23326 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23327 *ret_conv = RouteHop_read(ser_ref);
23328 return (uint64_t)ret_conv;
23331 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
23332 LDKRoute this_obj_conv;
23333 this_obj_conv.inner = (void*)(this_obj & (~1));
23334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23335 Route_free(this_obj_conv);
23338 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
23339 LDKRoute this_ptr_conv;
23340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23341 this_ptr_conv.is_owned = false;
23342 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
23343 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
23344 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
23345 for (size_t m = 0; m < ret_var.datalen; m++) {
23346 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
23347 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
23348 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
23349 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
23350 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
23351 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23352 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23353 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
23354 if (ret_conv_12_conv_10_var.is_owned) {
23355 ret_conv_12_conv_10_ref |= 1;
23357 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
23359 FREE(ret_conv_12_var.data);
23360 ret_arr_ptr[m] = ret_conv_12_arr;
23362 FREE(ret_var.data);
23366 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
23367 LDKRoute this_ptr_conv;
23368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23369 this_ptr_conv.is_owned = false;
23370 LDKCVec_CVec_RouteHopZZ val_constr;
23371 val_constr.datalen = *((uint32_t*)val);
23372 if (val_constr.datalen > 0)
23373 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23375 val_constr.data = NULL;
23376 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
23377 for (size_t m = 0; m < val_constr.datalen; m++) {
23378 uint32_tArray val_conv_12 = val_vals[m];
23379 LDKCVec_RouteHopZ val_conv_12_constr;
23380 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
23381 if (val_conv_12_constr.datalen > 0)
23382 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23384 val_conv_12_constr.data = NULL;
23385 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
23386 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23387 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
23388 LDKRouteHop val_conv_12_conv_10_conv;
23389 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23390 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23391 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23392 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23394 val_constr.data[m] = val_conv_12_constr;
23396 Route_set_paths(&this_ptr_conv, val_constr);
23399 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
23400 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23401 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
23402 if (paths_arg_constr.datalen > 0)
23403 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23405 paths_arg_constr.data = NULL;
23406 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
23407 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23408 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
23409 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23410 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
23411 if (paths_arg_conv_12_constr.datalen > 0)
23412 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23414 paths_arg_conv_12_constr.data = NULL;
23415 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
23416 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23417 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23418 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23419 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23420 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23421 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23422 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23424 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23426 LDKRoute ret_var = Route_new(paths_arg_constr);
23427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23429 uint64_t ret_ref = (uint64_t)ret_var.inner;
23430 if (ret_var.is_owned) {
23436 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
23437 LDKRoute orig_conv;
23438 orig_conv.inner = (void*)(orig & (~1));
23439 orig_conv.is_owned = false;
23440 LDKRoute ret_var = Route_clone(&orig_conv);
23441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23443 uint64_t ret_ref = (uint64_t)ret_var.inner;
23444 if (ret_var.is_owned) {
23450 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
23452 o_conv.inner = (void*)(o & (~1));
23453 o_conv.is_owned = false;
23454 int64_t ret_val = Route_hash(&o_conv);
23458 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
23460 a_conv.inner = (void*)(a & (~1));
23461 a_conv.is_owned = false;
23463 b_conv.inner = (void*)(b & (~1));
23464 b_conv.is_owned = false;
23465 jboolean ret_val = Route_eq(&a_conv, &b_conv);
23469 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
23470 LDKRoute this_arg_conv;
23471 this_arg_conv.inner = (void*)(this_arg & (~1));
23472 this_arg_conv.is_owned = false;
23473 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
23477 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
23478 LDKRoute this_arg_conv;
23479 this_arg_conv.inner = (void*)(this_arg & (~1));
23480 this_arg_conv.is_owned = false;
23481 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
23485 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
23487 obj_conv.inner = (void*)(obj & (~1));
23488 obj_conv.is_owned = false;
23489 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23490 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23491 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23492 CVec_u8Z_free(ret_var);
23496 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
23497 LDKu8slice ser_ref;
23498 ser_ref.datalen = *((uint32_t*)ser);
23499 ser_ref.data = (int8_t*)(ser + 4);
23500 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23501 *ret_conv = Route_read(ser_ref);
23502 return (uint64_t)ret_conv;
23505 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
23506 LDKRouteHint this_obj_conv;
23507 this_obj_conv.inner = (void*)(this_obj & (~1));
23508 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23509 RouteHint_free(this_obj_conv);
23512 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
23513 LDKRouteHint orig_conv;
23514 orig_conv.inner = (void*)(orig & (~1));
23515 orig_conv.is_owned = false;
23516 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23519 uint64_t ret_ref = (uint64_t)ret_var.inner;
23520 if (ret_var.is_owned) {
23526 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
23527 LDKRouteHint o_conv;
23528 o_conv.inner = (void*)(o & (~1));
23529 o_conv.is_owned = false;
23530 int64_t ret_val = RouteHint_hash(&o_conv);
23534 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
23535 LDKRouteHint a_conv;
23536 a_conv.inner = (void*)(a & (~1));
23537 a_conv.is_owned = false;
23538 LDKRouteHint b_conv;
23539 b_conv.inner = (void*)(b & (~1));
23540 b_conv.is_owned = false;
23541 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23545 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
23546 LDKRouteHintHop this_obj_conv;
23547 this_obj_conv.inner = (void*)(this_obj & (~1));
23548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23549 RouteHintHop_free(this_obj_conv);
23552 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
23553 LDKRouteHintHop this_ptr_conv;
23554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23555 this_ptr_conv.is_owned = false;
23556 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23557 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
23561 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
23562 LDKRouteHintHop this_ptr_conv;
23563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23564 this_ptr_conv.is_owned = false;
23565 LDKPublicKey val_ref;
23566 CHECK(*((uint32_t*)val) == 33);
23567 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
23568 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23571 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
23572 LDKRouteHintHop this_ptr_conv;
23573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23574 this_ptr_conv.is_owned = false;
23575 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23579 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
23580 LDKRouteHintHop this_ptr_conv;
23581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23582 this_ptr_conv.is_owned = false;
23583 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23586 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
23587 LDKRouteHintHop this_ptr_conv;
23588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23589 this_ptr_conv.is_owned = false;
23590 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23593 uint64_t ret_ref = (uint64_t)ret_var.inner;
23594 if (ret_var.is_owned) {
23600 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
23601 LDKRouteHintHop this_ptr_conv;
23602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23603 this_ptr_conv.is_owned = false;
23604 LDKRoutingFees val_conv;
23605 val_conv.inner = (void*)(val & (~1));
23606 val_conv.is_owned = (val & 1) || (val == 0);
23607 val_conv = RoutingFees_clone(&val_conv);
23608 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23611 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
23612 LDKRouteHintHop this_ptr_conv;
23613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23614 this_ptr_conv.is_owned = false;
23615 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23619 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
23620 LDKRouteHintHop this_ptr_conv;
23621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23622 this_ptr_conv.is_owned = false;
23623 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23626 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
23627 LDKRouteHintHop this_ptr_conv;
23628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23629 this_ptr_conv.is_owned = false;
23630 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23631 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23632 uint64_t ret_ref = (uint64_t)ret_copy;
23636 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
23637 LDKRouteHintHop this_ptr_conv;
23638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23639 this_ptr_conv.is_owned = false;
23640 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23641 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23642 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23645 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
23646 LDKRouteHintHop this_ptr_conv;
23647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23648 this_ptr_conv.is_owned = false;
23649 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23650 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23651 uint64_t ret_ref = (uint64_t)ret_copy;
23655 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
23656 LDKRouteHintHop this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23660 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
23661 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23664 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) {
23665 LDKPublicKey src_node_id_arg_ref;
23666 CHECK(*((uint32_t*)src_node_id_arg) == 33);
23667 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
23668 LDKRoutingFees fees_arg_conv;
23669 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23670 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23671 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23672 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23673 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
23674 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23675 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
23676 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);
23677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23679 uint64_t ret_ref = (uint64_t)ret_var.inner;
23680 if (ret_var.is_owned) {
23686 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
23687 LDKRouteHintHop orig_conv;
23688 orig_conv.inner = (void*)(orig & (~1));
23689 orig_conv.is_owned = false;
23690 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23693 uint64_t ret_ref = (uint64_t)ret_var.inner;
23694 if (ret_var.is_owned) {
23700 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
23701 LDKRouteHintHop o_conv;
23702 o_conv.inner = (void*)(o & (~1));
23703 o_conv.is_owned = false;
23704 int64_t ret_val = RouteHintHop_hash(&o_conv);
23708 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
23709 LDKRouteHintHop a_conv;
23710 a_conv.inner = (void*)(a & (~1));
23711 a_conv.is_owned = false;
23712 LDKRouteHintHop b_conv;
23713 b_conv.inner = (void*)(b & (~1));
23714 b_conv.is_owned = false;
23715 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23719 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) {
23720 LDKPublicKey our_node_id_ref;
23721 CHECK(*((uint32_t*)our_node_id) == 33);
23722 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23723 LDKNetworkGraph network_conv;
23724 network_conv.inner = (void*)(network & (~1));
23725 network_conv.is_owned = false;
23726 LDKPublicKey payee_ref;
23727 CHECK(*((uint32_t*)payee) == 33);
23728 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23729 LDKCVec_ChannelDetailsZ first_hops_constr;
23730 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23731 if (first_hops != 0) {
23732 first_hops_constr.datalen = *((uint32_t*)first_hops);
23733 if (first_hops_constr.datalen > 0)
23734 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23736 first_hops_constr.data = NULL;
23737 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23738 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23739 uint32_t first_hops_conv_16 = first_hops_vals[q];
23740 LDKChannelDetails first_hops_conv_16_conv;
23741 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23742 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23743 first_hops_constr.data[q] = first_hops_conv_16_conv;
23745 first_hops_ptr = &first_hops_constr;
23747 LDKCVec_RouteHintZ last_hops_constr;
23748 last_hops_constr.datalen = *((uint32_t*)last_hops);
23749 if (last_hops_constr.datalen > 0)
23750 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23752 last_hops_constr.data = NULL;
23753 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23754 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23755 uint32_t last_hops_conv_11 = last_hops_vals[l];
23756 LDKRouteHint last_hops_conv_11_conv;
23757 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23758 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23759 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23760 last_hops_constr.data[l] = last_hops_conv_11_conv;
23762 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23763 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23764 *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);
23765 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
23766 return (uint64_t)ret_conv;
23769 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) {
23770 LDKPublicKey our_node_id_ref;
23771 CHECK(*((uint32_t*)our_node_id) == 33);
23772 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
23773 LDKNetworkGraph network_conv;
23774 network_conv.inner = (void*)(network & (~1));
23775 network_conv.is_owned = false;
23776 LDKPublicKey payee_ref;
23777 CHECK(*((uint32_t*)payee) == 33);
23778 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
23779 LDKInvoiceFeatures payee_features_conv;
23780 payee_features_conv.inner = (void*)(payee_features & (~1));
23781 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23782 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23783 LDKCVec_ChannelDetailsZ first_hops_constr;
23784 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
23785 if (first_hops != 0) {
23786 first_hops_constr.datalen = *((uint32_t*)first_hops);
23787 if (first_hops_constr.datalen > 0)
23788 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23790 first_hops_constr.data = NULL;
23791 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
23792 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23793 uint32_t first_hops_conv_16 = first_hops_vals[q];
23794 LDKChannelDetails first_hops_conv_16_conv;
23795 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23796 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23797 first_hops_constr.data[q] = first_hops_conv_16_conv;
23799 first_hops_ptr = &first_hops_constr;
23801 LDKCVec_RouteHintZ last_hops_constr;
23802 last_hops_constr.datalen = *((uint32_t*)last_hops);
23803 if (last_hops_constr.datalen > 0)
23804 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23806 last_hops_constr.data = NULL;
23807 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
23808 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23809 uint32_t last_hops_conv_11 = last_hops_vals[l];
23810 LDKRouteHint last_hops_conv_11_conv;
23811 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23812 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23813 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23814 last_hops_constr.data[l] = last_hops_conv_11_conv;
23816 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23817 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23818 *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);
23819 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
23820 return (uint64_t)ret_conv;
23823 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
23824 LDKNetworkGraph this_obj_conv;
23825 this_obj_conv.inner = (void*)(this_obj & (~1));
23826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23827 NetworkGraph_free(this_obj_conv);
23830 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
23831 LDKReadOnlyNetworkGraph this_obj_conv;
23832 this_obj_conv.inner = (void*)(this_obj & (~1));
23833 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23834 ReadOnlyNetworkGraph_free(this_obj_conv);
23837 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
23838 if ((this_ptr & 1) != 0) return;
23839 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
23840 FREE((void*)this_ptr);
23841 NetworkUpdate_free(this_ptr_conv);
23844 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
23845 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
23846 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23847 *ret_copy = NetworkUpdate_clone(orig_conv);
23848 uint64_t ret_ref = (uint64_t)ret_copy;
23852 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
23853 LDKChannelUpdate msg_conv;
23854 msg_conv.inner = (void*)(msg & (~1));
23855 msg_conv.is_owned = (msg & 1) || (msg == 0);
23856 msg_conv = ChannelUpdate_clone(&msg_conv);
23857 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23858 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
23859 uint64_t ret_ref = (uint64_t)ret_copy;
23863 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
23864 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23865 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
23866 uint64_t ret_ref = (uint64_t)ret_copy;
23870 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
23871 LDKPublicKey node_id_ref;
23872 CHECK(*((uint32_t*)node_id) == 33);
23873 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
23874 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
23875 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
23876 uint64_t ret_ref = (uint64_t)ret_copy;
23880 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
23881 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
23882 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
23883 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23884 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23885 CVec_u8Z_free(ret_var);
23889 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
23890 LDKNetGraphMsgHandler this_arg_conv;
23891 this_arg_conv.inner = (void*)(this_arg & (~1));
23892 this_arg_conv.is_owned = false;
23893 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
23894 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
23895 return (uint64_t)ret_ret;
23898 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
23899 LDKNetGraphMsgHandler this_obj_conv;
23900 this_obj_conv.inner = (void*)(this_obj & (~1));
23901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23902 NetGraphMsgHandler_free(this_obj_conv);
23905 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
23906 LDKNetGraphMsgHandler this_ptr_conv;
23907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23908 this_ptr_conv.is_owned = false;
23909 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
23910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23912 uint64_t ret_ref = (uint64_t)ret_var.inner;
23913 if (ret_var.is_owned) {
23919 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
23920 LDKNetGraphMsgHandler this_ptr_conv;
23921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23922 this_ptr_conv.is_owned = false;
23923 LDKNetworkGraph val_conv;
23924 val_conv.inner = (void*)(val & (~1));
23925 val_conv.is_owned = (val & 1) || (val == 0);
23926 // Warning: we need a move here but no clone is available for LDKNetworkGraph
23927 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
23930 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
23931 LDKNetworkGraph network_graph_conv;
23932 network_graph_conv.inner = (void*)(network_graph & (~1));
23933 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23934 // Warning: we need a move here but no clone is available for LDKNetworkGraph
23935 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
23936 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
23937 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
23938 // Manually implement clone for Java trait instances
23940 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23941 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
23942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23944 uint64_t ret_ref = (uint64_t)ret_var.inner;
23945 if (ret_var.is_owned) {
23951 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
23952 LDKNetGraphMsgHandler this_arg_conv;
23953 this_arg_conv.inner = (void*)(this_arg & (~1));
23954 this_arg_conv.is_owned = false;
23955 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
23956 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
23957 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
23958 // Manually implement clone for Java trait instances
23960 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
23963 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
23964 LDKNetGraphMsgHandler this_arg_conv;
23965 this_arg_conv.inner = (void*)(this_arg & (~1));
23966 this_arg_conv.is_owned = false;
23967 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23968 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23969 return (uint64_t)ret_ret;
23972 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
23973 LDKNetGraphMsgHandler this_arg_conv;
23974 this_arg_conv.inner = (void*)(this_arg & (~1));
23975 this_arg_conv.is_owned = false;
23976 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23977 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23978 return (uint64_t)ret_ret;
23981 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
23982 LDKDirectionalChannelInfo this_obj_conv;
23983 this_obj_conv.inner = (void*)(this_obj & (~1));
23984 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23985 DirectionalChannelInfo_free(this_obj_conv);
23988 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
23989 LDKDirectionalChannelInfo this_ptr_conv;
23990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23991 this_ptr_conv.is_owned = false;
23992 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23996 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
23997 LDKDirectionalChannelInfo this_ptr_conv;
23998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23999 this_ptr_conv.is_owned = false;
24000 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24003 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24004 LDKDirectionalChannelInfo this_ptr_conv;
24005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24006 this_ptr_conv.is_owned = false;
24007 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24011 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24012 LDKDirectionalChannelInfo this_ptr_conv;
24013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24014 this_ptr_conv.is_owned = false;
24015 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24018 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24019 LDKDirectionalChannelInfo this_ptr_conv;
24020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24021 this_ptr_conv.is_owned = false;
24022 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24026 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24027 LDKDirectionalChannelInfo this_ptr_conv;
24028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24029 this_ptr_conv.is_owned = false;
24030 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24033 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24034 LDKDirectionalChannelInfo this_ptr_conv;
24035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24036 this_ptr_conv.is_owned = false;
24037 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24041 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24042 LDKDirectionalChannelInfo this_ptr_conv;
24043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24044 this_ptr_conv.is_owned = false;
24045 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24048 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24049 LDKDirectionalChannelInfo this_ptr_conv;
24050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24051 this_ptr_conv.is_owned = false;
24052 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24053 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24054 uint64_t ret_ref = (uint64_t)ret_copy;
24058 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24059 LDKDirectionalChannelInfo this_ptr_conv;
24060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24061 this_ptr_conv.is_owned = false;
24062 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24063 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24064 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24067 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24068 LDKDirectionalChannelInfo this_ptr_conv;
24069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24070 this_ptr_conv.is_owned = false;
24071 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24074 uint64_t ret_ref = (uint64_t)ret_var.inner;
24075 if (ret_var.is_owned) {
24081 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24082 LDKDirectionalChannelInfo this_ptr_conv;
24083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24084 this_ptr_conv.is_owned = false;
24085 LDKRoutingFees val_conv;
24086 val_conv.inner = (void*)(val & (~1));
24087 val_conv.is_owned = (val & 1) || (val == 0);
24088 val_conv = RoutingFees_clone(&val_conv);
24089 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24092 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24093 LDKDirectionalChannelInfo this_ptr_conv;
24094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24095 this_ptr_conv.is_owned = false;
24096 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24099 uint64_t ret_ref = (uint64_t)ret_var.inner;
24100 if (ret_var.is_owned) {
24106 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
24107 LDKDirectionalChannelInfo this_ptr_conv;
24108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24109 this_ptr_conv.is_owned = false;
24110 LDKChannelUpdate val_conv;
24111 val_conv.inner = (void*)(val & (~1));
24112 val_conv.is_owned = (val & 1) || (val == 0);
24113 val_conv = ChannelUpdate_clone(&val_conv);
24114 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
24117 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) {
24118 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
24119 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
24120 LDKRoutingFees fees_arg_conv;
24121 fees_arg_conv.inner = (void*)(fees_arg & (~1));
24122 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
24123 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
24124 LDKChannelUpdate last_update_message_arg_conv;
24125 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
24126 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
24127 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
24128 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);
24129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24131 uint64_t ret_ref = (uint64_t)ret_var.inner;
24132 if (ret_var.is_owned) {
24138 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
24139 LDKDirectionalChannelInfo orig_conv;
24140 orig_conv.inner = (void*)(orig & (~1));
24141 orig_conv.is_owned = false;
24142 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
24143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24145 uint64_t ret_ref = (uint64_t)ret_var.inner;
24146 if (ret_var.is_owned) {
24152 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
24153 LDKDirectionalChannelInfo obj_conv;
24154 obj_conv.inner = (void*)(obj & (~1));
24155 obj_conv.is_owned = false;
24156 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
24157 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24158 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24159 CVec_u8Z_free(ret_var);
24163 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
24164 LDKu8slice ser_ref;
24165 ser_ref.datalen = *((uint32_t*)ser);
24166 ser_ref.data = (int8_t*)(ser + 4);
24167 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
24168 *ret_conv = DirectionalChannelInfo_read(ser_ref);
24169 return (uint64_t)ret_conv;
24172 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
24173 LDKChannelInfo this_obj_conv;
24174 this_obj_conv.inner = (void*)(this_obj & (~1));
24175 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24176 ChannelInfo_free(this_obj_conv);
24179 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
24180 LDKChannelInfo this_ptr_conv;
24181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24182 this_ptr_conv.is_owned = false;
24183 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
24184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24186 uint64_t ret_ref = (uint64_t)ret_var.inner;
24187 if (ret_var.is_owned) {
24193 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
24194 LDKChannelInfo this_ptr_conv;
24195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24196 this_ptr_conv.is_owned = false;
24197 LDKChannelFeatures val_conv;
24198 val_conv.inner = (void*)(val & (~1));
24199 val_conv.is_owned = (val & 1) || (val == 0);
24200 val_conv = ChannelFeatures_clone(&val_conv);
24201 ChannelInfo_set_features(&this_ptr_conv, val_conv);
24204 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
24205 LDKChannelInfo this_ptr_conv;
24206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24207 this_ptr_conv.is_owned = false;
24208 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24209 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
24213 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
24214 LDKChannelInfo this_ptr_conv;
24215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24216 this_ptr_conv.is_owned = false;
24217 LDKPublicKey val_ref;
24218 CHECK(*((uint32_t*)val) == 33);
24219 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24220 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
24223 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
24224 LDKChannelInfo this_ptr_conv;
24225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24226 this_ptr_conv.is_owned = false;
24227 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
24228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24230 uint64_t ret_ref = (uint64_t)ret_var.inner;
24231 if (ret_var.is_owned) {
24237 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
24238 LDKChannelInfo this_ptr_conv;
24239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24240 this_ptr_conv.is_owned = false;
24241 LDKDirectionalChannelInfo val_conv;
24242 val_conv.inner = (void*)(val & (~1));
24243 val_conv.is_owned = (val & 1) || (val == 0);
24244 val_conv = DirectionalChannelInfo_clone(&val_conv);
24245 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
24248 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
24249 LDKChannelInfo this_ptr_conv;
24250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24251 this_ptr_conv.is_owned = false;
24252 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
24253 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
24257 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
24258 LDKChannelInfo this_ptr_conv;
24259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24260 this_ptr_conv.is_owned = false;
24261 LDKPublicKey val_ref;
24262 CHECK(*((uint32_t*)val) == 33);
24263 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
24264 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
24267 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
24268 LDKChannelInfo this_ptr_conv;
24269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24270 this_ptr_conv.is_owned = false;
24271 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
24272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24274 uint64_t ret_ref = (uint64_t)ret_var.inner;
24275 if (ret_var.is_owned) {
24281 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
24282 LDKChannelInfo this_ptr_conv;
24283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24284 this_ptr_conv.is_owned = false;
24285 LDKDirectionalChannelInfo val_conv;
24286 val_conv.inner = (void*)(val & (~1));
24287 val_conv.is_owned = (val & 1) || (val == 0);
24288 val_conv = DirectionalChannelInfo_clone(&val_conv);
24289 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
24292 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
24293 LDKChannelInfo this_ptr_conv;
24294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24295 this_ptr_conv.is_owned = false;
24296 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24297 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
24298 uint64_t ret_ref = (uint64_t)ret_copy;
24302 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
24303 LDKChannelInfo this_ptr_conv;
24304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24305 this_ptr_conv.is_owned = false;
24306 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24307 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24308 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
24311 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
24312 LDKChannelInfo this_ptr_conv;
24313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24314 this_ptr_conv.is_owned = false;
24315 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
24316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24318 uint64_t ret_ref = (uint64_t)ret_var.inner;
24319 if (ret_var.is_owned) {
24325 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24326 LDKChannelInfo this_ptr_conv;
24327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24328 this_ptr_conv.is_owned = false;
24329 LDKChannelAnnouncement val_conv;
24330 val_conv.inner = (void*)(val & (~1));
24331 val_conv.is_owned = (val & 1) || (val == 0);
24332 val_conv = ChannelAnnouncement_clone(&val_conv);
24333 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24336 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) {
24337 LDKChannelFeatures features_arg_conv;
24338 features_arg_conv.inner = (void*)(features_arg & (~1));
24339 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24340 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24341 LDKPublicKey node_one_arg_ref;
24342 CHECK(*((uint32_t*)node_one_arg) == 33);
24343 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
24344 LDKDirectionalChannelInfo one_to_two_arg_conv;
24345 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24346 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24347 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24348 LDKPublicKey node_two_arg_ref;
24349 CHECK(*((uint32_t*)node_two_arg) == 33);
24350 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
24351 LDKDirectionalChannelInfo two_to_one_arg_conv;
24352 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24353 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24354 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24355 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24356 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
24357 LDKChannelAnnouncement announcement_message_arg_conv;
24358 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24359 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24360 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24361 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);
24362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24364 uint64_t ret_ref = (uint64_t)ret_var.inner;
24365 if (ret_var.is_owned) {
24371 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
24372 LDKChannelInfo orig_conv;
24373 orig_conv.inner = (void*)(orig & (~1));
24374 orig_conv.is_owned = false;
24375 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24376 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24377 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24378 uint64_t ret_ref = (uint64_t)ret_var.inner;
24379 if (ret_var.is_owned) {
24385 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
24386 LDKChannelInfo obj_conv;
24387 obj_conv.inner = (void*)(obj & (~1));
24388 obj_conv.is_owned = false;
24389 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24390 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24391 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24392 CVec_u8Z_free(ret_var);
24396 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
24397 LDKu8slice ser_ref;
24398 ser_ref.datalen = *((uint32_t*)ser);
24399 ser_ref.data = (int8_t*)(ser + 4);
24400 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24401 *ret_conv = ChannelInfo_read(ser_ref);
24402 return (uint64_t)ret_conv;
24405 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
24406 LDKRoutingFees this_obj_conv;
24407 this_obj_conv.inner = (void*)(this_obj & (~1));
24408 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24409 RoutingFees_free(this_obj_conv);
24412 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
24413 LDKRoutingFees this_ptr_conv;
24414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24415 this_ptr_conv.is_owned = false;
24416 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24420 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
24421 LDKRoutingFees this_ptr_conv;
24422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24423 this_ptr_conv.is_owned = false;
24424 RoutingFees_set_base_msat(&this_ptr_conv, val);
24427 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
24428 LDKRoutingFees this_ptr_conv;
24429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24430 this_ptr_conv.is_owned = false;
24431 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24435 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
24436 LDKRoutingFees this_ptr_conv;
24437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24438 this_ptr_conv.is_owned = false;
24439 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24442 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
24443 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24446 uint64_t ret_ref = (uint64_t)ret_var.inner;
24447 if (ret_var.is_owned) {
24453 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
24454 LDKRoutingFees a_conv;
24455 a_conv.inner = (void*)(a & (~1));
24456 a_conv.is_owned = false;
24457 LDKRoutingFees b_conv;
24458 b_conv.inner = (void*)(b & (~1));
24459 b_conv.is_owned = false;
24460 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24464 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
24465 LDKRoutingFees orig_conv;
24466 orig_conv.inner = (void*)(orig & (~1));
24467 orig_conv.is_owned = false;
24468 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24471 uint64_t ret_ref = (uint64_t)ret_var.inner;
24472 if (ret_var.is_owned) {
24478 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
24479 LDKRoutingFees o_conv;
24480 o_conv.inner = (void*)(o & (~1));
24481 o_conv.is_owned = false;
24482 int64_t ret_val = RoutingFees_hash(&o_conv);
24486 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
24487 LDKRoutingFees obj_conv;
24488 obj_conv.inner = (void*)(obj & (~1));
24489 obj_conv.is_owned = false;
24490 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24491 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24492 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24493 CVec_u8Z_free(ret_var);
24497 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
24498 LDKu8slice ser_ref;
24499 ser_ref.datalen = *((uint32_t*)ser);
24500 ser_ref.data = (int8_t*)(ser + 4);
24501 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24502 *ret_conv = RoutingFees_read(ser_ref);
24503 return (uint64_t)ret_conv;
24506 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
24507 LDKNodeAnnouncementInfo this_obj_conv;
24508 this_obj_conv.inner = (void*)(this_obj & (~1));
24509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24510 NodeAnnouncementInfo_free(this_obj_conv);
24513 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
24514 LDKNodeAnnouncementInfo this_ptr_conv;
24515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24516 this_ptr_conv.is_owned = false;
24517 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24520 uint64_t ret_ref = (uint64_t)ret_var.inner;
24521 if (ret_var.is_owned) {
24527 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
24528 LDKNodeAnnouncementInfo this_ptr_conv;
24529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24530 this_ptr_conv.is_owned = false;
24531 LDKNodeFeatures val_conv;
24532 val_conv.inner = (void*)(val & (~1));
24533 val_conv.is_owned = (val & 1) || (val == 0);
24534 val_conv = NodeFeatures_clone(&val_conv);
24535 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24538 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
24539 LDKNodeAnnouncementInfo this_ptr_conv;
24540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24541 this_ptr_conv.is_owned = false;
24542 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24546 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24547 LDKNodeAnnouncementInfo this_ptr_conv;
24548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24549 this_ptr_conv.is_owned = false;
24550 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24553 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
24554 LDKNodeAnnouncementInfo this_ptr_conv;
24555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24556 this_ptr_conv.is_owned = false;
24557 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
24558 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
24562 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
24563 LDKNodeAnnouncementInfo this_ptr_conv;
24564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24565 this_ptr_conv.is_owned = false;
24566 LDKThreeBytes val_ref;
24567 CHECK(*((uint32_t*)val) == 3);
24568 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
24569 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24572 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
24573 LDKNodeAnnouncementInfo this_ptr_conv;
24574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24575 this_ptr_conv.is_owned = false;
24576 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24577 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
24581 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
24582 LDKNodeAnnouncementInfo this_ptr_conv;
24583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24584 this_ptr_conv.is_owned = false;
24585 LDKThirtyTwoBytes val_ref;
24586 CHECK(*((uint32_t*)val) == 32);
24587 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24588 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24591 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
24592 LDKNodeAnnouncementInfo this_ptr_conv;
24593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24594 this_ptr_conv.is_owned = false;
24595 LDKCVec_NetAddressZ val_constr;
24596 val_constr.datalen = *((uint32_t*)val);
24597 if (val_constr.datalen > 0)
24598 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24600 val_constr.data = NULL;
24601 uint32_t* val_vals = (uint32_t*)(val + 4);
24602 for (size_t m = 0; m < val_constr.datalen; m++) {
24603 uint32_t val_conv_12 = val_vals[m];
24604 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24605 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24606 val_constr.data[m] = val_conv_12_conv;
24608 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24611 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
24612 LDKNodeAnnouncementInfo this_ptr_conv;
24613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24614 this_ptr_conv.is_owned = false;
24615 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24618 uint64_t ret_ref = (uint64_t)ret_var.inner;
24619 if (ret_var.is_owned) {
24625 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24626 LDKNodeAnnouncementInfo this_ptr_conv;
24627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24628 this_ptr_conv.is_owned = false;
24629 LDKNodeAnnouncement val_conv;
24630 val_conv.inner = (void*)(val & (~1));
24631 val_conv.is_owned = (val & 1) || (val == 0);
24632 val_conv = NodeAnnouncement_clone(&val_conv);
24633 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24636 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) {
24637 LDKNodeFeatures features_arg_conv;
24638 features_arg_conv.inner = (void*)(features_arg & (~1));
24639 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24640 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24641 LDKThreeBytes rgb_arg_ref;
24642 CHECK(*((uint32_t*)rgb_arg) == 3);
24643 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
24644 LDKThirtyTwoBytes alias_arg_ref;
24645 CHECK(*((uint32_t*)alias_arg) == 32);
24646 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
24647 LDKCVec_NetAddressZ addresses_arg_constr;
24648 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
24649 if (addresses_arg_constr.datalen > 0)
24650 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24652 addresses_arg_constr.data = NULL;
24653 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
24654 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24655 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
24656 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24657 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24659 LDKNodeAnnouncement announcement_message_arg_conv;
24660 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24661 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24662 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24663 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24666 uint64_t ret_ref = (uint64_t)ret_var.inner;
24667 if (ret_var.is_owned) {
24673 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
24674 LDKNodeAnnouncementInfo orig_conv;
24675 orig_conv.inner = (void*)(orig & (~1));
24676 orig_conv.is_owned = false;
24677 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24680 uint64_t ret_ref = (uint64_t)ret_var.inner;
24681 if (ret_var.is_owned) {
24687 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
24688 LDKNodeAnnouncementInfo obj_conv;
24689 obj_conv.inner = (void*)(obj & (~1));
24690 obj_conv.is_owned = false;
24691 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24692 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24693 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24694 CVec_u8Z_free(ret_var);
24698 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
24699 LDKu8slice ser_ref;
24700 ser_ref.datalen = *((uint32_t*)ser);
24701 ser_ref.data = (int8_t*)(ser + 4);
24702 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24703 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24704 return (uint64_t)ret_conv;
24707 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
24708 LDKNodeInfo this_obj_conv;
24709 this_obj_conv.inner = (void*)(this_obj & (~1));
24710 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24711 NodeInfo_free(this_obj_conv);
24714 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
24715 LDKNodeInfo this_ptr_conv;
24716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24717 this_ptr_conv.is_owned = false;
24718 LDKCVec_u64Z val_constr;
24719 val_constr.datalen = *((uint32_t*)val);
24720 if (val_constr.datalen > 0)
24721 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24723 val_constr.data = NULL;
24724 int64_t* val_vals = (int64_t*)(val + 4);
24725 for (size_t i = 0; i < val_constr.datalen; i++) {
24726 int64_t val_conv_8 = val_vals[i];
24727 val_constr.data[i] = val_conv_8;
24729 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24732 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
24733 LDKNodeInfo this_ptr_conv;
24734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24735 this_ptr_conv.is_owned = false;
24736 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24739 uint64_t ret_ref = (uint64_t)ret_var.inner;
24740 if (ret_var.is_owned) {
24746 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
24747 LDKNodeInfo this_ptr_conv;
24748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24749 this_ptr_conv.is_owned = false;
24750 LDKRoutingFees val_conv;
24751 val_conv.inner = (void*)(val & (~1));
24752 val_conv.is_owned = (val & 1) || (val == 0);
24753 val_conv = RoutingFees_clone(&val_conv);
24754 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24757 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
24758 LDKNodeInfo this_ptr_conv;
24759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24760 this_ptr_conv.is_owned = false;
24761 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24762 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24763 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24764 uint64_t ret_ref = (uint64_t)ret_var.inner;
24765 if (ret_var.is_owned) {
24771 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
24772 LDKNodeInfo this_ptr_conv;
24773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24774 this_ptr_conv.is_owned = false;
24775 LDKNodeAnnouncementInfo val_conv;
24776 val_conv.inner = (void*)(val & (~1));
24777 val_conv.is_owned = (val & 1) || (val == 0);
24778 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24779 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24782 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
24783 LDKCVec_u64Z channels_arg_constr;
24784 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
24785 if (channels_arg_constr.datalen > 0)
24786 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24788 channels_arg_constr.data = NULL;
24789 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
24790 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
24791 int64_t channels_arg_conv_8 = channels_arg_vals[i];
24792 channels_arg_constr.data[i] = channels_arg_conv_8;
24794 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24795 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24796 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24797 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24798 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24799 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24800 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24801 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24802 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24805 uint64_t ret_ref = (uint64_t)ret_var.inner;
24806 if (ret_var.is_owned) {
24812 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
24813 LDKNodeInfo orig_conv;
24814 orig_conv.inner = (void*)(orig & (~1));
24815 orig_conv.is_owned = false;
24816 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24819 uint64_t ret_ref = (uint64_t)ret_var.inner;
24820 if (ret_var.is_owned) {
24826 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
24827 LDKNodeInfo obj_conv;
24828 obj_conv.inner = (void*)(obj & (~1));
24829 obj_conv.is_owned = false;
24830 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24831 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24832 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24833 CVec_u8Z_free(ret_var);
24837 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
24838 LDKu8slice ser_ref;
24839 ser_ref.datalen = *((uint32_t*)ser);
24840 ser_ref.data = (int8_t*)(ser + 4);
24841 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24842 *ret_conv = NodeInfo_read(ser_ref);
24843 return (uint64_t)ret_conv;
24846 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
24847 LDKNetworkGraph obj_conv;
24848 obj_conv.inner = (void*)(obj & (~1));
24849 obj_conv.is_owned = false;
24850 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24851 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24852 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24853 CVec_u8Z_free(ret_var);
24857 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
24858 LDKu8slice ser_ref;
24859 ser_ref.datalen = *((uint32_t*)ser);
24860 ser_ref.data = (int8_t*)(ser + 4);
24861 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24862 *ret_conv = NetworkGraph_read(ser_ref);
24863 return (uint64_t)ret_conv;
24866 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
24867 LDKThirtyTwoBytes genesis_hash_ref;
24868 CHECK(*((uint32_t*)genesis_hash) == 32);
24869 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
24870 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24873 uint64_t ret_ref = (uint64_t)ret_var.inner;
24874 if (ret_var.is_owned) {
24880 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
24881 LDKNetworkGraph this_arg_conv;
24882 this_arg_conv.inner = (void*)(this_arg & (~1));
24883 this_arg_conv.is_owned = false;
24884 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
24885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24887 uint64_t ret_ref = (uint64_t)ret_var.inner;
24888 if (ret_var.is_owned) {
24894 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
24895 LDKNetworkGraph this_arg_conv;
24896 this_arg_conv.inner = (void*)(this_arg & (~1));
24897 this_arg_conv.is_owned = false;
24898 LDKNodeAnnouncement msg_conv;
24899 msg_conv.inner = (void*)(msg & (~1));
24900 msg_conv.is_owned = false;
24901 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24902 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24903 return (uint64_t)ret_conv;
24906 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
24907 LDKNetworkGraph this_arg_conv;
24908 this_arg_conv.inner = (void*)(this_arg & (~1));
24909 this_arg_conv.is_owned = false;
24910 LDKUnsignedNodeAnnouncement msg_conv;
24911 msg_conv.inner = (void*)(msg & (~1));
24912 msg_conv.is_owned = false;
24913 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24914 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24915 return (uint64_t)ret_conv;
24918 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
24919 LDKNetworkGraph this_arg_conv;
24920 this_arg_conv.inner = (void*)(this_arg & (~1));
24921 this_arg_conv.is_owned = false;
24922 LDKChannelAnnouncement msg_conv;
24923 msg_conv.inner = (void*)(msg & (~1));
24924 msg_conv.is_owned = false;
24925 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24926 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24927 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24928 // Manually implement clone for Java trait instances
24930 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24931 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
24932 return (uint64_t)ret_conv;
24935 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
24936 LDKNetworkGraph this_arg_conv;
24937 this_arg_conv.inner = (void*)(this_arg & (~1));
24938 this_arg_conv.is_owned = false;
24939 LDKUnsignedChannelAnnouncement msg_conv;
24940 msg_conv.inner = (void*)(msg & (~1));
24941 msg_conv.is_owned = false;
24942 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24943 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24944 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24945 // Manually implement clone for Java trait instances
24947 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24948 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
24949 return (uint64_t)ret_conv;
24952 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
24953 LDKNetworkGraph this_arg_conv;
24954 this_arg_conv.inner = (void*)(this_arg & (~1));
24955 this_arg_conv.is_owned = false;
24956 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24959 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
24960 LDKNetworkGraph this_arg_conv;
24961 this_arg_conv.inner = (void*)(this_arg & (~1));
24962 this_arg_conv.is_owned = false;
24963 LDKPublicKey _node_id_ref;
24964 CHECK(*((uint32_t*)_node_id) == 33);
24965 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
24966 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
24969 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
24970 LDKNetworkGraph this_arg_conv;
24971 this_arg_conv.inner = (void*)(this_arg & (~1));
24972 this_arg_conv.is_owned = false;
24973 LDKChannelUpdate msg_conv;
24974 msg_conv.inner = (void*)(msg & (~1));
24975 msg_conv.is_owned = false;
24976 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24977 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24978 return (uint64_t)ret_conv;
24981 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
24982 LDKNetworkGraph this_arg_conv;
24983 this_arg_conv.inner = (void*)(this_arg & (~1));
24984 this_arg_conv.is_owned = false;
24985 LDKUnsignedChannelUpdate msg_conv;
24986 msg_conv.inner = (void*)(msg & (~1));
24987 msg_conv.is_owned = false;
24988 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24989 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24990 return (uint64_t)ret_conv;
24993 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
24994 LDKFilesystemPersister this_obj_conv;
24995 this_obj_conv.inner = (void*)(this_obj & (~1));
24996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24997 FilesystemPersister_free(this_obj_conv);
25000 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
25001 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
25002 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
25003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25005 uint64_t ret_ref = (uint64_t)ret_var.inner;
25006 if (ret_var.is_owned) {
25012 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
25013 LDKFilesystemPersister this_arg_conv;
25014 this_arg_conv.inner = (void*)(this_arg & (~1));
25015 this_arg_conv.is_owned = false;
25016 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
25017 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25022 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
25023 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
25024 LDKChannelManager manager_conv;
25025 manager_conv.inner = (void*)(manager & (~1));
25026 manager_conv.is_owned = false;
25027 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25028 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
25029 return (uint64_t)ret_conv;
25032 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
25033 LDKFilesystemPersister this_arg_conv;
25034 this_arg_conv.inner = (void*)(this_arg & (~1));
25035 this_arg_conv.is_owned = false;
25036 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25037 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
25038 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
25039 return (uint64_t)ret_conv;
25042 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
25043 LDKFilesystemPersister this_arg_conv;
25044 this_arg_conv.inner = (void*)(this_arg & (~1));
25045 this_arg_conv.is_owned = false;
25046 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
25047 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
25048 return (uint64_t)ret_ret;
25051 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
25052 LDKBackgroundProcessor this_obj_conv;
25053 this_obj_conv.inner = (void*)(this_obj & (~1));
25054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25055 BackgroundProcessor_free(this_obj_conv);
25058 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
25059 if ((this_ptr & 1) != 0) return;
25060 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
25061 FREE((void*)this_ptr);
25062 ChannelManagerPersister_free(this_ptr_conv);
25065 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t net_graph_msg_handler, uint32_t peer_manager, uint32_t logger) {
25066 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
25067 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
25068 LDKChainMonitor chain_monitor_conv;
25069 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
25070 chain_monitor_conv.is_owned = false;
25071 LDKChannelManager channel_manager_conv;
25072 channel_manager_conv.inner = (void*)(channel_manager & (~1));
25073 channel_manager_conv.is_owned = false;
25074 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
25075 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
25076 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
25077 LDKPeerManager peer_manager_conv;
25078 peer_manager_conv.inner = (void*)(peer_manager & (~1));
25079 peer_manager_conv.is_owned = false;
25080 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25081 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
25082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25084 uint64_t ret_ref = (uint64_t)ret_var.inner;
25085 if (ret_var.is_owned) {
25091 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
25092 LDKBackgroundProcessor this_arg_conv;
25093 this_arg_conv.inner = (void*)(this_arg & (~1));
25094 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25095 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25096 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25097 *ret_conv = BackgroundProcessor_join(this_arg_conv);
25098 return (uint64_t)ret_conv;
25101 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
25102 LDKBackgroundProcessor this_arg_conv;
25103 this_arg_conv.inner = (void*)(this_arg & (~1));
25104 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25105 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25106 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25107 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
25108 return (uint64_t)ret_conv;
25111 void __attribute__((visibility("default"))) TS_check_platform() {
25115 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
25116 LDKInvoice this_obj_conv;
25117 this_obj_conv.inner = (void*)(this_obj & (~1));
25118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25119 Invoice_free(this_obj_conv);
25122 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
25124 a_conv.inner = (void*)(a & (~1));
25125 a_conv.is_owned = false;
25127 b_conv.inner = (void*)(b & (~1));
25128 b_conv.is_owned = false;
25129 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
25133 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
25134 LDKInvoice orig_conv;
25135 orig_conv.inner = (void*)(orig & (~1));
25136 orig_conv.is_owned = false;
25137 LDKInvoice ret_var = Invoice_clone(&orig_conv);
25138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25140 uint64_t ret_ref = (uint64_t)ret_var.inner;
25141 if (ret_var.is_owned) {
25147 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
25148 LDKSignedRawInvoice this_obj_conv;
25149 this_obj_conv.inner = (void*)(this_obj & (~1));
25150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25151 SignedRawInvoice_free(this_obj_conv);
25154 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
25155 LDKSignedRawInvoice a_conv;
25156 a_conv.inner = (void*)(a & (~1));
25157 a_conv.is_owned = false;
25158 LDKSignedRawInvoice b_conv;
25159 b_conv.inner = (void*)(b & (~1));
25160 b_conv.is_owned = false;
25161 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
25165 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
25166 LDKSignedRawInvoice orig_conv;
25167 orig_conv.inner = (void*)(orig & (~1));
25168 orig_conv.is_owned = false;
25169 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
25170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25172 uint64_t ret_ref = (uint64_t)ret_var.inner;
25173 if (ret_var.is_owned) {
25179 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
25180 LDKRawInvoice this_obj_conv;
25181 this_obj_conv.inner = (void*)(this_obj & (~1));
25182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25183 RawInvoice_free(this_obj_conv);
25186 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
25187 LDKRawInvoice this_ptr_conv;
25188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25189 this_ptr_conv.is_owned = false;
25190 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
25191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25193 uint64_t ret_ref = (uint64_t)ret_var.inner;
25194 if (ret_var.is_owned) {
25200 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
25201 LDKRawInvoice this_ptr_conv;
25202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25203 this_ptr_conv.is_owned = false;
25204 LDKRawDataPart val_conv;
25205 val_conv.inner = (void*)(val & (~1));
25206 val_conv.is_owned = (val & 1) || (val == 0);
25207 val_conv = RawDataPart_clone(&val_conv);
25208 RawInvoice_set_data(&this_ptr_conv, val_conv);
25211 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
25212 LDKRawInvoice a_conv;
25213 a_conv.inner = (void*)(a & (~1));
25214 a_conv.is_owned = false;
25215 LDKRawInvoice b_conv;
25216 b_conv.inner = (void*)(b & (~1));
25217 b_conv.is_owned = false;
25218 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
25222 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
25223 LDKRawInvoice orig_conv;
25224 orig_conv.inner = (void*)(orig & (~1));
25225 orig_conv.is_owned = false;
25226 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
25227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25229 uint64_t ret_ref = (uint64_t)ret_var.inner;
25230 if (ret_var.is_owned) {
25236 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
25237 LDKRawDataPart this_obj_conv;
25238 this_obj_conv.inner = (void*)(this_obj & (~1));
25239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25240 RawDataPart_free(this_obj_conv);
25243 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
25244 LDKRawDataPart this_ptr_conv;
25245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25246 this_ptr_conv.is_owned = false;
25247 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
25248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25250 uint64_t ret_ref = (uint64_t)ret_var.inner;
25251 if (ret_var.is_owned) {
25257 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
25258 LDKRawDataPart this_ptr_conv;
25259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25260 this_ptr_conv.is_owned = false;
25261 LDKPositiveTimestamp val_conv;
25262 val_conv.inner = (void*)(val & (~1));
25263 val_conv.is_owned = (val & 1) || (val == 0);
25264 val_conv = PositiveTimestamp_clone(&val_conv);
25265 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
25268 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
25269 LDKRawDataPart a_conv;
25270 a_conv.inner = (void*)(a & (~1));
25271 a_conv.is_owned = false;
25272 LDKRawDataPart b_conv;
25273 b_conv.inner = (void*)(b & (~1));
25274 b_conv.is_owned = false;
25275 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
25279 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
25280 LDKRawDataPart orig_conv;
25281 orig_conv.inner = (void*)(orig & (~1));
25282 orig_conv.is_owned = false;
25283 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
25284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25286 uint64_t ret_ref = (uint64_t)ret_var.inner;
25287 if (ret_var.is_owned) {
25293 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
25294 LDKPositiveTimestamp this_obj_conv;
25295 this_obj_conv.inner = (void*)(this_obj & (~1));
25296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25297 PositiveTimestamp_free(this_obj_conv);
25300 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
25301 LDKPositiveTimestamp a_conv;
25302 a_conv.inner = (void*)(a & (~1));
25303 a_conv.is_owned = false;
25304 LDKPositiveTimestamp b_conv;
25305 b_conv.inner = (void*)(b & (~1));
25306 b_conv.is_owned = false;
25307 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
25311 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
25312 LDKPositiveTimestamp orig_conv;
25313 orig_conv.inner = (void*)(orig & (~1));
25314 orig_conv.is_owned = false;
25315 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
25316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25318 uint64_t ret_ref = (uint64_t)ret_var.inner;
25319 if (ret_var.is_owned) {
25325 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
25326 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
25327 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
25331 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
25332 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
25336 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
25337 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
25341 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
25342 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
25346 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
25347 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
25351 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
25352 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
25353 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
25354 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
25358 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
25359 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
25360 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
25364 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
25365 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
25366 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
25370 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
25371 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
25375 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
25376 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
25380 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
25381 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
25385 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
25386 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
25390 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
25391 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
25395 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
25396 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25397 int64_t ret_val = Currency_hash(o_conv);
25401 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
25402 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25403 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25404 jboolean ret_val = Currency_eq(a_conv, b_conv);
25408 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
25409 LDKSha256 this_obj_conv;
25410 this_obj_conv.inner = (void*)(this_obj & (~1));
25411 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25412 Sha256_free(this_obj_conv);
25415 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
25416 LDKSha256 orig_conv;
25417 orig_conv.inner = (void*)(orig & (~1));
25418 orig_conv.is_owned = false;
25419 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25422 uint64_t ret_ref = (uint64_t)ret_var.inner;
25423 if (ret_var.is_owned) {
25429 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
25431 o_conv.inner = (void*)(o & (~1));
25432 o_conv.is_owned = false;
25433 int64_t ret_val = Sha256_hash(&o_conv);
25437 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
25439 a_conv.inner = (void*)(a & (~1));
25440 a_conv.is_owned = false;
25442 b_conv.inner = (void*)(b & (~1));
25443 b_conv.is_owned = false;
25444 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25448 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
25449 LDKDescription this_obj_conv;
25450 this_obj_conv.inner = (void*)(this_obj & (~1));
25451 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25452 Description_free(this_obj_conv);
25455 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
25456 LDKDescription orig_conv;
25457 orig_conv.inner = (void*)(orig & (~1));
25458 orig_conv.is_owned = false;
25459 LDKDescription ret_var = Description_clone(&orig_conv);
25460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25462 uint64_t ret_ref = (uint64_t)ret_var.inner;
25463 if (ret_var.is_owned) {
25469 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
25470 LDKDescription o_conv;
25471 o_conv.inner = (void*)(o & (~1));
25472 o_conv.is_owned = false;
25473 int64_t ret_val = Description_hash(&o_conv);
25477 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
25478 LDKDescription a_conv;
25479 a_conv.inner = (void*)(a & (~1));
25480 a_conv.is_owned = false;
25481 LDKDescription b_conv;
25482 b_conv.inner = (void*)(b & (~1));
25483 b_conv.is_owned = false;
25484 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25488 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
25489 LDKPayeePubKey this_obj_conv;
25490 this_obj_conv.inner = (void*)(this_obj & (~1));
25491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25492 PayeePubKey_free(this_obj_conv);
25495 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
25496 LDKPayeePubKey orig_conv;
25497 orig_conv.inner = (void*)(orig & (~1));
25498 orig_conv.is_owned = false;
25499 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25502 uint64_t ret_ref = (uint64_t)ret_var.inner;
25503 if (ret_var.is_owned) {
25509 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
25510 LDKPayeePubKey o_conv;
25511 o_conv.inner = (void*)(o & (~1));
25512 o_conv.is_owned = false;
25513 int64_t ret_val = PayeePubKey_hash(&o_conv);
25517 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
25518 LDKPayeePubKey a_conv;
25519 a_conv.inner = (void*)(a & (~1));
25520 a_conv.is_owned = false;
25521 LDKPayeePubKey b_conv;
25522 b_conv.inner = (void*)(b & (~1));
25523 b_conv.is_owned = false;
25524 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25528 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
25529 LDKExpiryTime this_obj_conv;
25530 this_obj_conv.inner = (void*)(this_obj & (~1));
25531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25532 ExpiryTime_free(this_obj_conv);
25535 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
25536 LDKExpiryTime orig_conv;
25537 orig_conv.inner = (void*)(orig & (~1));
25538 orig_conv.is_owned = false;
25539 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25542 uint64_t ret_ref = (uint64_t)ret_var.inner;
25543 if (ret_var.is_owned) {
25549 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
25550 LDKExpiryTime o_conv;
25551 o_conv.inner = (void*)(o & (~1));
25552 o_conv.is_owned = false;
25553 int64_t ret_val = ExpiryTime_hash(&o_conv);
25557 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
25558 LDKExpiryTime a_conv;
25559 a_conv.inner = (void*)(a & (~1));
25560 a_conv.is_owned = false;
25561 LDKExpiryTime b_conv;
25562 b_conv.inner = (void*)(b & (~1));
25563 b_conv.is_owned = false;
25564 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25568 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
25569 LDKMinFinalCltvExpiry this_obj_conv;
25570 this_obj_conv.inner = (void*)(this_obj & (~1));
25571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25572 MinFinalCltvExpiry_free(this_obj_conv);
25575 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
25576 LDKMinFinalCltvExpiry orig_conv;
25577 orig_conv.inner = (void*)(orig & (~1));
25578 orig_conv.is_owned = false;
25579 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25582 uint64_t ret_ref = (uint64_t)ret_var.inner;
25583 if (ret_var.is_owned) {
25589 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
25590 LDKMinFinalCltvExpiry o_conv;
25591 o_conv.inner = (void*)(o & (~1));
25592 o_conv.is_owned = false;
25593 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
25597 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
25598 LDKMinFinalCltvExpiry a_conv;
25599 a_conv.inner = (void*)(a & (~1));
25600 a_conv.is_owned = false;
25601 LDKMinFinalCltvExpiry b_conv;
25602 b_conv.inner = (void*)(b & (~1));
25603 b_conv.is_owned = false;
25604 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25608 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
25609 if ((this_ptr & 1) != 0) return;
25610 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25611 FREE((void*)this_ptr);
25612 Fallback_free(this_ptr_conv);
25615 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
25616 LDKFallback* orig_conv = (LDKFallback*)orig;
25617 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25618 *ret_copy = Fallback_clone(orig_conv);
25619 uint64_t ret_ref = (uint64_t)ret_copy;
25623 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
25625 LDKCVec_u8Z program_ref;
25626 program_ref.datalen = *((uint32_t*)program);
25627 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
25628 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
25629 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25630 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
25631 uint64_t ret_ref = (uint64_t)ret_copy;
25635 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
25636 LDKTwentyBytes a_ref;
25637 CHECK(*((uint32_t*)a) == 20);
25638 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25639 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25640 *ret_copy = Fallback_pub_key_hash(a_ref);
25641 uint64_t ret_ref = (uint64_t)ret_copy;
25645 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
25646 LDKTwentyBytes a_ref;
25647 CHECK(*((uint32_t*)a) == 20);
25648 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
25649 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25650 *ret_copy = Fallback_script_hash(a_ref);
25651 uint64_t ret_ref = (uint64_t)ret_copy;
25655 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
25656 LDKFallback* o_conv = (LDKFallback*)o;
25657 int64_t ret_val = Fallback_hash(o_conv);
25661 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
25662 LDKFallback* a_conv = (LDKFallback*)a;
25663 LDKFallback* b_conv = (LDKFallback*)b;
25664 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25668 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
25669 LDKInvoiceSignature this_obj_conv;
25670 this_obj_conv.inner = (void*)(this_obj & (~1));
25671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25672 InvoiceSignature_free(this_obj_conv);
25675 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
25676 LDKInvoiceSignature orig_conv;
25677 orig_conv.inner = (void*)(orig & (~1));
25678 orig_conv.is_owned = false;
25679 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25682 uint64_t ret_ref = (uint64_t)ret_var.inner;
25683 if (ret_var.is_owned) {
25689 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
25690 LDKInvoiceSignature a_conv;
25691 a_conv.inner = (void*)(a & (~1));
25692 a_conv.is_owned = false;
25693 LDKInvoiceSignature b_conv;
25694 b_conv.inner = (void*)(b & (~1));
25695 b_conv.is_owned = false;
25696 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25700 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
25701 LDKPrivateRoute this_obj_conv;
25702 this_obj_conv.inner = (void*)(this_obj & (~1));
25703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25704 PrivateRoute_free(this_obj_conv);
25707 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
25708 LDKPrivateRoute orig_conv;
25709 orig_conv.inner = (void*)(orig & (~1));
25710 orig_conv.is_owned = false;
25711 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25714 uint64_t ret_ref = (uint64_t)ret_var.inner;
25715 if (ret_var.is_owned) {
25721 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
25722 LDKPrivateRoute o_conv;
25723 o_conv.inner = (void*)(o & (~1));
25724 o_conv.is_owned = false;
25725 int64_t ret_val = PrivateRoute_hash(&o_conv);
25729 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
25730 LDKPrivateRoute a_conv;
25731 a_conv.inner = (void*)(a & (~1));
25732 a_conv.is_owned = false;
25733 LDKPrivateRoute b_conv;
25734 b_conv.inner = (void*)(b & (~1));
25735 b_conv.is_owned = false;
25736 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25740 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
25741 LDKSignedRawInvoice this_arg_conv;
25742 this_arg_conv.inner = (void*)(this_arg & (~1));
25743 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25744 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25745 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25746 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
25747 return (uint64_t)ret_ref;
25750 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
25751 LDKSignedRawInvoice this_arg_conv;
25752 this_arg_conv.inner = (void*)(this_arg & (~1));
25753 this_arg_conv.is_owned = false;
25754 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25757 uint64_t ret_ref = (uint64_t)ret_var.inner;
25758 if (ret_var.is_owned) {
25764 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
25765 LDKSignedRawInvoice this_arg_conv;
25766 this_arg_conv.inner = (void*)(this_arg & (~1));
25767 this_arg_conv.is_owned = false;
25768 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25769 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
25773 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
25774 LDKSignedRawInvoice this_arg_conv;
25775 this_arg_conv.inner = (void*)(this_arg & (~1));
25776 this_arg_conv.is_owned = false;
25777 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25780 uint64_t ret_ref = (uint64_t)ret_var.inner;
25781 if (ret_var.is_owned) {
25787 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
25788 LDKSignedRawInvoice this_arg_conv;
25789 this_arg_conv.inner = (void*)(this_arg & (~1));
25790 this_arg_conv.is_owned = false;
25791 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25792 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25793 return (uint64_t)ret_conv;
25796 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
25797 LDKSignedRawInvoice this_arg_conv;
25798 this_arg_conv.inner = (void*)(this_arg & (~1));
25799 this_arg_conv.is_owned = false;
25800 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25804 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
25805 LDKRawInvoice this_arg_conv;
25806 this_arg_conv.inner = (void*)(this_arg & (~1));
25807 this_arg_conv.is_owned = false;
25808 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25809 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
25813 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
25814 LDKRawInvoice this_arg_conv;
25815 this_arg_conv.inner = (void*)(this_arg & (~1));
25816 this_arg_conv.is_owned = false;
25817 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25820 uint64_t ret_ref = (uint64_t)ret_var.inner;
25821 if (ret_var.is_owned) {
25827 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
25828 LDKRawInvoice this_arg_conv;
25829 this_arg_conv.inner = (void*)(this_arg & (~1));
25830 this_arg_conv.is_owned = false;
25831 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25834 uint64_t ret_ref = (uint64_t)ret_var.inner;
25835 if (ret_var.is_owned) {
25841 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
25842 LDKRawInvoice this_arg_conv;
25843 this_arg_conv.inner = (void*)(this_arg & (~1));
25844 this_arg_conv.is_owned = false;
25845 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25848 uint64_t ret_ref = (uint64_t)ret_var.inner;
25849 if (ret_var.is_owned) {
25855 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
25856 LDKRawInvoice this_arg_conv;
25857 this_arg_conv.inner = (void*)(this_arg & (~1));
25858 this_arg_conv.is_owned = false;
25859 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25862 uint64_t ret_ref = (uint64_t)ret_var.inner;
25863 if (ret_var.is_owned) {
25869 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
25870 LDKRawInvoice this_arg_conv;
25871 this_arg_conv.inner = (void*)(this_arg & (~1));
25872 this_arg_conv.is_owned = false;
25873 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25876 uint64_t ret_ref = (uint64_t)ret_var.inner;
25877 if (ret_var.is_owned) {
25883 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
25884 LDKRawInvoice this_arg_conv;
25885 this_arg_conv.inner = (void*)(this_arg & (~1));
25886 this_arg_conv.is_owned = false;
25887 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25890 uint64_t ret_ref = (uint64_t)ret_var.inner;
25891 if (ret_var.is_owned) {
25897 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
25898 LDKRawInvoice this_arg_conv;
25899 this_arg_conv.inner = (void*)(this_arg & (~1));
25900 this_arg_conv.is_owned = false;
25901 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
25902 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
25906 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
25907 LDKRawInvoice this_arg_conv;
25908 this_arg_conv.inner = (void*)(this_arg & (~1));
25909 this_arg_conv.is_owned = false;
25910 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25913 uint64_t ret_ref = (uint64_t)ret_var.inner;
25914 if (ret_var.is_owned) {
25920 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
25921 LDKRawInvoice this_arg_conv;
25922 this_arg_conv.inner = (void*)(this_arg & (~1));
25923 this_arg_conv.is_owned = false;
25924 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25925 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
25926 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
25927 for (size_t o = 0; o < ret_var.datalen; o++) {
25928 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25929 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25930 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25931 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25932 if (ret_conv_14_var.is_owned) {
25933 ret_conv_14_ref |= 1;
25935 ret_arr_ptr[o] = ret_conv_14_ref;
25937 FREE(ret_var.data);
25941 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
25942 LDKRawInvoice this_arg_conv;
25943 this_arg_conv.inner = (void*)(this_arg & (~1));
25944 this_arg_conv.is_owned = false;
25945 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25946 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25947 uint64_t ret_ref = (uint64_t)ret_copy;
25951 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
25952 LDKRawInvoice this_arg_conv;
25953 this_arg_conv.inner = (void*)(this_arg & (~1));
25954 this_arg_conv.is_owned = false;
25955 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
25959 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
25960 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25961 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25962 return (uint64_t)ret_conv;
25965 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
25966 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25967 *ret_conv = PositiveTimestamp_from_system_time(time);
25968 return (uint64_t)ret_conv;
25971 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
25972 LDKPositiveTimestamp this_arg_conv;
25973 this_arg_conv.inner = (void*)(this_arg & (~1));
25974 this_arg_conv.is_owned = false;
25975 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25979 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
25980 LDKPositiveTimestamp this_arg_conv;
25981 this_arg_conv.inner = (void*)(this_arg & (~1));
25982 this_arg_conv.is_owned = false;
25983 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25987 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
25988 LDKInvoice this_arg_conv;
25989 this_arg_conv.inner = (void*)(this_arg & (~1));
25990 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25991 this_arg_conv = Invoice_clone(&this_arg_conv);
25992 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25995 uint64_t ret_ref = (uint64_t)ret_var.inner;
25996 if (ret_var.is_owned) {
26002 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
26003 LDKInvoice this_arg_conv;
26004 this_arg_conv.inner = (void*)(this_arg & (~1));
26005 this_arg_conv.is_owned = false;
26006 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
26007 *ret_conv = Invoice_check_signature(&this_arg_conv);
26008 return (uint64_t)ret_conv;
26011 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
26012 LDKSignedRawInvoice signed_invoice_conv;
26013 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
26014 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
26015 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
26016 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
26017 *ret_conv = Invoice_from_signed(signed_invoice_conv);
26018 return (uint64_t)ret_conv;
26021 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
26022 LDKInvoice this_arg_conv;
26023 this_arg_conv.inner = (void*)(this_arg & (~1));
26024 this_arg_conv.is_owned = false;
26025 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
26029 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
26030 LDKInvoice this_arg_conv;
26031 this_arg_conv.inner = (void*)(this_arg & (~1));
26032 this_arg_conv.is_owned = false;
26033 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26034 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
26038 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
26039 LDKInvoice this_arg_conv;
26040 this_arg_conv.inner = (void*)(this_arg & (~1));
26041 this_arg_conv.is_owned = false;
26042 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26043 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
26047 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
26048 LDKInvoice this_arg_conv;
26049 this_arg_conv.inner = (void*)(this_arg & (~1));
26050 this_arg_conv.is_owned = false;
26051 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26052 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
26056 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
26057 LDKInvoice this_arg_conv;
26058 this_arg_conv.inner = (void*)(this_arg & (~1));
26059 this_arg_conv.is_owned = false;
26060 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
26061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26063 uint64_t ret_ref = (uint64_t)ret_var.inner;
26064 if (ret_var.is_owned) {
26070 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
26071 LDKInvoice this_arg_conv;
26072 this_arg_conv.inner = (void*)(this_arg & (~1));
26073 this_arg_conv.is_owned = false;
26074 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26075 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
26079 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
26080 LDKInvoice this_arg_conv;
26081 this_arg_conv.inner = (void*)(this_arg & (~1));
26082 this_arg_conv.is_owned = false;
26083 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
26087 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
26088 LDKInvoice this_arg_conv;
26089 this_arg_conv.inner = (void*)(this_arg & (~1));
26090 this_arg_conv.is_owned = false;
26091 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
26095 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
26096 LDKInvoice this_arg_conv;
26097 this_arg_conv.inner = (void*)(this_arg & (~1));
26098 this_arg_conv.is_owned = false;
26099 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
26100 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26101 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26102 for (size_t o = 0; o < ret_var.datalen; o++) {
26103 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26104 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26105 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26106 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26107 if (ret_conv_14_var.is_owned) {
26108 ret_conv_14_ref |= 1;
26110 ret_arr_ptr[o] = ret_conv_14_ref;
26112 FREE(ret_var.data);
26116 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
26117 LDKInvoice this_arg_conv;
26118 this_arg_conv.inner = (void*)(this_arg & (~1));
26119 this_arg_conv.is_owned = false;
26120 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
26121 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26122 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26123 for (size_t l = 0; l < ret_var.datalen; l++) {
26124 LDKRouteHint ret_conv_11_var = ret_var.data[l];
26125 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26126 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26127 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
26128 if (ret_conv_11_var.is_owned) {
26129 ret_conv_11_ref |= 1;
26131 ret_arr_ptr[l] = ret_conv_11_ref;
26133 FREE(ret_var.data);
26137 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
26138 LDKInvoice this_arg_conv;
26139 this_arg_conv.inner = (void*)(this_arg & (~1));
26140 this_arg_conv.is_owned = false;
26141 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
26145 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
26146 LDKInvoice this_arg_conv;
26147 this_arg_conv.inner = (void*)(this_arg & (~1));
26148 this_arg_conv.is_owned = false;
26149 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26150 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
26151 uint64_t ret_ref = (uint64_t)ret_copy;
26155 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
26156 LDKStr description_conv = str_ref_to_owned_c(description);
26157 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
26158 *ret_conv = Description_new(description_conv);
26159 return (uint64_t)ret_conv;
26162 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
26163 LDKDescription this_arg_conv;
26164 this_arg_conv.inner = (void*)(this_arg & (~1));
26165 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26166 this_arg_conv = Description_clone(&this_arg_conv);
26167 LDKStr ret_str = Description_into_inner(this_arg_conv);
26168 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26173 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
26174 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26175 *ret_conv = ExpiryTime_from_seconds(seconds);
26176 return (uint64_t)ret_conv;
26179 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
26180 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26181 *ret_conv = ExpiryTime_from_duration(duration);
26182 return (uint64_t)ret_conv;
26185 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
26186 LDKExpiryTime this_arg_conv;
26187 this_arg_conv.inner = (void*)(this_arg & (~1));
26188 this_arg_conv.is_owned = false;
26189 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
26193 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
26194 LDKExpiryTime this_arg_conv;
26195 this_arg_conv.inner = (void*)(this_arg & (~1));
26196 this_arg_conv.is_owned = false;
26197 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
26201 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
26202 LDKRouteHint hops_conv;
26203 hops_conv.inner = (void*)(hops & (~1));
26204 hops_conv.is_owned = (hops & 1) || (hops == 0);
26205 hops_conv = RouteHint_clone(&hops_conv);
26206 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
26207 *ret_conv = PrivateRoute_new(hops_conv);
26208 return (uint64_t)ret_conv;
26211 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
26212 LDKPrivateRoute this_arg_conv;
26213 this_arg_conv.inner = (void*)(this_arg & (~1));
26214 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26215 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
26216 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
26217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26219 uint64_t ret_ref = (uint64_t)ret_var.inner;
26220 if (ret_var.is_owned) {
26226 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
26227 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
26228 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
26232 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
26233 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
26237 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
26238 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
26242 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
26243 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
26247 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
26248 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
26252 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
26253 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
26254 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
26255 jboolean ret_val = CreationError_eq(a_conv, b_conv);
26259 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
26260 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
26261 LDKStr ret_str = CreationError_to_str(o_conv);
26262 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26267 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
26268 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
26269 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
26273 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
26274 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
26278 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
26279 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
26283 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
26284 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
26288 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
26289 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
26293 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
26294 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
26298 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
26299 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
26303 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
26304 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
26308 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
26309 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
26313 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
26314 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
26318 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
26319 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
26323 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
26324 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
26325 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
26326 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
26330 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
26331 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
26332 LDKStr ret_str = SemanticError_to_str(o_conv);
26333 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26338 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
26339 if ((this_ptr & 1) != 0) return;
26340 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
26341 FREE((void*)this_ptr);
26342 SignOrCreationError_free(this_ptr_conv);
26345 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
26346 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
26347 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26348 *ret_copy = SignOrCreationError_clone(orig_conv);
26349 uint64_t ret_ref = (uint64_t)ret_copy;
26353 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
26354 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26355 *ret_copy = SignOrCreationError_sign_error();
26356 uint64_t ret_ref = (uint64_t)ret_copy;
26360 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
26361 LDKCreationError a_conv = LDKCreationError_from_js(a);
26362 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26363 *ret_copy = SignOrCreationError_creation_error(a_conv);
26364 uint64_t ret_ref = (uint64_t)ret_copy;
26368 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
26369 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
26370 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
26371 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
26375 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
26376 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
26377 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
26378 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26383 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) {
26384 LDKChannelManager channelmanager_conv;
26385 channelmanager_conv.inner = (void*)(channelmanager & (~1));
26386 channelmanager_conv.is_owned = false;
26387 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26388 LDKCurrency network_conv = LDKCurrency_from_js(network);
26389 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
26390 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
26391 LDKStr description_conv = str_ref_to_owned_c(description);
26392 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26393 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
26394 return (uint64_t)ret_conv;
26397 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
26398 LDKStr s_conv = str_ref_to_owned_c(s);
26399 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
26400 *ret_conv = SiPrefix_from_str(s_conv);
26401 return (uint64_t)ret_conv;
26404 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
26405 LDKStr s_conv = str_ref_to_owned_c(s);
26406 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
26407 *ret_conv = Invoice_from_str(s_conv);
26408 return (uint64_t)ret_conv;
26411 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
26412 LDKStr s_conv = str_ref_to_owned_c(s);
26413 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
26414 *ret_conv = SignedRawInvoice_from_str(s_conv);
26415 return (uint64_t)ret_conv;
26418 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
26420 o_conv.inner = (void*)(o & (~1));
26421 o_conv.is_owned = false;
26422 LDKStr ret_str = Invoice_to_str(&o_conv);
26423 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26428 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
26429 LDKSignedRawInvoice o_conv;
26430 o_conv.inner = (void*)(o & (~1));
26431 o_conv.is_owned = false;
26432 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
26433 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26438 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
26439 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
26440 LDKStr ret_str = Currency_to_str(o_conv);
26441 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26446 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
26447 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
26448 LDKStr ret_str = SiPrefix_to_str(o_conv);
26449 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);