5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((unsigned long)(p) > 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 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
876 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t tuple) {
877 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
878 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
882 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
885 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t tuple) {
886 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
887 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
888 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
889 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
890 Transaction_free(ret_var);
894 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
895 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
896 ret->datalen = *((uint32_t*)elems);
897 if (ret->datalen == 0) {
900 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
901 uint32_t *java_elems = (uint32_t*)(elems + 4);
902 for (size_t i = 0; i < ret->datalen; i++) {
903 uint32_t arr_elem = java_elems[i];
904 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
905 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
906 ret->data[i] = arr_elem_conv;
909 return (uint64_t)ret;
911 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
912 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
913 for (size_t i = 0; i < ret.datalen; i++) {
914 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
918 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
919 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
920 for (size_t i = 0; i < ret.datalen; i++) {
921 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
925 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
926 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
928 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
929 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
930 CHECK(val->result_ok);
931 return *val->contents.result;
933 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
934 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
935 CHECK(!val->result_ok);
936 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
939 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
940 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
942 case LDKMonitorEvent_HTLCEvent: {
943 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
944 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
945 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
946 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
947 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
949 case LDKMonitorEvent_CommitmentTxConfirmed: {
950 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
951 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
952 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
953 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
954 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
959 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
960 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
961 ret->datalen = *((uint32_t*)elems);
962 if (ret->datalen == 0) {
965 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
966 uint32_t *java_elems = (uint32_t*)(elems + 4);
967 for (size_t i = 0; i < ret->datalen; i++) {
968 uint32_t arr_elem = java_elems[i];
969 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
970 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
971 ret->data[i] = arr_elem_conv;
974 return (uint64_t)ret;
976 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
977 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
978 for (size_t i = 0; i < ret.datalen; i++) {
979 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
983 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
984 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
986 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
987 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
988 *some_conv = obj->some;
989 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
990 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
992 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
993 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
998 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
999 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1001 case LDKNetworkUpdate_ChannelUpdateMessage: {
1002 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1003 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1004 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1005 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1006 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1008 case LDKNetworkUpdate_ChannelClosed: {
1009 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1011 case LDKNetworkUpdate_NodeFailure: {
1012 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1013 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
1014 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1019 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1020 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1022 case LDKCOption_NetworkUpdateZ_Some: {
1023 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1024 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1026 case LDKCOption_NetworkUpdateZ_None: {
1027 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1032 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1033 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1035 case LDKSpendableOutputDescriptor_StaticOutput: {
1036 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1037 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1038 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1039 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1040 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1041 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1043 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1044 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1045 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1046 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1047 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1048 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1050 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1051 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1052 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1055 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1060 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1061 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1062 ret->datalen = *((uint32_t*)elems);
1063 if (ret->datalen == 0) {
1066 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1067 uint32_t *java_elems = (uint32_t*)(elems + 4);
1068 for (size_t i = 0; i < ret->datalen; i++) {
1069 uint32_t arr_elem = java_elems[i];
1070 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1071 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1072 ret->data[i] = arr_elem_conv;
1075 return (uint64_t)ret;
1077 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1078 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1079 for (size_t i = 0; i < ret.datalen; i++) {
1080 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1084 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
1085 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1087 case LDKErrorAction_DisconnectPeer: {
1088 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1089 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1090 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1091 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1092 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
1094 case LDKErrorAction_IgnoreError: {
1095 return 0 /* LDKErrorAction - IgnoreError */;
1097 case LDKErrorAction_IgnoreAndLog: {
1098 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1099 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
1101 case LDKErrorAction_SendErrorMessage: {
1102 LDKErrorMessage msg_var = obj->send_error_message.msg;
1103 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1104 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1105 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1106 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
1111 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
1112 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1114 case LDKMessageSendEvent_SendAcceptChannel: {
1115 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1116 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
1117 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1118 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1119 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1120 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1121 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
1123 case LDKMessageSendEvent_SendOpenChannel: {
1124 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1125 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
1126 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1127 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1128 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1129 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1130 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
1132 case LDKMessageSendEvent_SendFundingCreated: {
1133 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1134 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
1135 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1136 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1137 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1138 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1139 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
1141 case LDKMessageSendEvent_SendFundingSigned: {
1142 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1143 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
1144 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1145 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1146 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1148 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
1150 case LDKMessageSendEvent_SendFundingLocked: {
1151 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1152 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
1153 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1154 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1155 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1156 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1157 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
1159 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1160 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1161 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
1162 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1163 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1164 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1165 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1166 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
1168 case LDKMessageSendEvent_UpdateHTLCs: {
1169 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1170 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
1171 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1172 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1173 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1174 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1175 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
1177 case LDKMessageSendEvent_SendRevokeAndACK: {
1178 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1179 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
1180 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1181 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1182 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1183 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1184 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
1186 case LDKMessageSendEvent_SendClosingSigned: {
1187 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1188 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
1189 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1190 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1191 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1192 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1193 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
1195 case LDKMessageSendEvent_SendShutdown: {
1196 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1197 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
1198 LDKShutdown msg_var = obj->send_shutdown.msg;
1199 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1200 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1201 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1202 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
1204 case LDKMessageSendEvent_SendChannelReestablish: {
1205 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1206 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
1207 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1208 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1210 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1211 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
1213 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1214 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1215 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1216 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1218 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1219 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1220 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1221 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1222 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
1224 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1225 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1226 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1227 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1228 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1229 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
1231 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1232 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1233 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1236 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
1238 case LDKMessageSendEvent_SendChannelUpdate: {
1239 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1240 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_update.node_id.compressed_form, 33);
1241 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1242 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1243 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1244 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1245 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
1247 case LDKMessageSendEvent_HandleError: {
1248 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1249 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
1250 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1251 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
1253 case LDKMessageSendEvent_SendChannelRangeQuery: {
1254 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1255 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
1256 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1257 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1258 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1259 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1260 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
1262 case LDKMessageSendEvent_SendShortIdsQuery: {
1263 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1264 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
1265 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1266 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1268 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1269 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
1271 case LDKMessageSendEvent_SendReplyChannelRange: {
1272 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1273 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
1274 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1275 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1276 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1277 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1278 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
1283 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
1284 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1285 ret->datalen = *((uint32_t*)elems);
1286 if (ret->datalen == 0) {
1289 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1290 uint32_t *java_elems = (uint32_t*)(elems + 4);
1291 for (size_t i = 0; i < ret->datalen; i++) {
1292 uint32_t arr_elem = java_elems[i];
1293 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1294 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1295 ret->data[i] = arr_elem_conv;
1298 return (uint64_t)ret;
1300 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1301 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1302 for (size_t i = 0; i < ret.datalen; i++) {
1303 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1307 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1308 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1310 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1311 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1312 CHECK(val->result_ok);
1313 LDKInitFeatures res_var = (*val->contents.result);
1314 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1315 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1316 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1319 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1320 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1321 CHECK(!val->result_ok);
1322 LDKDecodeError err_var = (*val->contents.err);
1323 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1328 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1329 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1331 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1332 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1333 CHECK(val->result_ok);
1334 LDKNodeFeatures res_var = (*val->contents.result);
1335 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1336 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1337 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1340 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1341 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1342 CHECK(!val->result_ok);
1343 LDKDecodeError err_var = (*val->contents.err);
1344 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1349 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1350 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1352 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1353 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1354 CHECK(val->result_ok);
1355 LDKChannelFeatures res_var = (*val->contents.result);
1356 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1361 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1362 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1363 CHECK(!val->result_ok);
1364 LDKDecodeError err_var = (*val->contents.err);
1365 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1370 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
1371 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1373 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
1374 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1375 CHECK(val->result_ok);
1376 LDKInvoiceFeatures res_var = (*val->contents.result);
1377 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1382 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
1383 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1384 CHECK(!val->result_ok);
1385 LDKDecodeError err_var = (*val->contents.err);
1386 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1391 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1392 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1395 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1396 CHECK(val->result_ok);
1397 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1398 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1399 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1403 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1404 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1405 CHECK(!val->result_ok);
1406 LDKDecodeError err_var = (*val->contents.err);
1407 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1412 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1413 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1415 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1416 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1417 CHECK(val->result_ok);
1418 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1419 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1424 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1425 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1426 CHECK(!val->result_ok);
1427 LDKDecodeError err_var = (*val->contents.err);
1428 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1429 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1430 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1433 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
1434 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1436 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
1437 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1438 CHECK(val->result_ok);
1439 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1442 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
1443 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1444 CHECK(!val->result_ok);
1445 LDKDecodeError err_var = (*val->contents.err);
1446 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1447 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1448 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1451 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
1452 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
1454 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
1455 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1456 CHECK(val->result_ok);
1457 return *val->contents.result;
1459 void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
1460 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
1461 CHECK(!val->result_ok);
1462 return *val->contents.err;
1464 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1465 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1467 CHECK(*((uint32_t*)a) == 64);
1468 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1470 LDKCVec_SignatureZ b_constr;
1471 b_constr.datalen = *((uint32_t*)b);
1472 if (b_constr.datalen > 0)
1473 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1475 b_constr.data = NULL;
1476 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1477 for (size_t m = 0; m < b_constr.datalen; m++) {
1478 int8_tArray b_conv_12 = b_vals[m];
1479 LDKSignature b_conv_12_ref;
1480 CHECK(*((uint32_t*)b_conv_12) == 64);
1481 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1482 b_constr.data[m] = b_conv_12_ref;
1485 return (uint64_t)ret;
1487 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1490 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t tuple) {
1491 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1492 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1493 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form, 64);
1497 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
1500 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t tuple) {
1501 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
1502 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
1503 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1504 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1505 for (size_t m = 0; m < ret_var.datalen; m++) {
1506 int8_tArray ret_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1507 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compact_form, 64);
1508 ret_arr_ptr[m] = ret_conv_12_arr;
1514 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1515 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1518 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1519 CHECK(val->result_ok);
1520 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1521 *res_conv = (*val->contents.result);
1522 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
1523 return ((uint64_t)res_conv);
1525 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1526 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1527 CHECK(!val->result_ok);
1528 return *val->contents.err;
1530 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1531 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1533 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1534 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1535 CHECK(val->result_ok);
1536 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1537 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1540 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1541 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1542 CHECK(!val->result_ok);
1543 return *val->contents.err;
1545 typedef struct LDKBaseSign_JCalls {
1546 atomic_size_t refcnt;
1547 uint32_t get_per_commitment_point_meth;
1548 uint32_t release_commitment_secret_meth;
1549 uint32_t validate_holder_commitment_meth;
1550 uint32_t channel_keys_id_meth;
1551 uint32_t sign_counterparty_commitment_meth;
1552 uint32_t validate_counterparty_revocation_meth;
1553 uint32_t sign_holder_commitment_and_htlcs_meth;
1554 uint32_t sign_justice_revoked_output_meth;
1555 uint32_t sign_justice_revoked_htlc_meth;
1556 uint32_t sign_counterparty_htlc_transaction_meth;
1557 uint32_t sign_closing_transaction_meth;
1558 uint32_t sign_channel_announcement_meth;
1559 uint32_t ready_channel_meth;
1560 } LDKBaseSign_JCalls;
1561 static void LDKBaseSign_JCalls_free(void* this_arg) {
1562 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1563 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1564 js_free(j_calls->get_per_commitment_point_meth);
1565 js_free(j_calls->release_commitment_secret_meth);
1566 js_free(j_calls->validate_holder_commitment_meth);
1567 js_free(j_calls->channel_keys_id_meth);
1568 js_free(j_calls->sign_counterparty_commitment_meth);
1569 js_free(j_calls->validate_counterparty_revocation_meth);
1570 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1571 js_free(j_calls->sign_justice_revoked_output_meth);
1572 js_free(j_calls->sign_justice_revoked_htlc_meth);
1573 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1574 js_free(j_calls->sign_closing_transaction_meth);
1575 js_free(j_calls->sign_channel_announcement_meth);
1576 js_free(j_calls->ready_channel_meth);
1580 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1581 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1582 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1583 LDKPublicKey ret_ref;
1584 CHECK(*((uint32_t*)ret) == 33);
1585 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1588 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1589 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1590 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1591 LDKThirtyTwoBytes ret_ref;
1592 CHECK(*((uint32_t*)ret) == 32);
1593 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1596 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1597 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1598 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1599 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1600 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1601 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1602 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
1603 if (holder_tx_var.is_owned) {
1606 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
1607 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1608 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1611 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1612 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1613 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1614 LDKThirtyTwoBytes ret_ref;
1615 CHECK(*((uint32_t*)ret) == 32);
1616 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1619 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1620 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1621 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1622 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1623 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1624 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1625 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1626 if (commitment_tx_var.is_owned) {
1627 commitment_tx_ref |= 1;
1629 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1630 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1631 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1634 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1635 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1636 int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1637 memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
1638 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
1639 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
1640 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
1643 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1644 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1645 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1646 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1647 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1648 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1649 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1650 if (commitment_tx_var.is_owned) {
1651 commitment_tx_ref |= 1;
1653 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1654 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1655 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
1658 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]) {
1659 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1660 LDKTransaction justice_tx_var = justice_tx;
1661 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1662 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1663 Transaction_free(justice_tx_var);
1664 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1665 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1666 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
1667 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1668 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1671 LDKCResult_SignatureNoneZ sign_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) {
1672 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1673 LDKTransaction justice_tx_var = justice_tx;
1674 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1675 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1676 Transaction_free(justice_tx_var);
1677 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1678 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1679 LDKHTLCOutputInCommitment htlc_var = *htlc;
1680 htlc_var = HTLCOutputInCommitment_clone(htlc);
1681 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1682 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1683 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1684 if (htlc_var.is_owned) {
1687 uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1688 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1689 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1692 LDKCResult_SignatureNoneZ sign_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) {
1693 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1694 LDKTransaction htlc_tx_var = htlc_tx;
1695 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1696 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1697 Transaction_free(htlc_tx_var);
1698 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1699 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1700 LDKHTLCOutputInCommitment htlc_var = *htlc;
1701 htlc_var = HTLCOutputInCommitment_clone(htlc);
1702 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1703 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1704 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
1705 if (htlc_var.is_owned) {
1708 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);
1709 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1710 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1713 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1714 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1715 LDKClosingTransaction closing_tx_var = *closing_tx;
1716 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
1717 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1718 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1719 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
1720 if (closing_tx_var.is_owned) {
1721 closing_tx_ref |= 1;
1723 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
1724 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1725 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1728 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1729 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1730 LDKUnsignedChannelAnnouncement msg_var = *msg;
1731 msg_var = UnsignedChannelAnnouncement_clone(msg);
1732 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1733 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1734 uint64_t msg_ref = (uint64_t)msg_var.inner;
1735 if (msg_var.is_owned) {
1738 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1739 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1740 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
1743 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1744 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1745 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1746 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1747 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1748 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1749 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1750 if (channel_parameters_var.is_owned) {
1751 channel_parameters_ref |= 1;
1753 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1755 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1756 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1757 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1759 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1760 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1761 atomic_init(&calls->refcnt, 1);
1762 //TODO: Assign calls->o from o
1764 LDKChannelPublicKeys pubkeys_conv;
1765 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1766 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1767 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1770 .this_arg = (void*) calls,
1771 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1772 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1773 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1774 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1775 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1776 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1777 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1778 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1779 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1780 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1781 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1782 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1783 .ready_channel = ready_channel_LDKBaseSign_jcall,
1784 .free = LDKBaseSign_JCalls_free,
1785 .pubkeys = pubkeys_conv,
1786 .set_pubkeys = NULL,
1790 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1791 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1792 *res_ptr = LDKBaseSign_init(o, pubkeys);
1793 return (long)res_ptr;
1795 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1796 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1797 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1798 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1802 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1803 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1804 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1805 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1809 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1810 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1811 LDKHolderCommitmentTransaction holder_tx_conv;
1812 holder_tx_conv.inner = (void*)(holder_tx & (~1));
1813 holder_tx_conv.is_owned = false;
1814 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1815 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
1816 return (uint64_t)ret_conv;
1819 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
1820 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1821 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1822 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1826 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1827 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1828 LDKCommitmentTransaction commitment_tx_conv;
1829 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1830 commitment_tx_conv.is_owned = false;
1831 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1832 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1833 return (uint64_t)ret_conv;
1836 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
1837 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1838 unsigned char secret_arr[32];
1839 CHECK(*((uint32_t*)secret) == 32);
1840 memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
1841 unsigned char (*secret_ref)[32] = &secret_arr;
1842 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1843 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1844 return (uint64_t)ret_conv;
1847 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1848 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1849 LDKHolderCommitmentTransaction commitment_tx_conv;
1850 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1851 commitment_tx_conv.is_owned = false;
1852 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1853 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1854 return (uint64_t)ret_conv;
1857 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) {
1858 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1859 LDKTransaction justice_tx_ref;
1860 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1861 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1862 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1863 justice_tx_ref.data_is_owned = true;
1864 unsigned char per_commitment_key_arr[32];
1865 CHECK(*((uint32_t*)per_commitment_key) == 32);
1866 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1867 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1868 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1869 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1870 return (uint64_t)ret_conv;
1873 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) {
1874 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1875 LDKTransaction justice_tx_ref;
1876 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1877 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1878 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1879 justice_tx_ref.data_is_owned = true;
1880 unsigned char per_commitment_key_arr[32];
1881 CHECK(*((uint32_t*)per_commitment_key) == 32);
1882 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1883 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1884 LDKHTLCOutputInCommitment htlc_conv;
1885 htlc_conv.inner = (void*)(htlc & (~1));
1886 htlc_conv.is_owned = false;
1887 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1888 *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);
1889 return (uint64_t)ret_conv;
1892 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) {
1893 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1894 LDKTransaction htlc_tx_ref;
1895 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1896 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1897 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1898 htlc_tx_ref.data_is_owned = true;
1899 LDKPublicKey per_commitment_point_ref;
1900 CHECK(*((uint32_t*)per_commitment_point) == 33);
1901 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1902 LDKHTLCOutputInCommitment htlc_conv;
1903 htlc_conv.inner = (void*)(htlc & (~1));
1904 htlc_conv.is_owned = false;
1905 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1906 *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);
1907 return (uint64_t)ret_conv;
1910 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
1911 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1912 LDKClosingTransaction closing_tx_conv;
1913 closing_tx_conv.inner = (void*)(closing_tx & (~1));
1914 closing_tx_conv.is_owned = false;
1915 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1916 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1917 return (uint64_t)ret_conv;
1920 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1921 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1922 LDKUnsignedChannelAnnouncement msg_conv;
1923 msg_conv.inner = (void*)(msg & (~1));
1924 msg_conv.is_owned = false;
1925 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1926 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1927 return (uint64_t)ret_conv;
1930 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
1931 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1932 LDKChannelTransactionParameters channel_parameters_conv;
1933 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1934 channel_parameters_conv.is_owned = false;
1935 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1938 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
1939 if (this_arg->set_pubkeys != NULL)
1940 this_arg->set_pubkeys(this_arg);
1941 return this_arg->pubkeys;
1943 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
1944 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
1945 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
1946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1948 uint64_t ret_ref = (uint64_t)ret_var.inner;
1949 if (ret_var.is_owned) {
1955 typedef struct LDKSign_JCalls {
1956 atomic_size_t refcnt;
1957 LDKBaseSign_JCalls* BaseSign;
1958 uint32_t write_meth;
1960 static void LDKSign_JCalls_free(void* this_arg) {
1961 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1962 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1963 js_free(j_calls->write_meth);
1967 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1968 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1969 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1970 LDKCVec_u8Z ret_ref;
1971 ret_ref.datalen = *((uint32_t*)ret);
1972 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1973 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1976 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
1977 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
1978 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1979 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
1981 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
1982 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1983 atomic_init(&calls->refcnt, 1);
1984 //TODO: Assign calls->o from o
1986 LDKChannelPublicKeys pubkeys_conv;
1987 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1988 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1989 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1992 .this_arg = (void*) calls,
1993 .write = write_LDKSign_jcall,
1994 .cloned = LDKSign_JCalls_cloned,
1995 .free = LDKSign_JCalls_free,
1996 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
1998 calls->BaseSign = ret.BaseSign.this_arg;
2001 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2002 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2003 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2004 return (long)res_ptr;
2006 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2007 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2008 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2009 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2010 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2011 CVec_u8Z_free(ret_var);
2015 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2016 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2019 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2020 CHECK(val->result_ok);
2021 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2022 *res_ret = Sign_clone(&(*val->contents.result));
2023 return (uint64_t)res_ret;
2025 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2026 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2027 CHECK(!val->result_ok);
2028 LDKDecodeError err_var = (*val->contents.err);
2029 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2030 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2031 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2034 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_result_ok(uint32_t arg) {
2035 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2037 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_ok(uint32_t arg) {
2038 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2039 CHECK(val->result_ok);
2040 int8_tArray es_arr = init_arr(68, sizeof(uint8_t), "Native int8_tArray Bytes");
2041 memcpy((uint8_t*)(es_arr + 4), (*val->contents.result).serialized_form, 68);
2044 void __attribute__((visibility("default"))) TS_LDKCResult_RecoverableSignatureNoneZ_get_err(uint32_t arg) {
2045 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2046 CHECK(!val->result_ok);
2047 return *val->contents.err;
2049 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2050 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2051 for (size_t i = 0; i < ret.datalen; i++) {
2052 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2056 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2057 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2059 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2060 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2061 CHECK(val->result_ok);
2062 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2063 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2064 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2065 for (size_t m = 0; m < res_var.datalen; m++) {
2066 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2067 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2068 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2069 res_arr_ptr[m] = res_conv_12_arr;
2073 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2074 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2075 CHECK(!val->result_ok);
2076 return *val->contents.err;
2078 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2079 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2081 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2082 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2083 CHECK(val->result_ok);
2084 LDKInMemorySigner res_var = (*val->contents.result);
2085 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2086 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2087 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2091 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2092 CHECK(!val->result_ok);
2093 LDKDecodeError err_var = (*val->contents.err);
2094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2099 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2100 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2101 ret->datalen = *((uint32_t*)elems);
2102 if (ret->datalen == 0) {
2105 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2106 uint32_t *java_elems = (uint32_t*)(elems + 4);
2107 for (size_t i = 0; i < ret->datalen; i++) {
2108 uint32_t arr_elem = java_elems[i];
2109 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2110 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2111 ret->data[i] = arr_elem_conv;
2114 return (uint64_t)ret;
2116 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2117 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2118 for (size_t i = 0; i < ret.datalen; i++) {
2119 ret.data[i] = TxOut_clone(&orig->data[i]);
2123 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2124 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2126 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2127 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2128 CHECK(val->result_ok);
2129 LDKTransaction res_var = (*val->contents.result);
2130 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2131 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2134 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2135 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2136 CHECK(!val->result_ok);
2137 return *val->contents.err;
2139 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2140 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2141 LDKThirtyTwoBytes a_ref;
2142 CHECK(*((uint32_t*)a) == 32);
2143 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2145 LDKChannelMonitor b_conv;
2146 b_conv.inner = (void*)(b & (~1));
2147 b_conv.is_owned = (b & 1) || (b == 0);
2148 b_conv = ChannelMonitor_clone(&b_conv);
2150 return (uint64_t)ret;
2152 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2153 return ThirtyTwoBytes_clone(&tuple->a);
2155 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t tuple) {
2156 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2157 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2158 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data, 32);
2162 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
2163 return ChannelMonitor_clone(&tuple->b);
2165 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t tuple) {
2166 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
2167 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
2168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2170 uint64_t ret_ref = (uint64_t)ret_var.inner;
2171 if (ret_var.is_owned) {
2177 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_new(uint32_tArray elems) {
2178 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2179 ret->datalen = *((uint32_t*)elems);
2180 if (ret->datalen == 0) {
2183 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2184 uint32_t *java_elems = (uint32_t*)(elems + 4);
2185 for (size_t i = 0; i < ret->datalen; i++) {
2186 uint32_t arr_elem = java_elems[i];
2187 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2188 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
2189 ret->data[i] = arr_elem_conv;
2192 return (uint64_t)ret;
2194 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
2195 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
2196 for (size_t i = 0; i < ret.datalen; i++) {
2197 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
2201 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(uint32_t arg) {
2202 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2204 uint32_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(uint32_t arg) {
2205 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2206 CHECK(val->result_ok);
2207 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2208 uint32_tArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2209 uint32_t *res_arr_ptr = (uint32_t*)(res_arr + 4);
2210 for (size_t j = 0; j < res_var.datalen; j++) {
2211 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2212 *res_conv_35_conv = res_var.data[j];
2213 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
2214 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
2218 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(uint32_t arg) {
2219 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2220 CHECK(!val->result_ok);
2221 uint32_t err_conv = LDKIOError_to_js((*val->contents.err));
2224 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_result_ok(uint32_t arg) {
2225 return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok;
2227 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_ok(uint32_t arg) {
2228 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2229 CHECK(val->result_ok);
2230 LDKPaymentId res_var = (*val->contents.result);
2231 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2232 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2233 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2236 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_err(uint32_t arg) {
2237 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
2238 CHECK(!val->result_ok);
2239 LDKDecodeError err_var = (*val->contents.err);
2240 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2241 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2242 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2245 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
2246 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
2248 case LDKCOption_u16Z_Some: {
2249 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
2251 case LDKCOption_u16Z_None: {
2252 return 0 /* LDKCOption_u16Z - None */;
2257 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2258 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2260 case LDKAPIError_APIMisuseError: {
2261 LDKStr err_str = obj->api_misuse_error.err;
2262 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2263 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
2265 case LDKAPIError_FeeRateTooHigh: {
2266 LDKStr err_str = obj->fee_rate_too_high.err;
2267 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2268 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
2270 case LDKAPIError_RouteError: {
2271 LDKStr err_str = obj->route_error.err;
2272 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2273 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2275 case LDKAPIError_ChannelUnavailable: {
2276 LDKStr err_str = obj->channel_unavailable.err;
2277 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2278 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
2280 case LDKAPIError_MonitorUpdateFailed: {
2281 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2283 case LDKAPIError_IncompatibleShutdownScript: {
2284 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2285 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2286 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2287 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
2288 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
2293 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2294 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2296 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2297 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2298 CHECK(val->result_ok);
2299 return *val->contents.result;
2301 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2302 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2303 CHECK(!val->result_ok);
2304 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2307 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2308 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2309 ret->datalen = *((uint32_t*)elems);
2310 if (ret->datalen == 0) {
2313 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2314 uint32_t *java_elems = (uint32_t*)(elems + 4);
2315 for (size_t i = 0; i < ret->datalen; i++) {
2316 uint32_t arr_elem = java_elems[i];
2317 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2318 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2319 ret->data[i] = arr_elem_conv;
2322 return (uint64_t)ret;
2324 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2325 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2326 for (size_t i = 0; i < ret.datalen; i++) {
2327 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2331 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2332 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2333 ret->datalen = *((uint32_t*)elems);
2334 if (ret->datalen == 0) {
2337 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2338 uint32_t *java_elems = (uint32_t*)(elems + 4);
2339 for (size_t i = 0; i < ret->datalen; i++) {
2340 uint32_t arr_elem = java_elems[i];
2341 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2342 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
2343 ret->data[i] = arr_elem_conv;
2346 return (uint64_t)ret;
2348 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2349 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2350 for (size_t i = 0; i < ret.datalen; i++) {
2351 ret.data[i] = APIError_clone(&orig->data[i]);
2355 jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) {
2356 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
2358 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) {
2359 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2360 CHECK(val->result_ok);
2361 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2362 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2365 uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) {
2366 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
2367 CHECK(!val->result_ok);
2368 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2371 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2372 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2374 case LDKPaymentSendFailure_ParameterError: {
2375 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
2376 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2378 case LDKPaymentSendFailure_PathParameterError: {
2379 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2380 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2381 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2382 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2383 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2384 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2385 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2386 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
2388 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2390 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2391 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2392 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2393 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2394 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2395 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
2396 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2398 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2400 case LDKPaymentSendFailure_PartialFailure: {
2401 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2402 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2403 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2404 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2405 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2406 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2407 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2408 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
2410 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2415 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) {
2416 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
2418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) {
2419 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2420 CHECK(val->result_ok);
2421 LDKPaymentId res_var = (*val->contents.result);
2422 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2423 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2424 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2427 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) {
2428 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
2429 CHECK(!val->result_ok);
2430 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2433 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2434 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2436 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2437 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2438 CHECK(val->result_ok);
2439 return *val->contents.result;
2441 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2442 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2443 CHECK(!val->result_ok);
2444 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2447 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) {
2448 LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2449 LDKThirtyTwoBytes a_ref;
2450 CHECK(*((uint32_t*)a) == 32);
2451 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2453 LDKPaymentId b_conv;
2454 b_conv.inner = (void*)(b & (~1));
2455 b_conv.is_owned = (b & 1) || (b == 0);
2456 b_conv = PaymentId_clone(&b_conv);
2458 return (uint64_t)ret;
2460 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2461 return ThirtyTwoBytes_clone(&tuple->a);
2463 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) {
2464 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2465 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2466 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32);
2470 static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
2471 return PaymentId_clone(&tuple->b);
2473 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) {
2474 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
2475 LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv);
2476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2478 uint64_t ret_ref = (uint64_t)ret_var.inner;
2479 if (ret_var.is_owned) {
2485 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) {
2486 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
2488 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) {
2489 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2490 CHECK(val->result_ok);
2491 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
2492 *res_conv = (*val->contents.result);
2493 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
2494 return ((uint64_t)res_conv);
2496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) {
2497 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
2498 CHECK(!val->result_ok);
2499 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2502 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
2503 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
2505 case LDKNetAddress_IPv4: {
2506 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
2507 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
2508 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
2510 case LDKNetAddress_IPv6: {
2511 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
2512 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
2513 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
2515 case LDKNetAddress_OnionV2: {
2516 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
2517 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
2518 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
2520 case LDKNetAddress_OnionV3: {
2521 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2522 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
2523 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
2528 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
2529 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2530 ret->datalen = *((uint32_t*)elems);
2531 if (ret->datalen == 0) {
2534 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2535 uint32_t *java_elems = (uint32_t*)(elems + 4);
2536 for (size_t i = 0; i < ret->datalen; i++) {
2537 uint32_t arr_elem = java_elems[i];
2538 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2539 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
2540 ret->data[i] = arr_elem_conv;
2543 return (uint64_t)ret;
2545 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2546 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2547 for (size_t i = 0; i < ret.datalen; i++) {
2548 ret.data[i] = NetAddress_clone(&orig->data[i]);
2552 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
2553 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
2554 LDKThirtyTwoBytes a_ref;
2555 CHECK(*((uint32_t*)a) == 32);
2556 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2558 LDKThirtyTwoBytes b_ref;
2559 CHECK(*((uint32_t*)b) == 32);
2560 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
2562 return (uint64_t)ret;
2564 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2565 return ThirtyTwoBytes_clone(&tuple->a);
2567 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t tuple) {
2568 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2569 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2570 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data, 32);
2574 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
2575 return ThirtyTwoBytes_clone(&tuple->b);
2577 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t tuple) {
2578 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
2579 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2580 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data, 32);
2584 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_result_ok(uint32_t arg) {
2585 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
2587 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) {
2588 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2589 CHECK(val->result_ok);
2590 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2591 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
2594 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_err(uint32_t arg) {
2595 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
2596 CHECK(!val->result_ok);
2597 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2600 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2601 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2602 ret->datalen = *((uint32_t*)elems);
2603 if (ret->datalen == 0) {
2606 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2607 uint32_t *java_elems = (uint32_t*)(elems + 4);
2608 for (size_t i = 0; i < ret->datalen; i++) {
2609 uint32_t arr_elem = java_elems[i];
2610 LDKChannelMonitor arr_elem_conv;
2611 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2612 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2613 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2614 ret->data[i] = arr_elem_conv;
2617 return (uint64_t)ret;
2619 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2620 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2621 for (size_t i = 0; i < ret.datalen; i++) {
2622 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2626 typedef struct LDKWatch_JCalls {
2627 atomic_size_t refcnt;
2628 uint32_t watch_channel_meth;
2629 uint32_t update_channel_meth;
2630 uint32_t release_pending_monitor_events_meth;
2632 static void LDKWatch_JCalls_free(void* this_arg) {
2633 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2634 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2635 js_free(j_calls->watch_channel_meth);
2636 js_free(j_calls->update_channel_meth);
2637 js_free(j_calls->release_pending_monitor_events_meth);
2641 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2642 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2643 LDKOutPoint funding_txo_var = funding_txo;
2644 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2645 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2646 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2647 if (funding_txo_var.is_owned) {
2648 funding_txo_ref |= 1;
2650 LDKChannelMonitor monitor_var = monitor;
2651 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2652 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2653 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
2654 if (monitor_var.is_owned) {
2657 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2658 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2659 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2662 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2663 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2664 LDKOutPoint funding_txo_var = funding_txo;
2665 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2666 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2667 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
2668 if (funding_txo_var.is_owned) {
2669 funding_txo_ref |= 1;
2671 LDKChannelMonitorUpdate update_var = update;
2672 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2673 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2674 uint64_t update_ref = (uint64_t)update_var.inner;
2675 if (update_var.is_owned) {
2678 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2679 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2680 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
2683 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2684 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2685 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2686 LDKCVec_MonitorEventZ ret_constr;
2687 ret_constr.datalen = *((uint32_t*)ret);
2688 if (ret_constr.datalen > 0)
2689 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2691 ret_constr.data = NULL;
2692 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2693 for (size_t o = 0; o < ret_constr.datalen; o++) {
2694 uint32_t ret_conv_14 = ret_vals[o];
2695 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2696 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
2697 ret_constr.data[o] = ret_conv_14_conv;
2701 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
2702 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
2703 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2705 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2706 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2707 atomic_init(&calls->refcnt, 1);
2708 //TODO: Assign calls->o from o
2711 .this_arg = (void*) calls,
2712 .watch_channel = watch_channel_LDKWatch_jcall,
2713 .update_channel = update_channel_LDKWatch_jcall,
2714 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2715 .free = LDKWatch_JCalls_free,
2719 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2720 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2721 *res_ptr = LDKWatch_init(o);
2722 return (long)res_ptr;
2724 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2725 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2726 LDKOutPoint funding_txo_conv;
2727 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2728 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2729 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2730 LDKChannelMonitor monitor_conv;
2731 monitor_conv.inner = (void*)(monitor & (~1));
2732 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2733 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2734 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2735 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2736 return (uint64_t)ret_conv;
2739 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2740 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2741 LDKOutPoint funding_txo_conv;
2742 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2743 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2744 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2745 LDKChannelMonitorUpdate update_conv;
2746 update_conv.inner = (void*)(update & (~1));
2747 update_conv.is_owned = (update & 1) || (update == 0);
2748 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2749 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2750 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2751 return (uint64_t)ret_conv;
2754 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2755 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2756 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2757 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2758 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2759 for (size_t o = 0; o < ret_var.datalen; o++) {
2760 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2761 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2762 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
2763 ret_arr_ptr[o] = ret_conv_14_ref;
2769 typedef struct LDKBroadcasterInterface_JCalls {
2770 atomic_size_t refcnt;
2771 uint32_t broadcast_transaction_meth;
2772 } LDKBroadcasterInterface_JCalls;
2773 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2774 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2775 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2776 js_free(j_calls->broadcast_transaction_meth);
2780 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2781 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2782 LDKTransaction tx_var = tx;
2783 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2784 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2785 Transaction_free(tx_var);
2786 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2788 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
2789 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
2790 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2792 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2793 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2794 atomic_init(&calls->refcnt, 1);
2795 //TODO: Assign calls->o from o
2797 LDKBroadcasterInterface ret = {
2798 .this_arg = (void*) calls,
2799 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2800 .free = LDKBroadcasterInterface_JCalls_free,
2804 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2805 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2806 *res_ptr = LDKBroadcasterInterface_init(o);
2807 return (long)res_ptr;
2809 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2810 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2811 LDKTransaction tx_ref;
2812 tx_ref.datalen = *((uint32_t*)tx);
2813 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2814 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2815 tx_ref.data_is_owned = true;
2816 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2819 typedef struct LDKKeysInterface_JCalls {
2820 atomic_size_t refcnt;
2821 uint32_t get_node_secret_meth;
2822 uint32_t get_destination_script_meth;
2823 uint32_t get_shutdown_scriptpubkey_meth;
2824 uint32_t get_channel_signer_meth;
2825 uint32_t get_secure_random_bytes_meth;
2826 uint32_t read_chan_signer_meth;
2827 uint32_t sign_invoice_meth;
2828 } LDKKeysInterface_JCalls;
2829 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2830 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2831 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2832 js_free(j_calls->get_node_secret_meth);
2833 js_free(j_calls->get_destination_script_meth);
2834 js_free(j_calls->get_shutdown_scriptpubkey_meth);
2835 js_free(j_calls->get_channel_signer_meth);
2836 js_free(j_calls->get_secure_random_bytes_meth);
2837 js_free(j_calls->read_chan_signer_meth);
2838 js_free(j_calls->sign_invoice_meth);
2842 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2843 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2844 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2845 LDKSecretKey ret_ref;
2846 CHECK(*((uint32_t*)ret) == 32);
2847 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2850 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2852 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2853 LDKCVec_u8Z ret_ref;
2854 ret_ref.datalen = *((uint32_t*)ret);
2855 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2856 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2859 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
2860 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2861 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
2862 LDKShutdownScript ret_conv;
2863 ret_conv.inner = (void*)(ret & (~1));
2864 ret_conv.is_owned = (ret & 1) || (ret == 0);
2865 ret_conv = ShutdownScript_clone(&ret_conv);
2868 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2869 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2870 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2871 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2872 ret_conv = Sign_clone(&ret_conv);
2875 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2876 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2877 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2878 LDKThirtyTwoBytes ret_ref;
2879 CHECK(*((uint32_t*)ret) == 32);
2880 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2883 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2884 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2885 LDKu8slice reader_var = reader;
2886 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2887 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2888 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2889 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2890 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
2893 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
2894 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2895 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
2896 int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2897 memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
2898 CVec_u8Z_free(invoice_preimage_var);
2899 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
2900 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
2901 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
2904 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
2905 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
2906 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2908 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2909 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2910 atomic_init(&calls->refcnt, 1);
2911 //TODO: Assign calls->o from o
2913 LDKKeysInterface ret = {
2914 .this_arg = (void*) calls,
2915 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2916 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2917 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
2918 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2919 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2920 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2921 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
2922 .free = LDKKeysInterface_JCalls_free,
2926 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2927 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2928 *res_ptr = LDKKeysInterface_init(o);
2929 return (long)res_ptr;
2931 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2932 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2933 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2934 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2938 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2939 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2940 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2941 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2942 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2943 CVec_u8Z_free(ret_var);
2947 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
2948 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2949 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
2950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2952 uint64_t ret_ref = (uint64_t)ret_var.inner;
2953 if (ret_var.is_owned) {
2959 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2960 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2961 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2962 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2963 return (uint64_t)ret_ret;
2966 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2967 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2968 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2969 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2973 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2974 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2975 LDKu8slice reader_ref;
2976 reader_ref.datalen = *((uint32_t*)reader);
2977 reader_ref.data = (int8_t*)(reader + 4);
2978 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2979 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2980 return (uint64_t)ret_conv;
2983 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
2984 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2985 LDKCVec_u8Z invoice_preimage_ref;
2986 invoice_preimage_ref.datalen = *((uint32_t*)invoice_preimage);
2987 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
2988 memcpy(invoice_preimage_ref.data, (uint8_t*)(invoice_preimage + 4), invoice_preimage_ref.datalen);
2989 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
2990 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
2991 return (uint64_t)ret_conv;
2994 typedef struct LDKFeeEstimator_JCalls {
2995 atomic_size_t refcnt;
2996 uint32_t get_est_sat_per_1000_weight_meth;
2997 } LDKFeeEstimator_JCalls;
2998 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2999 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3000 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3001 js_free(j_calls->get_est_sat_per_1000_weight_meth);
3005 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3006 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3007 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
3008 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3010 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
3011 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
3012 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3014 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
3015 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3016 atomic_init(&calls->refcnt, 1);
3017 //TODO: Assign calls->o from o
3019 LDKFeeEstimator ret = {
3020 .this_arg = (void*) calls,
3021 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3022 .free = LDKFeeEstimator_JCalls_free,
3026 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
3027 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3028 *res_ptr = LDKFeeEstimator_init(o);
3029 return (long)res_ptr;
3031 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
3032 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3033 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
3034 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3038 typedef struct LDKLogger_JCalls {
3039 atomic_size_t refcnt;
3042 static void LDKLogger_JCalls_free(void* this_arg) {
3043 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3044 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3045 js_free(j_calls->log_meth);
3049 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3050 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3051 const char* record_str = record;
3052 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
3053 js_invoke_function_1(j_calls->log_meth, record_conv);
3055 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3056 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3057 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3059 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
3060 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3061 atomic_init(&calls->refcnt, 1);
3062 //TODO: Assign calls->o from o
3065 .this_arg = (void*) calls,
3066 .log = log_LDKLogger_jcall,
3067 .free = LDKLogger_JCalls_free,
3071 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
3072 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3073 *res_ptr = LDKLogger_init(o);
3074 return (long)res_ptr;
3076 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
3077 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3078 LDKThirtyTwoBytes a_ref;
3079 CHECK(*((uint32_t*)a) == 32);
3080 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3082 LDKChannelManager b_conv;
3083 b_conv.inner = (void*)(b & (~1));
3084 b_conv.is_owned = (b & 1) || (b == 0);
3085 // Warning: we need a move here but no clone is available for LDKChannelManager
3087 return (uint64_t)ret;
3089 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3090 return ThirtyTwoBytes_clone(&tuple->a);
3092 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t tuple) {
3093 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3094 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3095 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data, 32);
3099 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
3102 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t tuple) {
3103 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
3104 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
3105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3107 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
3111 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
3112 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3114 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
3115 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3116 CHECK(val->result_ok);
3117 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3118 *res_conv = (*val->contents.result);
3119 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
3120 return ((uint64_t)res_conv) | 1;
3122 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
3123 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(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_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
3132 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
3134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
3135 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3136 CHECK(val->result_ok);
3137 LDKChannelConfig res_var = (*val->contents.result);
3138 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3139 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3140 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3143 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
3144 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
3145 CHECK(!val->result_ok);
3146 LDKDecodeError err_var = (*val->contents.err);
3147 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3148 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3149 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3152 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
3153 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
3155 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
3156 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3157 CHECK(val->result_ok);
3158 LDKOutPoint res_var = (*val->contents.result);
3159 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3160 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3161 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3164 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
3165 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
3166 CHECK(!val->result_ok);
3167 LDKDecodeError err_var = (*val->contents.err);
3168 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3169 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3170 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3173 typedef struct LDKType_JCalls {
3174 atomic_size_t refcnt;
3175 uint32_t type_id_meth;
3176 uint32_t debug_str_meth;
3177 uint32_t write_meth;
3179 static void LDKType_JCalls_free(void* this_arg) {
3180 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3181 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3182 js_free(j_calls->type_id_meth);
3183 js_free(j_calls->debug_str_meth);
3184 js_free(j_calls->write_meth);
3188 uint16_t type_id_LDKType_jcall(const void* this_arg) {
3189 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3190 return js_invoke_function_0(j_calls->type_id_meth);
3192 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
3193 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3194 uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
3195 LDKStr ret_conv = str_ref_to_owned_c(ret);
3198 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
3199 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
3200 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
3201 LDKCVec_u8Z ret_ref;
3202 ret_ref.datalen = *((uint32_t*)ret);
3203 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3204 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
3207 static void LDKType_JCalls_cloned(LDKType* new_obj) {
3208 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
3209 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3211 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
3212 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
3213 atomic_init(&calls->refcnt, 1);
3214 //TODO: Assign calls->o from o
3217 .this_arg = (void*) calls,
3218 .type_id = type_id_LDKType_jcall,
3219 .debug_str = debug_str_LDKType_jcall,
3220 .write = write_LDKType_jcall,
3221 .cloned = LDKType_JCalls_cloned,
3222 .free = LDKType_JCalls_free,
3226 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
3227 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
3228 *res_ptr = LDKType_init(o);
3229 return (long)res_ptr;
3231 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
3232 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3233 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
3237 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
3238 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3239 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
3240 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
3245 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
3246 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
3247 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3248 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3249 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3250 CVec_u8Z_free(ret_var);
3254 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
3255 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
3257 case LDKCOption_TypeZ_Some: {
3258 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
3259 *some_ret = Type_clone(&obj->some);
3260 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
3262 case LDKCOption_TypeZ_None: {
3263 return 0 /* LDKCOption_TypeZ - None */;
3268 jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
3269 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
3271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
3272 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3273 CHECK(val->result_ok);
3274 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
3277 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
3278 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
3279 CHECK(!val->result_ok);
3280 LDKDecodeError err_var = (*val->contents.err);
3281 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3282 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3283 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3286 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
3287 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
3289 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_ok(uint32_t arg) {
3290 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3291 CHECK(val->result_ok);
3292 uint32_t res_conv = LDKSiPrefix_to_js((*val->contents.result));
3295 void __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_get_err(uint32_t arg) {
3296 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
3297 CHECK(!val->result_ok);
3298 return *val->contents.err;
3300 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_result_ok(uint32_t arg) {
3301 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
3303 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_ok(uint32_t arg) {
3304 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3305 CHECK(val->result_ok);
3306 LDKInvoice res_var = (*val->contents.result);
3307 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3308 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3309 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3312 void __attribute__((visibility("default"))) TS_LDKCResult_InvoiceNoneZ_get_err(uint32_t arg) {
3313 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
3314 CHECK(!val->result_ok);
3315 return *val->contents.err;
3317 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_result_ok(uint32_t arg) {
3318 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
3320 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_ok(uint32_t arg) {
3321 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3322 CHECK(val->result_ok);
3323 LDKSignedRawInvoice res_var = (*val->contents.result);
3324 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3325 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3326 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3329 void __attribute__((visibility("default"))) TS_LDKCResult_SignedRawInvoiceNoneZ_get_err(uint32_t arg) {
3330 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
3331 CHECK(!val->result_ok);
3332 return *val->contents.err;
3334 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
3335 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
3336 LDKRawInvoice a_conv;
3337 a_conv.inner = (void*)(a & (~1));
3338 a_conv.is_owned = (a & 1) || (a == 0);
3339 a_conv = RawInvoice_clone(&a_conv);
3341 LDKThirtyTwoBytes b_ref;
3342 CHECK(*((uint32_t*)b) == 32);
3343 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
3345 LDKInvoiceSignature c_conv;
3346 c_conv.inner = (void*)(c & (~1));
3347 c_conv.is_owned = (c & 1) || (c == 0);
3348 c_conv = InvoiceSignature_clone(&c_conv);
3350 return (uint64_t)ret;
3352 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3353 return RawInvoice_clone(&tuple->a);
3355 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t tuple) {
3356 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3357 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
3358 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3359 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3360 uint64_t ret_ref = (uint64_t)ret_var.inner;
3361 if (ret_var.is_owned) {
3367 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3368 return ThirtyTwoBytes_clone(&tuple->b);
3370 int8_tArray __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t tuple) {
3371 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3372 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3373 memcpy((uint8_t*)(ret_arr + 4), C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data, 32);
3377 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
3378 return InvoiceSignature_clone(&tuple->c);
3380 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t tuple) {
3381 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
3382 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
3383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3385 uint64_t ret_ref = (uint64_t)ret_var.inner;
3386 if (ret_var.is_owned) {
3392 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_result_ok(uint32_t arg) {
3393 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
3395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_ok(uint32_t arg) {
3396 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3397 CHECK(val->result_ok);
3398 LDKPayeePubKey res_var = (*val->contents.result);
3399 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3400 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3401 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3404 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PayeePubKeyErrorZ_get_err(uint32_t arg) {
3405 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
3406 CHECK(!val->result_ok);
3407 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3410 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_PrivateRouteZ_new(uint32_tArray elems) {
3411 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
3412 ret->datalen = *((uint32_t*)elems);
3413 if (ret->datalen == 0) {
3416 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
3417 uint32_t *java_elems = (uint32_t*)(elems + 4);
3418 for (size_t i = 0; i < ret->datalen; i++) {
3419 uint32_t arr_elem = java_elems[i];
3420 LDKPrivateRoute arr_elem_conv;
3421 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3422 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3423 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
3424 ret->data[i] = arr_elem_conv;
3427 return (uint64_t)ret;
3429 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
3430 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
3431 for (size_t i = 0; i < ret.datalen; i++) {
3432 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
3436 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_result_ok(uint32_t arg) {
3437 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
3439 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t arg) {
3440 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3441 CHECK(val->result_ok);
3442 LDKPositiveTimestamp res_var = (*val->contents.result);
3443 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3444 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3445 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3448 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PositiveTimestampCreationErrorZ_get_err(uint32_t arg) {
3449 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
3450 CHECK(!val->result_ok);
3451 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3454 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_result_ok(uint32_t arg) {
3455 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
3457 void __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_ok(uint32_t arg) {
3458 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3459 CHECK(val->result_ok);
3460 return *val->contents.result;
3462 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneSemanticErrorZ_get_err(uint32_t arg) {
3463 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
3464 CHECK(!val->result_ok);
3465 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3468 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_result_ok(uint32_t arg) {
3469 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
3471 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_ok(uint32_t arg) {
3472 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3473 CHECK(val->result_ok);
3474 LDKInvoice res_var = (*val->contents.result);
3475 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3476 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3477 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3480 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSemanticErrorZ_get_err(uint32_t arg) {
3481 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
3482 CHECK(!val->result_ok);
3483 uint32_t err_conv = LDKSemanticError_to_js((*val->contents.err));
3486 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_result_ok(uint32_t arg) {
3487 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
3489 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_ok(uint32_t arg) {
3490 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3491 CHECK(val->result_ok);
3492 LDKDescription res_var = (*val->contents.result);
3493 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3494 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3495 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3498 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DescriptionCreationErrorZ_get_err(uint32_t arg) {
3499 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
3500 CHECK(!val->result_ok);
3501 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3504 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_result_ok(uint32_t arg) {
3505 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
3507 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_ok(uint32_t arg) {
3508 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3509 CHECK(val->result_ok);
3510 LDKExpiryTime res_var = (*val->contents.result);
3511 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3512 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3513 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3516 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ExpiryTimeCreationErrorZ_get_err(uint32_t arg) {
3517 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
3518 CHECK(!val->result_ok);
3519 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3522 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_result_ok(uint32_t arg) {
3523 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
3525 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_ok(uint32_t arg) {
3526 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3527 CHECK(val->result_ok);
3528 LDKPrivateRoute res_var = (*val->contents.result);
3529 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3530 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3531 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3534 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PrivateRouteCreationErrorZ_get_err(uint32_t arg) {
3535 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
3536 CHECK(!val->result_ok);
3537 uint32_t err_conv = LDKCreationError_to_js((*val->contents.err));
3540 jboolean __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_result_ok(uint32_t arg) {
3541 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
3543 jstring __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_ok(uint32_t arg) {
3544 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3545 CHECK(val->result_ok);
3546 LDKStr res_str = (*val->contents.result);
3547 jstring res_conv = str_ref_to_ts(res_str.chars, res_str.len);
3550 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_StringErrorZ_get_err(uint32_t arg) {
3551 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
3552 CHECK(!val->result_ok);
3553 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
3556 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3557 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
3559 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3560 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3561 CHECK(val->result_ok);
3562 LDKChannelMonitorUpdate res_var = (*val->contents.result);
3563 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3564 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3565 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3568 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
3569 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
3570 CHECK(!val->result_ok);
3571 LDKDecodeError err_var = (*val->contents.err);
3572 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3573 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3574 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3577 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3578 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
3580 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3581 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3582 CHECK(val->result_ok);
3583 LDKHTLCUpdate res_var = (*val->contents.result);
3584 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3585 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3586 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
3590 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
3591 CHECK(!val->result_ok);
3592 LDKDecodeError err_var = (*val->contents.err);
3593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3595 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3598 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
3599 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
3601 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
3602 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3603 CHECK(val->result_ok);
3604 return *val->contents.result;
3606 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
3607 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
3608 CHECK(!val->result_ok);
3609 LDKMonitorUpdateError err_var = (*val->contents.err);
3610 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3611 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3612 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3615 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
3616 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3618 a_conv.inner = (void*)(a & (~1));
3619 a_conv.is_owned = (a & 1) || (a == 0);
3620 a_conv = OutPoint_clone(&a_conv);
3623 b_ref.datalen = *((uint32_t*)b);
3624 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3625 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3627 return (uint64_t)ret;
3629 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3630 return OutPoint_clone(&tuple->a);
3632 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t tuple) {
3633 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3634 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
3635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3637 uint64_t ret_ref = (uint64_t)ret_var.inner;
3638 if (ret_var.is_owned) {
3644 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
3645 return CVec_u8Z_clone(&tuple->b);
3647 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t tuple) {
3648 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
3649 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
3650 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3651 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3652 CVec_u8Z_free(ret_var);
3656 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
3657 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3660 b_ref.datalen = *((uint32_t*)b);
3661 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3662 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
3664 return (uint64_t)ret;
3666 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3669 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t tuple) {
3670 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3671 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
3675 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
3676 return CVec_u8Z_clone(&tuple->b);
3678 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t tuple) {
3679 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
3680 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
3681 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3682 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
3683 CVec_u8Z_free(ret_var);
3687 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
3688 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
3689 ret->datalen = *((uint32_t*)elems);
3690 if (ret->datalen == 0) {
3693 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
3694 uint32_t *java_elems = (uint32_t*)(elems + 4);
3695 for (size_t i = 0; i < ret->datalen; i++) {
3696 uint32_t arr_elem = java_elems[i];
3697 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
3698 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
3699 ret->data[i] = arr_elem_conv;
3702 return (uint64_t)ret;
3704 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
3705 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
3706 for (size_t i = 0; i < ret.datalen; i++) {
3707 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
3711 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
3712 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
3713 LDKThirtyTwoBytes a_ref;
3714 CHECK(*((uint32_t*)a) == 32);
3715 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3717 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
3718 b_constr.datalen = *((uint32_t*)b);
3719 if (b_constr.datalen > 0)
3720 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
3722 b_constr.data = NULL;
3723 uint32_t* b_vals = (uint32_t*)(b + 4);
3724 for (size_t v = 0; v < b_constr.datalen; v++) {
3725 uint32_t b_conv_21 = b_vals[v];
3726 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
3727 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
3728 b_constr.data[v] = b_conv_21_conv;
3731 return (uint64_t)ret;
3733 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3734 return ThirtyTwoBytes_clone(&tuple->a);
3736 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t tuple) {
3737 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3738 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3739 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data, 32);
3743 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
3744 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
3746 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t tuple) {
3747 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
3748 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
3749 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3750 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3751 for (size_t v = 0; v < ret_var.datalen; v++) {
3752 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
3753 *ret_conv_21_conv = ret_var.data[v];
3754 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
3760 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
3761 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
3762 ret->datalen = *((uint32_t*)elems);
3763 if (ret->datalen == 0) {
3766 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
3767 uint32_t *java_elems = (uint32_t*)(elems + 4);
3768 for (size_t i = 0; i < ret->datalen; i++) {
3769 uint32_t arr_elem = java_elems[i];
3770 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
3771 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
3772 ret->data[i] = arr_elem_conv;
3775 return (uint64_t)ret;
3777 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
3778 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 };
3779 for (size_t i = 0; i < ret.datalen; i++) {
3780 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
3784 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
3785 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
3787 case LDKPaymentPurpose_InvoicePayment: {
3788 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3789 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
3790 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3791 memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
3792 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
3794 case LDKPaymentPurpose_SpontaneousPayment: {
3795 int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3796 memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
3797 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
3802 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
3803 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
3805 case LDKClosureReason_CounterpartyForceClosed: {
3806 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3807 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
3808 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
3810 case LDKClosureReason_HolderForceClosed: {
3811 return 0 /* LDKClosureReason - HolderForceClosed */;
3813 case LDKClosureReason_CooperativeClosure: {
3814 return 0 /* LDKClosureReason - CooperativeClosure */;
3816 case LDKClosureReason_CommitmentTxConfirmed: {
3817 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
3819 case LDKClosureReason_ProcessingError: {
3820 LDKStr err_str = obj->processing_error.err;
3821 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3822 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
3824 case LDKClosureReason_DisconnectedPeer: {
3825 return 0 /* LDKClosureReason - DisconnectedPeer */;
3827 case LDKClosureReason_OutdatedChannelManager: {
3828 return 0 /* LDKClosureReason - OutdatedChannelManager */;
3833 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
3834 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
3836 case LDKEvent_FundingGenerationReady: {
3837 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3838 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
3839 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3840 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3841 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
3842 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;
3844 case LDKEvent_PaymentReceived: {
3845 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3846 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
3847 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
3848 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
3850 case LDKEvent_PaymentSent: {
3851 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3852 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
3853 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3854 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32);
3855 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; (void) payment_hash_arr;
3857 case LDKEvent_PaymentPathFailed: {
3858 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3859 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
3860 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
3861 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3862 uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3863 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
3864 for (size_t k = 0; k < path_var.datalen; k++) {
3865 LDKRouteHop path_conv_10_var = path_var.data[k];
3866 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3867 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3868 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
3869 path_arr_ptr[k] = path_conv_10_ref;
3871 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
3872 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; (void) short_channel_id_ref;
3874 case LDKEvent_PendingHTLCsForwardable: {
3875 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
3877 case LDKEvent_SpendableOutputs: {
3878 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3879 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3880 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
3881 for (size_t b = 0; b < outputs_var.datalen; b++) {
3882 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
3883 outputs_arr_ptr[b] = outputs_conv_27_ref;
3885 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
3887 case LDKEvent_PaymentForwarded: {
3888 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
3889 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
3891 case LDKEvent_ChannelClosed: {
3892 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3893 memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
3894 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
3895 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
3897 case LDKEvent_DiscardFunding: {
3898 int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3899 memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32);
3900 LDKTransaction transaction_var = obj->discard_funding.transaction;
3901 int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3902 memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen);
3903 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
3908 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
3909 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3910 ret->datalen = *((uint32_t*)elems);
3911 if (ret->datalen == 0) {
3914 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
3915 uint32_t *java_elems = (uint32_t*)(elems + 4);
3916 for (size_t i = 0; i < ret->datalen; i++) {
3917 uint32_t arr_elem = java_elems[i];
3918 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
3919 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
3920 ret->data[i] = arr_elem_conv;
3923 return (uint64_t)ret;
3925 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
3926 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
3927 for (size_t i = 0; i < ret.datalen; i++) {
3928 ret.data[i] = Event_clone(&orig->data[i]);
3932 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
3933 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3935 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
3936 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
3938 return (uint64_t)ret;
3940 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3943 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t tuple) {
3944 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3945 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
3949 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
3950 return TxOut_clone(&tuple->b);
3952 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t tuple) {
3953 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
3954 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3955 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
3956 return (uint64_t)ret_ref;
3959 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
3960 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
3961 ret->datalen = *((uint32_t*)elems);
3962 if (ret->datalen == 0) {
3965 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
3966 uint32_t *java_elems = (uint32_t*)(elems + 4);
3967 for (size_t i = 0; i < ret->datalen; i++) {
3968 uint32_t arr_elem = java_elems[i];
3969 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
3970 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
3971 ret->data[i] = arr_elem_conv;
3974 return (uint64_t)ret;
3976 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
3977 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
3978 for (size_t i = 0; i < ret.datalen; i++) {
3979 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
3983 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
3984 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3985 LDKThirtyTwoBytes a_ref;
3986 CHECK(*((uint32_t*)a) == 32);
3987 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
3989 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3990 b_constr.datalen = *((uint32_t*)b);
3991 if (b_constr.datalen > 0)
3992 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3994 b_constr.data = NULL;
3995 uint32_t* b_vals = (uint32_t*)(b + 4);
3996 for (size_t u = 0; u < b_constr.datalen; u++) {
3997 uint32_t b_conv_20 = b_vals[u];
3998 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
3999 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
4000 b_constr.data[u] = b_conv_20_conv;
4003 return (uint64_t)ret;
4005 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4006 return ThirtyTwoBytes_clone(&tuple->a);
4008 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t tuple) {
4009 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4010 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4011 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data, 32);
4015 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
4016 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
4018 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t tuple) {
4019 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
4020 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
4021 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4022 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4023 for (size_t u = 0; u < ret_var.datalen; u++) {
4024 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4025 *ret_conv_20_conv = ret_var.data[u];
4026 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
4032 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
4033 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4034 ret->datalen = *((uint32_t*)elems);
4035 if (ret->datalen == 0) {
4038 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4039 uint32_t *java_elems = (uint32_t*)(elems + 4);
4040 for (size_t i = 0; i < ret->datalen; i++) {
4041 uint32_t arr_elem = java_elems[i];
4042 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4043 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4044 ret->data[i] = arr_elem_conv;
4047 return (uint64_t)ret;
4049 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4050 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 };
4051 for (size_t i = 0; i < ret.datalen; i++) {
4052 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4056 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
4057 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
4059 case LDKBalance_ClaimableOnChannelClose: {
4060 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
4062 case LDKBalance_ClaimableAwaitingConfirmations: {
4063 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
4065 case LDKBalance_ContentiousClaimable: {
4066 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
4068 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
4069 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
4074 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
4075 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
4076 ret->datalen = *((uint32_t*)elems);
4077 if (ret->datalen == 0) {
4080 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
4081 uint32_t *java_elems = (uint32_t*)(elems + 4);
4082 for (size_t i = 0; i < ret->datalen; i++) {
4083 uint32_t arr_elem = java_elems[i];
4084 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
4085 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
4086 ret->data[i] = arr_elem_conv;
4089 return (uint64_t)ret;
4091 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
4092 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
4093 for (size_t i = 0; i < ret.datalen; i++) {
4094 ret.data[i] = Balance_clone(&orig->data[i]);
4098 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
4099 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4101 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
4102 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4103 CHECK(val->result_ok);
4104 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4105 *res_conv = (*val->contents.result);
4106 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
4107 return ((uint64_t)res_conv);
4109 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
4110 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4111 CHECK(!val->result_ok);
4112 LDKDecodeError err_var = (*val->contents.err);
4113 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4114 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4115 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4118 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
4119 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4121 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
4122 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4123 CHECK(val->result_ok);
4124 return *val->contents.result;
4126 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
4127 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4128 CHECK(!val->result_ok);
4129 LDKLightningError err_var = (*val->contents.err);
4130 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4131 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4132 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4135 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
4136 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
4138 CHECK(*((uint32_t*)a) == 33);
4139 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
4141 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
4142 b_conv = Type_clone(&b_conv);
4144 return (uint64_t)ret;
4146 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4149 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t tuple) {
4150 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4151 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4152 memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form, 33);
4156 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
4157 return Type_clone(&tuple->b);
4159 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t tuple) {
4160 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
4161 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
4162 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
4163 return (uint64_t)ret_ret;
4166 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
4167 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
4168 ret->datalen = *((uint32_t*)elems);
4169 if (ret->datalen == 0) {
4172 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
4173 uint32_t *java_elems = (uint32_t*)(elems + 4);
4174 for (size_t i = 0; i < ret->datalen; i++) {
4175 uint32_t arr_elem = java_elems[i];
4176 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
4177 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
4178 ret->data[i] = arr_elem_conv;
4181 return (uint64_t)ret;
4183 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
4184 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
4185 for (size_t i = 0; i < ret.datalen; i++) {
4186 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
4190 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
4191 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4193 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
4194 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4195 CHECK(val->result_ok);
4196 return *val->contents.result;
4198 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
4199 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4200 CHECK(!val->result_ok);
4201 LDKLightningError err_var = (*val->contents.err);
4202 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4207 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
4208 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4209 LDKChannelAnnouncement a_conv;
4210 a_conv.inner = (void*)(a & (~1));
4211 a_conv.is_owned = (a & 1) || (a == 0);
4212 a_conv = ChannelAnnouncement_clone(&a_conv);
4214 LDKChannelUpdate b_conv;
4215 b_conv.inner = (void*)(b & (~1));
4216 b_conv.is_owned = (b & 1) || (b == 0);
4217 b_conv = ChannelUpdate_clone(&b_conv);
4219 LDKChannelUpdate c_conv;
4220 c_conv.inner = (void*)(c & (~1));
4221 c_conv.is_owned = (c & 1) || (c == 0);
4222 c_conv = ChannelUpdate_clone(&c_conv);
4224 return (uint64_t)ret;
4226 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4227 return ChannelAnnouncement_clone(&tuple->a);
4229 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t tuple) {
4230 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4231 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
4232 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 uint64_t ret_ref = (uint64_t)ret_var.inner;
4235 if (ret_var.is_owned) {
4241 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4242 return ChannelUpdate_clone(&tuple->b);
4244 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t tuple) {
4245 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4246 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
4247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4249 uint64_t ret_ref = (uint64_t)ret_var.inner;
4250 if (ret_var.is_owned) {
4256 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
4257 return ChannelUpdate_clone(&tuple->c);
4259 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t tuple) {
4260 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
4261 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
4262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4264 uint64_t ret_ref = (uint64_t)ret_var.inner;
4265 if (ret_var.is_owned) {
4271 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
4272 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4273 ret->datalen = *((uint32_t*)elems);
4274 if (ret->datalen == 0) {
4277 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4278 uint32_t *java_elems = (uint32_t*)(elems + 4);
4279 for (size_t i = 0; i < ret->datalen; i++) {
4280 uint32_t arr_elem = java_elems[i];
4281 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4282 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4283 ret->data[i] = arr_elem_conv;
4286 return (uint64_t)ret;
4288 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4289 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4290 for (size_t i = 0; i < ret.datalen; i++) {
4291 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4295 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
4296 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4297 ret->datalen = *((uint32_t*)elems);
4298 if (ret->datalen == 0) {
4301 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4302 uint32_t *java_elems = (uint32_t*)(elems + 4);
4303 for (size_t i = 0; i < ret->datalen; i++) {
4304 uint32_t arr_elem = java_elems[i];
4305 LDKNodeAnnouncement arr_elem_conv;
4306 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4307 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4308 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4309 ret->data[i] = arr_elem_conv;
4312 return (uint64_t)ret;
4314 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4315 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4316 for (size_t i = 0; i < ret.datalen; i++) {
4317 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4321 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
4322 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4324 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
4325 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4326 CHECK(val->result_ok);
4327 LDKCVec_u8Z res_var = (*val->contents.result);
4328 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4329 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
4332 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
4333 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4334 CHECK(!val->result_ok);
4335 LDKPeerHandleError err_var = (*val->contents.err);
4336 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4337 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4338 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4341 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
4342 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4344 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
4345 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4346 CHECK(val->result_ok);
4347 return *val->contents.result;
4349 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
4350 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4351 CHECK(!val->result_ok);
4352 LDKPeerHandleError err_var = (*val->contents.err);
4353 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4358 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
4359 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4361 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
4362 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4363 CHECK(val->result_ok);
4364 return *val->contents.result;
4366 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
4367 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4368 CHECK(!val->result_ok);
4369 LDKPeerHandleError err_var = (*val->contents.err);
4370 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4371 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4372 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4375 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) {
4376 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
4378 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) {
4379 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4380 CHECK(val->result_ok);
4381 LDKNodeId res_var = (*val->contents.result);
4382 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4383 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4384 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4387 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) {
4388 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
4389 CHECK(!val->result_ok);
4390 LDKDecodeError err_var = (*val->contents.err);
4391 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4396 typedef struct LDKAccess_JCalls {
4397 atomic_size_t refcnt;
4398 uint32_t get_utxo_meth;
4400 static void LDKAccess_JCalls_free(void* this_arg) {
4401 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4402 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4403 js_free(j_calls->get_utxo_meth);
4407 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4408 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4409 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4410 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4411 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4412 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4413 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
4416 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4417 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4418 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4420 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4421 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4422 atomic_init(&calls->refcnt, 1);
4423 //TODO: Assign calls->o from o
4426 .this_arg = (void*) calls,
4427 .get_utxo = get_utxo_LDKAccess_jcall,
4428 .free = LDKAccess_JCalls_free,
4432 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4433 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4434 *res_ptr = LDKAccess_init(o);
4435 return (long)res_ptr;
4437 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4438 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4439 unsigned char genesis_hash_arr[32];
4440 CHECK(*((uint32_t*)genesis_hash) == 32);
4441 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4442 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4443 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4444 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4445 return (uint64_t)ret_conv;
4448 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
4449 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4451 case LDKCOption_AccessZ_Some: {
4452 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
4453 *some_ret = obj->some;
4454 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
4455 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
4457 case LDKCOption_AccessZ_None: {
4458 return 0 /* LDKCOption_AccessZ - None */;
4463 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4464 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4466 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4467 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4468 CHECK(val->result_ok);
4469 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4470 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4471 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4472 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4475 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4476 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4477 CHECK(!val->result_ok);
4478 LDKDecodeError err_var = (*val->contents.err);
4479 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4480 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4481 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4484 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
4485 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4487 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
4488 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4489 CHECK(val->result_ok);
4490 LDKChannelInfo res_var = (*val->contents.result);
4491 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4492 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4493 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
4497 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4498 CHECK(!val->result_ok);
4499 LDKDecodeError err_var = (*val->contents.err);
4500 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4501 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4502 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4505 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
4506 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4508 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
4509 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4510 CHECK(val->result_ok);
4511 LDKRoutingFees res_var = (*val->contents.result);
4512 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4513 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4514 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
4518 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4519 CHECK(!val->result_ok);
4520 LDKDecodeError err_var = (*val->contents.err);
4521 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4522 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4523 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4526 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
4527 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4529 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
4530 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4531 CHECK(val->result_ok);
4532 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4533 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4534 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4535 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
4539 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4540 CHECK(!val->result_ok);
4541 LDKDecodeError err_var = (*val->contents.err);
4542 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4543 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4544 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4547 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
4548 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
4549 ret->datalen = *((uint32_t*)elems);
4550 if (ret->datalen == 0) {
4553 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
4554 int64_t *java_elems = (int64_t*)(elems + 4);
4555 for (size_t i = 0; i < ret->datalen; i++) {
4556 ret->data[i] = java_elems[i];
4559 return (uint64_t)ret;
4561 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4562 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4563 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4566 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
4567 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
4569 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
4570 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4571 CHECK(val->result_ok);
4572 LDKNodeInfo res_var = (*val->contents.result);
4573 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4574 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4575 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4578 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
4579 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
4580 CHECK(!val->result_ok);
4581 LDKDecodeError err_var = (*val->contents.err);
4582 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4583 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4584 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4587 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
4588 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
4590 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
4591 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4592 CHECK(val->result_ok);
4593 LDKNetworkGraph res_var = (*val->contents.result);
4594 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4595 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4596 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4599 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
4600 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
4601 CHECK(!val->result_ok);
4602 LDKDecodeError err_var = (*val->contents.err);
4603 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4604 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4605 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4608 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
4609 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4611 case LDKCOption_CVec_NetAddressZZ_Some: {
4612 LDKCVec_NetAddressZ some_var = obj->some;
4613 uint32_tArray some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4614 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
4615 for (size_t m = 0; m < some_var.datalen; m++) {
4616 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
4617 some_arr_ptr[m] = some_conv_12_ref;
4619 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
4621 case LDKCOption_CVec_NetAddressZZ_None: {
4622 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
4627 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
4628 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
4630 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
4631 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4632 CHECK(val->result_ok);
4633 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4636 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
4637 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
4638 CHECK(!val->result_ok);
4639 return *val->contents.err;
4641 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
4642 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
4644 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
4645 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4646 CHECK(val->result_ok);
4647 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
4648 *res_conv = (*val->contents.result);
4649 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
4650 return (uint64_t)res_conv;
4652 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
4653 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
4654 CHECK(!val->result_ok);
4655 LDKDecodeError err_var = (*val->contents.err);
4656 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4657 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4658 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4661 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_result_ok(uint32_t arg) {
4662 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
4664 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_ok(uint32_t arg) {
4665 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4666 CHECK(val->result_ok);
4667 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressDecodeErrorZ_get_err(uint32_t arg) {
4671 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
4672 CHECK(!val->result_ok);
4673 LDKDecodeError err_var = (*val->contents.err);
4674 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4675 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4676 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4679 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
4680 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
4681 ret->datalen = *((uint32_t*)elems);
4682 if (ret->datalen == 0) {
4685 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
4686 uint32_t *java_elems = (uint32_t*)(elems + 4);
4687 for (size_t i = 0; i < ret->datalen; i++) {
4688 uint32_t arr_elem = java_elems[i];
4689 LDKUpdateAddHTLC arr_elem_conv;
4690 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4691 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4692 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
4693 ret->data[i] = arr_elem_conv;
4696 return (uint64_t)ret;
4698 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4699 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4700 for (size_t i = 0; i < ret.datalen; i++) {
4701 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4705 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
4706 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
4707 ret->datalen = *((uint32_t*)elems);
4708 if (ret->datalen == 0) {
4711 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
4712 uint32_t *java_elems = (uint32_t*)(elems + 4);
4713 for (size_t i = 0; i < ret->datalen; i++) {
4714 uint32_t arr_elem = java_elems[i];
4715 LDKUpdateFulfillHTLC arr_elem_conv;
4716 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4717 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4718 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4719 ret->data[i] = arr_elem_conv;
4722 return (uint64_t)ret;
4724 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4725 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4726 for (size_t i = 0; i < ret.datalen; i++) {
4727 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4731 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
4732 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4733 ret->datalen = *((uint32_t*)elems);
4734 if (ret->datalen == 0) {
4737 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4738 uint32_t *java_elems = (uint32_t*)(elems + 4);
4739 for (size_t i = 0; i < ret->datalen; i++) {
4740 uint32_t arr_elem = java_elems[i];
4741 LDKUpdateFailHTLC arr_elem_conv;
4742 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4743 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4744 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4745 ret->data[i] = arr_elem_conv;
4748 return (uint64_t)ret;
4750 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4751 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4752 for (size_t i = 0; i < ret.datalen; i++) {
4753 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4757 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
4758 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4759 ret->datalen = *((uint32_t*)elems);
4760 if (ret->datalen == 0) {
4763 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4764 uint32_t *java_elems = (uint32_t*)(elems + 4);
4765 for (size_t i = 0; i < ret->datalen; i++) {
4766 uint32_t arr_elem = java_elems[i];
4767 LDKUpdateFailMalformedHTLC arr_elem_conv;
4768 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4769 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4770 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4771 ret->data[i] = arr_elem_conv;
4774 return (uint64_t)ret;
4776 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4777 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4778 for (size_t i = 0; i < ret.datalen; i++) {
4779 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4783 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
4784 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4786 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
4787 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4788 CHECK(val->result_ok);
4789 LDKAcceptChannel res_var = (*val->contents.result);
4790 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4791 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4792 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4795 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
4796 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4797 CHECK(!val->result_ok);
4798 LDKDecodeError err_var = (*val->contents.err);
4799 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4800 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4801 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4804 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
4805 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4807 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
4808 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4809 CHECK(val->result_ok);
4810 LDKAnnouncementSignatures res_var = (*val->contents.result);
4811 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4812 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4813 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4816 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
4817 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4818 CHECK(!val->result_ok);
4819 LDKDecodeError err_var = (*val->contents.err);
4820 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4821 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4822 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4825 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
4826 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4828 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
4829 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4830 CHECK(val->result_ok);
4831 LDKChannelReestablish res_var = (*val->contents.result);
4832 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4833 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4834 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4837 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
4838 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4839 CHECK(!val->result_ok);
4840 LDKDecodeError err_var = (*val->contents.err);
4841 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4842 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4843 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4846 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4847 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4849 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4850 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4851 CHECK(val->result_ok);
4852 LDKClosingSigned res_var = (*val->contents.result);
4853 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4854 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4855 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4858 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
4859 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4860 CHECK(!val->result_ok);
4861 LDKDecodeError err_var = (*val->contents.err);
4862 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4863 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4864 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4867 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
4868 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
4870 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
4871 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4872 CHECK(val->result_ok);
4873 LDKClosingSignedFeeRange res_var = (*val->contents.result);
4874 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4875 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4876 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4879 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
4880 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
4881 CHECK(!val->result_ok);
4882 LDKDecodeError err_var = (*val->contents.err);
4883 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4884 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4885 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4888 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
4889 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4891 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
4892 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4893 CHECK(val->result_ok);
4894 LDKCommitmentSigned res_var = (*val->contents.result);
4895 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4900 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
4901 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4902 CHECK(!val->result_ok);
4903 LDKDecodeError err_var = (*val->contents.err);
4904 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4905 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4906 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4909 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
4910 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4912 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
4913 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4914 CHECK(val->result_ok);
4915 LDKFundingCreated res_var = (*val->contents.result);
4916 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4917 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4918 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4921 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
4922 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4923 CHECK(!val->result_ok);
4924 LDKDecodeError err_var = (*val->contents.err);
4925 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4926 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4927 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4930 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
4931 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4933 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
4934 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4935 CHECK(val->result_ok);
4936 LDKFundingSigned res_var = (*val->contents.result);
4937 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4938 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4939 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4942 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
4943 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4944 CHECK(!val->result_ok);
4945 LDKDecodeError err_var = (*val->contents.err);
4946 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4947 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4948 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4951 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
4952 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4954 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
4955 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4956 CHECK(val->result_ok);
4957 LDKFundingLocked res_var = (*val->contents.result);
4958 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4959 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4960 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4963 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
4964 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4965 CHECK(!val->result_ok);
4966 LDKDecodeError err_var = (*val->contents.err);
4967 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4968 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4969 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4972 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
4973 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4975 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
4976 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4977 CHECK(val->result_ok);
4978 LDKInit res_var = (*val->contents.result);
4979 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4980 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4981 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4984 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
4985 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4986 CHECK(!val->result_ok);
4987 LDKDecodeError err_var = (*val->contents.err);
4988 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4989 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4990 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4993 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
4994 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4996 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
4997 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4998 CHECK(val->result_ok);
4999 LDKOpenChannel res_var = (*val->contents.result);
5000 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5001 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5002 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5005 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
5006 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5007 CHECK(!val->result_ok);
5008 LDKDecodeError err_var = (*val->contents.err);
5009 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5010 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5011 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5014 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
5015 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5017 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
5018 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5019 CHECK(val->result_ok);
5020 LDKRevokeAndACK res_var = (*val->contents.result);
5021 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5022 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5023 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5026 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
5027 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5028 CHECK(!val->result_ok);
5029 LDKDecodeError err_var = (*val->contents.err);
5030 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5031 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5032 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5035 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
5036 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5038 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
5039 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5040 CHECK(val->result_ok);
5041 LDKShutdown res_var = (*val->contents.result);
5042 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5043 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5044 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5047 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
5048 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5049 CHECK(!val->result_ok);
5050 LDKDecodeError err_var = (*val->contents.err);
5051 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5052 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5053 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5056 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5057 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5059 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5060 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5061 CHECK(val->result_ok);
5062 LDKUpdateFailHTLC res_var = (*val->contents.result);
5063 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5064 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5065 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5068 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
5069 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5070 CHECK(!val->result_ok);
5071 LDKDecodeError err_var = (*val->contents.err);
5072 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5073 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5074 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5077 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5078 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5080 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5081 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5082 CHECK(val->result_ok);
5083 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5084 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5085 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5086 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5089 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
5090 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5091 CHECK(!val->result_ok);
5092 LDKDecodeError err_var = (*val->contents.err);
5093 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5094 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5095 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5098 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
5099 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5101 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
5102 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5103 CHECK(val->result_ok);
5104 LDKUpdateFee res_var = (*val->contents.result);
5105 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5106 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5107 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5110 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
5111 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5112 CHECK(!val->result_ok);
5113 LDKDecodeError err_var = (*val->contents.err);
5114 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5115 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5116 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5119 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5120 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5122 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5123 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5124 CHECK(val->result_ok);
5125 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5126 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5127 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5128 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5131 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
5132 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5133 CHECK(!val->result_ok);
5134 LDKDecodeError err_var = (*val->contents.err);
5135 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5136 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5137 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5140 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
5141 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5143 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
5144 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5145 CHECK(val->result_ok);
5146 LDKUpdateAddHTLC res_var = (*val->contents.result);
5147 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5148 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5149 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5152 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
5153 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5154 CHECK(!val->result_ok);
5155 LDKDecodeError err_var = (*val->contents.err);
5156 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5157 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5158 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5161 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
5162 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5164 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
5165 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5166 CHECK(val->result_ok);
5167 LDKPing 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_PingDecodeErrorZ_get_err(uint32_t arg) {
5174 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5175 CHECK(!val->result_ok);
5176 LDKDecodeError err_var = (*val->contents.err);
5177 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5178 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5179 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5182 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
5183 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5185 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
5186 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5187 CHECK(val->result_ok);
5188 LDKPong res_var = (*val->contents.result);
5189 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5190 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5191 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5194 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
5195 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5196 CHECK(!val->result_ok);
5197 LDKDecodeError err_var = (*val->contents.err);
5198 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5199 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5200 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5203 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5204 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5206 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5207 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5208 CHECK(val->result_ok);
5209 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5210 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5211 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5212 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5215 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5216 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5217 CHECK(!val->result_ok);
5218 LDKDecodeError err_var = (*val->contents.err);
5219 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5220 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5221 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5224 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5225 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5227 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5228 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5229 CHECK(val->result_ok);
5230 LDKChannelAnnouncement res_var = (*val->contents.result);
5231 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5232 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5233 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5236 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5237 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5238 CHECK(!val->result_ok);
5239 LDKDecodeError err_var = (*val->contents.err);
5240 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5241 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5242 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5245 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5246 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5248 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5249 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5250 CHECK(val->result_ok);
5251 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5252 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5253 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5254 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5257 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5258 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5259 CHECK(!val->result_ok);
5260 LDKDecodeError err_var = (*val->contents.err);
5261 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5262 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5263 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5266 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
5267 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5269 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
5270 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5271 CHECK(val->result_ok);
5272 LDKChannelUpdate res_var = (*val->contents.result);
5273 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5274 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5275 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5278 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
5279 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5280 CHECK(!val->result_ok);
5281 LDKDecodeError err_var = (*val->contents.err);
5282 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5283 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5284 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5287 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
5288 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5290 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
5291 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5292 CHECK(val->result_ok);
5293 LDKErrorMessage res_var = (*val->contents.result);
5294 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5295 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5296 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5299 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
5300 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5301 CHECK(!val->result_ok);
5302 LDKDecodeError err_var = (*val->contents.err);
5303 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5304 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5305 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5308 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5309 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5311 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5312 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5313 CHECK(val->result_ok);
5314 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5315 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5316 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5317 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5320 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5321 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5322 CHECK(!val->result_ok);
5323 LDKDecodeError err_var = (*val->contents.err);
5324 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5325 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5326 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5329 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
5330 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5332 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
5333 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5334 CHECK(val->result_ok);
5335 LDKNodeAnnouncement res_var = (*val->contents.result);
5336 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5337 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5338 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5341 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
5342 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5343 CHECK(!val->result_ok);
5344 LDKDecodeError err_var = (*val->contents.err);
5345 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5346 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5347 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5350 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
5351 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5353 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
5354 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5355 CHECK(val->result_ok);
5356 LDKQueryShortChannelIds res_var = (*val->contents.result);
5357 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5358 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5359 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5362 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
5363 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5364 CHECK(!val->result_ok);
5365 LDKDecodeError err_var = (*val->contents.err);
5366 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5367 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5368 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5371 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
5372 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5374 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
5375 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5376 CHECK(val->result_ok);
5377 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5378 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5379 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5380 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5383 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
5384 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5385 CHECK(!val->result_ok);
5386 LDKDecodeError err_var = (*val->contents.err);
5387 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5388 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5389 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5392 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5393 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5395 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5396 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5397 CHECK(val->result_ok);
5398 LDKQueryChannelRange res_var = (*val->contents.result);
5399 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5400 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5401 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5404 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5405 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5406 CHECK(!val->result_ok);
5407 LDKDecodeError err_var = (*val->contents.err);
5408 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5409 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5410 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5413 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
5414 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5416 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
5417 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5418 CHECK(val->result_ok);
5419 LDKReplyChannelRange res_var = (*val->contents.result);
5420 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5421 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5422 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5425 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
5426 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5427 CHECK(!val->result_ok);
5428 LDKDecodeError err_var = (*val->contents.err);
5429 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5430 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5431 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5434 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
5435 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5437 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
5438 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5439 CHECK(val->result_ok);
5440 LDKGossipTimestampFilter res_var = (*val->contents.result);
5441 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5442 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5443 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5446 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
5447 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5448 CHECK(!val->result_ok);
5449 LDKDecodeError err_var = (*val->contents.err);
5450 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5451 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5452 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5455 uint32_t __attribute__((visibility("default"))) TS_LDKSignOrCreationError_ref_from_ptr(uint32_t ptr) {
5456 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5458 case LDKSignOrCreationError_SignError: {
5459 return 0 /* LDKSignOrCreationError - SignError */;
5461 case LDKSignOrCreationError_CreationError: {
5462 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
5463 return 0 /* LDKSignOrCreationError - CreationError */; (void) creation_error_conv;
5468 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(uint32_t arg) {
5469 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5471 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t arg) {
5472 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5473 CHECK(val->result_ok);
5474 LDKInvoice res_var = (*val->contents.result);
5475 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5476 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5477 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5480 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t arg) {
5481 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5482 CHECK(!val->result_ok);
5483 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5486 typedef struct LDKFilter_JCalls {
5487 atomic_size_t refcnt;
5488 uint32_t register_tx_meth;
5489 uint32_t register_output_meth;
5491 static void LDKFilter_JCalls_free(void* this_arg) {
5492 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5493 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5494 js_free(j_calls->register_tx_meth);
5495 js_free(j_calls->register_output_meth);
5499 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5500 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5501 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5502 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5503 LDKu8slice script_pubkey_var = script_pubkey;
5504 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5505 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
5506 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5508 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5509 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5510 LDKWatchedOutput output_var = output;
5511 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5512 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5513 uint64_t output_ref = (uint64_t)output_var.inner;
5514 if (output_var.is_owned) {
5517 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
5518 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5519 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
5522 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5523 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5524 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5526 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5527 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5528 atomic_init(&calls->refcnt, 1);
5529 //TODO: Assign calls->o from o
5532 .this_arg = (void*) calls,
5533 .register_tx = register_tx_LDKFilter_jcall,
5534 .register_output = register_output_LDKFilter_jcall,
5535 .free = LDKFilter_JCalls_free,
5539 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5540 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5541 *res_ptr = LDKFilter_init(o);
5542 return (long)res_ptr;
5544 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5545 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5546 unsigned char txid_arr[32];
5547 CHECK(*((uint32_t*)txid) == 32);
5548 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5549 unsigned char (*txid_ref)[32] = &txid_arr;
5550 LDKu8slice script_pubkey_ref;
5551 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
5552 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
5553 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5556 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5557 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5558 LDKWatchedOutput output_conv;
5559 output_conv.inner = (void*)(output & (~1));
5560 output_conv.is_owned = (output & 1) || (output == 0);
5561 output_conv = WatchedOutput_clone(&output_conv);
5562 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5563 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5564 uint64_t ret_ref = (uint64_t)ret_copy;
5568 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5569 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5571 case LDKCOption_FilterZ_Some: {
5572 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
5573 *some_ret = obj->some;
5574 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5575 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5577 case LDKCOption_FilterZ_None: {
5578 return 0 /* LDKCOption_FilterZ - None */;
5583 jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) {
5584 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
5586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) {
5587 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5588 CHECK(val->result_ok);
5589 LDKLockedChannelMonitor res_var = (*val->contents.result);
5590 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5591 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5592 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5595 void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) {
5596 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
5597 CHECK(!val->result_ok);
5598 return *val->contents.err;
5600 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) {
5601 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
5602 ret->datalen = *((uint32_t*)elems);
5603 if (ret->datalen == 0) {
5606 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
5607 uint32_t *java_elems = (uint32_t*)(elems + 4);
5608 for (size_t i = 0; i < ret->datalen; i++) {
5609 uint32_t arr_elem = java_elems[i];
5610 LDKOutPoint arr_elem_conv;
5611 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5612 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5613 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
5614 ret->data[i] = arr_elem_conv;
5617 return (uint64_t)ret;
5619 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5620 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5621 for (size_t i = 0; i < ret.datalen; i++) {
5622 ret.data[i] = OutPoint_clone(&orig->data[i]);
5626 typedef struct LDKMessageSendEventsProvider_JCalls {
5627 atomic_size_t refcnt;
5628 uint32_t get_and_clear_pending_msg_events_meth;
5629 } LDKMessageSendEventsProvider_JCalls;
5630 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5631 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5633 js_free(j_calls->get_and_clear_pending_msg_events_meth);
5637 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5638 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5639 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
5640 LDKCVec_MessageSendEventZ ret_constr;
5641 ret_constr.datalen = *((uint32_t*)ret);
5642 if (ret_constr.datalen > 0)
5643 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5645 ret_constr.data = NULL;
5646 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5647 for (size_t s = 0; s < ret_constr.datalen; s++) {
5648 uint32_t ret_conv_18 = ret_vals[s];
5649 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5650 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5651 ret_constr.data[s] = ret_conv_18_conv;
5655 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
5656 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
5657 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5659 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5660 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5661 atomic_init(&calls->refcnt, 1);
5662 //TODO: Assign calls->o from o
5664 LDKMessageSendEventsProvider ret = {
5665 .this_arg = (void*) calls,
5666 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
5667 .free = LDKMessageSendEventsProvider_JCalls_free,
5671 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5672 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5673 *res_ptr = LDKMessageSendEventsProvider_init(o);
5674 return (long)res_ptr;
5676 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
5677 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
5678 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
5679 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5680 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5681 for (size_t s = 0; s < ret_var.datalen; s++) {
5682 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5683 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
5684 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
5685 ret_arr_ptr[s] = ret_conv_18_ref;
5691 typedef struct LDKEventHandler_JCalls {
5692 atomic_size_t refcnt;
5693 uint32_t handle_event_meth;
5694 } LDKEventHandler_JCalls;
5695 static void LDKEventHandler_JCalls_free(void* this_arg) {
5696 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5697 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5698 js_free(j_calls->handle_event_meth);
5702 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
5703 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
5704 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
5705 *ret_event = Event_clone(event);
5706 js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
5708 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
5709 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
5710 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5712 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
5713 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
5714 atomic_init(&calls->refcnt, 1);
5715 //TODO: Assign calls->o from o
5717 LDKEventHandler ret = {
5718 .this_arg = (void*) calls,
5719 .handle_event = handle_event_LDKEventHandler_jcall,
5720 .free = LDKEventHandler_JCalls_free,
5724 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
5725 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5726 *res_ptr = LDKEventHandler_init(o);
5727 return (long)res_ptr;
5729 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
5730 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
5731 LDKEvent* event_conv = (LDKEvent*)event;
5732 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
5735 typedef struct LDKEventsProvider_JCalls {
5736 atomic_size_t refcnt;
5737 uint32_t process_pending_events_meth;
5738 } LDKEventsProvider_JCalls;
5739 static void LDKEventsProvider_JCalls_free(void* this_arg) {
5740 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5741 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5742 js_free(j_calls->process_pending_events_meth);
5746 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
5747 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
5748 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
5749 *handler_ret = handler;
5750 js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
5752 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
5753 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
5754 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5756 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
5757 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
5758 atomic_init(&calls->refcnt, 1);
5759 //TODO: Assign calls->o from o
5761 LDKEventsProvider ret = {
5762 .this_arg = (void*) calls,
5763 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
5764 .free = LDKEventsProvider_JCalls_free,
5768 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
5769 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5770 *res_ptr = LDKEventsProvider_init(o);
5771 return (long)res_ptr;
5773 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
5774 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
5775 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
5776 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
5779 typedef struct LDKListen_JCalls {
5780 atomic_size_t refcnt;
5781 uint32_t block_connected_meth;
5782 uint32_t block_disconnected_meth;
5784 static void LDKListen_JCalls_free(void* this_arg) {
5785 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5786 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5787 js_free(j_calls->block_connected_meth);
5788 js_free(j_calls->block_disconnected_meth);
5792 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
5793 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5794 LDKu8slice block_var = block;
5795 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5796 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
5797 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
5799 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5800 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
5801 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5802 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5803 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
5805 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
5806 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
5807 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5809 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
5810 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
5811 atomic_init(&calls->refcnt, 1);
5812 //TODO: Assign calls->o from o
5815 .this_arg = (void*) calls,
5816 .block_connected = block_connected_LDKListen_jcall,
5817 .block_disconnected = block_disconnected_LDKListen_jcall,
5818 .free = LDKListen_JCalls_free,
5822 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
5823 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5824 *res_ptr = LDKListen_init(o);
5825 return (long)res_ptr;
5827 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
5828 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5829 LDKu8slice block_ref;
5830 block_ref.datalen = *((uint32_t*)block);
5831 block_ref.data = (int8_t*)(block + 4);
5832 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5835 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
5836 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5837 unsigned char header_arr[80];
5838 CHECK(*((uint32_t*)header) == 80);
5839 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5840 unsigned char (*header_ref)[80] = &header_arr;
5841 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5844 typedef struct LDKConfirm_JCalls {
5845 atomic_size_t refcnt;
5846 uint32_t transactions_confirmed_meth;
5847 uint32_t transaction_unconfirmed_meth;
5848 uint32_t best_block_updated_meth;
5849 uint32_t get_relevant_txids_meth;
5850 } LDKConfirm_JCalls;
5851 static void LDKConfirm_JCalls_free(void* this_arg) {
5852 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5853 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5854 js_free(j_calls->transactions_confirmed_meth);
5855 js_free(j_calls->transaction_unconfirmed_meth);
5856 js_free(j_calls->best_block_updated_meth);
5857 js_free(j_calls->get_relevant_txids_meth);
5861 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
5862 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5863 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5864 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5865 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
5866 uint32_tArray txdata_arr = init_arr(txdata_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5867 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
5868 for (size_t c = 0; c < txdata_var.datalen; c++) {
5869 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5870 *txdata_conv_28_conv = txdata_var.data[c];
5871 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
5873 FREE(txdata_var.data);
5874 js_invoke_function_3(j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
5876 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
5877 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5878 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5879 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
5880 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, txid_arr);
5882 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
5883 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5884 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
5885 memcpy((uint8_t*)(header_arr + 4), *header, 80);
5886 js_invoke_function_2(j_calls->best_block_updated_meth, header_arr, height);
5888 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
5889 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
5890 ptrArray ret = js_invoke_function_0(j_calls->get_relevant_txids_meth);
5891 LDKCVec_TxidZ ret_constr;
5892 ret_constr.datalen = *((uint32_t*)ret);
5893 if (ret_constr.datalen > 0)
5894 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
5896 ret_constr.data = NULL;
5897 int8_tArray* ret_vals = (int8_tArray*)(ret + 4);
5898 for (size_t m = 0; m < ret_constr.datalen; m++) {
5899 int8_tArray ret_conv_12 = ret_vals[m];
5900 LDKThirtyTwoBytes ret_conv_12_ref;
5901 CHECK(*((uint32_t*)ret_conv_12) == 32);
5902 memcpy(ret_conv_12_ref.data, (uint8_t*)(ret_conv_12 + 4), 32);
5903 ret_constr.data[m] = ret_conv_12_ref;
5907 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
5908 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
5909 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5911 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
5912 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
5913 atomic_init(&calls->refcnt, 1);
5914 //TODO: Assign calls->o from o
5917 .this_arg = (void*) calls,
5918 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
5919 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
5920 .best_block_updated = best_block_updated_LDKConfirm_jcall,
5921 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
5922 .free = LDKConfirm_JCalls_free,
5926 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
5927 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
5928 *res_ptr = LDKConfirm_init(o);
5929 return (long)res_ptr;
5931 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5932 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5933 unsigned char header_arr[80];
5934 CHECK(*((uint32_t*)header) == 80);
5935 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5936 unsigned char (*header_ref)[80] = &header_arr;
5937 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5938 txdata_constr.datalen = *((uint32_t*)txdata);
5939 if (txdata_constr.datalen > 0)
5940 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5942 txdata_constr.data = NULL;
5943 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
5944 for (size_t c = 0; c < txdata_constr.datalen; c++) {
5945 uint32_t txdata_conv_28 = txdata_vals[c];
5946 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
5947 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
5948 txdata_constr.data[c] = txdata_conv_28_conv;
5950 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
5953 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
5954 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5955 unsigned char txid_arr[32];
5956 CHECK(*((uint32_t*)txid) == 32);
5957 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
5958 unsigned char (*txid_ref)[32] = &txid_arr;
5959 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
5962 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
5963 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5964 unsigned char header_arr[80];
5965 CHECK(*((uint32_t*)header) == 80);
5966 memcpy(header_arr, (uint8_t*)(header + 4), 80);
5967 unsigned char (*header_ref)[80] = &header_arr;
5968 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
5971 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
5972 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
5973 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
5974 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
5975 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5976 for (size_t m = 0; m < ret_var.datalen; m++) {
5977 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
5978 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
5979 ret_arr_ptr[m] = ret_conv_12_arr;
5985 typedef struct LDKPersist_JCalls {
5986 atomic_size_t refcnt;
5987 uint32_t persist_new_channel_meth;
5988 uint32_t update_persisted_channel_meth;
5989 } LDKPersist_JCalls;
5990 static void LDKPersist_JCalls_free(void* this_arg) {
5991 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5992 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5993 js_free(j_calls->persist_new_channel_meth);
5994 js_free(j_calls->update_persisted_channel_meth);
5998 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5999 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6000 LDKOutPoint id_var = id;
6001 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6002 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6003 uint64_t id_ref = (uint64_t)id_var.inner;
6004 if (id_var.is_owned) {
6007 LDKChannelMonitor data_var = *data;
6008 data_var = ChannelMonitor_clone(data);
6009 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6010 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6011 uint64_t data_ref = (uint64_t)data_var.inner;
6012 if (data_var.is_owned) {
6015 uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
6016 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6017 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6020 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6021 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6022 LDKOutPoint id_var = id;
6023 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 uint64_t id_ref = (uint64_t)id_var.inner;
6026 if (id_var.is_owned) {
6029 LDKChannelMonitorUpdate update_var = *update;
6030 update_var = ChannelMonitorUpdate_clone(update);
6031 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6032 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6033 uint64_t update_ref = (uint64_t)update_var.inner;
6034 if (update_var.is_owned) {
6037 LDKChannelMonitor data_var = *data;
6038 data_var = ChannelMonitor_clone(data);
6039 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6040 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6041 uint64_t data_ref = (uint64_t)data_var.inner;
6042 if (data_var.is_owned) {
6045 uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6046 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6047 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6050 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6051 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6052 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6054 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6055 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6056 atomic_init(&calls->refcnt, 1);
6057 //TODO: Assign calls->o from o
6060 .this_arg = (void*) calls,
6061 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6062 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6063 .free = LDKPersist_JCalls_free,
6067 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6068 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6069 *res_ptr = LDKPersist_init(o);
6070 return (long)res_ptr;
6072 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
6073 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6074 LDKOutPoint id_conv;
6075 id_conv.inner = (void*)(id & (~1));
6076 id_conv.is_owned = (id & 1) || (id == 0);
6077 id_conv = OutPoint_clone(&id_conv);
6078 LDKChannelMonitor data_conv;
6079 data_conv.inner = (void*)(data & (~1));
6080 data_conv.is_owned = false;
6081 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6082 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6083 return (uint64_t)ret_conv;
6086 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
6087 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6088 LDKOutPoint id_conv;
6089 id_conv.inner = (void*)(id & (~1));
6090 id_conv.is_owned = (id & 1) || (id == 0);
6091 id_conv = OutPoint_clone(&id_conv);
6092 LDKChannelMonitorUpdate update_conv;
6093 update_conv.inner = (void*)(update & (~1));
6094 update_conv.is_owned = false;
6095 LDKChannelMonitor data_conv;
6096 data_conv.inner = (void*)(data & (~1));
6097 data_conv.is_owned = false;
6098 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6099 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6100 return (uint64_t)ret_conv;
6103 typedef struct LDKChannelMessageHandler_JCalls {
6104 atomic_size_t refcnt;
6105 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6106 uint32_t handle_open_channel_meth;
6107 uint32_t handle_accept_channel_meth;
6108 uint32_t handle_funding_created_meth;
6109 uint32_t handle_funding_signed_meth;
6110 uint32_t handle_funding_locked_meth;
6111 uint32_t handle_shutdown_meth;
6112 uint32_t handle_closing_signed_meth;
6113 uint32_t handle_update_add_htlc_meth;
6114 uint32_t handle_update_fulfill_htlc_meth;
6115 uint32_t handle_update_fail_htlc_meth;
6116 uint32_t handle_update_fail_malformed_htlc_meth;
6117 uint32_t handle_commitment_signed_meth;
6118 uint32_t handle_revoke_and_ack_meth;
6119 uint32_t handle_update_fee_meth;
6120 uint32_t handle_announcement_signatures_meth;
6121 uint32_t peer_disconnected_meth;
6122 uint32_t peer_connected_meth;
6123 uint32_t handle_channel_reestablish_meth;
6124 uint32_t handle_channel_update_meth;
6125 uint32_t handle_error_meth;
6126 } LDKChannelMessageHandler_JCalls;
6127 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6128 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6129 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6130 js_free(j_calls->handle_open_channel_meth);
6131 js_free(j_calls->handle_accept_channel_meth);
6132 js_free(j_calls->handle_funding_created_meth);
6133 js_free(j_calls->handle_funding_signed_meth);
6134 js_free(j_calls->handle_funding_locked_meth);
6135 js_free(j_calls->handle_shutdown_meth);
6136 js_free(j_calls->handle_closing_signed_meth);
6137 js_free(j_calls->handle_update_add_htlc_meth);
6138 js_free(j_calls->handle_update_fulfill_htlc_meth);
6139 js_free(j_calls->handle_update_fail_htlc_meth);
6140 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
6141 js_free(j_calls->handle_commitment_signed_meth);
6142 js_free(j_calls->handle_revoke_and_ack_meth);
6143 js_free(j_calls->handle_update_fee_meth);
6144 js_free(j_calls->handle_announcement_signatures_meth);
6145 js_free(j_calls->peer_disconnected_meth);
6146 js_free(j_calls->peer_connected_meth);
6147 js_free(j_calls->handle_channel_reestablish_meth);
6148 js_free(j_calls->handle_channel_update_meth);
6149 js_free(j_calls->handle_error_meth);
6153 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6154 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6155 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6156 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6157 LDKInitFeatures their_features_var = their_features;
6158 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6159 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6160 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6161 if (their_features_var.is_owned) {
6162 their_features_ref |= 1;
6164 LDKOpenChannel msg_var = *msg;
6165 msg_var = OpenChannel_clone(msg);
6166 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6167 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6168 uint64_t msg_ref = (uint64_t)msg_var.inner;
6169 if (msg_var.is_owned) {
6172 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6174 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6175 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6176 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6177 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6178 LDKInitFeatures their_features_var = their_features;
6179 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6180 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6181 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6182 if (their_features_var.is_owned) {
6183 their_features_ref |= 1;
6185 LDKAcceptChannel msg_var = *msg;
6186 msg_var = AcceptChannel_clone(msg);
6187 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6188 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6189 uint64_t msg_ref = (uint64_t)msg_var.inner;
6190 if (msg_var.is_owned) {
6193 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6195 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6196 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6197 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6198 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6199 LDKFundingCreated msg_var = *msg;
6200 msg_var = FundingCreated_clone(msg);
6201 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6202 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6203 uint64_t msg_ref = (uint64_t)msg_var.inner;
6204 if (msg_var.is_owned) {
6207 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
6209 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
6210 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6211 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6212 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6213 LDKFundingSigned msg_var = *msg;
6214 msg_var = FundingSigned_clone(msg);
6215 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6216 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6217 uint64_t msg_ref = (uint64_t)msg_var.inner;
6218 if (msg_var.is_owned) {
6221 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
6223 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
6224 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6225 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6226 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6227 LDKFundingLocked msg_var = *msg;
6228 msg_var = FundingLocked_clone(msg);
6229 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6230 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6231 uint64_t msg_ref = (uint64_t)msg_var.inner;
6232 if (msg_var.is_owned) {
6235 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
6237 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
6238 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6239 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6240 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6241 LDKInitFeatures their_features_var = *their_features;
6242 their_features_var = InitFeatures_clone(their_features);
6243 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6244 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6245 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6246 if (their_features_var.is_owned) {
6247 their_features_ref |= 1;
6249 LDKShutdown msg_var = *msg;
6250 msg_var = Shutdown_clone(msg);
6251 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6252 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6253 uint64_t msg_ref = (uint64_t)msg_var.inner;
6254 if (msg_var.is_owned) {
6257 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
6259 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
6260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6261 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6262 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6263 LDKClosingSigned msg_var = *msg;
6264 msg_var = ClosingSigned_clone(msg);
6265 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6266 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6267 uint64_t msg_ref = (uint64_t)msg_var.inner;
6268 if (msg_var.is_owned) {
6271 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
6273 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
6274 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6275 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6276 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6277 LDKUpdateAddHTLC msg_var = *msg;
6278 msg_var = UpdateAddHTLC_clone(msg);
6279 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6280 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6281 uint64_t msg_ref = (uint64_t)msg_var.inner;
6282 if (msg_var.is_owned) {
6285 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
6287 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
6288 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6289 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6290 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6291 LDKUpdateFulfillHTLC msg_var = *msg;
6292 msg_var = UpdateFulfillHTLC_clone(msg);
6293 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6294 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6295 uint64_t msg_ref = (uint64_t)msg_var.inner;
6296 if (msg_var.is_owned) {
6299 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
6301 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
6302 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6303 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6304 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6305 LDKUpdateFailHTLC msg_var = *msg;
6306 msg_var = UpdateFailHTLC_clone(msg);
6307 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6308 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6309 uint64_t msg_ref = (uint64_t)msg_var.inner;
6310 if (msg_var.is_owned) {
6313 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
6315 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
6316 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6317 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6318 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6319 LDKUpdateFailMalformedHTLC msg_var = *msg;
6320 msg_var = UpdateFailMalformedHTLC_clone(msg);
6321 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6322 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6323 uint64_t msg_ref = (uint64_t)msg_var.inner;
6324 if (msg_var.is_owned) {
6327 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
6329 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
6330 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6331 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6332 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6333 LDKCommitmentSigned msg_var = *msg;
6334 msg_var = CommitmentSigned_clone(msg);
6335 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6336 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6337 uint64_t msg_ref = (uint64_t)msg_var.inner;
6338 if (msg_var.is_owned) {
6341 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
6343 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
6344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6345 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6346 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6347 LDKRevokeAndACK msg_var = *msg;
6348 msg_var = RevokeAndACK_clone(msg);
6349 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6350 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6351 uint64_t msg_ref = (uint64_t)msg_var.inner;
6352 if (msg_var.is_owned) {
6355 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
6357 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
6358 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6359 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6360 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6361 LDKUpdateFee msg_var = *msg;
6362 msg_var = UpdateFee_clone(msg);
6363 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6364 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6365 uint64_t msg_ref = (uint64_t)msg_var.inner;
6366 if (msg_var.is_owned) {
6369 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
6371 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
6372 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6373 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6374 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6375 LDKAnnouncementSignatures msg_var = *msg;
6376 msg_var = AnnouncementSignatures_clone(msg);
6377 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6378 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6379 uint64_t msg_ref = (uint64_t)msg_var.inner;
6380 if (msg_var.is_owned) {
6383 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
6385 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
6386 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6387 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6388 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6389 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
6391 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
6392 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6393 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6394 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6395 LDKInit msg_var = *msg;
6396 msg_var = Init_clone(msg);
6397 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6398 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6399 uint64_t msg_ref = (uint64_t)msg_var.inner;
6400 if (msg_var.is_owned) {
6403 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
6405 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
6406 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6407 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6408 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6409 LDKChannelReestablish msg_var = *msg;
6410 msg_var = ChannelReestablish_clone(msg);
6411 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6412 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6413 uint64_t msg_ref = (uint64_t)msg_var.inner;
6414 if (msg_var.is_owned) {
6417 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
6419 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
6420 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6421 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6422 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6423 LDKChannelUpdate msg_var = *msg;
6424 msg_var = ChannelUpdate_clone(msg);
6425 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6426 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6427 uint64_t msg_ref = (uint64_t)msg_var.inner;
6428 if (msg_var.is_owned) {
6431 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
6433 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
6434 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6435 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6436 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6437 LDKErrorMessage msg_var = *msg;
6438 msg_var = ErrorMessage_clone(msg);
6439 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6440 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6441 uint64_t msg_ref = (uint64_t)msg_var.inner;
6442 if (msg_var.is_owned) {
6445 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
6447 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
6448 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
6449 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6450 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6452 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6453 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
6454 atomic_init(&calls->refcnt, 1);
6455 //TODO: Assign calls->o from o
6457 LDKChannelMessageHandler ret = {
6458 .this_arg = (void*) calls,
6459 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
6460 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
6461 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
6462 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
6463 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
6464 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
6465 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
6466 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
6467 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
6468 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
6469 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
6470 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
6471 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
6472 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
6473 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
6474 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
6475 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
6476 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
6477 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
6478 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
6479 .free = LDKChannelMessageHandler_JCalls_free,
6480 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6482 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6485 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6486 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6487 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
6488 return (long)res_ptr;
6490 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) {
6491 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6492 LDKPublicKey their_node_id_ref;
6493 CHECK(*((uint32_t*)their_node_id) == 33);
6494 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6495 LDKInitFeatures their_features_conv;
6496 their_features_conv.inner = (void*)(their_features & (~1));
6497 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6498 their_features_conv = InitFeatures_clone(&their_features_conv);
6499 LDKOpenChannel msg_conv;
6500 msg_conv.inner = (void*)(msg & (~1));
6501 msg_conv.is_owned = false;
6502 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6505 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) {
6506 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6507 LDKPublicKey their_node_id_ref;
6508 CHECK(*((uint32_t*)their_node_id) == 33);
6509 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6510 LDKInitFeatures their_features_conv;
6511 their_features_conv.inner = (void*)(their_features & (~1));
6512 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
6513 their_features_conv = InitFeatures_clone(&their_features_conv);
6514 LDKAcceptChannel msg_conv;
6515 msg_conv.inner = (void*)(msg & (~1));
6516 msg_conv.is_owned = false;
6517 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
6520 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6521 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6522 LDKPublicKey their_node_id_ref;
6523 CHECK(*((uint32_t*)their_node_id) == 33);
6524 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6525 LDKFundingCreated msg_conv;
6526 msg_conv.inner = (void*)(msg & (~1));
6527 msg_conv.is_owned = false;
6528 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6531 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6532 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6533 LDKPublicKey their_node_id_ref;
6534 CHECK(*((uint32_t*)their_node_id) == 33);
6535 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6536 LDKFundingSigned msg_conv;
6537 msg_conv.inner = (void*)(msg & (~1));
6538 msg_conv.is_owned = false;
6539 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6542 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6543 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6544 LDKPublicKey their_node_id_ref;
6545 CHECK(*((uint32_t*)their_node_id) == 33);
6546 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6547 LDKFundingLocked msg_conv;
6548 msg_conv.inner = (void*)(msg & (~1));
6549 msg_conv.is_owned = false;
6550 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6553 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
6554 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6555 LDKPublicKey their_node_id_ref;
6556 CHECK(*((uint32_t*)their_node_id) == 33);
6557 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6558 LDKInitFeatures their_features_conv;
6559 their_features_conv.inner = (void*)(their_features & (~1));
6560 their_features_conv.is_owned = false;
6561 LDKShutdown msg_conv;
6562 msg_conv.inner = (void*)(msg & (~1));
6563 msg_conv.is_owned = false;
6564 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
6567 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6568 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6569 LDKPublicKey their_node_id_ref;
6570 CHECK(*((uint32_t*)their_node_id) == 33);
6571 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6572 LDKClosingSigned msg_conv;
6573 msg_conv.inner = (void*)(msg & (~1));
6574 msg_conv.is_owned = false;
6575 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6578 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6579 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6580 LDKPublicKey their_node_id_ref;
6581 CHECK(*((uint32_t*)their_node_id) == 33);
6582 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6583 LDKUpdateAddHTLC msg_conv;
6584 msg_conv.inner = (void*)(msg & (~1));
6585 msg_conv.is_owned = false;
6586 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6589 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6590 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6591 LDKPublicKey their_node_id_ref;
6592 CHECK(*((uint32_t*)their_node_id) == 33);
6593 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6594 LDKUpdateFulfillHTLC msg_conv;
6595 msg_conv.inner = (void*)(msg & (~1));
6596 msg_conv.is_owned = false;
6597 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6600 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6602 LDKPublicKey their_node_id_ref;
6603 CHECK(*((uint32_t*)their_node_id) == 33);
6604 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6605 LDKUpdateFailHTLC msg_conv;
6606 msg_conv.inner = (void*)(msg & (~1));
6607 msg_conv.is_owned = false;
6608 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6611 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6613 LDKPublicKey their_node_id_ref;
6614 CHECK(*((uint32_t*)their_node_id) == 33);
6615 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6616 LDKUpdateFailMalformedHTLC msg_conv;
6617 msg_conv.inner = (void*)(msg & (~1));
6618 msg_conv.is_owned = false;
6619 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6622 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6623 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6624 LDKPublicKey their_node_id_ref;
6625 CHECK(*((uint32_t*)their_node_id) == 33);
6626 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6627 LDKCommitmentSigned msg_conv;
6628 msg_conv.inner = (void*)(msg & (~1));
6629 msg_conv.is_owned = false;
6630 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6633 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6634 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6635 LDKPublicKey their_node_id_ref;
6636 CHECK(*((uint32_t*)their_node_id) == 33);
6637 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6638 LDKRevokeAndACK msg_conv;
6639 msg_conv.inner = (void*)(msg & (~1));
6640 msg_conv.is_owned = false;
6641 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6644 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6646 LDKPublicKey their_node_id_ref;
6647 CHECK(*((uint32_t*)their_node_id) == 33);
6648 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6649 LDKUpdateFee msg_conv;
6650 msg_conv.inner = (void*)(msg & (~1));
6651 msg_conv.is_owned = false;
6652 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6655 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6656 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6657 LDKPublicKey their_node_id_ref;
6658 CHECK(*((uint32_t*)their_node_id) == 33);
6659 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6660 LDKAnnouncementSignatures msg_conv;
6661 msg_conv.inner = (void*)(msg & (~1));
6662 msg_conv.is_owned = false;
6663 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6666 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
6667 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6668 LDKPublicKey their_node_id_ref;
6669 CHECK(*((uint32_t*)their_node_id) == 33);
6670 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6671 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
6674 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6675 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6676 LDKPublicKey their_node_id_ref;
6677 CHECK(*((uint32_t*)their_node_id) == 33);
6678 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6680 msg_conv.inner = (void*)(msg & (~1));
6681 msg_conv.is_owned = false;
6682 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6685 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6686 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((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 LDKChannelReestablish msg_conv;
6691 msg_conv.inner = (void*)(msg & (~1));
6692 msg_conv.is_owned = false;
6693 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6696 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6697 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6698 LDKPublicKey their_node_id_ref;
6699 CHECK(*((uint32_t*)their_node_id) == 33);
6700 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6701 LDKChannelUpdate msg_conv;
6702 msg_conv.inner = (void*)(msg & (~1));
6703 msg_conv.is_owned = false;
6704 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6707 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
6708 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
6709 LDKPublicKey their_node_id_ref;
6710 CHECK(*((uint32_t*)their_node_id) == 33);
6711 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
6712 LDKErrorMessage msg_conv;
6713 msg_conv.inner = (void*)(msg & (~1));
6714 msg_conv.is_owned = false;
6715 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
6718 typedef struct LDKRoutingMessageHandler_JCalls {
6719 atomic_size_t refcnt;
6720 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6721 uint32_t handle_node_announcement_meth;
6722 uint32_t handle_channel_announcement_meth;
6723 uint32_t handle_channel_update_meth;
6724 uint32_t get_next_channel_announcements_meth;
6725 uint32_t get_next_node_announcements_meth;
6726 uint32_t sync_routing_table_meth;
6727 uint32_t handle_reply_channel_range_meth;
6728 uint32_t handle_reply_short_channel_ids_end_meth;
6729 uint32_t handle_query_channel_range_meth;
6730 uint32_t handle_query_short_channel_ids_meth;
6731 } LDKRoutingMessageHandler_JCalls;
6732 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6733 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6734 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6735 js_free(j_calls->handle_node_announcement_meth);
6736 js_free(j_calls->handle_channel_announcement_meth);
6737 js_free(j_calls->handle_channel_update_meth);
6738 js_free(j_calls->get_next_channel_announcements_meth);
6739 js_free(j_calls->get_next_node_announcements_meth);
6740 js_free(j_calls->sync_routing_table_meth);
6741 js_free(j_calls->handle_reply_channel_range_meth);
6742 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
6743 js_free(j_calls->handle_query_channel_range_meth);
6744 js_free(j_calls->handle_query_short_channel_ids_meth);
6748 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6749 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6750 LDKNodeAnnouncement msg_var = *msg;
6751 msg_var = NodeAnnouncement_clone(msg);
6752 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6753 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6754 uint64_t msg_ref = (uint64_t)msg_var.inner;
6755 if (msg_var.is_owned) {
6758 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
6759 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6760 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6763 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6764 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6765 LDKChannelAnnouncement msg_var = *msg;
6766 msg_var = ChannelAnnouncement_clone(msg);
6767 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6768 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6769 uint64_t msg_ref = (uint64_t)msg_var.inner;
6770 if (msg_var.is_owned) {
6773 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
6774 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6775 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6778 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6779 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6780 LDKChannelUpdate msg_var = *msg;
6781 msg_var = ChannelUpdate_clone(msg);
6782 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6783 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6784 uint64_t msg_ref = (uint64_t)msg_var.inner;
6785 if (msg_var.is_owned) {
6788 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
6789 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6790 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
6793 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6794 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6795 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6796 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6797 ret_constr.datalen = *((uint32_t*)ret);
6798 if (ret_constr.datalen > 0)
6799 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6801 ret_constr.data = NULL;
6802 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6803 for (size_t h = 0; h < ret_constr.datalen; h++) {
6804 uint32_t ret_conv_59 = ret_vals[h];
6805 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1);
6806 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
6807 ret_constr.data[h] = ret_conv_59_conv;
6811 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6812 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6813 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6814 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
6815 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6816 LDKCVec_NodeAnnouncementZ ret_constr;
6817 ret_constr.datalen = *((uint32_t*)ret);
6818 if (ret_constr.datalen > 0)
6819 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6821 ret_constr.data = NULL;
6822 uint32_t* ret_vals = (uint32_t*)(ret + 4);
6823 for (size_t s = 0; s < ret_constr.datalen; s++) {
6824 uint32_t ret_conv_18 = ret_vals[s];
6825 LDKNodeAnnouncement ret_conv_18_conv;
6826 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6827 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6828 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6829 ret_constr.data[s] = ret_conv_18_conv;
6833 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6834 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6835 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6836 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6837 LDKInit init_var = *init;
6838 init_var = Init_clone(init);
6839 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6840 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6841 uint64_t init_ref = (uint64_t)init_var.inner;
6842 if (init_var.is_owned) {
6845 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6847 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6848 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6849 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6850 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6851 LDKReplyChannelRange msg_var = msg;
6852 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6853 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6854 uint64_t msg_ref = (uint64_t)msg_var.inner;
6855 if (msg_var.is_owned) {
6858 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6859 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6860 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6863 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6864 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6865 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6866 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6867 LDKReplyShortChannelIdsEnd msg_var = msg;
6868 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6869 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6870 uint64_t msg_ref = (uint64_t)msg_var.inner;
6871 if (msg_var.is_owned) {
6874 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6875 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6876 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6879 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6880 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6881 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6882 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6883 LDKQueryChannelRange msg_var = msg;
6884 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6885 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6886 uint64_t msg_ref = (uint64_t)msg_var.inner;
6887 if (msg_var.is_owned) {
6890 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6891 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6892 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6895 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6896 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6897 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
6898 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
6899 LDKQueryShortChannelIds msg_var = msg;
6900 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6901 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6902 uint64_t msg_ref = (uint64_t)msg_var.inner;
6903 if (msg_var.is_owned) {
6906 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6907 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6908 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
6911 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
6912 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
6913 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6914 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6916 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
6917 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6918 atomic_init(&calls->refcnt, 1);
6919 //TODO: Assign calls->o from o
6921 LDKRoutingMessageHandler ret = {
6922 .this_arg = (void*) calls,
6923 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6924 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6925 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6926 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6927 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6928 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6929 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6930 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6931 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6932 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6933 .free = LDKRoutingMessageHandler_JCalls_free,
6934 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
6936 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6939 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
6940 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6941 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
6942 return (long)res_ptr;
6944 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
6945 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6946 LDKNodeAnnouncement msg_conv;
6947 msg_conv.inner = (void*)(msg & (~1));
6948 msg_conv.is_owned = false;
6949 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6950 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6951 return (uint64_t)ret_conv;
6954 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
6955 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6956 LDKChannelAnnouncement msg_conv;
6957 msg_conv.inner = (void*)(msg & (~1));
6958 msg_conv.is_owned = false;
6959 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6960 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6961 return (uint64_t)ret_conv;
6964 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
6965 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6966 LDKChannelUpdate msg_conv;
6967 msg_conv.inner = (void*)(msg & (~1));
6968 msg_conv.is_owned = false;
6969 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6970 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6971 return (uint64_t)ret_conv;
6974 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
6975 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6976 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6977 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6978 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6979 for (size_t h = 0; h < ret_var.datalen; h++) {
6980 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6981 *ret_conv_59_conv = ret_var.data[h];
6982 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
6988 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6989 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6990 LDKPublicKey starting_point_ref;
6991 CHECK(*((uint32_t*)starting_point) == 33);
6992 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
6993 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6994 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
6995 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6996 for (size_t s = 0; s < ret_var.datalen; s++) {
6997 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6998 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6999 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7000 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
7001 if (ret_conv_18_var.is_owned) {
7002 ret_conv_18_ref |= 1;
7004 ret_arr_ptr[s] = ret_conv_18_ref;
7010 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
7011 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
7012 LDKPublicKey their_node_id_ref;
7013 CHECK(*((uint32_t*)their_node_id) == 33);
7014 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7016 init_conv.inner = (void*)(init & (~1));
7017 init_conv.is_owned = false;
7018 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
7021 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7022 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
7023 LDKPublicKey their_node_id_ref;
7024 CHECK(*((uint32_t*)their_node_id) == 33);
7025 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7026 LDKReplyChannelRange msg_conv;
7027 msg_conv.inner = (void*)(msg & (~1));
7028 msg_conv.is_owned = (msg & 1) || (msg == 0);
7029 msg_conv = ReplyChannelRange_clone(&msg_conv);
7030 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7031 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7032 return (uint64_t)ret_conv;
7035 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) {
7036 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
7037 LDKPublicKey their_node_id_ref;
7038 CHECK(*((uint32_t*)their_node_id) == 33);
7039 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7040 LDKReplyShortChannelIdsEnd msg_conv;
7041 msg_conv.inner = (void*)(msg & (~1));
7042 msg_conv.is_owned = (msg & 1) || (msg == 0);
7043 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
7044 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7045 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7046 return (uint64_t)ret_conv;
7049 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7050 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
7051 LDKPublicKey their_node_id_ref;
7052 CHECK(*((uint32_t*)their_node_id) == 33);
7053 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7054 LDKQueryChannelRange msg_conv;
7055 msg_conv.inner = (void*)(msg & (~1));
7056 msg_conv.is_owned = (msg & 1) || (msg == 0);
7057 msg_conv = QueryChannelRange_clone(&msg_conv);
7058 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7059 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7060 return (uint64_t)ret_conv;
7063 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7064 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
7065 LDKPublicKey their_node_id_ref;
7066 CHECK(*((uint32_t*)their_node_id) == 33);
7067 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
7068 LDKQueryShortChannelIds msg_conv;
7069 msg_conv.inner = (void*)(msg & (~1));
7070 msg_conv.is_owned = (msg & 1) || (msg == 0);
7071 msg_conv = QueryShortChannelIds_clone(&msg_conv);
7072 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7073 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
7074 return (uint64_t)ret_conv;
7077 typedef struct LDKCustomMessageReader_JCalls {
7078 atomic_size_t refcnt;
7080 } LDKCustomMessageReader_JCalls;
7081 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
7082 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7083 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7084 js_free(j_calls->read_meth);
7088 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
7089 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
7090 LDKu8slice buffer_var = buffer;
7091 int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7092 memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
7093 uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
7094 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
7095 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
7098 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
7099 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
7100 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7102 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
7103 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
7104 atomic_init(&calls->refcnt, 1);
7105 //TODO: Assign calls->o from o
7107 LDKCustomMessageReader ret = {
7108 .this_arg = (void*) calls,
7109 .read = read_LDKCustomMessageReader_jcall,
7110 .free = LDKCustomMessageReader_JCalls_free,
7114 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
7115 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
7116 *res_ptr = LDKCustomMessageReader_init(o);
7117 return (long)res_ptr;
7119 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
7120 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
7121 LDKu8slice buffer_ref;
7122 buffer_ref.datalen = *((uint32_t*)buffer);
7123 buffer_ref.data = (int8_t*)(buffer + 4);
7124 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
7125 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
7126 return (uint64_t)ret_conv;
7129 typedef struct LDKCustomMessageHandler_JCalls {
7130 atomic_size_t refcnt;
7131 LDKCustomMessageReader_JCalls* CustomMessageReader;
7132 uint32_t handle_custom_message_meth;
7133 uint32_t get_and_clear_pending_msg_meth;
7134 } LDKCustomMessageHandler_JCalls;
7135 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
7136 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7137 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7138 js_free(j_calls->handle_custom_message_meth);
7139 js_free(j_calls->get_and_clear_pending_msg_meth);
7143 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
7144 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7145 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
7147 int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
7148 memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
7149 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
7150 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
7151 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
7154 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
7155 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
7156 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
7157 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
7158 ret_constr.datalen = *((uint32_t*)ret);
7159 if (ret_constr.datalen > 0)
7160 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
7162 ret_constr.data = NULL;
7163 uint32_t* ret_vals = (uint32_t*)(ret + 4);
7164 for (size_t z = 0; z < ret_constr.datalen; z++) {
7165 uint32_t ret_conv_25 = ret_vals[z];
7166 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1);
7167 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
7168 ret_constr.data[z] = ret_conv_25_conv;
7172 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
7173 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
7174 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7175 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
7177 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
7178 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
7179 atomic_init(&calls->refcnt, 1);
7180 //TODO: Assign calls->o from o
7182 LDKCustomMessageHandler ret = {
7183 .this_arg = (void*) calls,
7184 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
7185 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
7186 .free = LDKCustomMessageHandler_JCalls_free,
7187 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
7189 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
7192 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
7193 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
7194 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
7195 return (long)res_ptr;
7197 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
7198 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
7199 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
7200 LDKPublicKey sender_node_id_ref;
7201 CHECK(*((uint32_t*)sender_node_id) == 33);
7202 memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
7203 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7204 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
7205 return (uint64_t)ret_conv;
7208 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
7209 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
7210 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
7211 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
7212 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7213 for (size_t z = 0; z < ret_var.datalen; z++) {
7214 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
7215 *ret_conv_25_conv = ret_var.data[z];
7216 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
7222 typedef struct LDKSocketDescriptor_JCalls {
7223 atomic_size_t refcnt;
7224 uint32_t send_data_meth;
7225 uint32_t disconnect_socket_meth;
7228 } LDKSocketDescriptor_JCalls;
7229 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
7230 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7231 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7232 js_free(j_calls->send_data_meth);
7233 js_free(j_calls->disconnect_socket_meth);
7234 js_free(j_calls->eq_meth);
7235 js_free(j_calls->hash_meth);
7239 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
7240 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7241 LDKu8slice data_var = data;
7242 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7243 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
7244 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
7246 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
7247 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7248 js_invoke_function_0(j_calls->disconnect_socket_meth);
7250 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
7251 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7252 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7253 *other_arg_clone = SocketDescriptor_clone(other_arg);
7254 return js_invoke_function_1(j_calls->eq_meth, (uint64_t)other_arg_clone);
7256 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
7257 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
7258 return js_invoke_function_0(j_calls->hash_meth);
7260 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
7261 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
7262 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7264 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
7265 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
7266 atomic_init(&calls->refcnt, 1);
7267 //TODO: Assign calls->o from o
7269 LDKSocketDescriptor ret = {
7270 .this_arg = (void*) calls,
7271 .send_data = send_data_LDKSocketDescriptor_jcall,
7272 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
7273 .eq = eq_LDKSocketDescriptor_jcall,
7274 .hash = hash_LDKSocketDescriptor_jcall,
7275 .cloned = LDKSocketDescriptor_JCalls_cloned,
7276 .free = LDKSocketDescriptor_JCalls_free,
7280 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
7281 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
7282 *res_ptr = LDKSocketDescriptor_init(o);
7283 return (long)res_ptr;
7285 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
7286 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7287 LDKu8slice data_ref;
7288 data_ref.datalen = *((uint32_t*)data);
7289 data_ref.data = (int8_t*)(data + 4);
7290 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
7294 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
7295 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7296 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
7299 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
7300 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
7301 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
7305 typedef struct LDKScore_JCalls {
7306 atomic_size_t refcnt;
7307 uint32_t channel_penalty_msat_meth;
7309 static void LDKScore_JCalls_free(void* this_arg) {
7310 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7311 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7312 js_free(j_calls->channel_penalty_msat_meth);
7316 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) {
7317 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7318 return js_invoke_function_1(j_calls->channel_penalty_msat_meth, short_channel_id);
7320 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7321 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7322 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7324 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
7325 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7326 atomic_init(&calls->refcnt, 1);
7327 //TODO: Assign calls->o from o
7330 .this_arg = (void*) calls,
7331 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7332 .free = LDKScore_JCalls_free,
7336 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
7337 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7338 *res_ptr = LDKScore_init(o);
7339 return (long)res_ptr;
7341 int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id) {
7342 LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1);
7343 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id);
7347 typedef struct LDKChannelManagerPersister_JCalls {
7348 atomic_size_t refcnt;
7349 uint32_t persist_manager_meth;
7350 } LDKChannelManagerPersister_JCalls;
7351 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
7352 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7353 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7354 js_free(j_calls->persist_manager_meth);
7358 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7359 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
7360 LDKChannelManager channel_manager_var = *channel_manager;
7361 // Warning: we may need a move here but no clone is available for LDKChannelManager
7362 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7363 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7364 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
7365 if (channel_manager_var.is_owned) {
7366 channel_manager_ref |= 1;
7368 uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
7369 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
7370 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
7373 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
7374 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
7375 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7377 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (/*TODO: JS Object Reference */void* o) {
7378 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
7379 atomic_init(&calls->refcnt, 1);
7380 //TODO: Assign calls->o from o
7382 LDKChannelManagerPersister ret = {
7383 .this_arg = (void*) calls,
7384 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
7385 .free = LDKChannelManagerPersister_JCalls_free,
7389 long __attribute__((visibility("default"))) TS_LDKChannelManagerPersister_new(/*TODO: JS Object Reference */void* o) {
7390 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
7391 *res_ptr = LDKChannelManagerPersister_init(o);
7392 return (long)res_ptr;
7394 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerPersister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
7395 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
7396 LDKChannelManager channel_manager_conv;
7397 channel_manager_conv.inner = (void*)(channel_manager & (~1));
7398 channel_manager_conv.is_owned = false;
7399 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7400 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7401 return (uint64_t)ret_conv;
7404 uint32_t __attribute__((visibility("default"))) TS_LDKFallback_ref_from_ptr(uint32_t ptr) {
7405 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
7407 case LDKFallback_SegWitProgram: {
7408 uint8_t version_val = obj->seg_wit_program.version._0;
7409 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
7410 int8_tArray program_arr = init_arr(program_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
7411 memcpy((uint8_t*)(program_arr + 4), program_var.data, program_var.datalen);
7412 return 0 /* LDKFallback - SegWitProgram */; (void) version_val; (void) program_arr;
7414 case LDKFallback_PubKeyHash: {
7415 int8_tArray pub_key_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7416 memcpy((uint8_t*)(pub_key_hash_arr + 4), obj->pub_key_hash.data, 20);
7417 return 0 /* LDKFallback - PubKeyHash */; (void) pub_key_hash_arr;
7419 case LDKFallback_ScriptHash: {
7420 int8_tArray script_hash_arr = init_arr(20, sizeof(uint8_t), "Native int8_tArray Bytes");
7421 memcpy((uint8_t*)(script_hash_arr + 4), obj->script_hash.data, 20);
7422 return 0 /* LDKFallback - ScriptHash */; (void) script_hash_arr;
7427 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
7428 LDKStr ret_str = _ldk_get_compiled_version();
7429 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7434 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
7435 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
7436 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7441 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
7442 LDKTransaction _res_ref;
7443 _res_ref.datalen = *((uint32_t*)_res);
7444 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
7445 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
7446 _res_ref.data_is_owned = true;
7447 Transaction_free(_res_ref);
7450 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
7451 LDKCVec_u8Z script_pubkey_ref;
7452 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
7453 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
7454 memcpy(script_pubkey_ref.data, (uint8_t*)(script_pubkey + 4), script_pubkey_ref.datalen);
7455 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7456 *ret_ref = TxOut_new(script_pubkey_ref, value);
7457 return (uint64_t)ret_ref;
7460 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
7461 if ((_res & 1) != 0) return;
7462 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
7464 TxOut_free(_res_conv);
7467 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
7468 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
7469 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7470 *ret_ref = TxOut_clone(orig_conv);
7471 return (uint64_t)ret_ref;
7474 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
7475 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
7479 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
7481 CHECK(*((uint32_t*)o) == 32);
7482 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
7483 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7484 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
7485 return (uint64_t)ret_conv;
7488 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
7489 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7490 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
7491 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
7492 return (uint64_t)ret_conv;
7495 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
7496 if ((_res & 1) != 0) return;
7497 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
7499 CResult_SecretKeyErrorZ_free(_res_conv);
7502 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
7504 CHECK(*((uint32_t*)o) == 33);
7505 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
7506 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7507 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
7508 return (uint64_t)ret_conv;
7511 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
7512 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7513 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7514 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
7515 return (uint64_t)ret_conv;
7518 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
7519 if ((_res & 1) != 0) return;
7520 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
7522 CResult_PublicKeyErrorZ_free(_res_conv);
7525 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
7526 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
7527 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
7528 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
7529 return (uint64_t)ret_conv;
7532 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
7533 LDKTxCreationKeys o_conv;
7534 o_conv.inner = (void*)(o & (~1));
7535 o_conv.is_owned = (o & 1) || (o == 0);
7536 o_conv = TxCreationKeys_clone(&o_conv);
7537 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7538 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
7539 return (uint64_t)ret_conv;
7542 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
7543 LDKDecodeError e_conv;
7544 e_conv.inner = (void*)(e & (~1));
7545 e_conv.is_owned = (e & 1) || (e == 0);
7546 e_conv = DecodeError_clone(&e_conv);
7547 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7548 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
7549 return (uint64_t)ret_conv;
7552 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
7553 if ((_res & 1) != 0) return;
7554 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7556 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
7559 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
7560 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
7561 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
7562 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
7563 return (uint64_t)ret_conv;
7566 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
7567 LDKChannelPublicKeys o_conv;
7568 o_conv.inner = (void*)(o & (~1));
7569 o_conv.is_owned = (o & 1) || (o == 0);
7570 o_conv = ChannelPublicKeys_clone(&o_conv);
7571 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7572 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
7573 return (uint64_t)ret_conv;
7576 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
7577 LDKDecodeError e_conv;
7578 e_conv.inner = (void*)(e & (~1));
7579 e_conv.is_owned = (e & 1) || (e == 0);
7580 e_conv = DecodeError_clone(&e_conv);
7581 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7582 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
7583 return (uint64_t)ret_conv;
7586 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
7587 if ((_res & 1) != 0) return;
7588 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7590 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
7593 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
7594 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
7595 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
7596 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
7597 return (uint64_t)ret_conv;
7600 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
7601 LDKTxCreationKeys o_conv;
7602 o_conv.inner = (void*)(o & (~1));
7603 o_conv.is_owned = (o & 1) || (o == 0);
7604 o_conv = TxCreationKeys_clone(&o_conv);
7605 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7606 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
7607 return (uint64_t)ret_conv;
7610 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
7611 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
7612 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7613 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
7614 return (uint64_t)ret_conv;
7617 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
7618 if ((_res & 1) != 0) return;
7619 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
7621 CResult_TxCreationKeysErrorZ_free(_res_conv);
7624 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
7625 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
7626 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
7627 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
7628 return (uint64_t)ret_conv;
7631 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
7632 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7633 *ret_copy = COption_u32Z_some(o);
7634 uint64_t ret_ref = (uint64_t)ret_copy;
7638 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
7639 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7640 *ret_copy = COption_u32Z_none();
7641 uint64_t ret_ref = (uint64_t)ret_copy;
7645 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
7646 if ((_res & 1) != 0) return;
7647 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
7649 COption_u32Z_free(_res_conv);
7652 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
7653 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
7654 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
7655 *ret_copy = COption_u32Z_clone(orig_conv);
7656 uint64_t ret_ref = (uint64_t)ret_copy;
7660 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
7661 LDKHTLCOutputInCommitment o_conv;
7662 o_conv.inner = (void*)(o & (~1));
7663 o_conv.is_owned = (o & 1) || (o == 0);
7664 o_conv = HTLCOutputInCommitment_clone(&o_conv);
7665 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7666 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
7667 return (uint64_t)ret_conv;
7670 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
7671 LDKDecodeError e_conv;
7672 e_conv.inner = (void*)(e & (~1));
7673 e_conv.is_owned = (e & 1) || (e == 0);
7674 e_conv = DecodeError_clone(&e_conv);
7675 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7676 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
7677 return (uint64_t)ret_conv;
7680 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
7681 if ((_res & 1) != 0) return;
7682 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
7684 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
7687 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
7688 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
7689 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
7690 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
7691 return (uint64_t)ret_conv;
7694 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7695 LDKCounterpartyChannelTransactionParameters o_conv;
7696 o_conv.inner = (void*)(o & (~1));
7697 o_conv.is_owned = (o & 1) || (o == 0);
7698 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
7699 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7700 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7701 return (uint64_t)ret_conv;
7704 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7705 LDKDecodeError e_conv;
7706 e_conv.inner = (void*)(e & (~1));
7707 e_conv.is_owned = (e & 1) || (e == 0);
7708 e_conv = DecodeError_clone(&e_conv);
7709 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7710 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
7711 return (uint64_t)ret_conv;
7714 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7715 if ((_res & 1) != 0) return;
7716 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7718 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7721 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7722 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7723 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
7724 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7725 return (uint64_t)ret_conv;
7728 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
7729 LDKChannelTransactionParameters o_conv;
7730 o_conv.inner = (void*)(o & (~1));
7731 o_conv.is_owned = (o & 1) || (o == 0);
7732 o_conv = ChannelTransactionParameters_clone(&o_conv);
7733 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7734 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
7735 return (uint64_t)ret_conv;
7738 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
7739 LDKDecodeError e_conv;
7740 e_conv.inner = (void*)(e & (~1));
7741 e_conv.is_owned = (e & 1) || (e == 0);
7742 e_conv = DecodeError_clone(&e_conv);
7743 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7744 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
7745 return (uint64_t)ret_conv;
7748 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
7749 if ((_res & 1) != 0) return;
7750 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
7752 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
7755 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
7756 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
7757 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
7758 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
7759 return (uint64_t)ret_conv;
7762 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
7763 LDKCVec_SignatureZ _res_constr;
7764 _res_constr.datalen = *((uint32_t*)_res);
7765 if (_res_constr.datalen > 0)
7766 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7768 _res_constr.data = NULL;
7769 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7770 for (size_t m = 0; m < _res_constr.datalen; m++) {
7771 int8_tArray _res_conv_12 = _res_vals[m];
7772 LDKSignature _res_conv_12_ref;
7773 CHECK(*((uint32_t*)_res_conv_12) == 64);
7774 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
7775 _res_constr.data[m] = _res_conv_12_ref;
7777 CVec_SignatureZ_free(_res_constr);
7780 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7781 LDKHolderCommitmentTransaction o_conv;
7782 o_conv.inner = (void*)(o & (~1));
7783 o_conv.is_owned = (o & 1) || (o == 0);
7784 o_conv = HolderCommitmentTransaction_clone(&o_conv);
7785 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7786 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
7787 return (uint64_t)ret_conv;
7790 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7791 LDKDecodeError e_conv;
7792 e_conv.inner = (void*)(e & (~1));
7793 e_conv.is_owned = (e & 1) || (e == 0);
7794 e_conv = DecodeError_clone(&e_conv);
7795 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7796 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
7797 return (uint64_t)ret_conv;
7800 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7801 if ((_res & 1) != 0) return;
7802 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7804 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
7807 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7808 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7809 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
7810 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7811 return (uint64_t)ret_conv;
7814 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7815 LDKBuiltCommitmentTransaction o_conv;
7816 o_conv.inner = (void*)(o & (~1));
7817 o_conv.is_owned = (o & 1) || (o == 0);
7818 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
7819 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7820 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
7821 return (uint64_t)ret_conv;
7824 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7825 LDKDecodeError e_conv;
7826 e_conv.inner = (void*)(e & (~1));
7827 e_conv.is_owned = (e & 1) || (e == 0);
7828 e_conv = DecodeError_clone(&e_conv);
7829 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7830 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
7831 return (uint64_t)ret_conv;
7834 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7835 if ((_res & 1) != 0) return;
7836 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7838 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
7841 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7842 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
7843 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
7844 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
7845 return (uint64_t)ret_conv;
7848 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
7849 LDKTrustedClosingTransaction o_conv;
7850 o_conv.inner = (void*)(o & (~1));
7851 o_conv.is_owned = (o & 1) || (o == 0);
7852 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
7853 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7854 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
7855 return (uint64_t)ret_conv;
7858 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
7859 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
7860 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
7861 return (uint64_t)ret_conv;
7864 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
7865 if ((_res & 1) != 0) return;
7866 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
7868 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
7871 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
7872 LDKCommitmentTransaction o_conv;
7873 o_conv.inner = (void*)(o & (~1));
7874 o_conv.is_owned = (o & 1) || (o == 0);
7875 o_conv = CommitmentTransaction_clone(&o_conv);
7876 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7877 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
7878 return (uint64_t)ret_conv;
7881 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
7882 LDKDecodeError e_conv;
7883 e_conv.inner = (void*)(e & (~1));
7884 e_conv.is_owned = (e & 1) || (e == 0);
7885 e_conv = DecodeError_clone(&e_conv);
7886 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7887 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
7888 return (uint64_t)ret_conv;
7891 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
7892 if ((_res & 1) != 0) return;
7893 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
7895 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
7898 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
7899 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
7900 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
7901 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
7902 return (uint64_t)ret_conv;
7905 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
7906 LDKTrustedCommitmentTransaction o_conv;
7907 o_conv.inner = (void*)(o & (~1));
7908 o_conv.is_owned = (o & 1) || (o == 0);
7909 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
7910 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7911 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7912 return (uint64_t)ret_conv;
7915 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
7916 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7917 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7918 return (uint64_t)ret_conv;
7921 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
7922 if ((_res & 1) != 0) return;
7923 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7925 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7928 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
7929 LDKCVec_SignatureZ o_constr;
7930 o_constr.datalen = *((uint32_t*)o);
7931 if (o_constr.datalen > 0)
7932 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7934 o_constr.data = NULL;
7935 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7936 for (size_t m = 0; m < o_constr.datalen; m++) {
7937 int8_tArray o_conv_12 = o_vals[m];
7938 LDKSignature o_conv_12_ref;
7939 CHECK(*((uint32_t*)o_conv_12) == 64);
7940 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
7941 o_constr.data[m] = o_conv_12_ref;
7943 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7944 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7945 return (uint64_t)ret_conv;
7948 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
7949 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7950 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7951 return (uint64_t)ret_conv;
7954 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
7955 if ((_res & 1) != 0) return;
7956 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7958 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7961 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
7962 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7963 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7964 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7965 return (uint64_t)ret_conv;
7968 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
7969 LDKShutdownScript o_conv;
7970 o_conv.inner = (void*)(o & (~1));
7971 o_conv.is_owned = (o & 1) || (o == 0);
7972 o_conv = ShutdownScript_clone(&o_conv);
7973 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7974 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
7975 return (uint64_t)ret_conv;
7978 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
7979 LDKDecodeError e_conv;
7980 e_conv.inner = (void*)(e & (~1));
7981 e_conv.is_owned = (e & 1) || (e == 0);
7982 e_conv = DecodeError_clone(&e_conv);
7983 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7984 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
7985 return (uint64_t)ret_conv;
7988 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
7989 if ((_res & 1) != 0) return;
7990 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
7992 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
7995 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
7996 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
7997 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
7998 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
7999 return (uint64_t)ret_conv;
8002 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
8003 LDKShutdownScript o_conv;
8004 o_conv.inner = (void*)(o & (~1));
8005 o_conv.is_owned = (o & 1) || (o == 0);
8006 o_conv = ShutdownScript_clone(&o_conv);
8007 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8008 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
8009 return (uint64_t)ret_conv;
8012 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
8013 LDKInvalidShutdownScript e_conv;
8014 e_conv.inner = (void*)(e & (~1));
8015 e_conv.is_owned = (e & 1) || (e == 0);
8016 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
8017 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
8018 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
8019 return (uint64_t)ret_conv;
8022 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
8023 if ((_res & 1) != 0) return;
8024 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
8026 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
8029 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
8030 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8031 *ret_conv = CResult_NoneErrorZ_ok();
8032 return (uint64_t)ret_conv;
8035 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
8036 LDKIOError e_conv = LDKIOError_from_js(e);
8037 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8038 *ret_conv = CResult_NoneErrorZ_err(e_conv);
8039 return (uint64_t)ret_conv;
8042 void __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
8043 if ((_res & 1) != 0) return;
8044 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
8046 CResult_NoneErrorZ_free(_res_conv);
8049 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
8050 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
8051 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8052 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
8053 return (uint64_t)ret_conv;
8056 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
8058 o_conv.inner = (void*)(o & (~1));
8059 o_conv.is_owned = (o & 1) || (o == 0);
8060 o_conv = RouteHop_clone(&o_conv);
8061 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8062 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
8063 return (uint64_t)ret_conv;
8066 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
8067 LDKDecodeError e_conv;
8068 e_conv.inner = (void*)(e & (~1));
8069 e_conv.is_owned = (e & 1) || (e == 0);
8070 e_conv = DecodeError_clone(&e_conv);
8071 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8072 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
8073 return (uint64_t)ret_conv;
8076 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
8077 if ((_res & 1) != 0) return;
8078 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
8080 CResult_RouteHopDecodeErrorZ_free(_res_conv);
8083 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
8084 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
8085 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
8086 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
8087 return (uint64_t)ret_conv;
8090 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
8091 LDKCVec_RouteHopZ _res_constr;
8092 _res_constr.datalen = *((uint32_t*)_res);
8093 if (_res_constr.datalen > 0)
8094 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8096 _res_constr.data = NULL;
8097 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8098 for (size_t k = 0; k < _res_constr.datalen; k++) {
8099 uint32_t _res_conv_10 = _res_vals[k];
8100 LDKRouteHop _res_conv_10_conv;
8101 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8102 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8103 _res_constr.data[k] = _res_conv_10_conv;
8105 CVec_RouteHopZ_free(_res_constr);
8108 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
8109 LDKCVec_CVec_RouteHopZZ _res_constr;
8110 _res_constr.datalen = *((uint32_t*)_res);
8111 if (_res_constr.datalen > 0)
8112 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8114 _res_constr.data = NULL;
8115 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
8116 for (size_t m = 0; m < _res_constr.datalen; m++) {
8117 uint32_tArray _res_conv_12 = _res_vals[m];
8118 LDKCVec_RouteHopZ _res_conv_12_constr;
8119 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
8120 if (_res_conv_12_constr.datalen > 0)
8121 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8123 _res_conv_12_constr.data = NULL;
8124 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
8125 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8126 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8127 LDKRouteHop _res_conv_12_conv_10_conv;
8128 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8129 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8130 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8132 _res_constr.data[m] = _res_conv_12_constr;
8134 CVec_CVec_RouteHopZZ_free(_res_constr);
8137 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
8139 o_conv.inner = (void*)(o & (~1));
8140 o_conv.is_owned = (o & 1) || (o == 0);
8141 o_conv = Route_clone(&o_conv);
8142 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8143 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8144 return (uint64_t)ret_conv;
8147 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
8148 LDKDecodeError e_conv;
8149 e_conv.inner = (void*)(e & (~1));
8150 e_conv.is_owned = (e & 1) || (e == 0);
8151 e_conv = DecodeError_clone(&e_conv);
8152 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8153 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8154 return (uint64_t)ret_conv;
8157 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
8158 if ((_res & 1) != 0) return;
8159 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
8161 CResult_RouteDecodeErrorZ_free(_res_conv);
8164 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
8165 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8166 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8167 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8168 return (uint64_t)ret_conv;
8171 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
8172 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8173 *ret_copy = COption_u64Z_some(o);
8174 uint64_t ret_ref = (uint64_t)ret_copy;
8178 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
8179 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8180 *ret_copy = COption_u64Z_none();
8181 uint64_t ret_ref = (uint64_t)ret_copy;
8185 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
8186 if ((_res & 1) != 0) return;
8187 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
8189 COption_u64Z_free(_res_conv);
8192 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
8193 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
8194 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8195 *ret_copy = COption_u64Z_clone(orig_conv);
8196 uint64_t ret_ref = (uint64_t)ret_copy;
8200 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
8201 LDKCVec_ChannelDetailsZ _res_constr;
8202 _res_constr.datalen = *((uint32_t*)_res);
8203 if (_res_constr.datalen > 0)
8204 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8206 _res_constr.data = NULL;
8207 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8208 for (size_t q = 0; q < _res_constr.datalen; q++) {
8209 uint32_t _res_conv_16 = _res_vals[q];
8210 LDKChannelDetails _res_conv_16_conv;
8211 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8212 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8213 _res_constr.data[q] = _res_conv_16_conv;
8215 CVec_ChannelDetailsZ_free(_res_constr);
8218 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
8219 LDKCVec_RouteHintZ _res_constr;
8220 _res_constr.datalen = *((uint32_t*)_res);
8221 if (_res_constr.datalen > 0)
8222 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8224 _res_constr.data = NULL;
8225 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8226 for (size_t l = 0; l < _res_constr.datalen; l++) {
8227 uint32_t _res_conv_11 = _res_vals[l];
8228 LDKRouteHint _res_conv_11_conv;
8229 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8230 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8231 _res_constr.data[l] = _res_conv_11_conv;
8233 CVec_RouteHintZ_free(_res_constr);
8236 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
8238 o_conv.inner = (void*)(o & (~1));
8239 o_conv.is_owned = (o & 1) || (o == 0);
8240 o_conv = Route_clone(&o_conv);
8241 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8242 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8243 return (uint64_t)ret_conv;
8246 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
8247 LDKLightningError e_conv;
8248 e_conv.inner = (void*)(e & (~1));
8249 e_conv.is_owned = (e & 1) || (e == 0);
8250 e_conv = LightningError_clone(&e_conv);
8251 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8252 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8253 return (uint64_t)ret_conv;
8256 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
8257 if ((_res & 1) != 0) return;
8258 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8260 CResult_RouteLightningErrorZ_free(_res_conv);
8263 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
8264 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8265 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8266 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8267 return (uint64_t)ret_conv;
8270 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
8271 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
8272 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
8273 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8274 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8275 return (uint64_t)ret_conv;
8278 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
8279 LDKAccessError e_conv = LDKAccessError_from_js(e);
8280 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8281 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8282 return (uint64_t)ret_conv;
8285 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
8286 if ((_res & 1) != 0) return;
8287 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
8289 CResult_TxOutAccessErrorZ_free(_res_conv);
8292 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
8293 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8294 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8295 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8296 return (uint64_t)ret_conv;
8299 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
8300 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
8301 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8302 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
8303 return ((uint64_t)ret_conv);
8306 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
8307 LDKTransaction b_ref;
8308 b_ref.datalen = *((uint32_t*)b);
8309 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
8310 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
8311 b_ref.data_is_owned = true;
8312 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8313 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
8314 return ((uint64_t)ret_conv);
8317 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
8318 if ((_res & 1) != 0) return;
8319 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
8321 C2Tuple_usizeTransactionZ_free(_res_conv);
8324 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
8325 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
8326 _res_constr.datalen = *((uint32_t*)_res);
8327 if (_res_constr.datalen > 0)
8328 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8330 _res_constr.data = NULL;
8331 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8332 for (size_t c = 0; c < _res_constr.datalen; c++) {
8333 uint32_t _res_conv_28 = _res_vals[c];
8334 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_28) & ~1);
8335 FREE((void*)_res_conv_28);
8336 _res_constr.data[c] = _res_conv_28_conv;
8338 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
8341 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
8342 LDKCVec_TxidZ _res_constr;
8343 _res_constr.datalen = *((uint32_t*)_res);
8344 if (_res_constr.datalen > 0)
8345 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8347 _res_constr.data = NULL;
8348 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8349 for (size_t m = 0; m < _res_constr.datalen; m++) {
8350 int8_tArray _res_conv_12 = _res_vals[m];
8351 LDKThirtyTwoBytes _res_conv_12_ref;
8352 CHECK(*((uint32_t*)_res_conv_12) == 32);
8353 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), 32);
8354 _res_constr.data[m] = _res_conv_12_ref;
8356 CVec_TxidZ_free(_res_constr);
8359 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
8360 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8361 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
8362 return (uint64_t)ret_conv;
8365 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
8366 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
8367 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8368 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
8369 return (uint64_t)ret_conv;
8372 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
8373 if ((_res & 1) != 0) return;
8374 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
8376 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
8379 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
8380 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
8381 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8382 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
8383 return (uint64_t)ret_conv;
8386 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
8387 LDKCVec_MonitorEventZ _res_constr;
8388 _res_constr.datalen = *((uint32_t*)_res);
8389 if (_res_constr.datalen > 0)
8390 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
8392 _res_constr.data = NULL;
8393 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8394 for (size_t o = 0; o < _res_constr.datalen; o++) {
8395 uint32_t _res_conv_14 = _res_vals[o];
8396 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
8397 FREE((void*)_res_conv_14);
8398 _res_constr.data[o] = _res_conv_14_conv;
8400 CVec_MonitorEventZ_free(_res_constr);
8403 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
8404 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
8405 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
8406 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8407 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8408 uint64_t ret_ref = (uint64_t)ret_copy;
8412 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
8413 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8414 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8415 uint64_t ret_ref = (uint64_t)ret_copy;
8419 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
8420 if ((_res & 1) != 0) return;
8421 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
8423 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8426 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
8427 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
8428 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8429 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
8430 uint64_t ret_ref = (uint64_t)ret_copy;
8434 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
8435 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
8436 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
8437 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8438 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
8439 uint64_t ret_ref = (uint64_t)ret_copy;
8443 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
8444 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8445 *ret_copy = COption_NetworkUpdateZ_none();
8446 uint64_t ret_ref = (uint64_t)ret_copy;
8450 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
8451 if ((_res & 1) != 0) return;
8452 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
8454 COption_NetworkUpdateZ_free(_res_conv);
8457 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
8458 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
8459 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8460 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
8461 uint64_t ret_ref = (uint64_t)ret_copy;
8465 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
8466 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8467 _res_constr.datalen = *((uint32_t*)_res);
8468 if (_res_constr.datalen > 0)
8469 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8471 _res_constr.data = NULL;
8472 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8473 for (size_t b = 0; b < _res_constr.datalen; b++) {
8474 uint32_t _res_conv_27 = _res_vals[b];
8475 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8476 FREE((void*)_res_conv_27);
8477 _res_constr.data[b] = _res_conv_27_conv;
8479 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8482 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
8483 LDKCVec_MessageSendEventZ _res_constr;
8484 _res_constr.datalen = *((uint32_t*)_res);
8485 if (_res_constr.datalen > 0)
8486 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8488 _res_constr.data = NULL;
8489 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8490 for (size_t s = 0; s < _res_constr.datalen; s++) {
8491 uint32_t _res_conv_18 = _res_vals[s];
8492 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
8493 FREE((void*)_res_conv_18);
8494 _res_constr.data[s] = _res_conv_18_conv;
8496 CVec_MessageSendEventZ_free(_res_constr);
8499 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
8500 LDKInitFeatures o_conv;
8501 o_conv.inner = (void*)(o & (~1));
8502 o_conv.is_owned = (o & 1) || (o == 0);
8503 o_conv = InitFeatures_clone(&o_conv);
8504 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8505 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
8506 return (uint64_t)ret_conv;
8509 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
8510 LDKDecodeError e_conv;
8511 e_conv.inner = (void*)(e & (~1));
8512 e_conv.is_owned = (e & 1) || (e == 0);
8513 e_conv = DecodeError_clone(&e_conv);
8514 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
8515 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
8516 return (uint64_t)ret_conv;
8519 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
8520 if ((_res & 1) != 0) return;
8521 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8523 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
8526 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
8527 LDKNodeFeatures o_conv;
8528 o_conv.inner = (void*)(o & (~1));
8529 o_conv.is_owned = (o & 1) || (o == 0);
8530 o_conv = NodeFeatures_clone(&o_conv);
8531 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8532 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
8533 return (uint64_t)ret_conv;
8536 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
8537 LDKDecodeError e_conv;
8538 e_conv.inner = (void*)(e & (~1));
8539 e_conv.is_owned = (e & 1) || (e == 0);
8540 e_conv = DecodeError_clone(&e_conv);
8541 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
8542 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
8543 return (uint64_t)ret_conv;
8546 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
8547 if ((_res & 1) != 0) return;
8548 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8550 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
8553 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
8554 LDKChannelFeatures o_conv;
8555 o_conv.inner = (void*)(o & (~1));
8556 o_conv.is_owned = (o & 1) || (o == 0);
8557 o_conv = ChannelFeatures_clone(&o_conv);
8558 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8559 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
8560 return (uint64_t)ret_conv;
8563 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
8564 LDKDecodeError e_conv;
8565 e_conv.inner = (void*)(e & (~1));
8566 e_conv.is_owned = (e & 1) || (e == 0);
8567 e_conv = DecodeError_clone(&e_conv);
8568 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
8569 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
8570 return (uint64_t)ret_conv;
8573 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
8574 if ((_res & 1) != 0) return;
8575 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8577 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
8580 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
8581 LDKInvoiceFeatures o_conv;
8582 o_conv.inner = (void*)(o & (~1));
8583 o_conv.is_owned = (o & 1) || (o == 0);
8584 o_conv = InvoiceFeatures_clone(&o_conv);
8585 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8586 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
8587 return (uint64_t)ret_conv;
8590 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
8591 LDKDecodeError e_conv;
8592 e_conv.inner = (void*)(e & (~1));
8593 e_conv.is_owned = (e & 1) || (e == 0);
8594 e_conv = DecodeError_clone(&e_conv);
8595 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
8596 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
8597 return (uint64_t)ret_conv;
8600 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
8601 if ((_res & 1) != 0) return;
8602 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8604 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
8607 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8608 LDKDelayedPaymentOutputDescriptor o_conv;
8609 o_conv.inner = (void*)(o & (~1));
8610 o_conv.is_owned = (o & 1) || (o == 0);
8611 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
8612 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8613 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8614 return (uint64_t)ret_conv;
8617 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8618 LDKDecodeError e_conv;
8619 e_conv.inner = (void*)(e & (~1));
8620 e_conv.is_owned = (e & 1) || (e == 0);
8621 e_conv = DecodeError_clone(&e_conv);
8622 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8623 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8624 return (uint64_t)ret_conv;
8627 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8628 if ((_res & 1) != 0) return;
8629 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8631 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8634 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8635 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8636 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
8637 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8638 return (uint64_t)ret_conv;
8641 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8642 LDKStaticPaymentOutputDescriptor o_conv;
8643 o_conv.inner = (void*)(o & (~1));
8644 o_conv.is_owned = (o & 1) || (o == 0);
8645 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
8646 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8647 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
8648 return (uint64_t)ret_conv;
8651 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8652 LDKDecodeError e_conv;
8653 e_conv.inner = (void*)(e & (~1));
8654 e_conv.is_owned = (e & 1) || (e == 0);
8655 e_conv = DecodeError_clone(&e_conv);
8656 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8657 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
8658 return (uint64_t)ret_conv;
8661 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8662 if ((_res & 1) != 0) return;
8663 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8665 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
8668 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8669 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
8670 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
8671 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
8672 return (uint64_t)ret_conv;
8675 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
8676 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8677 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
8678 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8679 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8680 return (uint64_t)ret_conv;
8683 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
8684 LDKDecodeError e_conv;
8685 e_conv.inner = (void*)(e & (~1));
8686 e_conv.is_owned = (e & 1) || (e == 0);
8687 e_conv = DecodeError_clone(&e_conv);
8688 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8689 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8690 return (uint64_t)ret_conv;
8693 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
8694 if ((_res & 1) != 0) return;
8695 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8697 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8700 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
8701 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8702 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8703 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8704 return (uint64_t)ret_conv;
8707 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
8708 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8709 *ret_conv = CResult_NoneNoneZ_ok();
8710 return (uint64_t)ret_conv;
8713 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
8714 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8715 *ret_conv = CResult_NoneNoneZ_err();
8716 return (uint64_t)ret_conv;
8719 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
8720 if ((_res & 1) != 0) return;
8721 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
8723 CResult_NoneNoneZ_free(_res_conv);
8726 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
8727 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
8728 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
8729 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
8730 return (uint64_t)ret_conv;
8733 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
8734 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8735 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8736 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8737 return ((uint64_t)ret_conv);
8740 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
8742 CHECK(*((uint32_t*)a) == 64);
8743 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
8744 LDKCVec_SignatureZ b_constr;
8745 b_constr.datalen = *((uint32_t*)b);
8746 if (b_constr.datalen > 0)
8747 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8749 b_constr.data = NULL;
8750 int8_tArray* b_vals = (int8_tArray*)(b + 4);
8751 for (size_t m = 0; m < b_constr.datalen; m++) {
8752 int8_tArray b_conv_12 = b_vals[m];
8753 LDKSignature b_conv_12_ref;
8754 CHECK(*((uint32_t*)b_conv_12) == 64);
8755 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
8756 b_constr.data[m] = b_conv_12_ref;
8758 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8759 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8760 return ((uint64_t)ret_conv);
8763 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
8764 if ((_res & 1) != 0) return;
8765 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8767 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8770 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
8771 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8772 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
8773 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8774 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8775 return (uint64_t)ret_conv;
8778 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
8779 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8780 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8781 return (uint64_t)ret_conv;
8784 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
8785 if ((_res & 1) != 0) return;
8786 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8788 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8791 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
8792 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8793 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8794 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8795 return (uint64_t)ret_conv;
8798 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
8800 CHECK(*((uint32_t*)o) == 64);
8801 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
8802 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8803 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8804 return (uint64_t)ret_conv;
8807 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
8808 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8809 *ret_conv = CResult_SignatureNoneZ_err();
8810 return (uint64_t)ret_conv;
8813 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
8814 if ((_res & 1) != 0) return;
8815 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8817 CResult_SignatureNoneZ_free(_res_conv);
8820 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
8821 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8822 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8823 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8824 return (uint64_t)ret_conv;
8827 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
8828 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8829 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8830 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8831 return (uint64_t)ret_conv;
8834 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
8835 LDKDecodeError e_conv;
8836 e_conv.inner = (void*)(e & (~1));
8837 e_conv.is_owned = (e & 1) || (e == 0);
8838 e_conv = DecodeError_clone(&e_conv);
8839 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8840 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8841 return (uint64_t)ret_conv;
8844 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
8845 if ((_res & 1) != 0) return;
8846 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8848 CResult_SignDecodeErrorZ_free(_res_conv);
8851 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
8852 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8853 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8854 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8855 return (uint64_t)ret_conv;
8858 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
8859 LDKCVec_u8Z _res_ref;
8860 _res_ref.datalen = *((uint32_t*)_res);
8861 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
8862 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
8863 CVec_u8Z_free(_res_ref);
8866 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
8867 LDKRecoverableSignature arg_ref;
8868 CHECK(*((uint32_t*)arg) == 68);
8869 memcpy(arg_ref.serialized_form, (uint8_t*)(arg + 4), 68);
8870 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8871 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
8872 return (uint64_t)ret_conv;
8875 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
8876 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8877 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
8878 return (uint64_t)ret_conv;
8881 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
8882 if ((_res & 1) != 0) return;
8883 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
8885 CResult_RecoverableSignatureNoneZ_free(_res_conv);
8888 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
8889 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
8890 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8891 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
8892 return (uint64_t)ret_conv;
8895 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
8896 LDKCVec_CVec_u8ZZ _res_constr;
8897 _res_constr.datalen = *((uint32_t*)_res);
8898 if (_res_constr.datalen > 0)
8899 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8901 _res_constr.data = NULL;
8902 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
8903 for (size_t m = 0; m < _res_constr.datalen; m++) {
8904 int8_tArray _res_conv_12 = _res_vals[m];
8905 LDKCVec_u8Z _res_conv_12_ref;
8906 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
8907 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8908 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
8909 _res_constr.data[m] = _res_conv_12_ref;
8911 CVec_CVec_u8ZZ_free(_res_constr);
8914 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
8915 LDKCVec_CVec_u8ZZ o_constr;
8916 o_constr.datalen = *((uint32_t*)o);
8917 if (o_constr.datalen > 0)
8918 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8920 o_constr.data = NULL;
8921 int8_tArray* o_vals = (int8_tArray*)(o + 4);
8922 for (size_t m = 0; m < o_constr.datalen; m++) {
8923 int8_tArray o_conv_12 = o_vals[m];
8924 LDKCVec_u8Z o_conv_12_ref;
8925 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
8926 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
8927 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
8928 o_constr.data[m] = o_conv_12_ref;
8930 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8931 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8932 return (uint64_t)ret_conv;
8935 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
8936 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8937 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8938 return (uint64_t)ret_conv;
8941 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
8942 if ((_res & 1) != 0) return;
8943 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8945 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8948 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
8949 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8950 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8951 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8952 return (uint64_t)ret_conv;
8955 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
8956 LDKInMemorySigner o_conv;
8957 o_conv.inner = (void*)(o & (~1));
8958 o_conv.is_owned = (o & 1) || (o == 0);
8959 o_conv = InMemorySigner_clone(&o_conv);
8960 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8961 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8962 return (uint64_t)ret_conv;
8965 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
8966 LDKDecodeError e_conv;
8967 e_conv.inner = (void*)(e & (~1));
8968 e_conv.is_owned = (e & 1) || (e == 0);
8969 e_conv = DecodeError_clone(&e_conv);
8970 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8971 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8972 return (uint64_t)ret_conv;
8975 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
8976 if ((_res & 1) != 0) return;
8977 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8979 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8982 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
8983 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8984 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8985 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8986 return (uint64_t)ret_conv;
8989 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
8990 LDKCVec_TxOutZ _res_constr;
8991 _res_constr.datalen = *((uint32_t*)_res);
8992 if (_res_constr.datalen > 0)
8993 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8995 _res_constr.data = NULL;
8996 uint32_t* _res_vals = (uint32_t*)(_res + 4);
8997 for (size_t h = 0; h < _res_constr.datalen; h++) {
8998 uint32_t _res_conv_7 = _res_vals[h];
8999 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
9000 FREE((void*)_res_conv_7);
9001 _res_constr.data[h] = _res_conv_7_conv;
9003 CVec_TxOutZ_free(_res_constr);
9006 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
9007 LDKTransaction o_ref;
9008 o_ref.datalen = *((uint32_t*)o);
9009 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
9010 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
9011 o_ref.data_is_owned = true;
9012 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9013 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
9014 return (uint64_t)ret_conv;
9017 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
9018 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9019 *ret_conv = CResult_TransactionNoneZ_err();
9020 return (uint64_t)ret_conv;
9023 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
9024 if ((_res & 1) != 0) return;
9025 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
9027 CResult_TransactionNoneZ_free(_res_conv);
9030 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
9031 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
9032 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
9033 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
9034 return (uint64_t)ret_conv;
9037 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
9038 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
9039 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9040 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
9041 return ((uint64_t)ret_conv);
9044 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
9045 LDKThirtyTwoBytes a_ref;
9046 CHECK(*((uint32_t*)a) == 32);
9047 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9048 LDKChannelMonitor b_conv;
9049 b_conv.inner = (void*)(b & (~1));
9050 b_conv.is_owned = (b & 1) || (b == 0);
9051 b_conv = ChannelMonitor_clone(&b_conv);
9052 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9053 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
9054 return ((uint64_t)ret_conv);
9057 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
9058 if ((_res & 1) != 0) return;
9059 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
9061 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
9064 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_BlockHashChannelMonitorZZ_free(uint32_tArray _res) {
9065 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
9066 _res_constr.datalen = *((uint32_t*)_res);
9067 if (_res_constr.datalen > 0)
9068 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9070 _res_constr.data = NULL;
9071 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9072 for (size_t j = 0; j < _res_constr.datalen; j++) {
9073 uint32_t _res_conv_35 = _res_vals[j];
9074 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_35) & ~1);
9075 FREE((void*)_res_conv_35);
9076 _res_constr.data[j] = _res_conv_35_conv;
9078 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
9081 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(uint32_tArray o) {
9082 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
9083 o_constr.datalen = *((uint32_t*)o);
9084 if (o_constr.datalen > 0)
9085 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
9087 o_constr.data = NULL;
9088 uint32_t* o_vals = (uint32_t*)(o + 4);
9089 for (size_t j = 0; j < o_constr.datalen; j++) {
9090 uint32_t o_conv_35 = o_vals[j];
9091 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1);
9092 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
9093 o_constr.data[j] = o_conv_35_conv;
9095 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9096 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
9097 return (uint64_t)ret_conv;
9100 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(uint32_t e) {
9101 LDKIOError e_conv = LDKIOError_from_js(e);
9102 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9103 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
9104 return (uint64_t)ret_conv;
9107 void __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(uint32_t _res) {
9108 if ((_res & 1) != 0) return;
9109 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
9111 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
9114 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(uint32_t orig) {
9115 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
9116 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
9117 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
9118 return (uint64_t)ret_conv;
9121 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_ok(uint32_t o) {
9122 LDKPaymentId o_conv;
9123 o_conv.inner = (void*)(o & (~1));
9124 o_conv.is_owned = (o & 1) || (o == 0);
9125 o_conv = PaymentId_clone(&o_conv);
9126 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9127 *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv);
9128 return (uint64_t)ret_conv;
9131 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_err(uint32_t e) {
9132 LDKDecodeError e_conv;
9133 e_conv.inner = (void*)(e & (~1));
9134 e_conv.is_owned = (e & 1) || (e == 0);
9135 e_conv = DecodeError_clone(&e_conv);
9136 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9137 *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv);
9138 return (uint64_t)ret_conv;
9141 void __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_free(uint32_t _res) {
9142 if ((_res & 1) != 0) return;
9143 LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1);
9145 CResult_PaymentIdDecodeErrorZ_free(_res_conv);
9148 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_clone(uint32_t orig) {
9149 LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1);
9150 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
9151 *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv);
9152 return (uint64_t)ret_conv;
9155 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
9156 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9157 *ret_copy = COption_u16Z_some(o);
9158 uint64_t ret_ref = (uint64_t)ret_copy;
9162 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
9163 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9164 *ret_copy = COption_u16Z_none();
9165 uint64_t ret_ref = (uint64_t)ret_copy;
9169 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
9170 if ((_res & 1) != 0) return;
9171 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
9173 COption_u16Z_free(_res_conv);
9176 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
9177 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
9178 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
9179 *ret_copy = COption_u16Z_clone(orig_conv);
9180 uint64_t ret_ref = (uint64_t)ret_copy;
9184 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
9185 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9186 *ret_conv = CResult_NoneAPIErrorZ_ok();
9187 return (uint64_t)ret_conv;
9190 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
9191 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
9192 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9193 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9194 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
9195 return (uint64_t)ret_conv;
9198 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
9199 if ((_res & 1) != 0) return;
9200 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
9202 CResult_NoneAPIErrorZ_free(_res_conv);
9205 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
9206 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
9207 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9208 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
9209 return (uint64_t)ret_conv;
9212 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
9213 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
9214 _res_constr.datalen = *((uint32_t*)_res);
9215 if (_res_constr.datalen > 0)
9216 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
9218 _res_constr.data = NULL;
9219 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9220 for (size_t w = 0; w < _res_constr.datalen; w++) {
9221 uint32_t _res_conv_22 = _res_vals[w];
9222 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
9223 FREE((void*)_res_conv_22);
9224 _res_constr.data[w] = _res_conv_22_conv;
9226 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
9229 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
9230 LDKCVec_APIErrorZ _res_constr;
9231 _res_constr.datalen = *((uint32_t*)_res);
9232 if (_res_constr.datalen > 0)
9233 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
9235 _res_constr.data = NULL;
9236 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9237 for (size_t k = 0; k < _res_constr.datalen; k++) {
9238 uint32_t _res_conv_10 = _res_vals[k];
9239 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
9240 FREE((void*)_res_conv_10);
9241 _res_constr.data[k] = _res_conv_10_conv;
9243 CVec_APIErrorZ_free(_res_constr);
9246 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
9247 LDKThirtyTwoBytes o_ref;
9248 CHECK(*((uint32_t*)o) == 32);
9249 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9250 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9251 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
9252 return (uint64_t)ret_conv;
9255 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
9256 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
9257 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9258 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9259 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
9260 return (uint64_t)ret_conv;
9263 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
9264 if ((_res & 1) != 0) return;
9265 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1);
9267 CResult__u832APIErrorZ_free(_res_conv);
9270 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
9271 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
9272 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
9273 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
9274 return (uint64_t)ret_conv;
9277 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(uint32_t o) {
9278 LDKPaymentId o_conv;
9279 o_conv.inner = (void*)(o & (~1));
9280 o_conv.is_owned = (o & 1) || (o == 0);
9281 o_conv = PaymentId_clone(&o_conv);
9282 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9283 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv);
9284 return (uint64_t)ret_conv;
9287 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
9288 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9289 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9290 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9291 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
9292 return (uint64_t)ret_conv;
9295 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
9296 if ((_res & 1) != 0) return;
9297 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9299 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
9302 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
9303 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
9304 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9305 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
9306 return (uint64_t)ret_conv;
9309 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
9310 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9311 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
9312 return (uint64_t)ret_conv;
9315 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
9316 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9317 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9318 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9319 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
9320 return (uint64_t)ret_conv;
9323 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
9324 if ((_res & 1) != 0) return;
9325 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9327 CResult_NonePaymentSendFailureZ_free(_res_conv);
9330 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
9331 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
9332 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9333 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
9334 return (uint64_t)ret_conv;
9337 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
9338 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
9339 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9340 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
9341 return ((uint64_t)ret_conv);
9344 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) {
9345 LDKThirtyTwoBytes a_ref;
9346 CHECK(*((uint32_t*)a) == 32);
9347 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9348 LDKPaymentId b_conv;
9349 b_conv.inner = (void*)(b & (~1));
9350 b_conv.is_owned = (b & 1) || (b == 0);
9351 b_conv = PaymentId_clone(&b_conv);
9352 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
9353 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv);
9354 return ((uint64_t)ret_conv);
9357 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
9358 if ((_res & 1) != 0) return;
9359 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1);
9361 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
9364 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
9365 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1);
9366 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
9367 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9368 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
9369 return (uint64_t)ret_conv;
9372 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
9373 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
9374 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
9375 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9376 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
9377 return (uint64_t)ret_conv;
9380 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
9381 if ((_res & 1) != 0) return;
9382 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
9384 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
9387 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
9388 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
9389 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
9390 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
9391 return (uint64_t)ret_conv;
9394 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
9395 LDKCVec_NetAddressZ _res_constr;
9396 _res_constr.datalen = *((uint32_t*)_res);
9397 if (_res_constr.datalen > 0)
9398 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9400 _res_constr.data = NULL;
9401 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9402 for (size_t m = 0; m < _res_constr.datalen; m++) {
9403 uint32_t _res_conv_12 = _res_vals[m];
9404 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
9405 FREE((void*)_res_conv_12);
9406 _res_constr.data[m] = _res_conv_12_conv;
9408 CVec_NetAddressZ_free(_res_constr);
9411 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
9412 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
9413 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9414 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
9415 return ((uint64_t)ret_conv);
9418 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
9419 LDKThirtyTwoBytes a_ref;
9420 CHECK(*((uint32_t*)a) == 32);
9421 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9422 LDKThirtyTwoBytes b_ref;
9423 CHECK(*((uint32_t*)b) == 32);
9424 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9425 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
9426 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
9427 return ((uint64_t)ret_conv);
9430 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
9431 if ((_res & 1) != 0) return;
9432 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
9434 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
9437 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
9438 LDKThirtyTwoBytes o_ref;
9439 CHECK(*((uint32_t*)o) == 32);
9440 memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
9441 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9442 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
9443 return (uint64_t)ret_conv;
9446 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
9447 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
9448 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
9449 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9450 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
9451 return (uint64_t)ret_conv;
9454 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
9455 if ((_res & 1) != 0) return;
9456 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
9458 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
9461 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
9462 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
9463 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
9464 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
9465 return (uint64_t)ret_conv;
9468 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
9469 LDKCVec_ChannelMonitorZ _res_constr;
9470 _res_constr.datalen = *((uint32_t*)_res);
9471 if (_res_constr.datalen > 0)
9472 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9474 _res_constr.data = NULL;
9475 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9476 for (size_t q = 0; q < _res_constr.datalen; q++) {
9477 uint32_t _res_conv_16 = _res_vals[q];
9478 LDKChannelMonitor _res_conv_16_conv;
9479 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9480 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9481 _res_constr.data[q] = _res_conv_16_conv;
9483 CVec_ChannelMonitorZ_free(_res_constr);
9486 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
9487 LDKThirtyTwoBytes a_ref;
9488 CHECK(*((uint32_t*)a) == 32);
9489 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
9490 LDKChannelManager b_conv;
9491 b_conv.inner = (void*)(b & (~1));
9492 b_conv.is_owned = (b & 1) || (b == 0);
9493 // Warning: we need a move here but no clone is available for LDKChannelManager
9494 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
9495 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
9496 return ((uint64_t)ret_conv);
9499 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
9500 if ((_res & 1) != 0) return;
9501 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
9503 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
9506 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
9507 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
9508 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
9509 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9510 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
9511 return (uint64_t)ret_conv;
9514 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
9515 LDKDecodeError e_conv;
9516 e_conv.inner = (void*)(e & (~1));
9517 e_conv.is_owned = (e & 1) || (e == 0);
9518 e_conv = DecodeError_clone(&e_conv);
9519 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9520 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
9521 return (uint64_t)ret_conv;
9524 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
9525 if ((_res & 1) != 0) return;
9526 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9528 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
9531 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
9532 LDKChannelConfig o_conv;
9533 o_conv.inner = (void*)(o & (~1));
9534 o_conv.is_owned = (o & 1) || (o == 0);
9535 o_conv = ChannelConfig_clone(&o_conv);
9536 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9537 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
9538 return (uint64_t)ret_conv;
9541 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
9542 LDKDecodeError e_conv;
9543 e_conv.inner = (void*)(e & (~1));
9544 e_conv.is_owned = (e & 1) || (e == 0);
9545 e_conv = DecodeError_clone(&e_conv);
9546 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9547 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9548 return (uint64_t)ret_conv;
9551 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9552 if ((_res & 1) != 0) return;
9553 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
9555 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9558 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9559 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9560 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9561 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9562 return (uint64_t)ret_conv;
9565 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9567 o_conv.inner = (void*)(o & (~1));
9568 o_conv.is_owned = (o & 1) || (o == 0);
9569 o_conv = OutPoint_clone(&o_conv);
9570 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9571 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9572 return (uint64_t)ret_conv;
9575 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9576 LDKDecodeError e_conv;
9577 e_conv.inner = (void*)(e & (~1));
9578 e_conv.is_owned = (e & 1) || (e == 0);
9579 e_conv = DecodeError_clone(&e_conv);
9580 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9581 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9582 return (uint64_t)ret_conv;
9585 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9586 if ((_res & 1) != 0) return;
9587 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
9589 CResult_OutPointDecodeErrorZ_free(_res_conv);
9592 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9593 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9594 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9595 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9596 return (uint64_t)ret_conv;
9599 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9600 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
9601 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9602 *ret_copy = COption_TypeZ_some(o_conv);
9603 uint64_t ret_ref = (uint64_t)ret_copy;
9607 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9608 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9609 *ret_copy = COption_TypeZ_none();
9610 uint64_t ret_ref = (uint64_t)ret_copy;
9614 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9615 if ((_res & 1) != 0) return;
9616 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
9618 COption_TypeZ_free(_res_conv);
9621 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9622 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9623 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9624 *ret_copy = COption_TypeZ_clone(orig_conv);
9625 uint64_t ret_ref = (uint64_t)ret_copy;
9629 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9630 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
9631 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9632 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9633 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9634 return (uint64_t)ret_conv;
9637 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9638 LDKDecodeError e_conv;
9639 e_conv.inner = (void*)(e & (~1));
9640 e_conv.is_owned = (e & 1) || (e == 0);
9641 e_conv = DecodeError_clone(&e_conv);
9642 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9643 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9644 return (uint64_t)ret_conv;
9647 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9648 if ((_res & 1) != 0) return;
9649 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
9651 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9654 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9655 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9656 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9657 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9658 return (uint64_t)ret_conv;
9661 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
9662 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
9663 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9664 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
9665 return (uint64_t)ret_conv;
9668 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_err() {
9669 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9670 *ret_conv = CResult_SiPrefixNoneZ_err();
9671 return (uint64_t)ret_conv;
9674 void __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
9675 if ((_res & 1) != 0) return;
9676 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
9678 CResult_SiPrefixNoneZ_free(_res_conv);
9681 uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
9682 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
9683 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
9684 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
9685 return (uint64_t)ret_conv;
9688 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
9690 o_conv.inner = (void*)(o & (~1));
9691 o_conv.is_owned = (o & 1) || (o == 0);
9692 o_conv = Invoice_clone(&o_conv);
9693 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9694 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
9695 return (uint64_t)ret_conv;
9698 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_err() {
9699 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9700 *ret_conv = CResult_InvoiceNoneZ_err();
9701 return (uint64_t)ret_conv;
9704 void __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
9705 if ((_res & 1) != 0) return;
9706 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
9708 CResult_InvoiceNoneZ_free(_res_conv);
9711 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
9712 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
9713 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
9714 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
9715 return (uint64_t)ret_conv;
9718 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
9719 LDKSignedRawInvoice o_conv;
9720 o_conv.inner = (void*)(o & (~1));
9721 o_conv.is_owned = (o & 1) || (o == 0);
9722 o_conv = SignedRawInvoice_clone(&o_conv);
9723 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9724 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
9725 return (uint64_t)ret_conv;
9728 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
9729 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9730 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
9731 return (uint64_t)ret_conv;
9734 void __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
9735 if ((_res & 1) != 0) return;
9736 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
9738 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
9741 uint32_t __attribute__((visibility("default"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
9742 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
9743 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
9744 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
9745 return (uint64_t)ret_conv;
9748 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
9749 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
9750 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9751 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
9752 return ((uint64_t)ret_conv);
9755 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
9756 LDKRawInvoice a_conv;
9757 a_conv.inner = (void*)(a & (~1));
9758 a_conv.is_owned = (a & 1) || (a == 0);
9759 a_conv = RawInvoice_clone(&a_conv);
9760 LDKThirtyTwoBytes b_ref;
9761 CHECK(*((uint32_t*)b) == 32);
9762 memcpy(b_ref.data, (uint8_t*)(b + 4), 32);
9763 LDKInvoiceSignature c_conv;
9764 c_conv.inner = (void*)(c & (~1));
9765 c_conv.is_owned = (c & 1) || (c == 0);
9766 c_conv = InvoiceSignature_clone(&c_conv);
9767 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
9768 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
9769 return ((uint64_t)ret_conv);
9772 void __attribute__((visibility("default"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
9773 if ((_res & 1) != 0) return;
9774 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
9776 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
9779 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
9780 LDKPayeePubKey o_conv;
9781 o_conv.inner = (void*)(o & (~1));
9782 o_conv.is_owned = (o & 1) || (o == 0);
9783 o_conv = PayeePubKey_clone(&o_conv);
9784 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9785 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
9786 return (uint64_t)ret_conv;
9789 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
9790 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9791 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9792 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
9793 return (uint64_t)ret_conv;
9796 void __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
9797 if ((_res & 1) != 0) return;
9798 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
9800 CResult_PayeePubKeyErrorZ_free(_res_conv);
9803 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
9804 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
9805 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
9806 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
9807 return (uint64_t)ret_conv;
9810 void __attribute__((visibility("default"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
9811 LDKCVec_PrivateRouteZ _res_constr;
9812 _res_constr.datalen = *((uint32_t*)_res);
9813 if (_res_constr.datalen > 0)
9814 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
9816 _res_constr.data = NULL;
9817 uint32_t* _res_vals = (uint32_t*)(_res + 4);
9818 for (size_t o = 0; o < _res_constr.datalen; o++) {
9819 uint32_t _res_conv_14 = _res_vals[o];
9820 LDKPrivateRoute _res_conv_14_conv;
9821 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
9822 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
9823 _res_constr.data[o] = _res_conv_14_conv;
9825 CVec_PrivateRouteZ_free(_res_constr);
9828 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
9829 LDKPositiveTimestamp o_conv;
9830 o_conv.inner = (void*)(o & (~1));
9831 o_conv.is_owned = (o & 1) || (o == 0);
9832 o_conv = PositiveTimestamp_clone(&o_conv);
9833 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9834 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
9835 return (uint64_t)ret_conv;
9838 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
9839 LDKCreationError e_conv = LDKCreationError_from_js(e);
9840 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9841 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
9842 return (uint64_t)ret_conv;
9845 void __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
9846 if ((_res & 1) != 0) return;
9847 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
9849 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
9852 uint32_t __attribute__((visibility("default"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
9853 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
9854 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
9855 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
9856 return (uint64_t)ret_conv;
9859 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_ok() {
9860 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9861 *ret_conv = CResult_NoneSemanticErrorZ_ok();
9862 return (uint64_t)ret_conv;
9865 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
9866 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9867 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9868 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
9869 return (uint64_t)ret_conv;
9872 void __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
9873 if ((_res & 1) != 0) return;
9874 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
9876 CResult_NoneSemanticErrorZ_free(_res_conv);
9879 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
9880 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
9881 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
9882 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
9883 return (uint64_t)ret_conv;
9886 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
9888 o_conv.inner = (void*)(o & (~1));
9889 o_conv.is_owned = (o & 1) || (o == 0);
9890 o_conv = Invoice_clone(&o_conv);
9891 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9892 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
9893 return (uint64_t)ret_conv;
9896 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
9897 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
9898 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9899 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
9900 return (uint64_t)ret_conv;
9903 void __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
9904 if ((_res & 1) != 0) return;
9905 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
9907 CResult_InvoiceSemanticErrorZ_free(_res_conv);
9910 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
9911 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
9912 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
9913 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
9914 return (uint64_t)ret_conv;
9917 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
9918 LDKDescription o_conv;
9919 o_conv.inner = (void*)(o & (~1));
9920 o_conv.is_owned = (o & 1) || (o == 0);
9921 o_conv = Description_clone(&o_conv);
9922 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9923 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
9924 return (uint64_t)ret_conv;
9927 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
9928 LDKCreationError e_conv = LDKCreationError_from_js(e);
9929 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9930 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
9931 return (uint64_t)ret_conv;
9934 void __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
9935 if ((_res & 1) != 0) return;
9936 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
9938 CResult_DescriptionCreationErrorZ_free(_res_conv);
9941 uint32_t __attribute__((visibility("default"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
9942 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
9943 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
9944 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
9945 return (uint64_t)ret_conv;
9948 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_ok(uint32_t o) {
9949 LDKExpiryTime o_conv;
9950 o_conv.inner = (void*)(o & (~1));
9951 o_conv.is_owned = (o & 1) || (o == 0);
9952 o_conv = ExpiryTime_clone(&o_conv);
9953 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9954 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
9955 return (uint64_t)ret_conv;
9958 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_err(uint32_t e) {
9959 LDKCreationError e_conv = LDKCreationError_from_js(e);
9960 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9961 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
9962 return (uint64_t)ret_conv;
9965 void __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_free(uint32_t _res) {
9966 if ((_res & 1) != 0) return;
9967 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
9969 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
9972 uint32_t __attribute__((visibility("default"))) TS_CResult_ExpiryTimeCreationErrorZ_clone(uint32_t orig) {
9973 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
9974 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
9975 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
9976 return (uint64_t)ret_conv;
9979 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
9980 LDKPrivateRoute o_conv;
9981 o_conv.inner = (void*)(o & (~1));
9982 o_conv.is_owned = (o & 1) || (o == 0);
9983 o_conv = PrivateRoute_clone(&o_conv);
9984 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9985 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
9986 return (uint64_t)ret_conv;
9989 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
9990 LDKCreationError e_conv = LDKCreationError_from_js(e);
9991 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
9992 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
9993 return (uint64_t)ret_conv;
9996 void __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
9997 if ((_res & 1) != 0) return;
9998 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
10000 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10003 uint32_t __attribute__((visibility("default"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
10004 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10005 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10006 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10007 return (uint64_t)ret_conv;
10010 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
10011 LDKStr o_conv = str_ref_to_owned_c(o);
10012 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10013 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10014 return (uint64_t)ret_conv;
10017 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
10018 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10019 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10020 *ret_conv = CResult_StringErrorZ_err(e_conv);
10021 return (uint64_t)ret_conv;
10024 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
10025 if ((_res & 1) != 0) return;
10026 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
10028 CResult_StringErrorZ_free(_res_conv);
10031 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
10032 LDKChannelMonitorUpdate o_conv;
10033 o_conv.inner = (void*)(o & (~1));
10034 o_conv.is_owned = (o & 1) || (o == 0);
10035 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10036 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10037 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10038 return (uint64_t)ret_conv;
10041 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
10042 LDKDecodeError e_conv;
10043 e_conv.inner = (void*)(e & (~1));
10044 e_conv.is_owned = (e & 1) || (e == 0);
10045 e_conv = DecodeError_clone(&e_conv);
10046 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10047 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10048 return (uint64_t)ret_conv;
10051 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
10052 if ((_res & 1) != 0) return;
10053 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10055 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10058 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
10059 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10060 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10061 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10062 return (uint64_t)ret_conv;
10065 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
10066 LDKHTLCUpdate o_conv;
10067 o_conv.inner = (void*)(o & (~1));
10068 o_conv.is_owned = (o & 1) || (o == 0);
10069 o_conv = HTLCUpdate_clone(&o_conv);
10070 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10071 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10072 return (uint64_t)ret_conv;
10075 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
10076 LDKDecodeError e_conv;
10077 e_conv.inner = (void*)(e & (~1));
10078 e_conv.is_owned = (e & 1) || (e == 0);
10079 e_conv = DecodeError_clone(&e_conv);
10080 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10081 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10082 return (uint64_t)ret_conv;
10085 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
10086 if ((_res & 1) != 0) return;
10087 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10089 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10092 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
10093 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10094 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10095 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10096 return (uint64_t)ret_conv;
10099 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
10100 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10101 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10102 return (uint64_t)ret_conv;
10105 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
10106 LDKMonitorUpdateError e_conv;
10107 e_conv.inner = (void*)(e & (~1));
10108 e_conv.is_owned = (e & 1) || (e == 0);
10109 e_conv = MonitorUpdateError_clone(&e_conv);
10110 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10111 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10112 return (uint64_t)ret_conv;
10115 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
10116 if ((_res & 1) != 0) return;
10117 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
10119 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10122 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
10123 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10124 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10125 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10126 return (uint64_t)ret_conv;
10129 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
10130 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10131 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10132 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
10133 return ((uint64_t)ret_conv);
10136 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10137 LDKOutPoint a_conv;
10138 a_conv.inner = (void*)(a & (~1));
10139 a_conv.is_owned = (a & 1) || (a == 0);
10140 a_conv = OutPoint_clone(&a_conv);
10142 b_ref.datalen = *((uint32_t*)b);
10143 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10144 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10145 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10146 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10147 return ((uint64_t)ret_conv);
10150 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10151 if ((_res & 1) != 0) return;
10152 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
10154 C2Tuple_OutPointScriptZ_free(_res_conv);
10157 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
10158 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10159 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10160 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
10161 return ((uint64_t)ret_conv);
10164 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10166 b_ref.datalen = *((uint32_t*)b);
10167 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10168 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
10169 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10170 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10171 return ((uint64_t)ret_conv);
10174 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10175 if ((_res & 1) != 0) return;
10176 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
10178 C2Tuple_u32ScriptZ_free(_res_conv);
10181 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10182 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10183 _res_constr.datalen = *((uint32_t*)_res);
10184 if (_res_constr.datalen > 0)
10185 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10187 _res_constr.data = NULL;
10188 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10189 for (size_t v = 0; v < _res_constr.datalen; v++) {
10190 uint32_t _res_conv_21 = _res_vals[v];
10191 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_21) & ~1);
10192 FREE((void*)_res_conv_21);
10193 _res_constr.data[v] = _res_conv_21_conv;
10195 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10198 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
10199 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10200 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10201 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10202 return ((uint64_t)ret_conv);
10205 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10206 LDKThirtyTwoBytes a_ref;
10207 CHECK(*((uint32_t*)a) == 32);
10208 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10209 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10210 b_constr.datalen = *((uint32_t*)b);
10211 if (b_constr.datalen > 0)
10212 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10214 b_constr.data = NULL;
10215 uint32_t* b_vals = (uint32_t*)(b + 4);
10216 for (size_t v = 0; v < b_constr.datalen; v++) {
10217 uint32_t b_conv_21 = b_vals[v];
10218 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
10219 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
10220 b_constr.data[v] = b_conv_21_conv;
10222 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10223 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10224 return ((uint64_t)ret_conv);
10227 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10228 if ((_res & 1) != 0) return;
10229 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
10231 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10234 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10235 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10236 _res_constr.datalen = *((uint32_t*)_res);
10237 if (_res_constr.datalen > 0)
10238 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10240 _res_constr.data = NULL;
10241 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10242 for (size_t o = 0; o < _res_constr.datalen; o++) {
10243 uint32_t _res_conv_40 = _res_vals[o];
10244 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_40) & ~1);
10245 FREE((void*)_res_conv_40);
10246 _res_constr.data[o] = _res_conv_40_conv;
10248 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10251 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10252 LDKCVec_EventZ _res_constr;
10253 _res_constr.datalen = *((uint32_t*)_res);
10254 if (_res_constr.datalen > 0)
10255 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10257 _res_constr.data = NULL;
10258 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10259 for (size_t h = 0; h < _res_constr.datalen; h++) {
10260 uint32_t _res_conv_7 = _res_vals[h];
10261 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
10262 FREE((void*)_res_conv_7);
10263 _res_constr.data[h] = _res_conv_7_conv;
10265 CVec_EventZ_free(_res_constr);
10268 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10269 LDKCVec_TransactionZ _res_constr;
10270 _res_constr.datalen = *((uint32_t*)_res);
10271 if (_res_constr.datalen > 0)
10272 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10274 _res_constr.data = NULL;
10275 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10276 for (size_t m = 0; m < _res_constr.datalen; m++) {
10277 int8_tArray _res_conv_12 = _res_vals[m];
10278 LDKTransaction _res_conv_12_ref;
10279 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
10280 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10281 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
10282 _res_conv_12_ref.data_is_owned = true;
10283 _res_constr.data[m] = _res_conv_12_ref;
10285 CVec_TransactionZ_free(_res_constr);
10288 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10289 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10290 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10291 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10292 return ((uint64_t)ret_conv);
10295 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10296 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
10297 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10298 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10299 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10300 return ((uint64_t)ret_conv);
10303 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10304 if ((_res & 1) != 0) return;
10305 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
10307 C2Tuple_u32TxOutZ_free(_res_conv);
10310 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10311 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10312 _res_constr.datalen = *((uint32_t*)_res);
10313 if (_res_constr.datalen > 0)
10314 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10316 _res_constr.data = NULL;
10317 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10318 for (size_t u = 0; u < _res_constr.datalen; u++) {
10319 uint32_t _res_conv_20 = _res_vals[u];
10320 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_20) & ~1);
10321 FREE((void*)_res_conv_20);
10322 _res_constr.data[u] = _res_conv_20_conv;
10324 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10327 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10328 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10329 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10330 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10331 return ((uint64_t)ret_conv);
10334 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10335 LDKThirtyTwoBytes a_ref;
10336 CHECK(*((uint32_t*)a) == 32);
10337 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
10338 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10339 b_constr.datalen = *((uint32_t*)b);
10340 if (b_constr.datalen > 0)
10341 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10343 b_constr.data = NULL;
10344 uint32_t* b_vals = (uint32_t*)(b + 4);
10345 for (size_t u = 0; u < b_constr.datalen; u++) {
10346 uint32_t b_conv_20 = b_vals[u];
10347 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
10348 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10349 b_constr.data[u] = b_conv_20_conv;
10351 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10352 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10353 return ((uint64_t)ret_conv);
10356 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10357 if ((_res & 1) != 0) return;
10358 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
10360 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10363 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10364 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10365 _res_constr.datalen = *((uint32_t*)_res);
10366 if (_res_constr.datalen > 0)
10367 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10369 _res_constr.data = NULL;
10370 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10371 for (size_t n = 0; n < _res_constr.datalen; n++) {
10372 uint32_t _res_conv_39 = _res_vals[n];
10373 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_39) & ~1);
10374 FREE((void*)_res_conv_39);
10375 _res_constr.data[n] = _res_conv_39_conv;
10377 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10380 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10381 LDKCVec_BalanceZ _res_constr;
10382 _res_constr.datalen = *((uint32_t*)_res);
10383 if (_res_constr.datalen > 0)
10384 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10386 _res_constr.data = NULL;
10387 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10388 for (size_t j = 0; j < _res_constr.datalen; j++) {
10389 uint32_t _res_conv_9 = _res_vals[j];
10390 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
10391 FREE((void*)_res_conv_9);
10392 _res_constr.data[j] = _res_conv_9_conv;
10394 CVec_BalanceZ_free(_res_constr);
10397 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10398 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
10399 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10400 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10401 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10402 return (uint64_t)ret_conv;
10405 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10406 LDKDecodeError e_conv;
10407 e_conv.inner = (void*)(e & (~1));
10408 e_conv.is_owned = (e & 1) || (e == 0);
10409 e_conv = DecodeError_clone(&e_conv);
10410 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10411 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10412 return (uint64_t)ret_conv;
10415 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10416 if ((_res & 1) != 0) return;
10417 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10419 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10422 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10423 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10424 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10425 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10426 return (uint64_t)ret_conv;
10429 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
10430 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10431 *ret_conv = CResult_NoneLightningErrorZ_ok();
10432 return (uint64_t)ret_conv;
10435 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
10436 LDKLightningError e_conv;
10437 e_conv.inner = (void*)(e & (~1));
10438 e_conv.is_owned = (e & 1) || (e == 0);
10439 e_conv = LightningError_clone(&e_conv);
10440 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10441 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
10442 return (uint64_t)ret_conv;
10445 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
10446 if ((_res & 1) != 0) return;
10447 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
10449 CResult_NoneLightningErrorZ_free(_res_conv);
10452 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
10453 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
10454 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10455 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
10456 return (uint64_t)ret_conv;
10459 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
10460 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
10461 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10462 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
10463 return ((uint64_t)ret_conv);
10466 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
10467 LDKPublicKey a_ref;
10468 CHECK(*((uint32_t*)a) == 33);
10469 memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
10470 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
10471 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10472 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
10473 return ((uint64_t)ret_conv);
10476 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
10477 if ((_res & 1) != 0) return;
10478 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
10480 C2Tuple_PublicKeyTypeZ_free(_res_conv);
10483 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
10484 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
10485 _res_constr.datalen = *((uint32_t*)_res);
10486 if (_res_constr.datalen > 0)
10487 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10489 _res_constr.data = NULL;
10490 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10491 for (size_t z = 0; z < _res_constr.datalen; z++) {
10492 uint32_t _res_conv_25 = _res_vals[z];
10493 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_25) & ~1);
10494 FREE((void*)_res_conv_25);
10495 _res_constr.data[z] = _res_conv_25_conv;
10497 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
10500 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
10501 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10502 *ret_conv = CResult_boolLightningErrorZ_ok(o);
10503 return (uint64_t)ret_conv;
10506 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
10507 LDKLightningError e_conv;
10508 e_conv.inner = (void*)(e & (~1));
10509 e_conv.is_owned = (e & 1) || (e == 0);
10510 e_conv = LightningError_clone(&e_conv);
10511 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10512 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
10513 return (uint64_t)ret_conv;
10516 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
10517 if ((_res & 1) != 0) return;
10518 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
10520 CResult_boolLightningErrorZ_free(_res_conv);
10523 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
10524 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
10525 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10526 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
10527 return (uint64_t)ret_conv;
10530 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
10531 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
10532 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10533 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
10534 return ((uint64_t)ret_conv);
10537 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
10538 LDKChannelAnnouncement a_conv;
10539 a_conv.inner = (void*)(a & (~1));
10540 a_conv.is_owned = (a & 1) || (a == 0);
10541 a_conv = ChannelAnnouncement_clone(&a_conv);
10542 LDKChannelUpdate b_conv;
10543 b_conv.inner = (void*)(b & (~1));
10544 b_conv.is_owned = (b & 1) || (b == 0);
10545 b_conv = ChannelUpdate_clone(&b_conv);
10546 LDKChannelUpdate c_conv;
10547 c_conv.inner = (void*)(c & (~1));
10548 c_conv.is_owned = (c & 1) || (c == 0);
10549 c_conv = ChannelUpdate_clone(&c_conv);
10550 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10551 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
10552 return ((uint64_t)ret_conv);
10555 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
10556 if ((_res & 1) != 0) return;
10557 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
10559 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
10562 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
10563 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
10564 _res_constr.datalen = *((uint32_t*)_res);
10565 if (_res_constr.datalen > 0)
10566 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10568 _res_constr.data = NULL;
10569 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10570 for (size_t h = 0; h < _res_constr.datalen; h++) {
10571 uint32_t _res_conv_59 = _res_vals[h];
10572 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_59) & ~1);
10573 FREE((void*)_res_conv_59);
10574 _res_constr.data[h] = _res_conv_59_conv;
10576 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
10579 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
10580 LDKCVec_NodeAnnouncementZ _res_constr;
10581 _res_constr.datalen = *((uint32_t*)_res);
10582 if (_res_constr.datalen > 0)
10583 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10585 _res_constr.data = NULL;
10586 uint32_t* _res_vals = (uint32_t*)(_res + 4);
10587 for (size_t s = 0; s < _res_constr.datalen; s++) {
10588 uint32_t _res_conv_18 = _res_vals[s];
10589 LDKNodeAnnouncement _res_conv_18_conv;
10590 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
10591 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
10592 _res_constr.data[s] = _res_conv_18_conv;
10594 CVec_NodeAnnouncementZ_free(_res_constr);
10597 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
10598 LDKCVec_PublicKeyZ _res_constr;
10599 _res_constr.datalen = *((uint32_t*)_res);
10600 if (_res_constr.datalen > 0)
10601 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10603 _res_constr.data = NULL;
10604 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
10605 for (size_t m = 0; m < _res_constr.datalen; m++) {
10606 int8_tArray _res_conv_12 = _res_vals[m];
10607 LDKPublicKey _res_conv_12_ref;
10608 CHECK(*((uint32_t*)_res_conv_12) == 33);
10609 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
10610 _res_constr.data[m] = _res_conv_12_ref;
10612 CVec_PublicKeyZ_free(_res_constr);
10615 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
10617 o_ref.datalen = *((uint32_t*)o);
10618 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
10619 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
10620 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10621 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
10622 return (uint64_t)ret_conv;
10625 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
10626 LDKPeerHandleError e_conv;
10627 e_conv.inner = (void*)(e & (~1));
10628 e_conv.is_owned = (e & 1) || (e == 0);
10629 e_conv = PeerHandleError_clone(&e_conv);
10630 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10631 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
10632 return (uint64_t)ret_conv;
10635 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
10636 if ((_res & 1) != 0) return;
10637 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10639 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
10642 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
10643 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
10644 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10645 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
10646 return (uint64_t)ret_conv;
10649 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
10650 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10651 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
10652 return (uint64_t)ret_conv;
10655 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
10656 LDKPeerHandleError e_conv;
10657 e_conv.inner = (void*)(e & (~1));
10658 e_conv.is_owned = (e & 1) || (e == 0);
10659 e_conv = PeerHandleError_clone(&e_conv);
10660 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10661 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
10662 return (uint64_t)ret_conv;
10665 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
10666 if ((_res & 1) != 0) return;
10667 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10669 CResult_NonePeerHandleErrorZ_free(_res_conv);
10672 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
10673 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
10674 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10675 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
10676 return (uint64_t)ret_conv;
10679 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
10680 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10681 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
10682 return (uint64_t)ret_conv;
10685 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
10686 LDKPeerHandleError e_conv;
10687 e_conv.inner = (void*)(e & (~1));
10688 e_conv.is_owned = (e & 1) || (e == 0);
10689 e_conv = PeerHandleError_clone(&e_conv);
10690 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10691 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
10692 return (uint64_t)ret_conv;
10695 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
10696 if ((_res & 1) != 0) return;
10697 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
10699 CResult_boolPeerHandleErrorZ_free(_res_conv);
10702 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
10703 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
10704 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10705 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
10706 return (uint64_t)ret_conv;
10709 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
10711 o_conv.inner = (void*)(o & (~1));
10712 o_conv.is_owned = (o & 1) || (o == 0);
10713 o_conv = NodeId_clone(&o_conv);
10714 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
10715 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
10716 return (uint64_t)ret_conv;
10719 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
10720 LDKDecodeError e_conv;
10721 e_conv.inner = (void*)(e & (~1));
10722 e_conv.is_owned = (e & 1) || (e == 0);
10723 e_conv = DecodeError_clone(&e_conv);
10724 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
10725 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
10726 return (uint64_t)ret_conv;
10729 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
10730 if ((_res & 1) != 0) return;
10731 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1);
10733 CResult_NodeIdDecodeErrorZ_free(_res_conv);
10736 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
10737 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
10738 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
10739 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
10740 return (uint64_t)ret_conv;
10743 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
10744 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
10745 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10746 *ret_copy = COption_AccessZ_some(o_conv);
10747 uint64_t ret_ref = (uint64_t)ret_copy;
10751 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
10752 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
10753 *ret_copy = COption_AccessZ_none();
10754 uint64_t ret_ref = (uint64_t)ret_copy;
10758 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
10759 if ((_res & 1) != 0) return;
10760 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
10762 COption_AccessZ_free(_res_conv);
10765 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
10766 LDKDirectionalChannelInfo o_conv;
10767 o_conv.inner = (void*)(o & (~1));
10768 o_conv.is_owned = (o & 1) || (o == 0);
10769 o_conv = DirectionalChannelInfo_clone(&o_conv);
10770 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10771 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
10772 return (uint64_t)ret_conv;
10775 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
10776 LDKDecodeError e_conv;
10777 e_conv.inner = (void*)(e & (~1));
10778 e_conv.is_owned = (e & 1) || (e == 0);
10779 e_conv = DecodeError_clone(&e_conv);
10780 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10781 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
10782 return (uint64_t)ret_conv;
10785 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
10786 if ((_res & 1) != 0) return;
10787 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10789 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
10792 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10793 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
10794 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
10795 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
10796 return (uint64_t)ret_conv;
10799 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
10800 LDKChannelInfo o_conv;
10801 o_conv.inner = (void*)(o & (~1));
10802 o_conv.is_owned = (o & 1) || (o == 0);
10803 o_conv = ChannelInfo_clone(&o_conv);
10804 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10805 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
10806 return (uint64_t)ret_conv;
10809 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
10810 LDKDecodeError e_conv;
10811 e_conv.inner = (void*)(e & (~1));
10812 e_conv.is_owned = (e & 1) || (e == 0);
10813 e_conv = DecodeError_clone(&e_conv);
10814 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10815 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
10816 return (uint64_t)ret_conv;
10819 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
10820 if ((_res & 1) != 0) return;
10821 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10823 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
10826 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
10827 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
10828 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
10829 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
10830 return (uint64_t)ret_conv;
10833 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
10834 LDKRoutingFees o_conv;
10835 o_conv.inner = (void*)(o & (~1));
10836 o_conv.is_owned = (o & 1) || (o == 0);
10837 o_conv = RoutingFees_clone(&o_conv);
10838 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10839 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
10840 return (uint64_t)ret_conv;
10843 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
10844 LDKDecodeError e_conv;
10845 e_conv.inner = (void*)(e & (~1));
10846 e_conv.is_owned = (e & 1) || (e == 0);
10847 e_conv = DecodeError_clone(&e_conv);
10848 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10849 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
10850 return (uint64_t)ret_conv;
10853 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
10854 if ((_res & 1) != 0) return;
10855 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10857 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
10860 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
10861 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
10862 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
10863 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
10864 return (uint64_t)ret_conv;
10867 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
10868 LDKNodeAnnouncementInfo o_conv;
10869 o_conv.inner = (void*)(o & (~1));
10870 o_conv.is_owned = (o & 1) || (o == 0);
10871 o_conv = NodeAnnouncementInfo_clone(&o_conv);
10872 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10873 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
10874 return (uint64_t)ret_conv;
10877 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
10878 LDKDecodeError e_conv;
10879 e_conv.inner = (void*)(e & (~1));
10880 e_conv.is_owned = (e & 1) || (e == 0);
10881 e_conv = DecodeError_clone(&e_conv);
10882 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10883 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
10884 return (uint64_t)ret_conv;
10887 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
10888 if ((_res & 1) != 0) return;
10889 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10891 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
10894 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
10895 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
10896 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
10897 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
10898 return (uint64_t)ret_conv;
10901 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
10902 LDKCVec_u64Z _res_constr;
10903 _res_constr.datalen = *((uint32_t*)_res);
10904 if (_res_constr.datalen > 0)
10905 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10907 _res_constr.data = NULL;
10908 int64_t* _res_vals = (int64_t*)(_res + 4);
10909 for (size_t i = 0; i < _res_constr.datalen; i++) {
10910 int64_t _res_conv_8 = _res_vals[i];
10911 _res_constr.data[i] = _res_conv_8;
10913 CVec_u64Z_free(_res_constr);
10916 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
10917 LDKNodeInfo o_conv;
10918 o_conv.inner = (void*)(o & (~1));
10919 o_conv.is_owned = (o & 1) || (o == 0);
10920 o_conv = NodeInfo_clone(&o_conv);
10921 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10922 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
10923 return (uint64_t)ret_conv;
10926 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
10927 LDKDecodeError e_conv;
10928 e_conv.inner = (void*)(e & (~1));
10929 e_conv.is_owned = (e & 1) || (e == 0);
10930 e_conv = DecodeError_clone(&e_conv);
10931 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10932 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
10933 return (uint64_t)ret_conv;
10936 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
10937 if ((_res & 1) != 0) return;
10938 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
10940 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
10943 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
10944 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
10945 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
10946 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
10947 return (uint64_t)ret_conv;
10950 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
10951 LDKNetworkGraph o_conv;
10952 o_conv.inner = (void*)(o & (~1));
10953 o_conv.is_owned = (o & 1) || (o == 0);
10954 o_conv = NetworkGraph_clone(&o_conv);
10955 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10956 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
10957 return (uint64_t)ret_conv;
10960 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
10961 LDKDecodeError e_conv;
10962 e_conv.inner = (void*)(e & (~1));
10963 e_conv.is_owned = (e & 1) || (e == 0);
10964 e_conv = DecodeError_clone(&e_conv);
10965 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10966 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
10967 return (uint64_t)ret_conv;
10970 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
10971 if ((_res & 1) != 0) return;
10972 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
10974 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
10977 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
10978 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
10979 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
10980 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
10981 return (uint64_t)ret_conv;
10984 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
10985 LDKCVec_NetAddressZ o_constr;
10986 o_constr.datalen = *((uint32_t*)o);
10987 if (o_constr.datalen > 0)
10988 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10990 o_constr.data = NULL;
10991 uint32_t* o_vals = (uint32_t*)(o + 4);
10992 for (size_t m = 0; m < o_constr.datalen; m++) {
10993 uint32_t o_conv_12 = o_vals[m];
10994 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1);
10995 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
10996 o_constr.data[m] = o_conv_12_conv;
10998 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
10999 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
11000 uint64_t ret_ref = (uint64_t)ret_copy;
11004 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
11005 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11006 *ret_copy = COption_CVec_NetAddressZZ_none();
11007 uint64_t ret_ref = (uint64_t)ret_copy;
11011 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
11012 if ((_res & 1) != 0) return;
11013 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1);
11015 COption_CVec_NetAddressZZ_free(_res_conv);
11018 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
11019 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
11020 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
11021 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
11022 uint64_t ret_ref = (uint64_t)ret_copy;
11026 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
11027 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11028 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11029 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11030 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11031 return (uint64_t)ret_conv;
11034 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
11035 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11036 *ret_conv = CResult_NetAddressu8Z_err(e);
11037 return (uint64_t)ret_conv;
11040 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
11041 if ((_res & 1) != 0) return;
11042 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11044 CResult_NetAddressu8Z_free(_res_conv);
11047 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
11048 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11049 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11050 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11051 return (uint64_t)ret_conv;
11054 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
11055 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11056 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
11057 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11058 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11059 return (uint64_t)ret_conv;
11062 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
11063 LDKDecodeError e_conv;
11064 e_conv.inner = (void*)(e & (~1));
11065 e_conv.is_owned = (e & 1) || (e == 0);
11066 e_conv = DecodeError_clone(&e_conv);
11067 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11068 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11069 return (uint64_t)ret_conv;
11072 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
11073 if ((_res & 1) != 0) return;
11074 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11076 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11079 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
11080 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11081 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11082 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11083 return (uint64_t)ret_conv;
11086 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
11087 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11088 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
11089 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11090 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11091 return (uint64_t)ret_conv;
11094 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
11095 LDKDecodeError e_conv;
11096 e_conv.inner = (void*)(e & (~1));
11097 e_conv.is_owned = (e & 1) || (e == 0);
11098 e_conv = DecodeError_clone(&e_conv);
11099 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11100 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11101 return (uint64_t)ret_conv;
11104 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
11105 if ((_res & 1) != 0) return;
11106 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
11108 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11111 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
11112 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11113 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11114 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11115 return (uint64_t)ret_conv;
11118 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
11119 LDKCVec_UpdateAddHTLCZ _res_constr;
11120 _res_constr.datalen = *((uint32_t*)_res);
11121 if (_res_constr.datalen > 0)
11122 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11124 _res_constr.data = NULL;
11125 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11126 for (size_t p = 0; p < _res_constr.datalen; p++) {
11127 uint32_t _res_conv_15 = _res_vals[p];
11128 LDKUpdateAddHTLC _res_conv_15_conv;
11129 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11130 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11131 _res_constr.data[p] = _res_conv_15_conv;
11133 CVec_UpdateAddHTLCZ_free(_res_constr);
11136 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
11137 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11138 _res_constr.datalen = *((uint32_t*)_res);
11139 if (_res_constr.datalen > 0)
11140 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11142 _res_constr.data = NULL;
11143 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11144 for (size_t t = 0; t < _res_constr.datalen; t++) {
11145 uint32_t _res_conv_19 = _res_vals[t];
11146 LDKUpdateFulfillHTLC _res_conv_19_conv;
11147 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11148 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11149 _res_constr.data[t] = _res_conv_19_conv;
11151 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11154 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
11155 LDKCVec_UpdateFailHTLCZ _res_constr;
11156 _res_constr.datalen = *((uint32_t*)_res);
11157 if (_res_constr.datalen > 0)
11158 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11160 _res_constr.data = NULL;
11161 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11162 for (size_t q = 0; q < _res_constr.datalen; q++) {
11163 uint32_t _res_conv_16 = _res_vals[q];
11164 LDKUpdateFailHTLC _res_conv_16_conv;
11165 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11166 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11167 _res_constr.data[q] = _res_conv_16_conv;
11169 CVec_UpdateFailHTLCZ_free(_res_constr);
11172 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
11173 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11174 _res_constr.datalen = *((uint32_t*)_res);
11175 if (_res_constr.datalen > 0)
11176 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11178 _res_constr.data = NULL;
11179 uint32_t* _res_vals = (uint32_t*)(_res + 4);
11180 for (size_t z = 0; z < _res_constr.datalen; z++) {
11181 uint32_t _res_conv_25 = _res_vals[z];
11182 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11183 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11184 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11185 _res_constr.data[z] = _res_conv_25_conv;
11187 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11190 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
11191 LDKAcceptChannel o_conv;
11192 o_conv.inner = (void*)(o & (~1));
11193 o_conv.is_owned = (o & 1) || (o == 0);
11194 o_conv = AcceptChannel_clone(&o_conv);
11195 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11196 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11197 return (uint64_t)ret_conv;
11200 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
11201 LDKDecodeError e_conv;
11202 e_conv.inner = (void*)(e & (~1));
11203 e_conv.is_owned = (e & 1) || (e == 0);
11204 e_conv = DecodeError_clone(&e_conv);
11205 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11206 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11207 return (uint64_t)ret_conv;
11210 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
11211 if ((_res & 1) != 0) return;
11212 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11214 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11217 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
11218 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11219 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11220 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11221 return (uint64_t)ret_conv;
11224 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
11225 LDKAnnouncementSignatures o_conv;
11226 o_conv.inner = (void*)(o & (~1));
11227 o_conv.is_owned = (o & 1) || (o == 0);
11228 o_conv = AnnouncementSignatures_clone(&o_conv);
11229 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11230 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11231 return (uint64_t)ret_conv;
11234 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
11235 LDKDecodeError e_conv;
11236 e_conv.inner = (void*)(e & (~1));
11237 e_conv.is_owned = (e & 1) || (e == 0);
11238 e_conv = DecodeError_clone(&e_conv);
11239 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11240 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11241 return (uint64_t)ret_conv;
11244 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
11245 if ((_res & 1) != 0) return;
11246 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11248 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11251 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
11252 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11253 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11254 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11255 return (uint64_t)ret_conv;
11258 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
11259 LDKChannelReestablish o_conv;
11260 o_conv.inner = (void*)(o & (~1));
11261 o_conv.is_owned = (o & 1) || (o == 0);
11262 o_conv = ChannelReestablish_clone(&o_conv);
11263 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11264 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11265 return (uint64_t)ret_conv;
11268 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
11269 LDKDecodeError e_conv;
11270 e_conv.inner = (void*)(e & (~1));
11271 e_conv.is_owned = (e & 1) || (e == 0);
11272 e_conv = DecodeError_clone(&e_conv);
11273 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11274 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11275 return (uint64_t)ret_conv;
11278 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
11279 if ((_res & 1) != 0) return;
11280 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
11282 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11285 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
11286 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11287 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11288 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11289 return (uint64_t)ret_conv;
11292 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
11293 LDKClosingSigned o_conv;
11294 o_conv.inner = (void*)(o & (~1));
11295 o_conv.is_owned = (o & 1) || (o == 0);
11296 o_conv = ClosingSigned_clone(&o_conv);
11297 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11298 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11299 return (uint64_t)ret_conv;
11302 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
11303 LDKDecodeError e_conv;
11304 e_conv.inner = (void*)(e & (~1));
11305 e_conv.is_owned = (e & 1) || (e == 0);
11306 e_conv = DecodeError_clone(&e_conv);
11307 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11308 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11309 return (uint64_t)ret_conv;
11312 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
11313 if ((_res & 1) != 0) return;
11314 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11316 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11319 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
11320 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11321 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11322 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11323 return (uint64_t)ret_conv;
11326 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
11327 LDKClosingSignedFeeRange o_conv;
11328 o_conv.inner = (void*)(o & (~1));
11329 o_conv.is_owned = (o & 1) || (o == 0);
11330 o_conv = ClosingSignedFeeRange_clone(&o_conv);
11331 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11332 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
11333 return (uint64_t)ret_conv;
11336 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
11337 LDKDecodeError e_conv;
11338 e_conv.inner = (void*)(e & (~1));
11339 e_conv.is_owned = (e & 1) || (e == 0);
11340 e_conv = DecodeError_clone(&e_conv);
11341 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11342 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
11343 return (uint64_t)ret_conv;
11346 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
11347 if ((_res & 1) != 0) return;
11348 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11350 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
11353 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
11354 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
11355 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
11356 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
11357 return (uint64_t)ret_conv;
11360 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
11361 LDKCommitmentSigned o_conv;
11362 o_conv.inner = (void*)(o & (~1));
11363 o_conv.is_owned = (o & 1) || (o == 0);
11364 o_conv = CommitmentSigned_clone(&o_conv);
11365 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11366 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11367 return (uint64_t)ret_conv;
11370 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
11371 LDKDecodeError e_conv;
11372 e_conv.inner = (void*)(e & (~1));
11373 e_conv.is_owned = (e & 1) || (e == 0);
11374 e_conv = DecodeError_clone(&e_conv);
11375 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11376 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11377 return (uint64_t)ret_conv;
11380 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
11381 if ((_res & 1) != 0) return;
11382 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11384 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11387 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
11388 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11389 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11390 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11391 return (uint64_t)ret_conv;
11394 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
11395 LDKFundingCreated o_conv;
11396 o_conv.inner = (void*)(o & (~1));
11397 o_conv.is_owned = (o & 1) || (o == 0);
11398 o_conv = FundingCreated_clone(&o_conv);
11399 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11400 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11401 return (uint64_t)ret_conv;
11404 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
11405 LDKDecodeError e_conv;
11406 e_conv.inner = (void*)(e & (~1));
11407 e_conv.is_owned = (e & 1) || (e == 0);
11408 e_conv = DecodeError_clone(&e_conv);
11409 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11410 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11411 return (uint64_t)ret_conv;
11414 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
11415 if ((_res & 1) != 0) return;
11416 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11418 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11421 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
11422 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11423 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11424 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11425 return (uint64_t)ret_conv;
11428 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
11429 LDKFundingSigned o_conv;
11430 o_conv.inner = (void*)(o & (~1));
11431 o_conv.is_owned = (o & 1) || (o == 0);
11432 o_conv = FundingSigned_clone(&o_conv);
11433 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11434 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
11435 return (uint64_t)ret_conv;
11438 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
11439 LDKDecodeError e_conv;
11440 e_conv.inner = (void*)(e & (~1));
11441 e_conv.is_owned = (e & 1) || (e == 0);
11442 e_conv = DecodeError_clone(&e_conv);
11443 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11444 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
11445 return (uint64_t)ret_conv;
11448 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
11449 if ((_res & 1) != 0) return;
11450 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11452 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
11455 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
11456 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
11457 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
11458 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
11459 return (uint64_t)ret_conv;
11462 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
11463 LDKFundingLocked o_conv;
11464 o_conv.inner = (void*)(o & (~1));
11465 o_conv.is_owned = (o & 1) || (o == 0);
11466 o_conv = FundingLocked_clone(&o_conv);
11467 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11468 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
11469 return (uint64_t)ret_conv;
11472 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
11473 LDKDecodeError e_conv;
11474 e_conv.inner = (void*)(e & (~1));
11475 e_conv.is_owned = (e & 1) || (e == 0);
11476 e_conv = DecodeError_clone(&e_conv);
11477 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11478 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
11479 return (uint64_t)ret_conv;
11482 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
11483 if ((_res & 1) != 0) return;
11484 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11486 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
11489 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
11490 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
11491 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
11492 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
11493 return (uint64_t)ret_conv;
11496 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
11498 o_conv.inner = (void*)(o & (~1));
11499 o_conv.is_owned = (o & 1) || (o == 0);
11500 o_conv = Init_clone(&o_conv);
11501 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11502 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
11503 return (uint64_t)ret_conv;
11506 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
11507 LDKDecodeError e_conv;
11508 e_conv.inner = (void*)(e & (~1));
11509 e_conv.is_owned = (e & 1) || (e == 0);
11510 e_conv = DecodeError_clone(&e_conv);
11511 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11512 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
11513 return (uint64_t)ret_conv;
11516 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
11517 if ((_res & 1) != 0) return;
11518 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
11520 CResult_InitDecodeErrorZ_free(_res_conv);
11523 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
11524 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
11525 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
11526 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
11527 return (uint64_t)ret_conv;
11530 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
11531 LDKOpenChannel o_conv;
11532 o_conv.inner = (void*)(o & (~1));
11533 o_conv.is_owned = (o & 1) || (o == 0);
11534 o_conv = OpenChannel_clone(&o_conv);
11535 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11536 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
11537 return (uint64_t)ret_conv;
11540 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
11541 LDKDecodeError e_conv;
11542 e_conv.inner = (void*)(e & (~1));
11543 e_conv.is_owned = (e & 1) || (e == 0);
11544 e_conv = DecodeError_clone(&e_conv);
11545 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11546 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
11547 return (uint64_t)ret_conv;
11550 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
11551 if ((_res & 1) != 0) return;
11552 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11554 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
11557 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
11558 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
11559 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
11560 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
11561 return (uint64_t)ret_conv;
11564 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
11565 LDKRevokeAndACK o_conv;
11566 o_conv.inner = (void*)(o & (~1));
11567 o_conv.is_owned = (o & 1) || (o == 0);
11568 o_conv = RevokeAndACK_clone(&o_conv);
11569 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11570 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
11571 return (uint64_t)ret_conv;
11574 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
11575 LDKDecodeError e_conv;
11576 e_conv.inner = (void*)(e & (~1));
11577 e_conv.is_owned = (e & 1) || (e == 0);
11578 e_conv = DecodeError_clone(&e_conv);
11579 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11580 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
11581 return (uint64_t)ret_conv;
11584 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
11585 if ((_res & 1) != 0) return;
11586 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
11588 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
11591 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
11592 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
11593 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
11594 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
11595 return (uint64_t)ret_conv;
11598 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
11599 LDKShutdown o_conv;
11600 o_conv.inner = (void*)(o & (~1));
11601 o_conv.is_owned = (o & 1) || (o == 0);
11602 o_conv = Shutdown_clone(&o_conv);
11603 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11604 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
11605 return (uint64_t)ret_conv;
11608 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
11609 LDKDecodeError e_conv;
11610 e_conv.inner = (void*)(e & (~1));
11611 e_conv.is_owned = (e & 1) || (e == 0);
11612 e_conv = DecodeError_clone(&e_conv);
11613 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11614 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
11615 return (uint64_t)ret_conv;
11618 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
11619 if ((_res & 1) != 0) return;
11620 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
11622 CResult_ShutdownDecodeErrorZ_free(_res_conv);
11625 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
11626 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
11627 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
11628 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
11629 return (uint64_t)ret_conv;
11632 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
11633 LDKUpdateFailHTLC o_conv;
11634 o_conv.inner = (void*)(o & (~1));
11635 o_conv.is_owned = (o & 1) || (o == 0);
11636 o_conv = UpdateFailHTLC_clone(&o_conv);
11637 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11638 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
11639 return (uint64_t)ret_conv;
11642 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
11643 LDKDecodeError e_conv;
11644 e_conv.inner = (void*)(e & (~1));
11645 e_conv.is_owned = (e & 1) || (e == 0);
11646 e_conv = DecodeError_clone(&e_conv);
11647 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11648 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
11649 return (uint64_t)ret_conv;
11652 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
11653 if ((_res & 1) != 0) return;
11654 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11656 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
11659 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
11660 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
11661 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
11662 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
11663 return (uint64_t)ret_conv;
11666 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
11667 LDKUpdateFailMalformedHTLC o_conv;
11668 o_conv.inner = (void*)(o & (~1));
11669 o_conv.is_owned = (o & 1) || (o == 0);
11670 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
11671 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11672 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
11673 return (uint64_t)ret_conv;
11676 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
11677 LDKDecodeError e_conv;
11678 e_conv.inner = (void*)(e & (~1));
11679 e_conv.is_owned = (e & 1) || (e == 0);
11680 e_conv = DecodeError_clone(&e_conv);
11681 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11682 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
11683 return (uint64_t)ret_conv;
11686 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
11687 if ((_res & 1) != 0) return;
11688 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11690 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
11693 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
11694 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
11695 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
11696 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
11697 return (uint64_t)ret_conv;
11700 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
11701 LDKUpdateFee o_conv;
11702 o_conv.inner = (void*)(o & (~1));
11703 o_conv.is_owned = (o & 1) || (o == 0);
11704 o_conv = UpdateFee_clone(&o_conv);
11705 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11706 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
11707 return (uint64_t)ret_conv;
11710 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
11711 LDKDecodeError e_conv;
11712 e_conv.inner = (void*)(e & (~1));
11713 e_conv.is_owned = (e & 1) || (e == 0);
11714 e_conv = DecodeError_clone(&e_conv);
11715 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11716 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
11717 return (uint64_t)ret_conv;
11720 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
11721 if ((_res & 1) != 0) return;
11722 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
11724 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
11727 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
11728 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
11729 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
11730 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
11731 return (uint64_t)ret_conv;
11734 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
11735 LDKUpdateFulfillHTLC o_conv;
11736 o_conv.inner = (void*)(o & (~1));
11737 o_conv.is_owned = (o & 1) || (o == 0);
11738 o_conv = UpdateFulfillHTLC_clone(&o_conv);
11739 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11740 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
11741 return (uint64_t)ret_conv;
11744 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
11745 LDKDecodeError e_conv;
11746 e_conv.inner = (void*)(e & (~1));
11747 e_conv.is_owned = (e & 1) || (e == 0);
11748 e_conv = DecodeError_clone(&e_conv);
11749 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11750 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
11751 return (uint64_t)ret_conv;
11754 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
11755 if ((_res & 1) != 0) return;
11756 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11758 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
11761 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
11762 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
11763 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
11764 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
11765 return (uint64_t)ret_conv;
11768 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
11769 LDKUpdateAddHTLC o_conv;
11770 o_conv.inner = (void*)(o & (~1));
11771 o_conv.is_owned = (o & 1) || (o == 0);
11772 o_conv = UpdateAddHTLC_clone(&o_conv);
11773 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11774 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
11775 return (uint64_t)ret_conv;
11778 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
11779 LDKDecodeError e_conv;
11780 e_conv.inner = (void*)(e & (~1));
11781 e_conv.is_owned = (e & 1) || (e == 0);
11782 e_conv = DecodeError_clone(&e_conv);
11783 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11784 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
11785 return (uint64_t)ret_conv;
11788 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
11789 if ((_res & 1) != 0) return;
11790 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
11792 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
11795 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
11796 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
11797 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
11798 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
11799 return (uint64_t)ret_conv;
11802 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
11804 o_conv.inner = (void*)(o & (~1));
11805 o_conv.is_owned = (o & 1) || (o == 0);
11806 o_conv = Ping_clone(&o_conv);
11807 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11808 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
11809 return (uint64_t)ret_conv;
11812 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
11813 LDKDecodeError e_conv;
11814 e_conv.inner = (void*)(e & (~1));
11815 e_conv.is_owned = (e & 1) || (e == 0);
11816 e_conv = DecodeError_clone(&e_conv);
11817 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11818 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
11819 return (uint64_t)ret_conv;
11822 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
11823 if ((_res & 1) != 0) return;
11824 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
11826 CResult_PingDecodeErrorZ_free(_res_conv);
11829 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
11830 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
11831 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11832 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
11833 return (uint64_t)ret_conv;
11836 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
11838 o_conv.inner = (void*)(o & (~1));
11839 o_conv.is_owned = (o & 1) || (o == 0);
11840 o_conv = Pong_clone(&o_conv);
11841 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11842 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
11843 return (uint64_t)ret_conv;
11846 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
11847 LDKDecodeError e_conv;
11848 e_conv.inner = (void*)(e & (~1));
11849 e_conv.is_owned = (e & 1) || (e == 0);
11850 e_conv = DecodeError_clone(&e_conv);
11851 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11852 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
11853 return (uint64_t)ret_conv;
11856 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
11857 if ((_res & 1) != 0) return;
11858 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
11860 CResult_PongDecodeErrorZ_free(_res_conv);
11863 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
11864 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
11865 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11866 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
11867 return (uint64_t)ret_conv;
11870 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11871 LDKUnsignedChannelAnnouncement o_conv;
11872 o_conv.inner = (void*)(o & (~1));
11873 o_conv.is_owned = (o & 1) || (o == 0);
11874 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
11875 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11876 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
11877 return (uint64_t)ret_conv;
11880 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11881 LDKDecodeError e_conv;
11882 e_conv.inner = (void*)(e & (~1));
11883 e_conv.is_owned = (e & 1) || (e == 0);
11884 e_conv = DecodeError_clone(&e_conv);
11885 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11886 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
11887 return (uint64_t)ret_conv;
11890 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11891 if ((_res & 1) != 0) return;
11892 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11894 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
11897 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11898 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11899 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11900 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11901 return (uint64_t)ret_conv;
11904 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
11905 LDKChannelAnnouncement o_conv;
11906 o_conv.inner = (void*)(o & (~1));
11907 o_conv.is_owned = (o & 1) || (o == 0);
11908 o_conv = ChannelAnnouncement_clone(&o_conv);
11909 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11910 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
11911 return (uint64_t)ret_conv;
11914 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
11915 LDKDecodeError e_conv;
11916 e_conv.inner = (void*)(e & (~1));
11917 e_conv.is_owned = (e & 1) || (e == 0);
11918 e_conv = DecodeError_clone(&e_conv);
11919 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11920 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
11921 return (uint64_t)ret_conv;
11924 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
11925 if ((_res & 1) != 0) return;
11926 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
11928 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
11931 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
11932 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
11933 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
11934 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
11935 return (uint64_t)ret_conv;
11938 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11939 LDKUnsignedChannelUpdate o_conv;
11940 o_conv.inner = (void*)(o & (~1));
11941 o_conv.is_owned = (o & 1) || (o == 0);
11942 o_conv = UnsignedChannelUpdate_clone(&o_conv);
11943 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11944 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
11945 return (uint64_t)ret_conv;
11948 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
11949 LDKDecodeError e_conv;
11950 e_conv.inner = (void*)(e & (~1));
11951 e_conv.is_owned = (e & 1) || (e == 0);
11952 e_conv = DecodeError_clone(&e_conv);
11953 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11954 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
11955 return (uint64_t)ret_conv;
11958 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11959 if ((_res & 1) != 0) return;
11960 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11962 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
11965 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
11966 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
11967 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11968 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
11969 return (uint64_t)ret_conv;
11972 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
11973 LDKChannelUpdate o_conv;
11974 o_conv.inner = (void*)(o & (~1));
11975 o_conv.is_owned = (o & 1) || (o == 0);
11976 o_conv = ChannelUpdate_clone(&o_conv);
11977 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11978 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
11979 return (uint64_t)ret_conv;
11982 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
11983 LDKDecodeError e_conv;
11984 e_conv.inner = (void*)(e & (~1));
11985 e_conv.is_owned = (e & 1) || (e == 0);
11986 e_conv = DecodeError_clone(&e_conv);
11987 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
11988 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
11989 return (uint64_t)ret_conv;
11992 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
11993 if ((_res & 1) != 0) return;
11994 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11996 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
11999 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
12000 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12001 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12002 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12003 return (uint64_t)ret_conv;
12006 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
12007 LDKErrorMessage o_conv;
12008 o_conv.inner = (void*)(o & (~1));
12009 o_conv.is_owned = (o & 1) || (o == 0);
12010 o_conv = ErrorMessage_clone(&o_conv);
12011 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12012 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12013 return (uint64_t)ret_conv;
12016 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
12017 LDKDecodeError e_conv;
12018 e_conv.inner = (void*)(e & (~1));
12019 e_conv.is_owned = (e & 1) || (e == 0);
12020 e_conv = DecodeError_clone(&e_conv);
12021 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12022 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12023 return (uint64_t)ret_conv;
12026 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
12027 if ((_res & 1) != 0) return;
12028 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12030 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12033 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
12034 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12035 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12036 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12037 return (uint64_t)ret_conv;
12040 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12041 LDKUnsignedNodeAnnouncement o_conv;
12042 o_conv.inner = (void*)(o & (~1));
12043 o_conv.is_owned = (o & 1) || (o == 0);
12044 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12045 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12046 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12047 return (uint64_t)ret_conv;
12050 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12051 LDKDecodeError e_conv;
12052 e_conv.inner = (void*)(e & (~1));
12053 e_conv.is_owned = (e & 1) || (e == 0);
12054 e_conv = DecodeError_clone(&e_conv);
12055 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12056 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12057 return (uint64_t)ret_conv;
12060 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12061 if ((_res & 1) != 0) return;
12062 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12064 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12067 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12068 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12069 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12070 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12071 return (uint64_t)ret_conv;
12074 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
12075 LDKNodeAnnouncement o_conv;
12076 o_conv.inner = (void*)(o & (~1));
12077 o_conv.is_owned = (o & 1) || (o == 0);
12078 o_conv = NodeAnnouncement_clone(&o_conv);
12079 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12080 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12081 return (uint64_t)ret_conv;
12084 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
12085 LDKDecodeError e_conv;
12086 e_conv.inner = (void*)(e & (~1));
12087 e_conv.is_owned = (e & 1) || (e == 0);
12088 e_conv = DecodeError_clone(&e_conv);
12089 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12090 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12091 return (uint64_t)ret_conv;
12094 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
12095 if ((_res & 1) != 0) return;
12096 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12098 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12101 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
12102 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12103 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12104 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12105 return (uint64_t)ret_conv;
12108 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
12109 LDKQueryShortChannelIds o_conv;
12110 o_conv.inner = (void*)(o & (~1));
12111 o_conv.is_owned = (o & 1) || (o == 0);
12112 o_conv = QueryShortChannelIds_clone(&o_conv);
12113 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12114 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12115 return (uint64_t)ret_conv;
12118 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
12119 LDKDecodeError e_conv;
12120 e_conv.inner = (void*)(e & (~1));
12121 e_conv.is_owned = (e & 1) || (e == 0);
12122 e_conv = DecodeError_clone(&e_conv);
12123 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12124 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12125 return (uint64_t)ret_conv;
12128 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
12129 if ((_res & 1) != 0) return;
12130 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12132 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12135 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
12136 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12137 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12138 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12139 return (uint64_t)ret_conv;
12142 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
12143 LDKReplyShortChannelIdsEnd o_conv;
12144 o_conv.inner = (void*)(o & (~1));
12145 o_conv.is_owned = (o & 1) || (o == 0);
12146 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12147 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12148 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12149 return (uint64_t)ret_conv;
12152 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
12153 LDKDecodeError e_conv;
12154 e_conv.inner = (void*)(e & (~1));
12155 e_conv.is_owned = (e & 1) || (e == 0);
12156 e_conv = DecodeError_clone(&e_conv);
12157 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12158 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12159 return (uint64_t)ret_conv;
12162 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
12163 if ((_res & 1) != 0) return;
12164 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
12166 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12169 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
12170 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12171 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12172 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12173 return (uint64_t)ret_conv;
12176 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
12177 LDKQueryChannelRange o_conv;
12178 o_conv.inner = (void*)(o & (~1));
12179 o_conv.is_owned = (o & 1) || (o == 0);
12180 o_conv = QueryChannelRange_clone(&o_conv);
12181 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12182 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12183 return (uint64_t)ret_conv;
12186 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
12187 LDKDecodeError e_conv;
12188 e_conv.inner = (void*)(e & (~1));
12189 e_conv.is_owned = (e & 1) || (e == 0);
12190 e_conv = DecodeError_clone(&e_conv);
12191 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12192 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12193 return (uint64_t)ret_conv;
12196 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
12197 if ((_res & 1) != 0) return;
12198 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12200 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12203 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12204 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12205 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12206 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12207 return (uint64_t)ret_conv;
12210 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
12211 LDKReplyChannelRange o_conv;
12212 o_conv.inner = (void*)(o & (~1));
12213 o_conv.is_owned = (o & 1) || (o == 0);
12214 o_conv = ReplyChannelRange_clone(&o_conv);
12215 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12216 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12217 return (uint64_t)ret_conv;
12220 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
12221 LDKDecodeError e_conv;
12222 e_conv.inner = (void*)(e & (~1));
12223 e_conv.is_owned = (e & 1) || (e == 0);
12224 e_conv = DecodeError_clone(&e_conv);
12225 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12226 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12227 return (uint64_t)ret_conv;
12230 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
12231 if ((_res & 1) != 0) return;
12232 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12234 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12237 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
12238 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12239 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12240 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12241 return (uint64_t)ret_conv;
12244 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
12245 LDKGossipTimestampFilter o_conv;
12246 o_conv.inner = (void*)(o & (~1));
12247 o_conv.is_owned = (o & 1) || (o == 0);
12248 o_conv = GossipTimestampFilter_clone(&o_conv);
12249 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12250 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12251 return (uint64_t)ret_conv;
12254 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
12255 LDKDecodeError e_conv;
12256 e_conv.inner = (void*)(e & (~1));
12257 e_conv.is_owned = (e & 1) || (e == 0);
12258 e_conv = DecodeError_clone(&e_conv);
12259 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12260 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12261 return (uint64_t)ret_conv;
12264 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
12265 if ((_res & 1) != 0) return;
12266 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
12268 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12271 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
12272 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12273 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12274 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12275 return (uint64_t)ret_conv;
12278 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
12280 o_conv.inner = (void*)(o & (~1));
12281 o_conv.is_owned = (o & 1) || (o == 0);
12282 o_conv = Invoice_clone(&o_conv);
12283 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12284 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12285 return (uint64_t)ret_conv;
12288 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
12289 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
12290 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
12291 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12292 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12293 return (uint64_t)ret_conv;
12296 void __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
12297 if ((_res & 1) != 0) return;
12298 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
12300 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12303 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
12304 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12305 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12306 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12307 return (uint64_t)ret_conv;
12310 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
12311 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
12312 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12313 *ret_copy = COption_FilterZ_some(o_conv);
12314 uint64_t ret_ref = (uint64_t)ret_copy;
12318 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
12319 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
12320 *ret_copy = COption_FilterZ_none();
12321 uint64_t ret_ref = (uint64_t)ret_copy;
12325 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
12326 if ((_res & 1) != 0) return;
12327 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
12329 COption_FilterZ_free(_res_conv);
12332 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
12333 LDKLockedChannelMonitor o_conv;
12334 o_conv.inner = (void*)(o & (~1));
12335 o_conv.is_owned = (o & 1) || (o == 0);
12336 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
12337 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12338 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
12339 return (uint64_t)ret_conv;
12342 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
12343 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
12344 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
12345 return (uint64_t)ret_conv;
12348 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
12349 if ((_res & 1) != 0) return;
12350 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1);
12352 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
12355 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
12356 LDKCVec_OutPointZ _res_constr;
12357 _res_constr.datalen = *((uint32_t*)_res);
12358 if (_res_constr.datalen > 0)
12359 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
12361 _res_constr.data = NULL;
12362 uint32_t* _res_vals = (uint32_t*)(_res + 4);
12363 for (size_t k = 0; k < _res_constr.datalen; k++) {
12364 uint32_t _res_conv_10 = _res_vals[k];
12365 LDKOutPoint _res_conv_10_conv;
12366 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12367 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12368 _res_constr.data[k] = _res_conv_10_conv;
12370 CVec_OutPointZ_free(_res_constr);
12373 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
12374 if ((this_ptr & 1) != 0) return;
12375 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
12376 FREE((void*)this_ptr);
12377 PaymentPurpose_free(this_ptr_conv);
12380 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
12381 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
12382 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12383 *ret_copy = PaymentPurpose_clone(orig_conv);
12384 uint64_t ret_ref = (uint64_t)ret_copy;
12388 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
12389 LDKThirtyTwoBytes payment_preimage_ref;
12390 CHECK(*((uint32_t*)payment_preimage) == 32);
12391 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12392 LDKThirtyTwoBytes payment_secret_ref;
12393 CHECK(*((uint32_t*)payment_secret) == 32);
12394 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
12395 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12396 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
12397 uint64_t ret_ref = (uint64_t)ret_copy;
12401 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
12402 LDKThirtyTwoBytes a_ref;
12403 CHECK(*((uint32_t*)a) == 32);
12404 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
12405 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12406 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
12407 uint64_t ret_ref = (uint64_t)ret_copy;
12411 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
12412 if ((this_ptr & 1) != 0) return;
12413 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
12414 FREE((void*)this_ptr);
12415 ClosureReason_free(this_ptr_conv);
12418 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
12419 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
12420 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12421 *ret_copy = ClosureReason_clone(orig_conv);
12422 uint64_t ret_ref = (uint64_t)ret_copy;
12426 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
12427 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
12428 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12429 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
12430 uint64_t ret_ref = (uint64_t)ret_copy;
12434 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
12435 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12436 *ret_copy = ClosureReason_holder_force_closed();
12437 uint64_t ret_ref = (uint64_t)ret_copy;
12441 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
12442 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12443 *ret_copy = ClosureReason_cooperative_closure();
12444 uint64_t ret_ref = (uint64_t)ret_copy;
12448 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
12449 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12450 *ret_copy = ClosureReason_commitment_tx_confirmed();
12451 uint64_t ret_ref = (uint64_t)ret_copy;
12455 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
12456 LDKStr err_conv = str_ref_to_owned_c(err);
12457 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12458 *ret_copy = ClosureReason_processing_error(err_conv);
12459 uint64_t ret_ref = (uint64_t)ret_copy;
12463 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
12464 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12465 *ret_copy = ClosureReason_disconnected_peer();
12466 uint64_t ret_ref = (uint64_t)ret_copy;
12470 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
12471 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
12472 *ret_copy = ClosureReason_outdated_channel_manager();
12473 uint64_t ret_ref = (uint64_t)ret_copy;
12477 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
12478 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
12479 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
12480 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12481 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12482 CVec_u8Z_free(ret_var);
12486 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
12487 if ((this_ptr & 1) != 0) return;
12488 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12489 FREE((void*)this_ptr);
12490 Event_free(this_ptr_conv);
12493 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
12494 LDKEvent* orig_conv = (LDKEvent*)orig;
12495 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12496 *ret_copy = Event_clone(orig_conv);
12497 uint64_t ret_ref = (uint64_t)ret_copy;
12501 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) {
12502 LDKThirtyTwoBytes temporary_channel_id_ref;
12503 CHECK(*((uint32_t*)temporary_channel_id) == 32);
12504 memcpy(temporary_channel_id_ref.data, (uint8_t*)(temporary_channel_id + 4), 32);
12505 LDKCVec_u8Z output_script_ref;
12506 output_script_ref.datalen = *((uint32_t*)output_script);
12507 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
12508 memcpy(output_script_ref.data, (uint8_t*)(output_script + 4), output_script_ref.datalen);
12509 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12510 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
12511 uint64_t ret_ref = (uint64_t)ret_copy;
12515 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
12516 LDKThirtyTwoBytes payment_hash_ref;
12517 CHECK(*((uint32_t*)payment_hash) == 32);
12518 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12519 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
12520 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
12521 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12522 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
12523 uint64_t ret_ref = (uint64_t)ret_copy;
12527 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage, int8_tArray payment_hash) {
12528 LDKThirtyTwoBytes payment_preimage_ref;
12529 CHECK(*((uint32_t*)payment_preimage) == 32);
12530 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
12531 LDKThirtyTwoBytes payment_hash_ref;
12532 CHECK(*((uint32_t*)payment_hash) == 32);
12533 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12534 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12535 *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref);
12536 uint64_t ret_ref = (uint64_t)ret_copy;
12540 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, uint32_t short_channel_id) {
12541 LDKThirtyTwoBytes payment_hash_ref;
12542 CHECK(*((uint32_t*)payment_hash) == 32);
12543 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
12544 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
12545 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
12546 LDKCVec_RouteHopZ path_constr;
12547 path_constr.datalen = *((uint32_t*)path);
12548 if (path_constr.datalen > 0)
12549 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12551 path_constr.data = NULL;
12552 uint32_t* path_vals = (uint32_t*)(path + 4);
12553 for (size_t k = 0; k < path_constr.datalen; k++) {
12554 uint32_t path_conv_10 = path_vals[k];
12555 LDKRouteHop path_conv_10_conv;
12556 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12557 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12558 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12559 path_constr.data[k] = path_conv_10_conv;
12561 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1);
12562 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
12563 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12564 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv);
12565 uint64_t ret_ref = (uint64_t)ret_copy;
12569 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
12570 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12571 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
12572 uint64_t ret_ref = (uint64_t)ret_copy;
12576 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
12577 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
12578 outputs_constr.datalen = *((uint32_t*)outputs);
12579 if (outputs_constr.datalen > 0)
12580 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12582 outputs_constr.data = NULL;
12583 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
12584 for (size_t b = 0; b < outputs_constr.datalen; b++) {
12585 uint32_t outputs_conv_27 = outputs_vals[b];
12586 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
12587 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
12588 outputs_constr.data[b] = outputs_conv_27_conv;
12590 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12591 *ret_copy = Event_spendable_outputs(outputs_constr);
12592 uint64_t ret_ref = (uint64_t)ret_copy;
12596 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
12597 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
12598 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
12599 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12600 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
12601 uint64_t ret_ref = (uint64_t)ret_copy;
12605 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
12606 LDKThirtyTwoBytes channel_id_ref;
12607 CHECK(*((uint32_t*)channel_id) == 32);
12608 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
12609 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
12610 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
12611 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12612 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
12613 uint64_t ret_ref = (uint64_t)ret_copy;
12617 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
12618 LDKThirtyTwoBytes channel_id_ref;
12619 CHECK(*((uint32_t*)channel_id) == 32);
12620 memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
12621 LDKTransaction transaction_ref;
12622 transaction_ref.datalen = *((uint32_t*)transaction);
12623 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
12624 memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen);
12625 transaction_ref.data_is_owned = true;
12626 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12627 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
12628 uint64_t ret_ref = (uint64_t)ret_copy;
12632 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
12633 LDKEvent* obj_conv = (LDKEvent*)obj;
12634 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12635 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12636 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12637 CVec_u8Z_free(ret_var);
12641 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
12642 if ((this_ptr & 1) != 0) return;
12643 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12644 FREE((void*)this_ptr);
12645 MessageSendEvent_free(this_ptr_conv);
12648 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
12649 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12650 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12651 *ret_copy = MessageSendEvent_clone(orig_conv);
12652 uint64_t ret_ref = (uint64_t)ret_copy;
12656 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
12657 LDKPublicKey node_id_ref;
12658 CHECK(*((uint32_t*)node_id) == 33);
12659 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12660 LDKAcceptChannel msg_conv;
12661 msg_conv.inner = (void*)(msg & (~1));
12662 msg_conv.is_owned = (msg & 1) || (msg == 0);
12663 msg_conv = AcceptChannel_clone(&msg_conv);
12664 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12665 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
12666 uint64_t ret_ref = (uint64_t)ret_copy;
12670 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
12671 LDKPublicKey node_id_ref;
12672 CHECK(*((uint32_t*)node_id) == 33);
12673 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12674 LDKOpenChannel msg_conv;
12675 msg_conv.inner = (void*)(msg & (~1));
12676 msg_conv.is_owned = (msg & 1) || (msg == 0);
12677 msg_conv = OpenChannel_clone(&msg_conv);
12678 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12679 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
12680 uint64_t ret_ref = (uint64_t)ret_copy;
12684 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
12685 LDKPublicKey node_id_ref;
12686 CHECK(*((uint32_t*)node_id) == 33);
12687 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12688 LDKFundingCreated msg_conv;
12689 msg_conv.inner = (void*)(msg & (~1));
12690 msg_conv.is_owned = (msg & 1) || (msg == 0);
12691 msg_conv = FundingCreated_clone(&msg_conv);
12692 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12693 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
12694 uint64_t ret_ref = (uint64_t)ret_copy;
12698 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
12699 LDKPublicKey node_id_ref;
12700 CHECK(*((uint32_t*)node_id) == 33);
12701 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12702 LDKFundingSigned msg_conv;
12703 msg_conv.inner = (void*)(msg & (~1));
12704 msg_conv.is_owned = (msg & 1) || (msg == 0);
12705 msg_conv = FundingSigned_clone(&msg_conv);
12706 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12707 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
12708 uint64_t ret_ref = (uint64_t)ret_copy;
12712 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
12713 LDKPublicKey node_id_ref;
12714 CHECK(*((uint32_t*)node_id) == 33);
12715 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12716 LDKFundingLocked msg_conv;
12717 msg_conv.inner = (void*)(msg & (~1));
12718 msg_conv.is_owned = (msg & 1) || (msg == 0);
12719 msg_conv = FundingLocked_clone(&msg_conv);
12720 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12721 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
12722 uint64_t ret_ref = (uint64_t)ret_copy;
12726 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
12727 LDKPublicKey node_id_ref;
12728 CHECK(*((uint32_t*)node_id) == 33);
12729 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12730 LDKAnnouncementSignatures msg_conv;
12731 msg_conv.inner = (void*)(msg & (~1));
12732 msg_conv.is_owned = (msg & 1) || (msg == 0);
12733 msg_conv = AnnouncementSignatures_clone(&msg_conv);
12734 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12735 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
12736 uint64_t ret_ref = (uint64_t)ret_copy;
12740 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
12741 LDKPublicKey node_id_ref;
12742 CHECK(*((uint32_t*)node_id) == 33);
12743 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12744 LDKCommitmentUpdate updates_conv;
12745 updates_conv.inner = (void*)(updates & (~1));
12746 updates_conv.is_owned = (updates & 1) || (updates == 0);
12747 updates_conv = CommitmentUpdate_clone(&updates_conv);
12748 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12749 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
12750 uint64_t ret_ref = (uint64_t)ret_copy;
12754 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
12755 LDKPublicKey node_id_ref;
12756 CHECK(*((uint32_t*)node_id) == 33);
12757 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12758 LDKRevokeAndACK msg_conv;
12759 msg_conv.inner = (void*)(msg & (~1));
12760 msg_conv.is_owned = (msg & 1) || (msg == 0);
12761 msg_conv = RevokeAndACK_clone(&msg_conv);
12762 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12763 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
12764 uint64_t ret_ref = (uint64_t)ret_copy;
12768 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
12769 LDKPublicKey node_id_ref;
12770 CHECK(*((uint32_t*)node_id) == 33);
12771 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12772 LDKClosingSigned msg_conv;
12773 msg_conv.inner = (void*)(msg & (~1));
12774 msg_conv.is_owned = (msg & 1) || (msg == 0);
12775 msg_conv = ClosingSigned_clone(&msg_conv);
12776 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12777 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
12778 uint64_t ret_ref = (uint64_t)ret_copy;
12782 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
12783 LDKPublicKey node_id_ref;
12784 CHECK(*((uint32_t*)node_id) == 33);
12785 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12786 LDKShutdown msg_conv;
12787 msg_conv.inner = (void*)(msg & (~1));
12788 msg_conv.is_owned = (msg & 1) || (msg == 0);
12789 msg_conv = Shutdown_clone(&msg_conv);
12790 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12791 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
12792 uint64_t ret_ref = (uint64_t)ret_copy;
12796 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
12797 LDKPublicKey node_id_ref;
12798 CHECK(*((uint32_t*)node_id) == 33);
12799 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12800 LDKChannelReestablish msg_conv;
12801 msg_conv.inner = (void*)(msg & (~1));
12802 msg_conv.is_owned = (msg & 1) || (msg == 0);
12803 msg_conv = ChannelReestablish_clone(&msg_conv);
12804 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12805 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
12806 uint64_t ret_ref = (uint64_t)ret_copy;
12810 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
12811 LDKChannelAnnouncement msg_conv;
12812 msg_conv.inner = (void*)(msg & (~1));
12813 msg_conv.is_owned = (msg & 1) || (msg == 0);
12814 msg_conv = ChannelAnnouncement_clone(&msg_conv);
12815 LDKChannelUpdate update_msg_conv;
12816 update_msg_conv.inner = (void*)(update_msg & (~1));
12817 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
12818 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
12819 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12820 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
12821 uint64_t ret_ref = (uint64_t)ret_copy;
12825 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
12826 LDKNodeAnnouncement msg_conv;
12827 msg_conv.inner = (void*)(msg & (~1));
12828 msg_conv.is_owned = (msg & 1) || (msg == 0);
12829 msg_conv = NodeAnnouncement_clone(&msg_conv);
12830 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12831 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
12832 uint64_t ret_ref = (uint64_t)ret_copy;
12836 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
12837 LDKChannelUpdate msg_conv;
12838 msg_conv.inner = (void*)(msg & (~1));
12839 msg_conv.is_owned = (msg & 1) || (msg == 0);
12840 msg_conv = ChannelUpdate_clone(&msg_conv);
12841 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12842 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
12843 uint64_t ret_ref = (uint64_t)ret_copy;
12847 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
12848 LDKPublicKey node_id_ref;
12849 CHECK(*((uint32_t*)node_id) == 33);
12850 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12851 LDKChannelUpdate msg_conv;
12852 msg_conv.inner = (void*)(msg & (~1));
12853 msg_conv.is_owned = (msg & 1) || (msg == 0);
12854 msg_conv = ChannelUpdate_clone(&msg_conv);
12855 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12856 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
12857 uint64_t ret_ref = (uint64_t)ret_copy;
12861 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
12862 LDKPublicKey node_id_ref;
12863 CHECK(*((uint32_t*)node_id) == 33);
12864 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12865 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
12866 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
12867 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12868 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
12869 uint64_t ret_ref = (uint64_t)ret_copy;
12873 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
12874 LDKPublicKey node_id_ref;
12875 CHECK(*((uint32_t*)node_id) == 33);
12876 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12877 LDKQueryChannelRange msg_conv;
12878 msg_conv.inner = (void*)(msg & (~1));
12879 msg_conv.is_owned = (msg & 1) || (msg == 0);
12880 msg_conv = QueryChannelRange_clone(&msg_conv);
12881 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12882 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
12883 uint64_t ret_ref = (uint64_t)ret_copy;
12887 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
12888 LDKPublicKey node_id_ref;
12889 CHECK(*((uint32_t*)node_id) == 33);
12890 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12891 LDKQueryShortChannelIds msg_conv;
12892 msg_conv.inner = (void*)(msg & (~1));
12893 msg_conv.is_owned = (msg & 1) || (msg == 0);
12894 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12895 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12896 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
12897 uint64_t ret_ref = (uint64_t)ret_copy;
12901 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
12902 LDKPublicKey node_id_ref;
12903 CHECK(*((uint32_t*)node_id) == 33);
12904 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
12905 LDKReplyChannelRange msg_conv;
12906 msg_conv.inner = (void*)(msg & (~1));
12907 msg_conv.is_owned = (msg & 1) || (msg == 0);
12908 msg_conv = ReplyChannelRange_clone(&msg_conv);
12909 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12910 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
12911 uint64_t ret_ref = (uint64_t)ret_copy;
12915 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
12916 if ((this_ptr & 1) != 0) return;
12917 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12918 FREE((void*)this_ptr);
12919 MessageSendEventsProvider_free(this_ptr_conv);
12922 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
12923 if ((this_ptr & 1) != 0) return;
12924 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12925 FREE((void*)this_ptr);
12926 EventsProvider_free(this_ptr_conv);
12929 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
12930 if ((this_ptr & 1) != 0) return;
12931 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12932 FREE((void*)this_ptr);
12933 EventHandler_free(this_ptr_conv);
12936 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
12937 if ((this_ptr & 1) != 0) return;
12938 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12939 FREE((void*)this_ptr);
12940 APIError_free(this_ptr_conv);
12943 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
12944 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12945 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12946 *ret_copy = APIError_clone(orig_conv);
12947 uint64_t ret_ref = (uint64_t)ret_copy;
12951 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
12952 LDKStr err_conv = str_ref_to_owned_c(err);
12953 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12954 *ret_copy = APIError_apimisuse_error(err_conv);
12955 uint64_t ret_ref = (uint64_t)ret_copy;
12959 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
12960 LDKStr err_conv = str_ref_to_owned_c(err);
12961 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12962 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
12963 uint64_t ret_ref = (uint64_t)ret_copy;
12967 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
12968 LDKStr err_conv = str_ref_to_owned_c(err);
12969 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12970 *ret_copy = APIError_route_error(err_conv);
12971 uint64_t ret_ref = (uint64_t)ret_copy;
12975 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
12976 LDKStr err_conv = str_ref_to_owned_c(err);
12977 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12978 *ret_copy = APIError_channel_unavailable(err_conv);
12979 uint64_t ret_ref = (uint64_t)ret_copy;
12983 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
12984 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12985 *ret_copy = APIError_monitor_update_failed();
12986 uint64_t ret_ref = (uint64_t)ret_copy;
12990 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
12991 LDKShutdownScript script_conv;
12992 script_conv.inner = (void*)(script & (~1));
12993 script_conv.is_owned = (script & 1) || (script == 0);
12994 script_conv = ShutdownScript_clone(&script_conv);
12995 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12996 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
12997 uint64_t ret_ref = (uint64_t)ret_copy;
13001 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
13002 LDKu8slice msg_ref;
13003 msg_ref.datalen = *((uint32_t*)msg);
13004 msg_ref.data = (int8_t*)(msg + 4);
13005 unsigned char sk_arr[32];
13006 CHECK(*((uint32_t*)sk) == 32);
13007 memcpy(sk_arr, (uint8_t*)(sk + 4), 32);
13008 unsigned char (*sk_ref)[32] = &sk_arr;
13009 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13010 *ret_conv = sign(msg_ref, sk_ref);
13011 return (uint64_t)ret_conv;
13014 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
13015 LDKu8slice msg_ref;
13016 msg_ref.datalen = *((uint32_t*)msg);
13017 msg_ref.data = (int8_t*)(msg + 4);
13018 LDKStr sig_conv = str_ref_to_owned_c(sig);
13019 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13020 *ret_conv = recover_pk(msg_ref, sig_conv);
13021 return (uint64_t)ret_conv;
13024 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
13025 LDKu8slice msg_ref;
13026 msg_ref.datalen = *((uint32_t*)msg);
13027 msg_ref.data = (int8_t*)(msg + 4);
13028 LDKStr sig_conv = str_ref_to_owned_c(sig);
13029 LDKPublicKey pk_ref;
13030 CHECK(*((uint32_t*)pk) == 33);
13031 memcpy(pk_ref.compressed_form, (uint8_t*)(pk + 4), 33);
13032 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13036 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
13037 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13038 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
13042 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
13043 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
13047 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
13048 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
13052 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
13053 uint32_t ret_conv = LDKLevel_to_js(Level_info());
13057 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
13058 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
13062 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
13063 uint32_t ret_conv = LDKLevel_to_js(Level_error());
13067 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
13068 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13069 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13070 jboolean ret_val = Level_eq(a_conv, b_conv);
13074 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
13075 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13076 int64_t ret_val = Level_hash(o_conv);
13080 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
13081 uint32_t ret_conv = LDKLevel_to_js(Level_max());
13085 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
13086 if ((this_ptr & 1) != 0) return;
13087 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13088 FREE((void*)this_ptr);
13089 Logger_free(this_ptr_conv);
13092 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
13093 LDKChannelHandshakeConfig this_obj_conv;
13094 this_obj_conv.inner = (void*)(this_obj & (~1));
13095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13096 ChannelHandshakeConfig_free(this_obj_conv);
13099 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
13100 LDKChannelHandshakeConfig this_ptr_conv;
13101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13102 this_ptr_conv.is_owned = false;
13103 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13107 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
13108 LDKChannelHandshakeConfig this_ptr_conv;
13109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13110 this_ptr_conv.is_owned = false;
13111 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13114 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
13115 LDKChannelHandshakeConfig this_ptr_conv;
13116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13117 this_ptr_conv.is_owned = false;
13118 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13122 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
13123 LDKChannelHandshakeConfig this_ptr_conv;
13124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13125 this_ptr_conv.is_owned = false;
13126 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13129 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
13130 LDKChannelHandshakeConfig this_ptr_conv;
13131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13132 this_ptr_conv.is_owned = false;
13133 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13137 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13138 LDKChannelHandshakeConfig this_ptr_conv;
13139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13140 this_ptr_conv.is_owned = false;
13141 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13144 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) {
13145 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13148 uint64_t ret_ref = (uint64_t)ret_var.inner;
13149 if (ret_var.is_owned) {
13155 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
13156 LDKChannelHandshakeConfig orig_conv;
13157 orig_conv.inner = (void*)(orig & (~1));
13158 orig_conv.is_owned = false;
13159 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13162 uint64_t ret_ref = (uint64_t)ret_var.inner;
13163 if (ret_var.is_owned) {
13169 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
13170 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13173 uint64_t ret_ref = (uint64_t)ret_var.inner;
13174 if (ret_var.is_owned) {
13180 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
13181 LDKChannelHandshakeLimits this_obj_conv;
13182 this_obj_conv.inner = (void*)(this_obj & (~1));
13183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13184 ChannelHandshakeLimits_free(this_obj_conv);
13187 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
13188 LDKChannelHandshakeLimits this_ptr_conv;
13189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13190 this_ptr_conv.is_owned = false;
13191 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13195 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
13196 LDKChannelHandshakeLimits this_ptr_conv;
13197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13198 this_ptr_conv.is_owned = false;
13199 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13202 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
13203 LDKChannelHandshakeLimits this_ptr_conv;
13204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13205 this_ptr_conv.is_owned = false;
13206 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13210 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13211 LDKChannelHandshakeLimits this_ptr_conv;
13212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13213 this_ptr_conv.is_owned = false;
13214 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13217 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
13218 LDKChannelHandshakeLimits this_ptr_conv;
13219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13220 this_ptr_conv.is_owned = false;
13221 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13225 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
13226 LDKChannelHandshakeLimits this_ptr_conv;
13227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13228 this_ptr_conv.is_owned = false;
13229 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13232 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
13233 LDKChannelHandshakeLimits this_ptr_conv;
13234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13235 this_ptr_conv.is_owned = false;
13236 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13240 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
13241 LDKChannelHandshakeLimits this_ptr_conv;
13242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13243 this_ptr_conv.is_owned = false;
13244 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13247 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
13248 LDKChannelHandshakeLimits this_ptr_conv;
13249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13250 this_ptr_conv.is_owned = false;
13251 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13255 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
13256 LDKChannelHandshakeLimits this_ptr_conv;
13257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13258 this_ptr_conv.is_owned = false;
13259 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13262 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
13263 LDKChannelHandshakeLimits this_ptr_conv;
13264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13265 this_ptr_conv.is_owned = false;
13266 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13270 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
13271 LDKChannelHandshakeLimits this_ptr_conv;
13272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13273 this_ptr_conv.is_owned = false;
13274 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13277 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
13278 LDKChannelHandshakeLimits this_ptr_conv;
13279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13280 this_ptr_conv.is_owned = false;
13281 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13285 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
13286 LDKChannelHandshakeLimits this_ptr_conv;
13287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13288 this_ptr_conv.is_owned = false;
13289 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13292 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
13293 LDKChannelHandshakeLimits this_ptr_conv;
13294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13295 this_ptr_conv.is_owned = false;
13296 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13300 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
13301 LDKChannelHandshakeLimits this_ptr_conv;
13302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13303 this_ptr_conv.is_owned = false;
13304 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13307 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) {
13308 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);
13309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13311 uint64_t ret_ref = (uint64_t)ret_var.inner;
13312 if (ret_var.is_owned) {
13318 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
13319 LDKChannelHandshakeLimits orig_conv;
13320 orig_conv.inner = (void*)(orig & (~1));
13321 orig_conv.is_owned = false;
13322 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13325 uint64_t ret_ref = (uint64_t)ret_var.inner;
13326 if (ret_var.is_owned) {
13332 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
13333 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13336 uint64_t ret_ref = (uint64_t)ret_var.inner;
13337 if (ret_var.is_owned) {
13343 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
13344 LDKChannelConfig this_obj_conv;
13345 this_obj_conv.inner = (void*)(this_obj & (~1));
13346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13347 ChannelConfig_free(this_obj_conv);
13350 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
13351 LDKChannelConfig this_ptr_conv;
13352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13353 this_ptr_conv.is_owned = false;
13354 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
13358 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13359 LDKChannelConfig this_ptr_conv;
13360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13361 this_ptr_conv.is_owned = false;
13362 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
13365 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
13366 LDKChannelConfig this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = false;
13369 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
13373 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
13374 LDKChannelConfig this_ptr_conv;
13375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13376 this_ptr_conv.is_owned = false;
13377 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
13380 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
13381 LDKChannelConfig this_ptr_conv;
13382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13383 this_ptr_conv.is_owned = false;
13384 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13388 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13389 LDKChannelConfig this_ptr_conv;
13390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13391 this_ptr_conv.is_owned = false;
13392 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13395 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
13396 LDKChannelConfig this_ptr_conv;
13397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13398 this_ptr_conv.is_owned = false;
13399 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13403 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
13404 LDKChannelConfig this_ptr_conv;
13405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13406 this_ptr_conv.is_owned = false;
13407 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13410 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
13411 LDKChannelConfig this_ptr_conv;
13412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13413 this_ptr_conv.is_owned = false;
13414 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13418 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
13419 LDKChannelConfig this_ptr_conv;
13420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13421 this_ptr_conv.is_owned = false;
13422 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13425 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
13426 LDKChannelConfig this_ptr_conv;
13427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13428 this_ptr_conv.is_owned = false;
13429 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
13433 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
13434 LDKChannelConfig this_ptr_conv;
13435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13436 this_ptr_conv.is_owned = false;
13437 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
13440 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
13441 LDKChannelConfig this_ptr_conv;
13442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13443 this_ptr_conv.is_owned = false;
13444 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
13448 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
13449 LDKChannelConfig this_ptr_conv;
13450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13451 this_ptr_conv.is_owned = false;
13452 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
13455 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) {
13456 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);
13457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13459 uint64_t ret_ref = (uint64_t)ret_var.inner;
13460 if (ret_var.is_owned) {
13466 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
13467 LDKChannelConfig orig_conv;
13468 orig_conv.inner = (void*)(orig & (~1));
13469 orig_conv.is_owned = false;
13470 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13473 uint64_t ret_ref = (uint64_t)ret_var.inner;
13474 if (ret_var.is_owned) {
13480 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
13481 LDKChannelConfig ret_var = ChannelConfig_default();
13482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13484 uint64_t ret_ref = (uint64_t)ret_var.inner;
13485 if (ret_var.is_owned) {
13491 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
13492 LDKChannelConfig obj_conv;
13493 obj_conv.inner = (void*)(obj & (~1));
13494 obj_conv.is_owned = false;
13495 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13496 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13497 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13498 CVec_u8Z_free(ret_var);
13502 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
13503 LDKu8slice ser_ref;
13504 ser_ref.datalen = *((uint32_t*)ser);
13505 ser_ref.data = (int8_t*)(ser + 4);
13506 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13507 *ret_conv = ChannelConfig_read(ser_ref);
13508 return (uint64_t)ret_conv;
13511 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
13512 LDKUserConfig this_obj_conv;
13513 this_obj_conv.inner = (void*)(this_obj & (~1));
13514 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13515 UserConfig_free(this_obj_conv);
13518 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
13519 LDKUserConfig this_ptr_conv;
13520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13521 this_ptr_conv.is_owned = false;
13522 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13525 uint64_t ret_ref = (uint64_t)ret_var.inner;
13526 if (ret_var.is_owned) {
13532 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
13533 LDKUserConfig this_ptr_conv;
13534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13535 this_ptr_conv.is_owned = false;
13536 LDKChannelHandshakeConfig val_conv;
13537 val_conv.inner = (void*)(val & (~1));
13538 val_conv.is_owned = (val & 1) || (val == 0);
13539 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13540 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13543 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
13544 LDKUserConfig this_ptr_conv;
13545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13546 this_ptr_conv.is_owned = false;
13547 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13550 uint64_t ret_ref = (uint64_t)ret_var.inner;
13551 if (ret_var.is_owned) {
13557 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
13558 LDKUserConfig this_ptr_conv;
13559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13560 this_ptr_conv.is_owned = false;
13561 LDKChannelHandshakeLimits val_conv;
13562 val_conv.inner = (void*)(val & (~1));
13563 val_conv.is_owned = (val & 1) || (val == 0);
13564 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13565 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13568 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
13569 LDKUserConfig this_ptr_conv;
13570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13571 this_ptr_conv.is_owned = false;
13572 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13575 uint64_t ret_ref = (uint64_t)ret_var.inner;
13576 if (ret_var.is_owned) {
13582 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
13583 LDKUserConfig this_ptr_conv;
13584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13585 this_ptr_conv.is_owned = false;
13586 LDKChannelConfig val_conv;
13587 val_conv.inner = (void*)(val & (~1));
13588 val_conv.is_owned = (val & 1) || (val == 0);
13589 val_conv = ChannelConfig_clone(&val_conv);
13590 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13593 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
13594 LDKUserConfig this_ptr_conv;
13595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13596 this_ptr_conv.is_owned = false;
13597 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
13601 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
13602 LDKUserConfig this_ptr_conv;
13603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13604 this_ptr_conv.is_owned = false;
13605 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
13608 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) {
13609 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13610 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13611 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13612 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13613 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13614 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13615 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13616 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13617 LDKChannelConfig channel_options_arg_conv;
13618 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13619 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13620 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13621 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);
13622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13624 uint64_t ret_ref = (uint64_t)ret_var.inner;
13625 if (ret_var.is_owned) {
13631 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
13632 LDKUserConfig orig_conv;
13633 orig_conv.inner = (void*)(orig & (~1));
13634 orig_conv.is_owned = false;
13635 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13638 uint64_t ret_ref = (uint64_t)ret_var.inner;
13639 if (ret_var.is_owned) {
13645 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
13646 LDKUserConfig ret_var = UserConfig_default();
13647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13649 uint64_t ret_ref = (uint64_t)ret_var.inner;
13650 if (ret_var.is_owned) {
13656 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
13657 LDKBestBlock this_obj_conv;
13658 this_obj_conv.inner = (void*)(this_obj & (~1));
13659 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13660 BestBlock_free(this_obj_conv);
13663 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
13664 LDKBestBlock orig_conv;
13665 orig_conv.inner = (void*)(orig & (~1));
13666 orig_conv.is_owned = false;
13667 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
13668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13670 uint64_t ret_ref = (uint64_t)ret_var.inner;
13671 if (ret_var.is_owned) {
13677 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
13678 LDKNetwork network_conv = LDKNetwork_from_js(network);
13679 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
13680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13682 uint64_t ret_ref = (uint64_t)ret_var.inner;
13683 if (ret_var.is_owned) {
13689 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
13690 LDKThirtyTwoBytes block_hash_ref;
13691 CHECK(*((uint32_t*)block_hash) == 32);
13692 memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
13693 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
13694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13696 uint64_t ret_ref = (uint64_t)ret_var.inner;
13697 if (ret_var.is_owned) {
13703 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
13704 LDKBestBlock this_arg_conv;
13705 this_arg_conv.inner = (void*)(this_arg & (~1));
13706 this_arg_conv.is_owned = false;
13707 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13708 memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
13712 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
13713 LDKBestBlock this_arg_conv;
13714 this_arg_conv.inner = (void*)(this_arg & (~1));
13715 this_arg_conv.is_owned = false;
13716 int32_t ret_val = BestBlock_height(&this_arg_conv);
13720 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
13721 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13722 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
13726 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
13727 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
13731 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
13732 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
13736 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
13737 if ((this_ptr & 1) != 0) return;
13738 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13739 FREE((void*)this_ptr);
13740 Access_free(this_ptr_conv);
13743 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
13744 if ((this_ptr & 1) != 0) return;
13745 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13746 FREE((void*)this_ptr);
13747 Listen_free(this_ptr_conv);
13750 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
13751 if ((this_ptr & 1) != 0) return;
13752 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13753 FREE((void*)this_ptr);
13754 Confirm_free(this_ptr_conv);
13757 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
13758 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13759 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
13763 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
13764 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
13768 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
13769 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
13773 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
13774 if ((this_ptr & 1) != 0) return;
13775 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13776 FREE((void*)this_ptr);
13777 Watch_free(this_ptr_conv);
13780 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
13781 if ((this_ptr & 1) != 0) return;
13782 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13783 FREE((void*)this_ptr);
13784 Filter_free(this_ptr_conv);
13787 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
13788 LDKWatchedOutput this_obj_conv;
13789 this_obj_conv.inner = (void*)(this_obj & (~1));
13790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13791 WatchedOutput_free(this_obj_conv);
13794 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
13795 LDKWatchedOutput this_ptr_conv;
13796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13797 this_ptr_conv.is_owned = false;
13798 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13799 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
13803 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
13804 LDKWatchedOutput this_ptr_conv;
13805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13806 this_ptr_conv.is_owned = false;
13807 LDKThirtyTwoBytes val_ref;
13808 CHECK(*((uint32_t*)val) == 32);
13809 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13810 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13813 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
13814 LDKWatchedOutput this_ptr_conv;
13815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13816 this_ptr_conv.is_owned = false;
13817 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13820 uint64_t ret_ref = (uint64_t)ret_var.inner;
13821 if (ret_var.is_owned) {
13827 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
13828 LDKWatchedOutput this_ptr_conv;
13829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13830 this_ptr_conv.is_owned = false;
13831 LDKOutPoint val_conv;
13832 val_conv.inner = (void*)(val & (~1));
13833 val_conv.is_owned = (val & 1) || (val == 0);
13834 val_conv = OutPoint_clone(&val_conv);
13835 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13838 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
13839 LDKWatchedOutput this_ptr_conv;
13840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13841 this_ptr_conv.is_owned = false;
13842 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13843 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13844 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13848 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
13849 LDKWatchedOutput this_ptr_conv;
13850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13851 this_ptr_conv.is_owned = false;
13852 LDKCVec_u8Z val_ref;
13853 val_ref.datalen = *((uint32_t*)val);
13854 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13855 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
13856 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13859 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
13860 LDKThirtyTwoBytes block_hash_arg_ref;
13861 CHECK(*((uint32_t*)block_hash_arg) == 32);
13862 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
13863 LDKOutPoint outpoint_arg_conv;
13864 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13865 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13866 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13867 LDKCVec_u8Z script_pubkey_arg_ref;
13868 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
13869 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13870 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
13871 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13874 uint64_t ret_ref = (uint64_t)ret_var.inner;
13875 if (ret_var.is_owned) {
13881 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
13882 LDKWatchedOutput orig_conv;
13883 orig_conv.inner = (void*)(orig & (~1));
13884 orig_conv.is_owned = false;
13885 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13888 uint64_t ret_ref = (uint64_t)ret_var.inner;
13889 if (ret_var.is_owned) {
13895 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
13896 LDKWatchedOutput o_conv;
13897 o_conv.inner = (void*)(o & (~1));
13898 o_conv.is_owned = false;
13899 int64_t ret_val = WatchedOutput_hash(&o_conv);
13903 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
13904 if ((this_ptr & 1) != 0) return;
13905 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13906 FREE((void*)this_ptr);
13907 BroadcasterInterface_free(this_ptr_conv);
13910 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
13911 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13912 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
13916 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
13917 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
13921 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
13922 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
13926 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
13927 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
13931 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
13932 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
13933 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
13934 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
13938 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
13939 if ((this_ptr & 1) != 0) return;
13940 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13941 FREE((void*)this_ptr);
13942 FeeEstimator_free(this_ptr_conv);
13945 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
13946 if ((this_ptr & 1) != 0) return;
13947 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
13948 FREE((void*)this_ptr);
13949 Persist_free(this_ptr_conv);
13952 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
13953 LDKLockedChannelMonitor this_obj_conv;
13954 this_obj_conv.inner = (void*)(this_obj & (~1));
13955 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13956 LockedChannelMonitor_free(this_obj_conv);
13959 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
13960 LDKChainMonitor this_obj_conv;
13961 this_obj_conv.inner = (void*)(this_obj & (~1));
13962 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13963 ChainMonitor_free(this_obj_conv);
13966 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
13967 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
13968 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
13969 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
13970 // Manually implement clone for Java trait instances
13972 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13973 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13974 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13975 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13976 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13979 uint64_t ret_ref = (uint64_t)ret_var.inner;
13980 if (ret_var.is_owned) {
13986 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
13987 LDKChainMonitor this_arg_conv;
13988 this_arg_conv.inner = (void*)(this_arg & (~1));
13989 this_arg_conv.is_owned = false;
13990 LDKCVec_ChannelDetailsZ ignored_channels_constr;
13991 ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
13992 if (ignored_channels_constr.datalen > 0)
13993 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13995 ignored_channels_constr.data = NULL;
13996 uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
13997 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
13998 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
13999 LDKChannelDetails ignored_channels_conv_16_conv;
14000 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
14001 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
14002 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
14003 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
14005 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
14006 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14007 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14008 for (size_t j = 0; j < ret_var.datalen; j++) {
14009 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14010 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
14011 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
14012 ret_arr_ptr[j] = ret_conv_9_ref;
14014 FREE(ret_var.data);
14018 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
14019 LDKChainMonitor this_arg_conv;
14020 this_arg_conv.inner = (void*)(this_arg & (~1));
14021 this_arg_conv.is_owned = false;
14022 LDKOutPoint funding_txo_conv;
14023 funding_txo_conv.inner = (void*)(funding_txo & (~1));
14024 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
14025 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
14026 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
14027 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
14028 return (uint64_t)ret_conv;
14031 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
14032 LDKChainMonitor this_arg_conv;
14033 this_arg_conv.inner = (void*)(this_arg & (~1));
14034 this_arg_conv.is_owned = false;
14035 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
14036 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14037 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14038 for (size_t k = 0; k < ret_var.datalen; k++) {
14039 LDKOutPoint ret_conv_10_var = ret_var.data[k];
14040 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14041 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14042 uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
14043 if (ret_conv_10_var.is_owned) {
14044 ret_conv_10_ref |= 1;
14046 ret_arr_ptr[k] = ret_conv_10_ref;
14048 FREE(ret_var.data);
14052 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
14053 LDKChainMonitor this_arg_conv;
14054 this_arg_conv.inner = (void*)(this_arg & (~1));
14055 this_arg_conv.is_owned = false;
14056 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
14057 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
14058 return (uint64_t)ret_ret;
14061 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
14062 LDKChainMonitor this_arg_conv;
14063 this_arg_conv.inner = (void*)(this_arg & (~1));
14064 this_arg_conv.is_owned = false;
14065 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14066 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
14067 return (uint64_t)ret_ret;
14070 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
14071 LDKChainMonitor this_arg_conv;
14072 this_arg_conv.inner = (void*)(this_arg & (~1));
14073 this_arg_conv.is_owned = false;
14074 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
14075 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
14076 return (uint64_t)ret_ret;
14079 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
14080 LDKChainMonitor this_arg_conv;
14081 this_arg_conv.inner = (void*)(this_arg & (~1));
14082 this_arg_conv.is_owned = false;
14083 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14084 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14085 return (uint64_t)ret_ret;
14088 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
14089 LDKChannelMonitorUpdate this_obj_conv;
14090 this_obj_conv.inner = (void*)(this_obj & (~1));
14091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14092 ChannelMonitorUpdate_free(this_obj_conv);
14095 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
14096 LDKChannelMonitorUpdate this_ptr_conv;
14097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14098 this_ptr_conv.is_owned = false;
14099 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14103 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
14104 LDKChannelMonitorUpdate this_ptr_conv;
14105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14106 this_ptr_conv.is_owned = false;
14107 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14110 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
14111 LDKChannelMonitorUpdate orig_conv;
14112 orig_conv.inner = (void*)(orig & (~1));
14113 orig_conv.is_owned = false;
14114 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14117 uint64_t ret_ref = (uint64_t)ret_var.inner;
14118 if (ret_var.is_owned) {
14124 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
14125 LDKChannelMonitorUpdate obj_conv;
14126 obj_conv.inner = (void*)(obj & (~1));
14127 obj_conv.is_owned = false;
14128 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14129 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14130 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14131 CVec_u8Z_free(ret_var);
14135 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
14136 LDKu8slice ser_ref;
14137 ser_ref.datalen = *((uint32_t*)ser);
14138 ser_ref.data = (int8_t*)(ser + 4);
14139 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14140 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14141 return (uint64_t)ret_conv;
14144 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
14145 LDKMonitorUpdateError this_obj_conv;
14146 this_obj_conv.inner = (void*)(this_obj & (~1));
14147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14148 MonitorUpdateError_free(this_obj_conv);
14151 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
14152 LDKMonitorUpdateError orig_conv;
14153 orig_conv.inner = (void*)(orig & (~1));
14154 orig_conv.is_owned = false;
14155 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14158 uint64_t ret_ref = (uint64_t)ret_var.inner;
14159 if (ret_var.is_owned) {
14165 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
14166 if ((this_ptr & 1) != 0) return;
14167 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
14168 FREE((void*)this_ptr);
14169 MonitorEvent_free(this_ptr_conv);
14172 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
14173 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14174 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14175 *ret_copy = MonitorEvent_clone(orig_conv);
14176 uint64_t ret_ref = (uint64_t)ret_copy;
14180 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
14181 LDKHTLCUpdate a_conv;
14182 a_conv.inner = (void*)(a & (~1));
14183 a_conv.is_owned = (a & 1) || (a == 0);
14184 a_conv = HTLCUpdate_clone(&a_conv);
14185 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14186 *ret_copy = MonitorEvent_htlcevent(a_conv);
14187 uint64_t ret_ref = (uint64_t)ret_copy;
14191 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
14192 LDKOutPoint a_conv;
14193 a_conv.inner = (void*)(a & (~1));
14194 a_conv.is_owned = (a & 1) || (a == 0);
14195 a_conv = OutPoint_clone(&a_conv);
14196 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14197 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
14198 uint64_t ret_ref = (uint64_t)ret_copy;
14202 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
14203 LDKHTLCUpdate this_obj_conv;
14204 this_obj_conv.inner = (void*)(this_obj & (~1));
14205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14206 HTLCUpdate_free(this_obj_conv);
14209 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
14210 LDKHTLCUpdate orig_conv;
14211 orig_conv.inner = (void*)(orig & (~1));
14212 orig_conv.is_owned = false;
14213 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14216 uint64_t ret_ref = (uint64_t)ret_var.inner;
14217 if (ret_var.is_owned) {
14223 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
14224 LDKHTLCUpdate obj_conv;
14225 obj_conv.inner = (void*)(obj & (~1));
14226 obj_conv.is_owned = false;
14227 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14228 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14229 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14230 CVec_u8Z_free(ret_var);
14234 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
14235 LDKu8slice ser_ref;
14236 ser_ref.datalen = *((uint32_t*)ser);
14237 ser_ref.data = (int8_t*)(ser + 4);
14238 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14239 *ret_conv = HTLCUpdate_read(ser_ref);
14240 return (uint64_t)ret_conv;
14243 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
14244 if ((this_ptr & 1) != 0) return;
14245 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
14246 FREE((void*)this_ptr);
14247 Balance_free(this_ptr_conv);
14250 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
14251 LDKBalance* orig_conv = (LDKBalance*)orig;
14252 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14253 *ret_copy = Balance_clone(orig_conv);
14254 uint64_t ret_ref = (uint64_t)ret_copy;
14258 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
14259 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14260 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
14261 uint64_t ret_ref = (uint64_t)ret_copy;
14265 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
14266 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14267 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
14268 uint64_t ret_ref = (uint64_t)ret_copy;
14272 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
14273 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14274 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
14275 uint64_t ret_ref = (uint64_t)ret_copy;
14279 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
14280 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14281 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
14282 uint64_t ret_ref = (uint64_t)ret_copy;
14286 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
14287 LDKBalance* a_conv = (LDKBalance*)a;
14288 LDKBalance* b_conv = (LDKBalance*)b;
14289 jboolean ret_val = Balance_eq(a_conv, b_conv);
14293 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
14294 LDKChannelMonitor this_obj_conv;
14295 this_obj_conv.inner = (void*)(this_obj & (~1));
14296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14297 ChannelMonitor_free(this_obj_conv);
14300 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
14301 LDKChannelMonitor orig_conv;
14302 orig_conv.inner = (void*)(orig & (~1));
14303 orig_conv.is_owned = false;
14304 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14307 uint64_t ret_ref = (uint64_t)ret_var.inner;
14308 if (ret_var.is_owned) {
14314 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
14315 LDKChannelMonitor obj_conv;
14316 obj_conv.inner = (void*)(obj & (~1));
14317 obj_conv.is_owned = false;
14318 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14319 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14320 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14321 CVec_u8Z_free(ret_var);
14325 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) {
14326 LDKChannelMonitor this_arg_conv;
14327 this_arg_conv.inner = (void*)(this_arg & (~1));
14328 this_arg_conv.is_owned = false;
14329 LDKChannelMonitorUpdate updates_conv;
14330 updates_conv.inner = (void*)(updates & (~1));
14331 updates_conv.is_owned = false;
14332 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14333 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14334 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14335 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14336 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14337 return (uint64_t)ret_conv;
14340 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
14341 LDKChannelMonitor this_arg_conv;
14342 this_arg_conv.inner = (void*)(this_arg & (~1));
14343 this_arg_conv.is_owned = false;
14344 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14348 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
14349 LDKChannelMonitor this_arg_conv;
14350 this_arg_conv.inner = (void*)(this_arg & (~1));
14351 this_arg_conv.is_owned = false;
14352 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14353 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
14354 return ((uint64_t)ret_conv);
14357 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
14358 LDKChannelMonitor this_arg_conv;
14359 this_arg_conv.inner = (void*)(this_arg & (~1));
14360 this_arg_conv.is_owned = false;
14361 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14362 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14363 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14364 for (size_t o = 0; o < ret_var.datalen; o++) {
14365 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14366 *ret_conv_40_conv = ret_var.data[o];
14367 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
14369 FREE(ret_var.data);
14373 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
14374 LDKChannelMonitor this_arg_conv;
14375 this_arg_conv.inner = (void*)(this_arg & (~1));
14376 this_arg_conv.is_owned = false;
14377 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14378 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14381 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
14382 LDKChannelMonitor this_arg_conv;
14383 this_arg_conv.inner = (void*)(this_arg & (~1));
14384 this_arg_conv.is_owned = false;
14385 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14386 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14387 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14388 for (size_t o = 0; o < ret_var.datalen; o++) {
14389 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14390 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14391 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14392 ret_arr_ptr[o] = ret_conv_14_ref;
14394 FREE(ret_var.data);
14398 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
14399 LDKChannelMonitor this_arg_conv;
14400 this_arg_conv.inner = (void*)(this_arg & (~1));
14401 this_arg_conv.is_owned = false;
14402 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14403 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14404 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14405 for (size_t h = 0; h < ret_var.datalen; h++) {
14406 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14407 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14408 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14409 ret_arr_ptr[h] = ret_conv_7_ref;
14411 FREE(ret_var.data);
14415 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
14416 LDKChannelMonitor this_arg_conv;
14417 this_arg_conv.inner = (void*)(this_arg & (~1));
14418 this_arg_conv.is_owned = false;
14419 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14420 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14421 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14422 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14423 for (size_t m = 0; m < ret_var.datalen; m++) {
14424 LDKTransaction ret_conv_12_var = ret_var.data[m];
14425 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14426 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
14427 Transaction_free(ret_conv_12_var);
14428 ret_arr_ptr[m] = ret_conv_12_arr;
14430 FREE(ret_var.data);
14434 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) {
14435 LDKChannelMonitor this_arg_conv;
14436 this_arg_conv.inner = (void*)(this_arg & (~1));
14437 this_arg_conv.is_owned = false;
14438 unsigned char header_arr[80];
14439 CHECK(*((uint32_t*)header) == 80);
14440 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14441 unsigned char (*header_ref)[80] = &header_arr;
14442 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14443 txdata_constr.datalen = *((uint32_t*)txdata);
14444 if (txdata_constr.datalen > 0)
14445 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14447 txdata_constr.data = NULL;
14448 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
14449 for (size_t c = 0; c < txdata_constr.datalen; c++) {
14450 uint32_t txdata_conv_28 = txdata_vals[c];
14451 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
14452 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
14453 txdata_constr.data[c] = txdata_conv_28_conv;
14455 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14456 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14457 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14458 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);
14459 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14460 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14461 for (size_t n = 0; n < ret_var.datalen; n++) {
14462 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14463 *ret_conv_39_conv = ret_var.data[n];
14464 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14466 FREE(ret_var.data);
14470 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) {
14471 LDKChannelMonitor this_arg_conv;
14472 this_arg_conv.inner = (void*)(this_arg & (~1));
14473 this_arg_conv.is_owned = false;
14474 unsigned char header_arr[80];
14475 CHECK(*((uint32_t*)header) == 80);
14476 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14477 unsigned char (*header_ref)[80] = &header_arr;
14478 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14479 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14480 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14481 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14484 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) {
14485 LDKChannelMonitor this_arg_conv;
14486 this_arg_conv.inner = (void*)(this_arg & (~1));
14487 this_arg_conv.is_owned = false;
14488 unsigned char header_arr[80];
14489 CHECK(*((uint32_t*)header) == 80);
14490 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14491 unsigned char (*header_ref)[80] = &header_arr;
14492 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14493 txdata_constr.datalen = *((uint32_t*)txdata);
14494 if (txdata_constr.datalen > 0)
14495 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14497 txdata_constr.data = NULL;
14498 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
14499 for (size_t c = 0; c < txdata_constr.datalen; c++) {
14500 uint32_t txdata_conv_28 = txdata_vals[c];
14501 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
14502 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
14503 txdata_constr.data[c] = txdata_conv_28_conv;
14505 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14506 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14507 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14508 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);
14509 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14510 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14511 for (size_t n = 0; n < ret_var.datalen; n++) {
14512 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14513 *ret_conv_39_conv = ret_var.data[n];
14514 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14516 FREE(ret_var.data);
14520 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) {
14521 LDKChannelMonitor this_arg_conv;
14522 this_arg_conv.inner = (void*)(this_arg & (~1));
14523 this_arg_conv.is_owned = false;
14524 unsigned char txid_arr[32];
14525 CHECK(*((uint32_t*)txid) == 32);
14526 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
14527 unsigned char (*txid_ref)[32] = &txid_arr;
14528 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14529 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14530 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14531 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14534 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) {
14535 LDKChannelMonitor this_arg_conv;
14536 this_arg_conv.inner = (void*)(this_arg & (~1));
14537 this_arg_conv.is_owned = false;
14538 unsigned char header_arr[80];
14539 CHECK(*((uint32_t*)header) == 80);
14540 memcpy(header_arr, (uint8_t*)(header + 4), 80);
14541 unsigned char (*header_ref)[80] = &header_arr;
14542 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14543 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14544 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14545 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14546 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14547 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14548 for (size_t n = 0; n < ret_var.datalen; n++) {
14549 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14550 *ret_conv_39_conv = ret_var.data[n];
14551 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
14553 FREE(ret_var.data);
14557 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
14558 LDKChannelMonitor this_arg_conv;
14559 this_arg_conv.inner = (void*)(this_arg & (~1));
14560 this_arg_conv.is_owned = false;
14561 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14562 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
14563 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
14564 for (size_t m = 0; m < ret_var.datalen; m++) {
14565 int8_tArray ret_conv_12_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14566 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].data, 32);
14567 ret_arr_ptr[m] = ret_conv_12_arr;
14569 FREE(ret_var.data);
14573 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
14574 LDKChannelMonitor this_arg_conv;
14575 this_arg_conv.inner = (void*)(this_arg & (~1));
14576 this_arg_conv.is_owned = false;
14577 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
14578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14580 uint64_t ret_ref = (uint64_t)ret_var.inner;
14581 if (ret_var.is_owned) {
14587 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
14588 LDKChannelMonitor this_arg_conv;
14589 this_arg_conv.inner = (void*)(this_arg & (~1));
14590 this_arg_conv.is_owned = false;
14591 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
14592 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
14593 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
14594 for (size_t j = 0; j < ret_var.datalen; j++) {
14595 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
14596 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
14597 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
14598 ret_arr_ptr[j] = ret_conv_9_ref;
14600 FREE(ret_var.data);
14604 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
14605 LDKu8slice ser_ref;
14606 ser_ref.datalen = *((uint32_t*)ser);
14607 ser_ref.data = (int8_t*)(ser + 4);
14608 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14609 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14610 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14611 return (uint64_t)ret_conv;
14614 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
14615 LDKOutPoint this_obj_conv;
14616 this_obj_conv.inner = (void*)(this_obj & (~1));
14617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14618 OutPoint_free(this_obj_conv);
14621 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
14622 LDKOutPoint this_ptr_conv;
14623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14624 this_ptr_conv.is_owned = false;
14625 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14626 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
14630 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
14631 LDKOutPoint this_ptr_conv;
14632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14633 this_ptr_conv.is_owned = false;
14634 LDKThirtyTwoBytes val_ref;
14635 CHECK(*((uint32_t*)val) == 32);
14636 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14637 OutPoint_set_txid(&this_ptr_conv, val_ref);
14640 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
14641 LDKOutPoint this_ptr_conv;
14642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14643 this_ptr_conv.is_owned = false;
14644 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14648 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
14649 LDKOutPoint this_ptr_conv;
14650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14651 this_ptr_conv.is_owned = false;
14652 OutPoint_set_index(&this_ptr_conv, val);
14655 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
14656 LDKThirtyTwoBytes txid_arg_ref;
14657 CHECK(*((uint32_t*)txid_arg) == 32);
14658 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
14659 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14662 uint64_t ret_ref = (uint64_t)ret_var.inner;
14663 if (ret_var.is_owned) {
14669 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
14670 LDKOutPoint orig_conv;
14671 orig_conv.inner = (void*)(orig & (~1));
14672 orig_conv.is_owned = false;
14673 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14676 uint64_t ret_ref = (uint64_t)ret_var.inner;
14677 if (ret_var.is_owned) {
14683 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
14684 LDKOutPoint a_conv;
14685 a_conv.inner = (void*)(a & (~1));
14686 a_conv.is_owned = false;
14687 LDKOutPoint b_conv;
14688 b_conv.inner = (void*)(b & (~1));
14689 b_conv.is_owned = false;
14690 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14694 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
14695 LDKOutPoint o_conv;
14696 o_conv.inner = (void*)(o & (~1));
14697 o_conv.is_owned = false;
14698 int64_t ret_val = OutPoint_hash(&o_conv);
14702 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
14703 LDKOutPoint this_arg_conv;
14704 this_arg_conv.inner = (void*)(this_arg & (~1));
14705 this_arg_conv.is_owned = false;
14706 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14707 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
14711 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
14712 LDKOutPoint obj_conv;
14713 obj_conv.inner = (void*)(obj & (~1));
14714 obj_conv.is_owned = false;
14715 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14716 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14717 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14718 CVec_u8Z_free(ret_var);
14722 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
14723 LDKu8slice ser_ref;
14724 ser_ref.datalen = *((uint32_t*)ser);
14725 ser_ref.data = (int8_t*)(ser + 4);
14726 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14727 *ret_conv = OutPoint_read(ser_ref);
14728 return (uint64_t)ret_conv;
14731 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
14732 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14733 this_obj_conv.inner = (void*)(this_obj & (~1));
14734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14735 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14738 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14739 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14741 this_ptr_conv.is_owned = false;
14742 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14745 uint64_t ret_ref = (uint64_t)ret_var.inner;
14746 if (ret_var.is_owned) {
14752 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14753 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14755 this_ptr_conv.is_owned = false;
14756 LDKOutPoint val_conv;
14757 val_conv.inner = (void*)(val & (~1));
14758 val_conv.is_owned = (val & 1) || (val == 0);
14759 val_conv = OutPoint_clone(&val_conv);
14760 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14763 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
14764 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14766 this_ptr_conv.is_owned = false;
14767 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14768 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
14772 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
14773 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14775 this_ptr_conv.is_owned = false;
14776 LDKPublicKey val_ref;
14777 CHECK(*((uint32_t*)val) == 33);
14778 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14779 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14782 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
14783 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14785 this_ptr_conv.is_owned = false;
14786 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14790 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
14791 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14793 this_ptr_conv.is_owned = false;
14794 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14797 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14798 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14800 this_ptr_conv.is_owned = false;
14801 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14802 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14803 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14806 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
14807 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14809 this_ptr_conv.is_owned = false;
14810 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14811 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
14815 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
14816 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14818 this_ptr_conv.is_owned = false;
14819 LDKPublicKey val_ref;
14820 CHECK(*((uint32_t*)val) == 33);
14821 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14822 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14825 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14826 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14828 this_ptr_conv.is_owned = false;
14829 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14830 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14834 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14835 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14837 this_ptr_conv.is_owned = false;
14838 LDKThirtyTwoBytes val_ref;
14839 CHECK(*((uint32_t*)val) == 32);
14840 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14841 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14844 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14845 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14847 this_ptr_conv.is_owned = false;
14848 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14852 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14853 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14855 this_ptr_conv.is_owned = false;
14856 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14859 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) {
14860 LDKOutPoint outpoint_arg_conv;
14861 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14862 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14863 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14864 LDKPublicKey per_commitment_point_arg_ref;
14865 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
14866 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
14867 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14868 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
14869 LDKPublicKey revocation_pubkey_arg_ref;
14870 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
14871 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
14872 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14873 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
14874 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
14875 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);
14876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14878 uint64_t ret_ref = (uint64_t)ret_var.inner;
14879 if (ret_var.is_owned) {
14885 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
14886 LDKDelayedPaymentOutputDescriptor orig_conv;
14887 orig_conv.inner = (void*)(orig & (~1));
14888 orig_conv.is_owned = false;
14889 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14892 uint64_t ret_ref = (uint64_t)ret_var.inner;
14893 if (ret_var.is_owned) {
14899 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
14900 LDKDelayedPaymentOutputDescriptor obj_conv;
14901 obj_conv.inner = (void*)(obj & (~1));
14902 obj_conv.is_owned = false;
14903 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14904 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14905 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14906 CVec_u8Z_free(ret_var);
14910 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
14911 LDKu8slice ser_ref;
14912 ser_ref.datalen = *((uint32_t*)ser);
14913 ser_ref.data = (int8_t*)(ser + 4);
14914 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14915 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14916 return (uint64_t)ret_conv;
14919 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
14920 LDKStaticPaymentOutputDescriptor this_obj_conv;
14921 this_obj_conv.inner = (void*)(this_obj & (~1));
14922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14923 StaticPaymentOutputDescriptor_free(this_obj_conv);
14926 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
14927 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14929 this_ptr_conv.is_owned = false;
14930 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14933 uint64_t ret_ref = (uint64_t)ret_var.inner;
14934 if (ret_var.is_owned) {
14940 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
14941 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14943 this_ptr_conv.is_owned = false;
14944 LDKOutPoint val_conv;
14945 val_conv.inner = (void*)(val & (~1));
14946 val_conv.is_owned = (val & 1) || (val == 0);
14947 val_conv = OutPoint_clone(&val_conv);
14948 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14951 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
14952 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14954 this_ptr_conv.is_owned = false;
14955 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14956 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
14957 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14960 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
14961 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14963 this_ptr_conv.is_owned = false;
14964 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14965 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
14969 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
14970 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14972 this_ptr_conv.is_owned = false;
14973 LDKThirtyTwoBytes val_ref;
14974 CHECK(*((uint32_t*)val) == 32);
14975 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14976 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14979 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
14980 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14982 this_ptr_conv.is_owned = false;
14983 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14987 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
14988 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14990 this_ptr_conv.is_owned = false;
14991 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14994 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) {
14995 LDKOutPoint outpoint_arg_conv;
14996 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14997 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14998 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14999 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
15000 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
15001 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15002 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
15003 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
15004 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
15005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15007 uint64_t ret_ref = (uint64_t)ret_var.inner;
15008 if (ret_var.is_owned) {
15014 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
15015 LDKStaticPaymentOutputDescriptor orig_conv;
15016 orig_conv.inner = (void*)(orig & (~1));
15017 orig_conv.is_owned = false;
15018 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
15019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15021 uint64_t ret_ref = (uint64_t)ret_var.inner;
15022 if (ret_var.is_owned) {
15028 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
15029 LDKStaticPaymentOutputDescriptor obj_conv;
15030 obj_conv.inner = (void*)(obj & (~1));
15031 obj_conv.is_owned = false;
15032 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15033 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15034 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15035 CVec_u8Z_free(ret_var);
15039 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
15040 LDKu8slice ser_ref;
15041 ser_ref.datalen = *((uint32_t*)ser);
15042 ser_ref.data = (int8_t*)(ser + 4);
15043 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15044 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15045 return (uint64_t)ret_conv;
15048 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
15049 if ((this_ptr & 1) != 0) return;
15050 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
15051 FREE((void*)this_ptr);
15052 SpendableOutputDescriptor_free(this_ptr_conv);
15055 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
15056 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15057 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15058 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15059 uint64_t ret_ref = (uint64_t)ret_copy;
15063 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
15064 LDKOutPoint outpoint_conv;
15065 outpoint_conv.inner = (void*)(outpoint & (~1));
15066 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
15067 outpoint_conv = OutPoint_clone(&outpoint_conv);
15068 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
15069 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
15070 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15071 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
15072 uint64_t ret_ref = (uint64_t)ret_copy;
15076 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
15077 LDKDelayedPaymentOutputDescriptor a_conv;
15078 a_conv.inner = (void*)(a & (~1));
15079 a_conv.is_owned = (a & 1) || (a == 0);
15080 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
15081 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15082 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
15083 uint64_t ret_ref = (uint64_t)ret_copy;
15087 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
15088 LDKStaticPaymentOutputDescriptor a_conv;
15089 a_conv.inner = (void*)(a & (~1));
15090 a_conv.is_owned = (a & 1) || (a == 0);
15091 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
15092 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15093 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
15094 uint64_t ret_ref = (uint64_t)ret_copy;
15098 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
15099 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15100 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15101 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15102 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15103 CVec_u8Z_free(ret_var);
15107 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
15108 LDKu8slice ser_ref;
15109 ser_ref.datalen = *((uint32_t*)ser);
15110 ser_ref.data = (int8_t*)(ser + 4);
15111 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15112 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15113 return (uint64_t)ret_conv;
15116 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
15117 if ((this_ptr & 1) != 0) return;
15118 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
15119 FREE((void*)this_ptr);
15120 BaseSign_free(this_ptr_conv);
15123 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
15124 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
15125 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15126 *ret_ret = Sign_clone(orig_conv);
15127 return (uint64_t)ret_ret;
15130 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
15131 if ((this_ptr & 1) != 0) return;
15132 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
15133 FREE((void*)this_ptr);
15134 Sign_free(this_ptr_conv);
15137 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
15138 if ((this_ptr & 1) != 0) return;
15139 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
15140 FREE((void*)this_ptr);
15141 KeysInterface_free(this_ptr_conv);
15144 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
15145 LDKInMemorySigner this_obj_conv;
15146 this_obj_conv.inner = (void*)(this_obj & (~1));
15147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15148 InMemorySigner_free(this_obj_conv);
15151 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
15152 LDKInMemorySigner this_ptr_conv;
15153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15154 this_ptr_conv.is_owned = false;
15155 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15156 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
15160 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
15161 LDKInMemorySigner this_ptr_conv;
15162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15163 this_ptr_conv.is_owned = false;
15164 LDKSecretKey val_ref;
15165 CHECK(*((uint32_t*)val) == 32);
15166 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15167 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15170 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
15171 LDKInMemorySigner this_ptr_conv;
15172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15173 this_ptr_conv.is_owned = false;
15174 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15175 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
15179 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
15180 LDKInMemorySigner this_ptr_conv;
15181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15182 this_ptr_conv.is_owned = false;
15183 LDKSecretKey val_ref;
15184 CHECK(*((uint32_t*)val) == 32);
15185 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15186 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15189 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
15190 LDKInMemorySigner this_ptr_conv;
15191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15192 this_ptr_conv.is_owned = false;
15193 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15194 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
15198 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
15199 LDKInMemorySigner this_ptr_conv;
15200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15201 this_ptr_conv.is_owned = false;
15202 LDKSecretKey val_ref;
15203 CHECK(*((uint32_t*)val) == 32);
15204 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15205 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15208 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
15209 LDKInMemorySigner this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15213 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
15217 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
15218 LDKInMemorySigner this_ptr_conv;
15219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15220 this_ptr_conv.is_owned = false;
15221 LDKSecretKey val_ref;
15222 CHECK(*((uint32_t*)val) == 32);
15223 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15224 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15227 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
15228 LDKInMemorySigner this_ptr_conv;
15229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15230 this_ptr_conv.is_owned = false;
15231 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15232 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
15236 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
15237 LDKInMemorySigner this_ptr_conv;
15238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15239 this_ptr_conv.is_owned = false;
15240 LDKSecretKey val_ref;
15241 CHECK(*((uint32_t*)val) == 32);
15242 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
15243 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15246 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
15247 LDKInMemorySigner this_ptr_conv;
15248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15249 this_ptr_conv.is_owned = false;
15250 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15251 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
15255 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
15256 LDKInMemorySigner this_ptr_conv;
15257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15258 this_ptr_conv.is_owned = false;
15259 LDKThirtyTwoBytes val_ref;
15260 CHECK(*((uint32_t*)val) == 32);
15261 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15262 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15265 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
15266 LDKInMemorySigner orig_conv;
15267 orig_conv.inner = (void*)(orig & (~1));
15268 orig_conv.is_owned = false;
15269 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
15270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15272 uint64_t ret_ref = (uint64_t)ret_var.inner;
15273 if (ret_var.is_owned) {
15279 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) {
15280 LDKSecretKey funding_key_ref;
15281 CHECK(*((uint32_t*)funding_key) == 32);
15282 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
15283 LDKSecretKey revocation_base_key_ref;
15284 CHECK(*((uint32_t*)revocation_base_key) == 32);
15285 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
15286 LDKSecretKey payment_key_ref;
15287 CHECK(*((uint32_t*)payment_key) == 32);
15288 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
15289 LDKSecretKey delayed_payment_base_key_ref;
15290 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
15291 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
15292 LDKSecretKey htlc_base_key_ref;
15293 CHECK(*((uint32_t*)htlc_base_key) == 32);
15294 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
15295 LDKThirtyTwoBytes commitment_seed_ref;
15296 CHECK(*((uint32_t*)commitment_seed) == 32);
15297 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
15298 LDKThirtyTwoBytes channel_keys_id_ref;
15299 CHECK(*((uint32_t*)channel_keys_id) == 32);
15300 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
15301 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);
15302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15304 uint64_t ret_ref = (uint64_t)ret_var.inner;
15305 if (ret_var.is_owned) {
15311 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
15312 LDKInMemorySigner this_arg_conv;
15313 this_arg_conv.inner = (void*)(this_arg & (~1));
15314 this_arg_conv.is_owned = false;
15315 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15318 uint64_t ret_ref = (uint64_t)ret_var.inner;
15319 if (ret_var.is_owned) {
15325 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
15326 LDKInMemorySigner this_arg_conv;
15327 this_arg_conv.inner = (void*)(this_arg & (~1));
15328 this_arg_conv.is_owned = false;
15329 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15333 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
15334 LDKInMemorySigner this_arg_conv;
15335 this_arg_conv.inner = (void*)(this_arg & (~1));
15336 this_arg_conv.is_owned = false;
15337 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15341 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
15342 LDKInMemorySigner this_arg_conv;
15343 this_arg_conv.inner = (void*)(this_arg & (~1));
15344 this_arg_conv.is_owned = false;
15345 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15349 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
15350 LDKInMemorySigner this_arg_conv;
15351 this_arg_conv.inner = (void*)(this_arg & (~1));
15352 this_arg_conv.is_owned = false;
15353 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15356 uint64_t ret_ref = (uint64_t)ret_var.inner;
15357 if (ret_var.is_owned) {
15363 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
15364 LDKInMemorySigner this_arg_conv;
15365 this_arg_conv.inner = (void*)(this_arg & (~1));
15366 this_arg_conv.is_owned = false;
15367 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15370 uint64_t ret_ref = (uint64_t)ret_var.inner;
15371 if (ret_var.is_owned) {
15377 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) {
15378 LDKInMemorySigner this_arg_conv;
15379 this_arg_conv.inner = (void*)(this_arg & (~1));
15380 this_arg_conv.is_owned = false;
15381 LDKTransaction spend_tx_ref;
15382 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15383 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15384 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15385 spend_tx_ref.data_is_owned = true;
15386 LDKStaticPaymentOutputDescriptor descriptor_conv;
15387 descriptor_conv.inner = (void*)(descriptor & (~1));
15388 descriptor_conv.is_owned = false;
15389 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15390 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15391 return (uint64_t)ret_conv;
15394 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) {
15395 LDKInMemorySigner this_arg_conv;
15396 this_arg_conv.inner = (void*)(this_arg & (~1));
15397 this_arg_conv.is_owned = false;
15398 LDKTransaction spend_tx_ref;
15399 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
15400 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15401 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
15402 spend_tx_ref.data_is_owned = true;
15403 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15404 descriptor_conv.inner = (void*)(descriptor & (~1));
15405 descriptor_conv.is_owned = false;
15406 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15407 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15408 return (uint64_t)ret_conv;
15411 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
15412 LDKInMemorySigner this_arg_conv;
15413 this_arg_conv.inner = (void*)(this_arg & (~1));
15414 this_arg_conv.is_owned = false;
15415 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15416 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15417 return (uint64_t)ret_ret;
15420 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
15421 LDKInMemorySigner this_arg_conv;
15422 this_arg_conv.inner = (void*)(this_arg & (~1));
15423 this_arg_conv.is_owned = false;
15424 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
15425 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
15426 return (uint64_t)ret_ret;
15429 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
15430 LDKInMemorySigner obj_conv;
15431 obj_conv.inner = (void*)(obj & (~1));
15432 obj_conv.is_owned = false;
15433 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15434 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15435 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15436 CVec_u8Z_free(ret_var);
15440 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
15441 LDKu8slice ser_ref;
15442 ser_ref.datalen = *((uint32_t*)ser);
15443 ser_ref.data = (int8_t*)(ser + 4);
15444 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15445 *ret_conv = InMemorySigner_read(ser_ref);
15446 return (uint64_t)ret_conv;
15449 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
15450 LDKKeysManager this_obj_conv;
15451 this_obj_conv.inner = (void*)(this_obj & (~1));
15452 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15453 KeysManager_free(this_obj_conv);
15456 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
15457 unsigned char seed_arr[32];
15458 CHECK(*((uint32_t*)seed) == 32);
15459 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
15460 unsigned char (*seed_ref)[32] = &seed_arr;
15461 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15464 uint64_t ret_ref = (uint64_t)ret_var.inner;
15465 if (ret_var.is_owned) {
15471 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
15472 LDKKeysManager this_arg_conv;
15473 this_arg_conv.inner = (void*)(this_arg & (~1));
15474 this_arg_conv.is_owned = false;
15475 unsigned char params_arr[32];
15476 CHECK(*((uint32_t*)params) == 32);
15477 memcpy(params_arr, (uint8_t*)(params + 4), 32);
15478 unsigned char (*params_ref)[32] = ¶ms_arr;
15479 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15482 uint64_t ret_ref = (uint64_t)ret_var.inner;
15483 if (ret_var.is_owned) {
15489 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) {
15490 LDKKeysManager this_arg_conv;
15491 this_arg_conv.inner = (void*)(this_arg & (~1));
15492 this_arg_conv.is_owned = false;
15493 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15494 descriptors_constr.datalen = *((uint32_t*)descriptors);
15495 if (descriptors_constr.datalen > 0)
15496 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15498 descriptors_constr.data = NULL;
15499 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
15500 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15501 uint32_t descriptors_conv_27 = descriptors_vals[b];
15502 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15503 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15504 descriptors_constr.data[b] = descriptors_conv_27_conv;
15506 LDKCVec_TxOutZ outputs_constr;
15507 outputs_constr.datalen = *((uint32_t*)outputs);
15508 if (outputs_constr.datalen > 0)
15509 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15511 outputs_constr.data = NULL;
15512 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
15513 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15514 uint32_t outputs_conv_7 = outputs_vals[h];
15515 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15516 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15517 outputs_constr.data[h] = outputs_conv_7_conv;
15519 LDKCVec_u8Z change_destination_script_ref;
15520 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
15521 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15522 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
15523 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15524 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15525 return (uint64_t)ret_conv;
15528 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
15529 LDKKeysManager this_arg_conv;
15530 this_arg_conv.inner = (void*)(this_arg & (~1));
15531 this_arg_conv.is_owned = false;
15532 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15533 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
15534 return (uint64_t)ret_ret;
15537 void __attribute__((visibility("default"))) TS_PaymentId_free(uint32_t this_obj) {
15538 LDKPaymentId this_obj_conv;
15539 this_obj_conv.inner = (void*)(this_obj & (~1));
15540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15541 PaymentId_free(this_obj_conv);
15544 int64_t __attribute__((visibility("default"))) TS_PaymentId_hash(uint32_t o) {
15545 LDKPaymentId o_conv;
15546 o_conv.inner = (void*)(o & (~1));
15547 o_conv.is_owned = false;
15548 int64_t ret_val = PaymentId_hash(&o_conv);
15552 uint32_t __attribute__((visibility("default"))) TS_PaymentId_clone(uint32_t orig) {
15553 LDKPaymentId orig_conv;
15554 orig_conv.inner = (void*)(orig & (~1));
15555 orig_conv.is_owned = false;
15556 LDKPaymentId ret_var = PaymentId_clone(&orig_conv);
15557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15559 uint64_t ret_ref = (uint64_t)ret_var.inner;
15560 if (ret_var.is_owned) {
15566 jboolean __attribute__((visibility("default"))) TS_PaymentId_eq(uint32_t a, uint32_t b) {
15567 LDKPaymentId a_conv;
15568 a_conv.inner = (void*)(a & (~1));
15569 a_conv.is_owned = false;
15570 LDKPaymentId b_conv;
15571 b_conv.inner = (void*)(b & (~1));
15572 b_conv.is_owned = false;
15573 jboolean ret_val = PaymentId_eq(&a_conv, &b_conv);
15577 int8_tArray __attribute__((visibility("default"))) TS_PaymentId_write(uint32_t obj) {
15578 LDKPaymentId obj_conv;
15579 obj_conv.inner = (void*)(obj & (~1));
15580 obj_conv.is_owned = false;
15581 LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv);
15582 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15583 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15584 CVec_u8Z_free(ret_var);
15588 uint32_t __attribute__((visibility("default"))) TS_PaymentId_read(int8_tArray ser) {
15589 LDKu8slice ser_ref;
15590 ser_ref.datalen = *((uint32_t*)ser);
15591 ser_ref.data = (int8_t*)(ser + 4);
15592 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
15593 *ret_conv = PaymentId_read(ser_ref);
15594 return (uint64_t)ret_conv;
15597 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
15598 LDKChannelManager this_obj_conv;
15599 this_obj_conv.inner = (void*)(this_obj & (~1));
15600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15601 ChannelManager_free(this_obj_conv);
15604 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
15605 LDKChainParameters this_obj_conv;
15606 this_obj_conv.inner = (void*)(this_obj & (~1));
15607 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15608 ChainParameters_free(this_obj_conv);
15611 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
15612 LDKChainParameters this_ptr_conv;
15613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15614 this_ptr_conv.is_owned = false;
15615 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
15619 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
15620 LDKChainParameters this_ptr_conv;
15621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15622 this_ptr_conv.is_owned = false;
15623 LDKNetwork val_conv = LDKNetwork_from_js(val);
15624 ChainParameters_set_network(&this_ptr_conv, val_conv);
15627 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
15628 LDKChainParameters this_ptr_conv;
15629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15630 this_ptr_conv.is_owned = false;
15631 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15634 uint64_t ret_ref = (uint64_t)ret_var.inner;
15635 if (ret_var.is_owned) {
15641 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
15642 LDKChainParameters this_ptr_conv;
15643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15644 this_ptr_conv.is_owned = false;
15645 LDKBestBlock val_conv;
15646 val_conv.inner = (void*)(val & (~1));
15647 val_conv.is_owned = (val & 1) || (val == 0);
15648 val_conv = BestBlock_clone(&val_conv);
15649 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15652 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
15653 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
15654 LDKBestBlock best_block_arg_conv;
15655 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15656 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15657 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15658 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15661 uint64_t ret_ref = (uint64_t)ret_var.inner;
15662 if (ret_var.is_owned) {
15668 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
15669 LDKChainParameters orig_conv;
15670 orig_conv.inner = (void*)(orig & (~1));
15671 orig_conv.is_owned = false;
15672 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15675 uint64_t ret_ref = (uint64_t)ret_var.inner;
15676 if (ret_var.is_owned) {
15682 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
15683 LDKCounterpartyForwardingInfo this_obj_conv;
15684 this_obj_conv.inner = (void*)(this_obj & (~1));
15685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15686 CounterpartyForwardingInfo_free(this_obj_conv);
15689 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
15690 LDKCounterpartyForwardingInfo this_ptr_conv;
15691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15692 this_ptr_conv.is_owned = false;
15693 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
15697 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
15698 LDKCounterpartyForwardingInfo this_ptr_conv;
15699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15700 this_ptr_conv.is_owned = false;
15701 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
15704 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
15705 LDKCounterpartyForwardingInfo this_ptr_conv;
15706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15707 this_ptr_conv.is_owned = false;
15708 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
15712 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
15713 LDKCounterpartyForwardingInfo this_ptr_conv;
15714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15715 this_ptr_conv.is_owned = false;
15716 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
15719 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
15720 LDKCounterpartyForwardingInfo this_ptr_conv;
15721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15722 this_ptr_conv.is_owned = false;
15723 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
15727 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
15728 LDKCounterpartyForwardingInfo this_ptr_conv;
15729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15730 this_ptr_conv.is_owned = false;
15731 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
15734 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) {
15735 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
15736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15738 uint64_t ret_ref = (uint64_t)ret_var.inner;
15739 if (ret_var.is_owned) {
15745 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
15746 LDKCounterpartyForwardingInfo orig_conv;
15747 orig_conv.inner = (void*)(orig & (~1));
15748 orig_conv.is_owned = false;
15749 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
15750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15752 uint64_t ret_ref = (uint64_t)ret_var.inner;
15753 if (ret_var.is_owned) {
15759 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
15760 LDKChannelCounterparty this_obj_conv;
15761 this_obj_conv.inner = (void*)(this_obj & (~1));
15762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15763 ChannelCounterparty_free(this_obj_conv);
15766 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
15767 LDKChannelCounterparty this_ptr_conv;
15768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15769 this_ptr_conv.is_owned = false;
15770 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15771 memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
15775 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
15776 LDKChannelCounterparty this_ptr_conv;
15777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15778 this_ptr_conv.is_owned = false;
15779 LDKPublicKey val_ref;
15780 CHECK(*((uint32_t*)val) == 33);
15781 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15782 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
15785 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
15786 LDKChannelCounterparty this_ptr_conv;
15787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15788 this_ptr_conv.is_owned = false;
15789 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
15790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15792 uint64_t ret_ref = (uint64_t)ret_var.inner;
15793 if (ret_var.is_owned) {
15799 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
15800 LDKChannelCounterparty this_ptr_conv;
15801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15802 this_ptr_conv.is_owned = false;
15803 LDKInitFeatures val_conv;
15804 val_conv.inner = (void*)(val & (~1));
15805 val_conv.is_owned = (val & 1) || (val == 0);
15806 val_conv = InitFeatures_clone(&val_conv);
15807 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
15810 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15811 LDKChannelCounterparty this_ptr_conv;
15812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15813 this_ptr_conv.is_owned = false;
15814 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
15818 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
15819 LDKChannelCounterparty this_ptr_conv;
15820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15821 this_ptr_conv.is_owned = false;
15822 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
15825 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
15826 LDKChannelCounterparty this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = false;
15829 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
15830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15832 uint64_t ret_ref = (uint64_t)ret_var.inner;
15833 if (ret_var.is_owned) {
15839 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
15840 LDKChannelCounterparty this_ptr_conv;
15841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15842 this_ptr_conv.is_owned = false;
15843 LDKCounterpartyForwardingInfo val_conv;
15844 val_conv.inner = (void*)(val & (~1));
15845 val_conv.is_owned = (val & 1) || (val == 0);
15846 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
15847 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
15850 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) {
15851 LDKPublicKey node_id_arg_ref;
15852 CHECK(*((uint32_t*)node_id_arg) == 33);
15853 memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
15854 LDKInitFeatures features_arg_conv;
15855 features_arg_conv.inner = (void*)(features_arg & (~1));
15856 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15857 features_arg_conv = InitFeatures_clone(&features_arg_conv);
15858 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
15859 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
15860 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
15861 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
15862 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
15863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15865 uint64_t ret_ref = (uint64_t)ret_var.inner;
15866 if (ret_var.is_owned) {
15872 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
15873 LDKChannelCounterparty orig_conv;
15874 orig_conv.inner = (void*)(orig & (~1));
15875 orig_conv.is_owned = false;
15876 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
15877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15879 uint64_t ret_ref = (uint64_t)ret_var.inner;
15880 if (ret_var.is_owned) {
15886 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
15887 LDKChannelDetails this_obj_conv;
15888 this_obj_conv.inner = (void*)(this_obj & (~1));
15889 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15890 ChannelDetails_free(this_obj_conv);
15893 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
15894 LDKChannelDetails this_ptr_conv;
15895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15896 this_ptr_conv.is_owned = false;
15897 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15898 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
15902 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
15903 LDKChannelDetails this_ptr_conv;
15904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15905 this_ptr_conv.is_owned = false;
15906 LDKThirtyTwoBytes val_ref;
15907 CHECK(*((uint32_t*)val) == 32);
15908 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
15909 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15912 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
15913 LDKChannelDetails this_ptr_conv;
15914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15915 this_ptr_conv.is_owned = false;
15916 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
15917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15919 uint64_t ret_ref = (uint64_t)ret_var.inner;
15920 if (ret_var.is_owned) {
15926 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
15927 LDKChannelDetails this_ptr_conv;
15928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15929 this_ptr_conv.is_owned = false;
15930 LDKChannelCounterparty val_conv;
15931 val_conv.inner = (void*)(val & (~1));
15932 val_conv.is_owned = (val & 1) || (val == 0);
15933 val_conv = ChannelCounterparty_clone(&val_conv);
15934 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
15937 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
15938 LDKChannelDetails this_ptr_conv;
15939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15940 this_ptr_conv.is_owned = false;
15941 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15944 uint64_t ret_ref = (uint64_t)ret_var.inner;
15945 if (ret_var.is_owned) {
15951 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
15952 LDKChannelDetails this_ptr_conv;
15953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15954 this_ptr_conv.is_owned = false;
15955 LDKOutPoint val_conv;
15956 val_conv.inner = (void*)(val & (~1));
15957 val_conv.is_owned = (val & 1) || (val == 0);
15958 val_conv = OutPoint_clone(&val_conv);
15959 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15962 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
15963 LDKChannelDetails this_ptr_conv;
15964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15965 this_ptr_conv.is_owned = false;
15966 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15967 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15968 uint64_t ret_ref = (uint64_t)ret_copy;
15972 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
15973 LDKChannelDetails this_ptr_conv;
15974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15975 this_ptr_conv.is_owned = false;
15976 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15977 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
15978 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15981 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
15982 LDKChannelDetails this_ptr_conv;
15983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15984 this_ptr_conv.is_owned = false;
15985 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15989 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
15990 LDKChannelDetails this_ptr_conv;
15991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15992 this_ptr_conv.is_owned = false;
15993 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15996 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
15997 LDKChannelDetails this_ptr_conv;
15998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15999 this_ptr_conv.is_owned = false;
16000 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16001 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16002 uint64_t ret_ref = (uint64_t)ret_copy;
16006 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
16007 LDKChannelDetails this_ptr_conv;
16008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16009 this_ptr_conv.is_owned = false;
16010 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16011 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
16012 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16015 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
16016 LDKChannelDetails this_ptr_conv;
16017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16018 this_ptr_conv.is_owned = false;
16019 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
16023 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
16024 LDKChannelDetails this_ptr_conv;
16025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16026 this_ptr_conv.is_owned = false;
16027 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
16030 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
16031 LDKChannelDetails this_ptr_conv;
16032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16033 this_ptr_conv.is_owned = false;
16034 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16038 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16039 LDKChannelDetails this_ptr_conv;
16040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16041 this_ptr_conv.is_owned = false;
16042 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16045 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
16046 LDKChannelDetails this_ptr_conv;
16047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16048 this_ptr_conv.is_owned = false;
16049 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16053 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
16054 LDKChannelDetails this_ptr_conv;
16055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16056 this_ptr_conv.is_owned = false;
16057 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16060 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
16061 LDKChannelDetails this_ptr_conv;
16062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16063 this_ptr_conv.is_owned = false;
16064 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16065 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16066 uint64_t ret_ref = (uint64_t)ret_copy;
16070 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
16071 LDKChannelDetails this_ptr_conv;
16072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16073 this_ptr_conv.is_owned = false;
16074 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
16075 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
16076 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16079 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
16080 LDKChannelDetails this_ptr_conv;
16081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16082 this_ptr_conv.is_owned = false;
16083 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16084 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16085 uint64_t ret_ref = (uint64_t)ret_copy;
16089 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
16090 LDKChannelDetails this_ptr_conv;
16091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16092 this_ptr_conv.is_owned = false;
16093 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
16094 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
16095 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16098 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
16099 LDKChannelDetails this_ptr_conv;
16100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16101 this_ptr_conv.is_owned = false;
16102 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16106 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
16107 LDKChannelDetails this_ptr_conv;
16108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16109 this_ptr_conv.is_owned = false;
16110 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16113 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
16114 LDKChannelDetails this_ptr_conv;
16115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16116 this_ptr_conv.is_owned = false;
16117 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16121 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
16122 LDKChannelDetails this_ptr_conv;
16123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16124 this_ptr_conv.is_owned = false;
16125 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16128 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
16129 LDKChannelDetails this_ptr_conv;
16130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16131 this_ptr_conv.is_owned = false;
16132 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16136 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
16137 LDKChannelDetails this_ptr_conv;
16138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16139 this_ptr_conv.is_owned = false;
16140 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16143 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
16144 LDKChannelDetails this_ptr_conv;
16145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16146 this_ptr_conv.is_owned = false;
16147 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16151 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
16152 LDKChannelDetails this_ptr_conv;
16153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16154 this_ptr_conv.is_owned = false;
16155 ChannelDetails_set_is_public(&this_ptr_conv, val);
16158 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
16159 LDKThirtyTwoBytes channel_id_arg_ref;
16160 CHECK(*((uint32_t*)channel_id_arg) == 32);
16161 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16162 LDKChannelCounterparty counterparty_arg_conv;
16163 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16164 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16165 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16166 LDKOutPoint funding_txo_arg_conv;
16167 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16168 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16169 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16170 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
16171 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
16172 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16173 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
16174 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
16175 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16176 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
16177 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
16178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16180 uint64_t ret_ref = (uint64_t)ret_var.inner;
16181 if (ret_var.is_owned) {
16187 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
16188 LDKChannelDetails orig_conv;
16189 orig_conv.inner = (void*)(orig & (~1));
16190 orig_conv.is_owned = false;
16191 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
16192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16194 uint64_t ret_ref = (uint64_t)ret_var.inner;
16195 if (ret_var.is_owned) {
16201 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
16202 if ((this_ptr & 1) != 0) return;
16203 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
16204 FREE((void*)this_ptr);
16205 PaymentSendFailure_free(this_ptr_conv);
16208 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
16209 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
16210 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16211 *ret_copy = PaymentSendFailure_clone(orig_conv);
16212 uint64_t ret_ref = (uint64_t)ret_copy;
16216 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
16217 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
16218 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
16219 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16220 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
16221 uint64_t ret_ref = (uint64_t)ret_copy;
16225 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
16226 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16227 a_constr.datalen = *((uint32_t*)a);
16228 if (a_constr.datalen > 0)
16229 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16231 a_constr.data = NULL;
16232 uint32_t* a_vals = (uint32_t*)(a + 4);
16233 for (size_t w = 0; w < a_constr.datalen; w++) {
16234 uint32_t a_conv_22 = a_vals[w];
16235 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
16236 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16237 a_constr.data[w] = a_conv_22_conv;
16239 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16240 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
16241 uint64_t ret_ref = (uint64_t)ret_copy;
16245 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
16246 LDKCVec_APIErrorZ a_constr;
16247 a_constr.datalen = *((uint32_t*)a);
16248 if (a_constr.datalen > 0)
16249 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16251 a_constr.data = NULL;
16252 uint32_t* a_vals = (uint32_t*)(a + 4);
16253 for (size_t k = 0; k < a_constr.datalen; k++) {
16254 uint32_t a_conv_10 = a_vals[k];
16255 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
16256 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
16257 a_constr.data[k] = a_conv_10_conv;
16259 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16260 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
16261 uint64_t ret_ref = (uint64_t)ret_copy;
16265 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray a) {
16266 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
16267 a_constr.datalen = *((uint32_t*)a);
16268 if (a_constr.datalen > 0)
16269 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16271 a_constr.data = NULL;
16272 uint32_t* a_vals = (uint32_t*)(a + 4);
16273 for (size_t w = 0; w < a_constr.datalen; w++) {
16274 uint32_t a_conv_22 = a_vals[w];
16275 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
16276 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
16277 a_constr.data[w] = a_conv_22_conv;
16279 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16280 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
16281 uint64_t ret_ref = (uint64_t)ret_copy;
16285 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) {
16286 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
16287 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16288 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16289 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16290 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16291 LDKUserConfig config_conv;
16292 config_conv.inner = (void*)(config & (~1));
16293 config_conv.is_owned = (config & 1) || (config == 0);
16294 config_conv = UserConfig_clone(&config_conv);
16295 LDKChainParameters params_conv;
16296 params_conv.inner = (void*)(params & (~1));
16297 params_conv.is_owned = (params & 1) || (params == 0);
16298 params_conv = ChainParameters_clone(¶ms_conv);
16299 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
16300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16302 uint64_t ret_ref = (uint64_t)ret_var.inner;
16303 if (ret_var.is_owned) {
16309 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
16310 LDKChannelManager this_arg_conv;
16311 this_arg_conv.inner = (void*)(this_arg & (~1));
16312 this_arg_conv.is_owned = false;
16313 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
16314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16316 uint64_t ret_ref = (uint64_t)ret_var.inner;
16317 if (ret_var.is_owned) {
16323 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
16324 LDKChannelManager this_arg_conv;
16325 this_arg_conv.inner = (void*)(this_arg & (~1));
16326 this_arg_conv.is_owned = false;
16327 LDKPublicKey their_network_key_ref;
16328 CHECK(*((uint32_t*)their_network_key) == 33);
16329 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
16330 LDKUserConfig override_config_conv;
16331 override_config_conv.inner = (void*)(override_config & (~1));
16332 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
16333 override_config_conv = UserConfig_clone(&override_config_conv);
16334 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16335 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
16336 return (uint64_t)ret_conv;
16339 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
16340 LDKChannelManager this_arg_conv;
16341 this_arg_conv.inner = (void*)(this_arg & (~1));
16342 this_arg_conv.is_owned = false;
16343 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
16344 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16345 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16346 for (size_t q = 0; q < ret_var.datalen; q++) {
16347 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16348 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16349 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16350 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16351 if (ret_conv_16_var.is_owned) {
16352 ret_conv_16_ref |= 1;
16354 ret_arr_ptr[q] = ret_conv_16_ref;
16356 FREE(ret_var.data);
16360 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
16361 LDKChannelManager this_arg_conv;
16362 this_arg_conv.inner = (void*)(this_arg & (~1));
16363 this_arg_conv.is_owned = false;
16364 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
16365 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
16366 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
16367 for (size_t q = 0; q < ret_var.datalen; q++) {
16368 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16369 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16370 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16371 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16372 if (ret_conv_16_var.is_owned) {
16373 ret_conv_16_ref |= 1;
16375 ret_arr_ptr[q] = ret_conv_16_ref;
16377 FREE(ret_var.data);
16381 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
16382 LDKChannelManager this_arg_conv;
16383 this_arg_conv.inner = (void*)(this_arg & (~1));
16384 this_arg_conv.is_owned = false;
16385 unsigned char channel_id_arr[32];
16386 CHECK(*((uint32_t*)channel_id) == 32);
16387 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
16388 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16389 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16390 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16391 return (uint64_t)ret_conv;
16394 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) {
16395 LDKChannelManager this_arg_conv;
16396 this_arg_conv.inner = (void*)(this_arg & (~1));
16397 this_arg_conv.is_owned = false;
16398 unsigned char channel_id_arr[32];
16399 CHECK(*((uint32_t*)channel_id) == 32);
16400 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
16401 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16402 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16403 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
16404 return (uint64_t)ret_conv;
16407 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
16408 LDKChannelManager this_arg_conv;
16409 this_arg_conv.inner = (void*)(this_arg & (~1));
16410 this_arg_conv.is_owned = false;
16411 unsigned char channel_id_arr[32];
16412 CHECK(*((uint32_t*)channel_id) == 32);
16413 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
16414 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16415 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16416 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
16417 return (uint64_t)ret_conv;
16420 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
16421 LDKChannelManager this_arg_conv;
16422 this_arg_conv.inner = (void*)(this_arg & (~1));
16423 this_arg_conv.is_owned = false;
16424 ChannelManager_force_close_all_channels(&this_arg_conv);
16427 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
16428 LDKChannelManager this_arg_conv;
16429 this_arg_conv.inner = (void*)(this_arg & (~1));
16430 this_arg_conv.is_owned = false;
16431 LDKRoute route_conv;
16432 route_conv.inner = (void*)(route & (~1));
16433 route_conv.is_owned = false;
16434 LDKThirtyTwoBytes payment_hash_ref;
16435 CHECK(*((uint32_t*)payment_hash) == 32);
16436 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16437 LDKThirtyTwoBytes payment_secret_ref;
16438 CHECK(*((uint32_t*)payment_secret) == 32);
16439 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
16440 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
16441 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
16442 return (uint64_t)ret_conv;
16445 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, uint32_t payment_id) {
16446 LDKChannelManager this_arg_conv;
16447 this_arg_conv.inner = (void*)(this_arg & (~1));
16448 this_arg_conv.is_owned = false;
16449 LDKRoute route_conv;
16450 route_conv.inner = (void*)(route & (~1));
16451 route_conv.is_owned = false;
16452 LDKPaymentId payment_id_conv;
16453 payment_id_conv.inner = (void*)(payment_id & (~1));
16454 payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0);
16455 payment_id_conv = PaymentId_clone(&payment_id_conv);
16456 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16457 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv);
16458 return (uint64_t)ret_conv;
16461 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
16462 LDKChannelManager this_arg_conv;
16463 this_arg_conv.inner = (void*)(this_arg & (~1));
16464 this_arg_conv.is_owned = false;
16465 LDKRoute route_conv;
16466 route_conv.inner = (void*)(route & (~1));
16467 route_conv.is_owned = false;
16468 LDKThirtyTwoBytes payment_preimage_ref;
16469 CHECK(*((uint32_t*)payment_preimage) == 32);
16470 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16471 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16472 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
16473 return (uint64_t)ret_conv;
16476 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
16477 LDKChannelManager this_arg_conv;
16478 this_arg_conv.inner = (void*)(this_arg & (~1));
16479 this_arg_conv.is_owned = false;
16480 unsigned char temporary_channel_id_arr[32];
16481 CHECK(*((uint32_t*)temporary_channel_id) == 32);
16482 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
16483 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
16484 LDKTransaction funding_transaction_ref;
16485 funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
16486 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
16487 memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
16488 funding_transaction_ref.data_is_owned = true;
16489 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16490 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
16491 return (uint64_t)ret_conv;
16494 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
16495 LDKChannelManager this_arg_conv;
16496 this_arg_conv.inner = (void*)(this_arg & (~1));
16497 this_arg_conv.is_owned = false;
16498 LDKThreeBytes rgb_ref;
16499 CHECK(*((uint32_t*)rgb) == 3);
16500 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
16501 LDKThirtyTwoBytes alias_ref;
16502 CHECK(*((uint32_t*)alias) == 32);
16503 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
16504 LDKCVec_NetAddressZ addresses_constr;
16505 addresses_constr.datalen = *((uint32_t*)addresses);
16506 if (addresses_constr.datalen > 0)
16507 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16509 addresses_constr.data = NULL;
16510 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
16511 for (size_t m = 0; m < addresses_constr.datalen; m++) {
16512 uint32_t addresses_conv_12 = addresses_vals[m];
16513 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
16514 addresses_constr.data[m] = addresses_conv_12_conv;
16516 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
16519 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
16520 LDKChannelManager this_arg_conv;
16521 this_arg_conv.inner = (void*)(this_arg & (~1));
16522 this_arg_conv.is_owned = false;
16523 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
16526 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
16527 LDKChannelManager this_arg_conv;
16528 this_arg_conv.inner = (void*)(this_arg & (~1));
16529 this_arg_conv.is_owned = false;
16530 ChannelManager_timer_tick_occurred(&this_arg_conv);
16533 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
16534 LDKChannelManager this_arg_conv;
16535 this_arg_conv.inner = (void*)(this_arg & (~1));
16536 this_arg_conv.is_owned = false;
16537 unsigned char payment_hash_arr[32];
16538 CHECK(*((uint32_t*)payment_hash) == 32);
16539 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
16540 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
16541 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
16545 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
16546 LDKChannelManager this_arg_conv;
16547 this_arg_conv.inner = (void*)(this_arg & (~1));
16548 this_arg_conv.is_owned = false;
16549 LDKThirtyTwoBytes payment_preimage_ref;
16550 CHECK(*((uint32_t*)payment_preimage) == 32);
16551 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
16552 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
16556 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
16557 LDKChannelManager this_arg_conv;
16558 this_arg_conv.inner = (void*)(this_arg & (~1));
16559 this_arg_conv.is_owned = false;
16560 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16561 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
16565 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
16566 LDKChannelManager this_arg_conv;
16567 this_arg_conv.inner = (void*)(this_arg & (~1));
16568 this_arg_conv.is_owned = false;
16569 LDKOutPoint funding_txo_conv;
16570 funding_txo_conv.inner = (void*)(funding_txo & (~1));
16571 funding_txo_conv.is_owned = false;
16572 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
16575 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) {
16576 LDKChannelManager this_arg_conv;
16577 this_arg_conv.inner = (void*)(this_arg & (~1));
16578 this_arg_conv.is_owned = false;
16579 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16580 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
16581 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16582 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
16583 return ((uint64_t)ret_conv);
16586 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) {
16587 LDKChannelManager this_arg_conv;
16588 this_arg_conv.inner = (void*)(this_arg & (~1));
16589 this_arg_conv.is_owned = false;
16590 LDKThirtyTwoBytes payment_hash_ref;
16591 CHECK(*((uint32_t*)payment_hash) == 32);
16592 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
16593 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16594 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
16595 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16596 *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);
16597 return (uint64_t)ret_conv;
16600 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
16601 LDKChannelManager this_arg_conv;
16602 this_arg_conv.inner = (void*)(this_arg & (~1));
16603 this_arg_conv.is_owned = false;
16604 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16605 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
16606 return (uint64_t)ret_ret;
16609 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
16610 LDKChannelManager this_arg_conv;
16611 this_arg_conv.inner = (void*)(this_arg & (~1));
16612 this_arg_conv.is_owned = false;
16613 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16614 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
16615 return (uint64_t)ret_ret;
16618 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
16619 LDKChannelManager this_arg_conv;
16620 this_arg_conv.inner = (void*)(this_arg & (~1));
16621 this_arg_conv.is_owned = false;
16622 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
16623 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
16624 return (uint64_t)ret_ret;
16627 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
16628 LDKChannelManager this_arg_conv;
16629 this_arg_conv.inner = (void*)(this_arg & (~1));
16630 this_arg_conv.is_owned = false;
16631 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16632 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
16633 return (uint64_t)ret_ret;
16636 jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
16637 LDKChannelManager this_arg_conv;
16638 this_arg_conv.inner = (void*)(this_arg & (~1));
16639 this_arg_conv.is_owned = false;
16640 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
16644 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
16645 LDKChannelManager this_arg_conv;
16646 this_arg_conv.inner = (void*)(this_arg & (~1));
16647 this_arg_conv.is_owned = false;
16648 ChannelManager_await_persistable_update(&this_arg_conv);
16651 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
16652 LDKChannelManager this_arg_conv;
16653 this_arg_conv.inner = (void*)(this_arg & (~1));
16654 this_arg_conv.is_owned = false;
16655 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
16656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16658 uint64_t ret_ref = (uint64_t)ret_var.inner;
16659 if (ret_var.is_owned) {
16665 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
16666 LDKChannelManager this_arg_conv;
16667 this_arg_conv.inner = (void*)(this_arg & (~1));
16668 this_arg_conv.is_owned = false;
16669 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16670 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
16671 return (uint64_t)ret_ret;
16674 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
16675 LDKChannelManager obj_conv;
16676 obj_conv.inner = (void*)(obj & (~1));
16677 obj_conv.is_owned = false;
16678 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
16679 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16680 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16681 CVec_u8Z_free(ret_var);
16685 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
16686 LDKChannelManagerReadArgs this_obj_conv;
16687 this_obj_conv.inner = (void*)(this_obj & (~1));
16688 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16689 ChannelManagerReadArgs_free(this_obj_conv);
16692 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
16693 LDKChannelManagerReadArgs this_ptr_conv;
16694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16695 this_ptr_conv.is_owned = false;
16696 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
16700 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
16701 LDKChannelManagerReadArgs this_ptr_conv;
16702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16703 this_ptr_conv.is_owned = false;
16704 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
16705 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
16708 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
16709 LDKChannelManagerReadArgs this_ptr_conv;
16710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16711 this_ptr_conv.is_owned = false;
16712 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
16716 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
16717 LDKChannelManagerReadArgs this_ptr_conv;
16718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16719 this_ptr_conv.is_owned = false;
16720 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16721 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16724 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
16725 LDKChannelManagerReadArgs this_ptr_conv;
16726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16727 this_ptr_conv.is_owned = false;
16728 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16732 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
16733 LDKChannelManagerReadArgs this_ptr_conv;
16734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16735 this_ptr_conv.is_owned = false;
16736 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16737 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16740 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
16741 LDKChannelManagerReadArgs this_ptr_conv;
16742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16743 this_ptr_conv.is_owned = false;
16744 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16748 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
16749 LDKChannelManagerReadArgs this_ptr_conv;
16750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16751 this_ptr_conv.is_owned = false;
16752 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16753 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16756 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
16757 LDKChannelManagerReadArgs this_ptr_conv;
16758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16759 this_ptr_conv.is_owned = false;
16760 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16764 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
16765 LDKChannelManagerReadArgs this_ptr_conv;
16766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16767 this_ptr_conv.is_owned = false;
16768 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16769 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16772 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
16773 LDKChannelManagerReadArgs this_ptr_conv;
16774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16775 this_ptr_conv.is_owned = false;
16776 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16779 uint64_t ret_ref = (uint64_t)ret_var.inner;
16780 if (ret_var.is_owned) {
16786 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
16787 LDKChannelManagerReadArgs this_ptr_conv;
16788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16789 this_ptr_conv.is_owned = false;
16790 LDKUserConfig val_conv;
16791 val_conv.inner = (void*)(val & (~1));
16792 val_conv.is_owned = (val & 1) || (val == 0);
16793 val_conv = UserConfig_clone(&val_conv);
16794 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16797 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) {
16798 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16799 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16800 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16801 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16802 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16803 LDKUserConfig default_config_conv;
16804 default_config_conv.inner = (void*)(default_config & (~1));
16805 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16806 default_config_conv = UserConfig_clone(&default_config_conv);
16807 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16808 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
16809 if (channel_monitors_constr.datalen > 0)
16810 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16812 channel_monitors_constr.data = NULL;
16813 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
16814 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16815 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
16816 LDKChannelMonitor channel_monitors_conv_16_conv;
16817 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16818 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16819 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16821 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);
16822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16824 uint64_t ret_ref = (uint64_t)ret_var.inner;
16825 if (ret_var.is_owned) {
16831 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
16832 LDKu8slice ser_ref;
16833 ser_ref.datalen = *((uint32_t*)ser);
16834 ser_ref.data = (int8_t*)(ser + 4);
16835 LDKChannelManagerReadArgs arg_conv;
16836 arg_conv.inner = (void*)(arg & (~1));
16837 arg_conv.is_owned = (arg & 1) || (arg == 0);
16838 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16839 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16840 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16841 return (uint64_t)ret_conv;
16844 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
16845 LDKDecodeError this_obj_conv;
16846 this_obj_conv.inner = (void*)(this_obj & (~1));
16847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16848 DecodeError_free(this_obj_conv);
16851 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
16852 LDKDecodeError orig_conv;
16853 orig_conv.inner = (void*)(orig & (~1));
16854 orig_conv.is_owned = false;
16855 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16858 uint64_t ret_ref = (uint64_t)ret_var.inner;
16859 if (ret_var.is_owned) {
16865 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
16866 LDKInit this_obj_conv;
16867 this_obj_conv.inner = (void*)(this_obj & (~1));
16868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16869 Init_free(this_obj_conv);
16872 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
16873 LDKInit this_ptr_conv;
16874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16875 this_ptr_conv.is_owned = false;
16876 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16879 uint64_t ret_ref = (uint64_t)ret_var.inner;
16880 if (ret_var.is_owned) {
16886 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
16887 LDKInit this_ptr_conv;
16888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16889 this_ptr_conv.is_owned = false;
16890 LDKInitFeatures val_conv;
16891 val_conv.inner = (void*)(val & (~1));
16892 val_conv.is_owned = (val & 1) || (val == 0);
16893 val_conv = InitFeatures_clone(&val_conv);
16894 Init_set_features(&this_ptr_conv, val_conv);
16897 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
16898 LDKInitFeatures features_arg_conv;
16899 features_arg_conv.inner = (void*)(features_arg & (~1));
16900 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16901 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16902 LDKInit ret_var = Init_new(features_arg_conv);
16903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16905 uint64_t ret_ref = (uint64_t)ret_var.inner;
16906 if (ret_var.is_owned) {
16912 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
16914 orig_conv.inner = (void*)(orig & (~1));
16915 orig_conv.is_owned = false;
16916 LDKInit ret_var = Init_clone(&orig_conv);
16917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16919 uint64_t ret_ref = (uint64_t)ret_var.inner;
16920 if (ret_var.is_owned) {
16926 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
16927 LDKErrorMessage this_obj_conv;
16928 this_obj_conv.inner = (void*)(this_obj & (~1));
16929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16930 ErrorMessage_free(this_obj_conv);
16933 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
16934 LDKErrorMessage this_ptr_conv;
16935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16936 this_ptr_conv.is_owned = false;
16937 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16938 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
16942 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
16943 LDKErrorMessage this_ptr_conv;
16944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16945 this_ptr_conv.is_owned = false;
16946 LDKThirtyTwoBytes val_ref;
16947 CHECK(*((uint32_t*)val) == 32);
16948 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16949 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16952 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
16953 LDKErrorMessage this_ptr_conv;
16954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16955 this_ptr_conv.is_owned = false;
16956 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16957 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16962 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
16963 LDKErrorMessage this_ptr_conv;
16964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16965 this_ptr_conv.is_owned = false;
16966 LDKStr val_conv = str_ref_to_owned_c(val);
16967 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16970 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
16971 LDKThirtyTwoBytes channel_id_arg_ref;
16972 CHECK(*((uint32_t*)channel_id_arg) == 32);
16973 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
16974 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
16975 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16978 uint64_t ret_ref = (uint64_t)ret_var.inner;
16979 if (ret_var.is_owned) {
16985 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
16986 LDKErrorMessage orig_conv;
16987 orig_conv.inner = (void*)(orig & (~1));
16988 orig_conv.is_owned = false;
16989 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16992 uint64_t ret_ref = (uint64_t)ret_var.inner;
16993 if (ret_var.is_owned) {
16999 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
17000 LDKPing this_obj_conv;
17001 this_obj_conv.inner = (void*)(this_obj & (~1));
17002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17003 Ping_free(this_obj_conv);
17006 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
17007 LDKPing this_ptr_conv;
17008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17009 this_ptr_conv.is_owned = false;
17010 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17014 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
17015 LDKPing this_ptr_conv;
17016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17017 this_ptr_conv.is_owned = false;
17018 Ping_set_ponglen(&this_ptr_conv, val);
17021 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
17022 LDKPing this_ptr_conv;
17023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17024 this_ptr_conv.is_owned = false;
17025 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17029 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
17030 LDKPing this_ptr_conv;
17031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17032 this_ptr_conv.is_owned = false;
17033 Ping_set_byteslen(&this_ptr_conv, val);
17036 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
17037 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17040 uint64_t ret_ref = (uint64_t)ret_var.inner;
17041 if (ret_var.is_owned) {
17047 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
17049 orig_conv.inner = (void*)(orig & (~1));
17050 orig_conv.is_owned = false;
17051 LDKPing ret_var = Ping_clone(&orig_conv);
17052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17054 uint64_t ret_ref = (uint64_t)ret_var.inner;
17055 if (ret_var.is_owned) {
17061 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
17062 LDKPong this_obj_conv;
17063 this_obj_conv.inner = (void*)(this_obj & (~1));
17064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17065 Pong_free(this_obj_conv);
17068 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
17069 LDKPong this_ptr_conv;
17070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17071 this_ptr_conv.is_owned = false;
17072 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17076 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
17077 LDKPong this_ptr_conv;
17078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17079 this_ptr_conv.is_owned = false;
17080 Pong_set_byteslen(&this_ptr_conv, val);
17083 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
17084 LDKPong ret_var = Pong_new(byteslen_arg);
17085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17087 uint64_t ret_ref = (uint64_t)ret_var.inner;
17088 if (ret_var.is_owned) {
17094 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
17096 orig_conv.inner = (void*)(orig & (~1));
17097 orig_conv.is_owned = false;
17098 LDKPong ret_var = Pong_clone(&orig_conv);
17099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17101 uint64_t ret_ref = (uint64_t)ret_var.inner;
17102 if (ret_var.is_owned) {
17108 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
17109 LDKOpenChannel this_obj_conv;
17110 this_obj_conv.inner = (void*)(this_obj & (~1));
17111 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17112 OpenChannel_free(this_obj_conv);
17115 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
17116 LDKOpenChannel this_ptr_conv;
17117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17118 this_ptr_conv.is_owned = false;
17119 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17120 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
17124 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
17125 LDKOpenChannel this_ptr_conv;
17126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17127 this_ptr_conv.is_owned = false;
17128 LDKThirtyTwoBytes val_ref;
17129 CHECK(*((uint32_t*)val) == 32);
17130 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17131 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
17134 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
17135 LDKOpenChannel this_ptr_conv;
17136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17137 this_ptr_conv.is_owned = false;
17138 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17139 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
17143 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17144 LDKOpenChannel this_ptr_conv;
17145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17146 this_ptr_conv.is_owned = false;
17147 LDKThirtyTwoBytes val_ref;
17148 CHECK(*((uint32_t*)val) == 32);
17149 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17150 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17153 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
17154 LDKOpenChannel this_ptr_conv;
17155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17156 this_ptr_conv.is_owned = false;
17157 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
17161 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
17162 LDKOpenChannel this_ptr_conv;
17163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17164 this_ptr_conv.is_owned = false;
17165 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
17168 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
17169 LDKOpenChannel this_ptr_conv;
17170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17171 this_ptr_conv.is_owned = false;
17172 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
17176 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
17177 LDKOpenChannel this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 OpenChannel_set_push_msat(&this_ptr_conv, val);
17183 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
17184 LDKOpenChannel this_ptr_conv;
17185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17186 this_ptr_conv.is_owned = false;
17187 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
17191 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
17192 LDKOpenChannel this_ptr_conv;
17193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17194 this_ptr_conv.is_owned = false;
17195 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17198 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17199 LDKOpenChannel this_ptr_conv;
17200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17201 this_ptr_conv.is_owned = false;
17202 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17206 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17207 LDKOpenChannel this_ptr_conv;
17208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17209 this_ptr_conv.is_owned = false;
17210 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17213 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
17214 LDKOpenChannel this_ptr_conv;
17215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17216 this_ptr_conv.is_owned = false;
17217 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17221 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17222 LDKOpenChannel this_ptr_conv;
17223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17224 this_ptr_conv.is_owned = false;
17225 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17228 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
17229 LDKOpenChannel this_ptr_conv;
17230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17231 this_ptr_conv.is_owned = false;
17232 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
17236 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17237 LDKOpenChannel this_ptr_conv;
17238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17239 this_ptr_conv.is_owned = false;
17240 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17243 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
17244 LDKOpenChannel this_ptr_conv;
17245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17246 this_ptr_conv.is_owned = false;
17247 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
17251 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
17252 LDKOpenChannel this_ptr_conv;
17253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17254 this_ptr_conv.is_owned = false;
17255 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
17258 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
17259 LDKOpenChannel this_ptr_conv;
17260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17261 this_ptr_conv.is_owned = false;
17262 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
17266 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
17267 LDKOpenChannel this_ptr_conv;
17268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17269 this_ptr_conv.is_owned = false;
17270 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
17273 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
17274 LDKOpenChannel this_ptr_conv;
17275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17276 this_ptr_conv.is_owned = false;
17277 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
17281 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17282 LDKOpenChannel this_ptr_conv;
17283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17284 this_ptr_conv.is_owned = false;
17285 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17288 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
17289 LDKOpenChannel this_ptr_conv;
17290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17291 this_ptr_conv.is_owned = false;
17292 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17293 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17297 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17298 LDKOpenChannel this_ptr_conv;
17299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17300 this_ptr_conv.is_owned = false;
17301 LDKPublicKey val_ref;
17302 CHECK(*((uint32_t*)val) == 33);
17303 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17304 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17307 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
17308 LDKOpenChannel this_ptr_conv;
17309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17310 this_ptr_conv.is_owned = false;
17311 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17312 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17316 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17317 LDKOpenChannel this_ptr_conv;
17318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17319 this_ptr_conv.is_owned = false;
17320 LDKPublicKey val_ref;
17321 CHECK(*((uint32_t*)val) == 33);
17322 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17323 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17326 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
17327 LDKOpenChannel this_ptr_conv;
17328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17329 this_ptr_conv.is_owned = false;
17330 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17331 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
17335 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17336 LDKOpenChannel this_ptr_conv;
17337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17338 this_ptr_conv.is_owned = false;
17339 LDKPublicKey val_ref;
17340 CHECK(*((uint32_t*)val) == 33);
17341 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17342 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
17345 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
17346 LDKOpenChannel this_ptr_conv;
17347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17348 this_ptr_conv.is_owned = false;
17349 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17350 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17354 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17355 LDKOpenChannel this_ptr_conv;
17356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17357 this_ptr_conv.is_owned = false;
17358 LDKPublicKey val_ref;
17359 CHECK(*((uint32_t*)val) == 33);
17360 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17361 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17364 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
17365 LDKOpenChannel this_ptr_conv;
17366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17367 this_ptr_conv.is_owned = false;
17368 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17369 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17373 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
17374 LDKOpenChannel this_ptr_conv;
17375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17376 this_ptr_conv.is_owned = false;
17377 LDKPublicKey val_ref;
17378 CHECK(*((uint32_t*)val) == 33);
17379 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17380 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17383 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
17384 LDKOpenChannel this_ptr_conv;
17385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17386 this_ptr_conv.is_owned = false;
17387 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17388 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17392 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17393 LDKOpenChannel this_ptr_conv;
17394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17395 this_ptr_conv.is_owned = false;
17396 LDKPublicKey val_ref;
17397 CHECK(*((uint32_t*)val) == 33);
17398 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17399 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17402 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
17403 LDKOpenChannel this_ptr_conv;
17404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17405 this_ptr_conv.is_owned = false;
17406 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
17410 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
17411 LDKOpenChannel this_ptr_conv;
17412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17413 this_ptr_conv.is_owned = false;
17414 OpenChannel_set_channel_flags(&this_ptr_conv, val);
17417 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
17418 LDKOpenChannel orig_conv;
17419 orig_conv.inner = (void*)(orig & (~1));
17420 orig_conv.is_owned = false;
17421 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
17422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17424 uint64_t ret_ref = (uint64_t)ret_var.inner;
17425 if (ret_var.is_owned) {
17431 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
17432 LDKAcceptChannel this_obj_conv;
17433 this_obj_conv.inner = (void*)(this_obj & (~1));
17434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17435 AcceptChannel_free(this_obj_conv);
17438 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
17439 LDKAcceptChannel this_ptr_conv;
17440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17441 this_ptr_conv.is_owned = false;
17442 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17443 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
17447 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17448 LDKAcceptChannel this_ptr_conv;
17449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17450 this_ptr_conv.is_owned = false;
17451 LDKThirtyTwoBytes val_ref;
17452 CHECK(*((uint32_t*)val) == 32);
17453 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17454 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17457 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
17458 LDKAcceptChannel this_ptr_conv;
17459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17460 this_ptr_conv.is_owned = false;
17461 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
17465 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
17466 LDKAcceptChannel this_ptr_conv;
17467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17468 this_ptr_conv.is_owned = false;
17469 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17472 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17473 LDKAcceptChannel this_ptr_conv;
17474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17475 this_ptr_conv.is_owned = false;
17476 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17480 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17481 LDKAcceptChannel this_ptr_conv;
17482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17483 this_ptr_conv.is_owned = false;
17484 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17487 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
17488 LDKAcceptChannel this_ptr_conv;
17489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17490 this_ptr_conv.is_owned = false;
17491 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17495 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17496 LDKAcceptChannel this_ptr_conv;
17497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17498 this_ptr_conv.is_owned = false;
17499 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17502 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
17503 LDKAcceptChannel this_ptr_conv;
17504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17505 this_ptr_conv.is_owned = false;
17506 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
17510 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17511 LDKAcceptChannel this_ptr_conv;
17512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17513 this_ptr_conv.is_owned = false;
17514 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17517 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
17518 LDKAcceptChannel this_ptr_conv;
17519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17520 this_ptr_conv.is_owned = false;
17521 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
17525 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17526 LDKAcceptChannel this_ptr_conv;
17527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17528 this_ptr_conv.is_owned = false;
17529 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
17532 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
17533 LDKAcceptChannel this_ptr_conv;
17534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17535 this_ptr_conv.is_owned = false;
17536 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
17540 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
17541 LDKAcceptChannel this_ptr_conv;
17542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17543 this_ptr_conv.is_owned = false;
17544 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
17547 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
17548 LDKAcceptChannel this_ptr_conv;
17549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17550 this_ptr_conv.is_owned = false;
17551 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
17555 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17556 LDKAcceptChannel this_ptr_conv;
17557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17558 this_ptr_conv.is_owned = false;
17559 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17562 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
17563 LDKAcceptChannel this_ptr_conv;
17564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17565 this_ptr_conv.is_owned = false;
17566 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17567 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
17571 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
17572 LDKAcceptChannel this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 LDKPublicKey val_ref;
17576 CHECK(*((uint32_t*)val) == 33);
17577 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17578 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17581 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
17582 LDKAcceptChannel this_ptr_conv;
17583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17584 this_ptr_conv.is_owned = false;
17585 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17586 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
17590 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
17591 LDKAcceptChannel this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 LDKPublicKey val_ref;
17595 CHECK(*((uint32_t*)val) == 33);
17596 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17597 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17600 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
17601 LDKAcceptChannel this_ptr_conv;
17602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17603 this_ptr_conv.is_owned = false;
17604 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17605 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
17609 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
17610 LDKAcceptChannel this_ptr_conv;
17611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17612 this_ptr_conv.is_owned = false;
17613 LDKPublicKey val_ref;
17614 CHECK(*((uint32_t*)val) == 33);
17615 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17616 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
17619 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
17620 LDKAcceptChannel this_ptr_conv;
17621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17622 this_ptr_conv.is_owned = false;
17623 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17624 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
17628 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
17629 LDKAcceptChannel this_ptr_conv;
17630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17631 this_ptr_conv.is_owned = false;
17632 LDKPublicKey val_ref;
17633 CHECK(*((uint32_t*)val) == 33);
17634 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17635 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17638 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
17639 LDKAcceptChannel this_ptr_conv;
17640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17641 this_ptr_conv.is_owned = false;
17642 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17643 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
17647 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
17648 LDKAcceptChannel this_ptr_conv;
17649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17650 this_ptr_conv.is_owned = false;
17651 LDKPublicKey val_ref;
17652 CHECK(*((uint32_t*)val) == 33);
17653 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17654 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17657 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
17658 LDKAcceptChannel this_ptr_conv;
17659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17660 this_ptr_conv.is_owned = false;
17661 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17662 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17666 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17667 LDKAcceptChannel this_ptr_conv;
17668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17669 this_ptr_conv.is_owned = false;
17670 LDKPublicKey val_ref;
17671 CHECK(*((uint32_t*)val) == 33);
17672 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17673 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17676 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
17677 LDKAcceptChannel orig_conv;
17678 orig_conv.inner = (void*)(orig & (~1));
17679 orig_conv.is_owned = false;
17680 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
17681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17683 uint64_t ret_ref = (uint64_t)ret_var.inner;
17684 if (ret_var.is_owned) {
17690 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
17691 LDKFundingCreated this_obj_conv;
17692 this_obj_conv.inner = (void*)(this_obj & (~1));
17693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17694 FundingCreated_free(this_obj_conv);
17697 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
17698 LDKFundingCreated this_ptr_conv;
17699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17700 this_ptr_conv.is_owned = false;
17701 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17702 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
17706 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
17707 LDKFundingCreated this_ptr_conv;
17708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17709 this_ptr_conv.is_owned = false;
17710 LDKThirtyTwoBytes val_ref;
17711 CHECK(*((uint32_t*)val) == 32);
17712 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17713 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17716 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
17717 LDKFundingCreated this_ptr_conv;
17718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17719 this_ptr_conv.is_owned = false;
17720 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17721 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
17725 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
17726 LDKFundingCreated this_ptr_conv;
17727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17728 this_ptr_conv.is_owned = false;
17729 LDKThirtyTwoBytes val_ref;
17730 CHECK(*((uint32_t*)val) == 32);
17731 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17732 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17735 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
17736 LDKFundingCreated this_ptr_conv;
17737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17738 this_ptr_conv.is_owned = false;
17739 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17743 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
17744 LDKFundingCreated this_ptr_conv;
17745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17746 this_ptr_conv.is_owned = false;
17747 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17750 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
17751 LDKFundingCreated this_ptr_conv;
17752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17753 this_ptr_conv.is_owned = false;
17754 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17755 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
17759 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
17760 LDKFundingCreated this_ptr_conv;
17761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17762 this_ptr_conv.is_owned = false;
17763 LDKSignature val_ref;
17764 CHECK(*((uint32_t*)val) == 64);
17765 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17766 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17769 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) {
17770 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17771 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
17772 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
17773 LDKThirtyTwoBytes funding_txid_arg_ref;
17774 CHECK(*((uint32_t*)funding_txid_arg) == 32);
17775 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
17776 LDKSignature signature_arg_ref;
17777 CHECK(*((uint32_t*)signature_arg) == 64);
17778 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17779 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17782 uint64_t ret_ref = (uint64_t)ret_var.inner;
17783 if (ret_var.is_owned) {
17789 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
17790 LDKFundingCreated orig_conv;
17791 orig_conv.inner = (void*)(orig & (~1));
17792 orig_conv.is_owned = false;
17793 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17796 uint64_t ret_ref = (uint64_t)ret_var.inner;
17797 if (ret_var.is_owned) {
17803 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
17804 LDKFundingSigned this_obj_conv;
17805 this_obj_conv.inner = (void*)(this_obj & (~1));
17806 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17807 FundingSigned_free(this_obj_conv);
17810 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
17811 LDKFundingSigned this_ptr_conv;
17812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17813 this_ptr_conv.is_owned = false;
17814 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17815 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
17819 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17820 LDKFundingSigned this_ptr_conv;
17821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17822 this_ptr_conv.is_owned = false;
17823 LDKThirtyTwoBytes val_ref;
17824 CHECK(*((uint32_t*)val) == 32);
17825 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17826 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17829 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
17830 LDKFundingSigned this_ptr_conv;
17831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17832 this_ptr_conv.is_owned = false;
17833 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17834 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
17838 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
17839 LDKFundingSigned this_ptr_conv;
17840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17841 this_ptr_conv.is_owned = false;
17842 LDKSignature val_ref;
17843 CHECK(*((uint32_t*)val) == 64);
17844 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17845 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17848 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
17849 LDKThirtyTwoBytes channel_id_arg_ref;
17850 CHECK(*((uint32_t*)channel_id_arg) == 32);
17851 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17852 LDKSignature signature_arg_ref;
17853 CHECK(*((uint32_t*)signature_arg) == 64);
17854 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
17855 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17858 uint64_t ret_ref = (uint64_t)ret_var.inner;
17859 if (ret_var.is_owned) {
17865 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
17866 LDKFundingSigned orig_conv;
17867 orig_conv.inner = (void*)(orig & (~1));
17868 orig_conv.is_owned = false;
17869 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17872 uint64_t ret_ref = (uint64_t)ret_var.inner;
17873 if (ret_var.is_owned) {
17879 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
17880 LDKFundingLocked this_obj_conv;
17881 this_obj_conv.inner = (void*)(this_obj & (~1));
17882 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17883 FundingLocked_free(this_obj_conv);
17886 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
17887 LDKFundingLocked this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17891 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
17895 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17896 LDKFundingLocked this_ptr_conv;
17897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17898 this_ptr_conv.is_owned = false;
17899 LDKThirtyTwoBytes val_ref;
17900 CHECK(*((uint32_t*)val) == 32);
17901 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17902 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17905 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
17906 LDKFundingLocked this_ptr_conv;
17907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17908 this_ptr_conv.is_owned = false;
17909 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17910 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
17914 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
17915 LDKFundingLocked this_ptr_conv;
17916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17917 this_ptr_conv.is_owned = false;
17918 LDKPublicKey val_ref;
17919 CHECK(*((uint32_t*)val) == 33);
17920 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17921 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17924 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
17925 LDKThirtyTwoBytes channel_id_arg_ref;
17926 CHECK(*((uint32_t*)channel_id_arg) == 32);
17927 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
17928 LDKPublicKey next_per_commitment_point_arg_ref;
17929 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
17930 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
17931 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17934 uint64_t ret_ref = (uint64_t)ret_var.inner;
17935 if (ret_var.is_owned) {
17941 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
17942 LDKFundingLocked orig_conv;
17943 orig_conv.inner = (void*)(orig & (~1));
17944 orig_conv.is_owned = false;
17945 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17948 uint64_t ret_ref = (uint64_t)ret_var.inner;
17949 if (ret_var.is_owned) {
17955 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
17956 LDKShutdown this_obj_conv;
17957 this_obj_conv.inner = (void*)(this_obj & (~1));
17958 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17959 Shutdown_free(this_obj_conv);
17962 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
17963 LDKShutdown this_ptr_conv;
17964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17965 this_ptr_conv.is_owned = false;
17966 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17967 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
17971 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
17972 LDKShutdown this_ptr_conv;
17973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17974 this_ptr_conv.is_owned = false;
17975 LDKThirtyTwoBytes val_ref;
17976 CHECK(*((uint32_t*)val) == 32);
17977 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17978 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17981 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
17982 LDKShutdown this_ptr_conv;
17983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17984 this_ptr_conv.is_owned = false;
17985 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17986 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17987 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17991 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
17992 LDKShutdown this_ptr_conv;
17993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17994 this_ptr_conv.is_owned = false;
17995 LDKCVec_u8Z val_ref;
17996 val_ref.datalen = *((uint32_t*)val);
17997 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17998 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17999 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18002 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18003 LDKThirtyTwoBytes channel_id_arg_ref;
18004 CHECK(*((uint32_t*)channel_id_arg) == 32);
18005 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18006 LDKCVec_u8Z scriptpubkey_arg_ref;
18007 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
18008 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18009 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
18010 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18013 uint64_t ret_ref = (uint64_t)ret_var.inner;
18014 if (ret_var.is_owned) {
18020 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
18021 LDKShutdown orig_conv;
18022 orig_conv.inner = (void*)(orig & (~1));
18023 orig_conv.is_owned = false;
18024 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18027 uint64_t ret_ref = (uint64_t)ret_var.inner;
18028 if (ret_var.is_owned) {
18034 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
18035 LDKClosingSignedFeeRange this_obj_conv;
18036 this_obj_conv.inner = (void*)(this_obj & (~1));
18037 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18038 ClosingSignedFeeRange_free(this_obj_conv);
18041 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
18042 LDKClosingSignedFeeRange this_ptr_conv;
18043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18044 this_ptr_conv.is_owned = false;
18045 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
18049 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
18050 LDKClosingSignedFeeRange this_ptr_conv;
18051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18052 this_ptr_conv.is_owned = false;
18053 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
18056 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
18057 LDKClosingSignedFeeRange this_ptr_conv;
18058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18059 this_ptr_conv.is_owned = false;
18060 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
18064 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
18065 LDKClosingSignedFeeRange this_ptr_conv;
18066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18067 this_ptr_conv.is_owned = false;
18068 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
18071 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
18072 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
18073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18075 uint64_t ret_ref = (uint64_t)ret_var.inner;
18076 if (ret_var.is_owned) {
18082 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
18083 LDKClosingSignedFeeRange orig_conv;
18084 orig_conv.inner = (void*)(orig & (~1));
18085 orig_conv.is_owned = false;
18086 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
18087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18089 uint64_t ret_ref = (uint64_t)ret_var.inner;
18090 if (ret_var.is_owned) {
18096 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
18097 LDKClosingSigned this_obj_conv;
18098 this_obj_conv.inner = (void*)(this_obj & (~1));
18099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18100 ClosingSigned_free(this_obj_conv);
18103 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
18104 LDKClosingSigned this_ptr_conv;
18105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18106 this_ptr_conv.is_owned = false;
18107 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18108 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
18112 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18113 LDKClosingSigned this_ptr_conv;
18114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18115 this_ptr_conv.is_owned = false;
18116 LDKThirtyTwoBytes val_ref;
18117 CHECK(*((uint32_t*)val) == 32);
18118 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18119 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18122 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
18123 LDKClosingSigned this_ptr_conv;
18124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18125 this_ptr_conv.is_owned = false;
18126 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
18130 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
18131 LDKClosingSigned this_ptr_conv;
18132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18133 this_ptr_conv.is_owned = false;
18134 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
18137 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
18138 LDKClosingSigned this_ptr_conv;
18139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18140 this_ptr_conv.is_owned = false;
18141 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18142 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
18146 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18147 LDKClosingSigned this_ptr_conv;
18148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18149 this_ptr_conv.is_owned = false;
18150 LDKSignature val_ref;
18151 CHECK(*((uint32_t*)val) == 64);
18152 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18153 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
18156 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
18157 LDKClosingSigned this_ptr_conv;
18158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18159 this_ptr_conv.is_owned = false;
18160 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
18161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18163 uint64_t ret_ref = (uint64_t)ret_var.inner;
18164 if (ret_var.is_owned) {
18170 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
18171 LDKClosingSigned this_ptr_conv;
18172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18173 this_ptr_conv.is_owned = false;
18174 LDKClosingSignedFeeRange val_conv;
18175 val_conv.inner = (void*)(val & (~1));
18176 val_conv.is_owned = (val & 1) || (val == 0);
18177 val_conv = ClosingSignedFeeRange_clone(&val_conv);
18178 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
18181 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) {
18182 LDKThirtyTwoBytes channel_id_arg_ref;
18183 CHECK(*((uint32_t*)channel_id_arg) == 32);
18184 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18185 LDKSignature signature_arg_ref;
18186 CHECK(*((uint32_t*)signature_arg) == 64);
18187 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18188 LDKClosingSignedFeeRange fee_range_arg_conv;
18189 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
18190 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
18191 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
18192 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
18193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18195 uint64_t ret_ref = (uint64_t)ret_var.inner;
18196 if (ret_var.is_owned) {
18202 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
18203 LDKClosingSigned orig_conv;
18204 orig_conv.inner = (void*)(orig & (~1));
18205 orig_conv.is_owned = false;
18206 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
18207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18209 uint64_t ret_ref = (uint64_t)ret_var.inner;
18210 if (ret_var.is_owned) {
18216 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
18217 LDKUpdateAddHTLC this_obj_conv;
18218 this_obj_conv.inner = (void*)(this_obj & (~1));
18219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18220 UpdateAddHTLC_free(this_obj_conv);
18223 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
18224 LDKUpdateAddHTLC 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18228 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
18232 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18233 LDKUpdateAddHTLC this_ptr_conv;
18234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18235 this_ptr_conv.is_owned = false;
18236 LDKThirtyTwoBytes val_ref;
18237 CHECK(*((uint32_t*)val) == 32);
18238 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18239 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
18242 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
18243 LDKUpdateAddHTLC this_ptr_conv;
18244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18245 this_ptr_conv.is_owned = false;
18246 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
18250 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18251 LDKUpdateAddHTLC this_ptr_conv;
18252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18253 this_ptr_conv.is_owned = false;
18254 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
18257 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
18258 LDKUpdateAddHTLC this_ptr_conv;
18259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18260 this_ptr_conv.is_owned = false;
18261 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
18265 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
18266 LDKUpdateAddHTLC this_ptr_conv;
18267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18268 this_ptr_conv.is_owned = false;
18269 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
18272 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
18273 LDKUpdateAddHTLC this_ptr_conv;
18274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18275 this_ptr_conv.is_owned = false;
18276 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18277 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
18281 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
18282 LDKUpdateAddHTLC this_ptr_conv;
18283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18284 this_ptr_conv.is_owned = false;
18285 LDKThirtyTwoBytes val_ref;
18286 CHECK(*((uint32_t*)val) == 32);
18287 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18288 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
18291 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
18292 LDKUpdateAddHTLC this_ptr_conv;
18293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18294 this_ptr_conv.is_owned = false;
18295 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
18299 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
18300 LDKUpdateAddHTLC this_ptr_conv;
18301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18302 this_ptr_conv.is_owned = false;
18303 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
18306 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
18307 LDKUpdateAddHTLC orig_conv;
18308 orig_conv.inner = (void*)(orig & (~1));
18309 orig_conv.is_owned = false;
18310 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
18311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18313 uint64_t ret_ref = (uint64_t)ret_var.inner;
18314 if (ret_var.is_owned) {
18320 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
18321 LDKUpdateFulfillHTLC this_obj_conv;
18322 this_obj_conv.inner = (void*)(this_obj & (~1));
18323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18324 UpdateFulfillHTLC_free(this_obj_conv);
18327 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
18328 LDKUpdateFulfillHTLC this_ptr_conv;
18329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18330 this_ptr_conv.is_owned = false;
18331 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18332 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
18336 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18337 LDKUpdateFulfillHTLC this_ptr_conv;
18338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18339 this_ptr_conv.is_owned = false;
18340 LDKThirtyTwoBytes val_ref;
18341 CHECK(*((uint32_t*)val) == 32);
18342 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18343 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
18346 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
18347 LDKUpdateFulfillHTLC this_ptr_conv;
18348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18349 this_ptr_conv.is_owned = false;
18350 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
18354 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18355 LDKUpdateFulfillHTLC this_ptr_conv;
18356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18357 this_ptr_conv.is_owned = false;
18358 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
18361 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
18362 LDKUpdateFulfillHTLC this_ptr_conv;
18363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18364 this_ptr_conv.is_owned = false;
18365 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18366 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
18370 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
18371 LDKUpdateFulfillHTLC this_ptr_conv;
18372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18373 this_ptr_conv.is_owned = false;
18374 LDKThirtyTwoBytes val_ref;
18375 CHECK(*((uint32_t*)val) == 32);
18376 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18377 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
18380 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
18381 LDKThirtyTwoBytes channel_id_arg_ref;
18382 CHECK(*((uint32_t*)channel_id_arg) == 32);
18383 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18384 LDKThirtyTwoBytes payment_preimage_arg_ref;
18385 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
18386 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
18387 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
18388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18390 uint64_t ret_ref = (uint64_t)ret_var.inner;
18391 if (ret_var.is_owned) {
18397 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
18398 LDKUpdateFulfillHTLC orig_conv;
18399 orig_conv.inner = (void*)(orig & (~1));
18400 orig_conv.is_owned = false;
18401 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
18402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18404 uint64_t ret_ref = (uint64_t)ret_var.inner;
18405 if (ret_var.is_owned) {
18411 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
18412 LDKUpdateFailHTLC this_obj_conv;
18413 this_obj_conv.inner = (void*)(this_obj & (~1));
18414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18415 UpdateFailHTLC_free(this_obj_conv);
18418 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
18419 LDKUpdateFailHTLC this_ptr_conv;
18420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18421 this_ptr_conv.is_owned = false;
18422 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18423 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
18427 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18428 LDKUpdateFailHTLC this_ptr_conv;
18429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18430 this_ptr_conv.is_owned = false;
18431 LDKThirtyTwoBytes val_ref;
18432 CHECK(*((uint32_t*)val) == 32);
18433 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18434 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
18437 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
18438 LDKUpdateFailHTLC this_ptr_conv;
18439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18440 this_ptr_conv.is_owned = false;
18441 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
18445 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18446 LDKUpdateFailHTLC this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
18452 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
18453 LDKUpdateFailHTLC orig_conv;
18454 orig_conv.inner = (void*)(orig & (~1));
18455 orig_conv.is_owned = false;
18456 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
18457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18459 uint64_t ret_ref = (uint64_t)ret_var.inner;
18460 if (ret_var.is_owned) {
18466 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
18467 LDKUpdateFailMalformedHTLC this_obj_conv;
18468 this_obj_conv.inner = (void*)(this_obj & (~1));
18469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18470 UpdateFailMalformedHTLC_free(this_obj_conv);
18473 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
18474 LDKUpdateFailMalformedHTLC this_ptr_conv;
18475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18476 this_ptr_conv.is_owned = false;
18477 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18478 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
18482 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18483 LDKUpdateFailMalformedHTLC this_ptr_conv;
18484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18485 this_ptr_conv.is_owned = false;
18486 LDKThirtyTwoBytes val_ref;
18487 CHECK(*((uint32_t*)val) == 32);
18488 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18489 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
18492 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
18493 LDKUpdateFailMalformedHTLC this_ptr_conv;
18494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18495 this_ptr_conv.is_owned = false;
18496 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
18500 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
18501 LDKUpdateFailMalformedHTLC this_ptr_conv;
18502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18503 this_ptr_conv.is_owned = false;
18504 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
18507 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
18508 LDKUpdateFailMalformedHTLC this_ptr_conv;
18509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18510 this_ptr_conv.is_owned = false;
18511 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
18515 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
18516 LDKUpdateFailMalformedHTLC this_ptr_conv;
18517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18518 this_ptr_conv.is_owned = false;
18519 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
18522 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
18523 LDKUpdateFailMalformedHTLC orig_conv;
18524 orig_conv.inner = (void*)(orig & (~1));
18525 orig_conv.is_owned = false;
18526 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_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_CommitmentSigned_free(uint32_t this_obj) {
18537 LDKCommitmentSigned this_obj_conv;
18538 this_obj_conv.inner = (void*)(this_obj & (~1));
18539 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18540 CommitmentSigned_free(this_obj_conv);
18543 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
18544 LDKCommitmentSigned this_ptr_conv;
18545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18546 this_ptr_conv.is_owned = false;
18547 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18548 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
18552 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18553 LDKCommitmentSigned this_ptr_conv;
18554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18555 this_ptr_conv.is_owned = false;
18556 LDKThirtyTwoBytes val_ref;
18557 CHECK(*((uint32_t*)val) == 32);
18558 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18559 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
18562 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
18563 LDKCommitmentSigned this_ptr_conv;
18564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18565 this_ptr_conv.is_owned = false;
18566 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
18567 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
18571 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
18572 LDKCommitmentSigned this_ptr_conv;
18573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18574 this_ptr_conv.is_owned = false;
18575 LDKSignature val_ref;
18576 CHECK(*((uint32_t*)val) == 64);
18577 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
18578 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
18581 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
18582 LDKCommitmentSigned this_ptr_conv;
18583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18584 this_ptr_conv.is_owned = false;
18585 LDKCVec_SignatureZ val_constr;
18586 val_constr.datalen = *((uint32_t*)val);
18587 if (val_constr.datalen > 0)
18588 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18590 val_constr.data = NULL;
18591 int8_tArray* val_vals = (int8_tArray*)(val + 4);
18592 for (size_t m = 0; m < val_constr.datalen; m++) {
18593 int8_tArray val_conv_12 = val_vals[m];
18594 LDKSignature val_conv_12_ref;
18595 CHECK(*((uint32_t*)val_conv_12) == 64);
18596 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
18597 val_constr.data[m] = val_conv_12_ref;
18599 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
18602 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
18603 LDKThirtyTwoBytes channel_id_arg_ref;
18604 CHECK(*((uint32_t*)channel_id_arg) == 32);
18605 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18606 LDKSignature signature_arg_ref;
18607 CHECK(*((uint32_t*)signature_arg) == 64);
18608 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
18609 LDKCVec_SignatureZ htlc_signatures_arg_constr;
18610 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
18611 if (htlc_signatures_arg_constr.datalen > 0)
18612 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18614 htlc_signatures_arg_constr.data = NULL;
18615 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
18616 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
18617 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
18618 LDKSignature htlc_signatures_arg_conv_12_ref;
18619 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
18620 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
18621 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
18623 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
18624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18626 uint64_t ret_ref = (uint64_t)ret_var.inner;
18627 if (ret_var.is_owned) {
18633 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
18634 LDKCommitmentSigned orig_conv;
18635 orig_conv.inner = (void*)(orig & (~1));
18636 orig_conv.is_owned = false;
18637 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
18638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18640 uint64_t ret_ref = (uint64_t)ret_var.inner;
18641 if (ret_var.is_owned) {
18647 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
18648 LDKRevokeAndACK this_obj_conv;
18649 this_obj_conv.inner = (void*)(this_obj & (~1));
18650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18651 RevokeAndACK_free(this_obj_conv);
18654 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
18655 LDKRevokeAndACK this_ptr_conv;
18656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18657 this_ptr_conv.is_owned = false;
18658 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18659 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
18663 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18664 LDKRevokeAndACK this_ptr_conv;
18665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18666 this_ptr_conv.is_owned = false;
18667 LDKThirtyTwoBytes val_ref;
18668 CHECK(*((uint32_t*)val) == 32);
18669 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18670 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
18673 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
18674 LDKRevokeAndACK this_ptr_conv;
18675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18676 this_ptr_conv.is_owned = false;
18677 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18678 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
18682 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18683 LDKRevokeAndACK this_ptr_conv;
18684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18685 this_ptr_conv.is_owned = false;
18686 LDKThirtyTwoBytes val_ref;
18687 CHECK(*((uint32_t*)val) == 32);
18688 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18689 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
18692 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
18693 LDKRevokeAndACK this_ptr_conv;
18694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18695 this_ptr_conv.is_owned = false;
18696 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18697 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18701 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18702 LDKRevokeAndACK this_ptr_conv;
18703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18704 this_ptr_conv.is_owned = false;
18705 LDKPublicKey val_ref;
18706 CHECK(*((uint32_t*)val) == 33);
18707 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18708 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18711 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) {
18712 LDKThirtyTwoBytes channel_id_arg_ref;
18713 CHECK(*((uint32_t*)channel_id_arg) == 32);
18714 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18715 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
18716 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
18717 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
18718 LDKPublicKey next_per_commitment_point_arg_ref;
18719 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
18720 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
18721 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
18722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18724 uint64_t ret_ref = (uint64_t)ret_var.inner;
18725 if (ret_var.is_owned) {
18731 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
18732 LDKRevokeAndACK orig_conv;
18733 orig_conv.inner = (void*)(orig & (~1));
18734 orig_conv.is_owned = false;
18735 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
18736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18738 uint64_t ret_ref = (uint64_t)ret_var.inner;
18739 if (ret_var.is_owned) {
18745 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
18746 LDKUpdateFee this_obj_conv;
18747 this_obj_conv.inner = (void*)(this_obj & (~1));
18748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18749 UpdateFee_free(this_obj_conv);
18752 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
18753 LDKUpdateFee this_ptr_conv;
18754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18755 this_ptr_conv.is_owned = false;
18756 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18757 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
18761 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18762 LDKUpdateFee this_ptr_conv;
18763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18764 this_ptr_conv.is_owned = false;
18765 LDKThirtyTwoBytes val_ref;
18766 CHECK(*((uint32_t*)val) == 32);
18767 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18768 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
18771 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
18772 LDKUpdateFee this_ptr_conv;
18773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18774 this_ptr_conv.is_owned = false;
18775 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18779 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
18780 LDKUpdateFee this_ptr_conv;
18781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18782 this_ptr_conv.is_owned = false;
18783 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18786 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
18787 LDKThirtyTwoBytes channel_id_arg_ref;
18788 CHECK(*((uint32_t*)channel_id_arg) == 32);
18789 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
18790 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18793 uint64_t ret_ref = (uint64_t)ret_var.inner;
18794 if (ret_var.is_owned) {
18800 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
18801 LDKUpdateFee orig_conv;
18802 orig_conv.inner = (void*)(orig & (~1));
18803 orig_conv.is_owned = false;
18804 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18807 uint64_t ret_ref = (uint64_t)ret_var.inner;
18808 if (ret_var.is_owned) {
18814 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
18815 LDKDataLossProtect this_obj_conv;
18816 this_obj_conv.inner = (void*)(this_obj & (~1));
18817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18818 DataLossProtect_free(this_obj_conv);
18821 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
18822 LDKDataLossProtect this_ptr_conv;
18823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18824 this_ptr_conv.is_owned = false;
18825 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18826 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
18830 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
18831 LDKDataLossProtect this_ptr_conv;
18832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18833 this_ptr_conv.is_owned = false;
18834 LDKThirtyTwoBytes val_ref;
18835 CHECK(*((uint32_t*)val) == 32);
18836 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18837 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18840 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
18841 LDKDataLossProtect this_ptr_conv;
18842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18843 this_ptr_conv.is_owned = false;
18844 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18845 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
18849 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
18850 LDKDataLossProtect this_ptr_conv;
18851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18852 this_ptr_conv.is_owned = false;
18853 LDKPublicKey val_ref;
18854 CHECK(*((uint32_t*)val) == 33);
18855 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18856 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18859 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
18860 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18861 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
18862 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
18863 LDKPublicKey my_current_per_commitment_point_arg_ref;
18864 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
18865 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
18866 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18869 uint64_t ret_ref = (uint64_t)ret_var.inner;
18870 if (ret_var.is_owned) {
18876 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
18877 LDKDataLossProtect orig_conv;
18878 orig_conv.inner = (void*)(orig & (~1));
18879 orig_conv.is_owned = false;
18880 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18883 uint64_t ret_ref = (uint64_t)ret_var.inner;
18884 if (ret_var.is_owned) {
18890 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
18891 LDKChannelReestablish this_obj_conv;
18892 this_obj_conv.inner = (void*)(this_obj & (~1));
18893 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18894 ChannelReestablish_free(this_obj_conv);
18897 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
18898 LDKChannelReestablish this_ptr_conv;
18899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18900 this_ptr_conv.is_owned = false;
18901 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18902 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
18906 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18907 LDKChannelReestablish this_ptr_conv;
18908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18909 this_ptr_conv.is_owned = false;
18910 LDKThirtyTwoBytes val_ref;
18911 CHECK(*((uint32_t*)val) == 32);
18912 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18913 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18916 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
18917 LDKChannelReestablish this_ptr_conv;
18918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18919 this_ptr_conv.is_owned = false;
18920 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18924 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
18925 LDKChannelReestablish this_ptr_conv;
18926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18927 this_ptr_conv.is_owned = false;
18928 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18931 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
18932 LDKChannelReestablish this_ptr_conv;
18933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18934 this_ptr_conv.is_owned = false;
18935 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18939 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
18940 LDKChannelReestablish this_ptr_conv;
18941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18942 this_ptr_conv.is_owned = false;
18943 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18946 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
18947 LDKChannelReestablish orig_conv;
18948 orig_conv.inner = (void*)(orig & (~1));
18949 orig_conv.is_owned = false;
18950 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18953 uint64_t ret_ref = (uint64_t)ret_var.inner;
18954 if (ret_var.is_owned) {
18960 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
18961 LDKAnnouncementSignatures this_obj_conv;
18962 this_obj_conv.inner = (void*)(this_obj & (~1));
18963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18964 AnnouncementSignatures_free(this_obj_conv);
18967 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
18968 LDKAnnouncementSignatures this_ptr_conv;
18969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18970 this_ptr_conv.is_owned = false;
18971 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18972 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
18976 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
18977 LDKAnnouncementSignatures this_ptr_conv;
18978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18979 this_ptr_conv.is_owned = false;
18980 LDKThirtyTwoBytes val_ref;
18981 CHECK(*((uint32_t*)val) == 32);
18982 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18983 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18986 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
18987 LDKAnnouncementSignatures this_ptr_conv;
18988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18989 this_ptr_conv.is_owned = false;
18990 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18994 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18995 LDKAnnouncementSignatures this_ptr_conv;
18996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18997 this_ptr_conv.is_owned = false;
18998 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19001 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
19002 LDKAnnouncementSignatures this_ptr_conv;
19003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19004 this_ptr_conv.is_owned = false;
19005 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19006 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
19010 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
19011 LDKAnnouncementSignatures this_ptr_conv;
19012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19013 this_ptr_conv.is_owned = false;
19014 LDKSignature val_ref;
19015 CHECK(*((uint32_t*)val) == 64);
19016 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19017 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19020 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
19021 LDKAnnouncementSignatures this_ptr_conv;
19022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19023 this_ptr_conv.is_owned = false;
19024 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19025 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
19029 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
19030 LDKAnnouncementSignatures this_ptr_conv;
19031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19032 this_ptr_conv.is_owned = false;
19033 LDKSignature val_ref;
19034 CHECK(*((uint32_t*)val) == 64);
19035 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19036 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19039 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) {
19040 LDKThirtyTwoBytes channel_id_arg_ref;
19041 CHECK(*((uint32_t*)channel_id_arg) == 32);
19042 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
19043 LDKSignature node_signature_arg_ref;
19044 CHECK(*((uint32_t*)node_signature_arg) == 64);
19045 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
19046 LDKSignature bitcoin_signature_arg_ref;
19047 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
19048 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
19049 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19052 uint64_t ret_ref = (uint64_t)ret_var.inner;
19053 if (ret_var.is_owned) {
19059 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
19060 LDKAnnouncementSignatures orig_conv;
19061 orig_conv.inner = (void*)(orig & (~1));
19062 orig_conv.is_owned = false;
19063 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19066 uint64_t ret_ref = (uint64_t)ret_var.inner;
19067 if (ret_var.is_owned) {
19073 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
19074 if ((this_ptr & 1) != 0) return;
19075 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
19076 FREE((void*)this_ptr);
19077 NetAddress_free(this_ptr_conv);
19080 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
19081 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19082 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19083 *ret_copy = NetAddress_clone(orig_conv);
19084 uint64_t ret_ref = (uint64_t)ret_copy;
19088 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
19089 LDKFourBytes addr_ref;
19090 CHECK(*((uint32_t*)addr) == 4);
19091 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 4);
19092 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19093 *ret_copy = NetAddress_ipv4(addr_ref, port);
19094 uint64_t ret_ref = (uint64_t)ret_copy;
19098 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
19099 LDKSixteenBytes addr_ref;
19100 CHECK(*((uint32_t*)addr) == 16);
19101 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 16);
19102 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19103 *ret_copy = NetAddress_ipv6(addr_ref, port);
19104 uint64_t ret_ref = (uint64_t)ret_copy;
19108 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) {
19109 LDKTenBytes addr_ref;
19110 CHECK(*((uint32_t*)addr) == 10);
19111 memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10);
19112 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19113 *ret_copy = NetAddress_onion_v2(addr_ref, port);
19114 uint64_t ret_ref = (uint64_t)ret_copy;
19118 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
19119 LDKThirtyTwoBytes ed25519_pubkey_ref;
19120 CHECK(*((uint32_t*)ed25519_pubkey) == 32);
19121 memcpy(ed25519_pubkey_ref.data, (uint8_t*)(ed25519_pubkey + 4), 32);
19122 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19123 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
19124 uint64_t ret_ref = (uint64_t)ret_copy;
19128 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
19129 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19130 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19131 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19132 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19133 CVec_u8Z_free(ret_var);
19137 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
19138 LDKu8slice ser_ref;
19139 ser_ref.datalen = *((uint32_t*)ser);
19140 ser_ref.data = (int8_t*)(ser + 4);
19141 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
19142 *ret_conv = Result_read(ser_ref);
19143 return (uint64_t)ret_conv;
19146 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
19147 LDKu8slice ser_ref;
19148 ser_ref.datalen = *((uint32_t*)ser);
19149 ser_ref.data = (int8_t*)(ser + 4);
19150 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19151 *ret_conv = NetAddress_read(ser_ref);
19152 return (uint64_t)ret_conv;
19155 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
19156 LDKUnsignedNodeAnnouncement this_obj_conv;
19157 this_obj_conv.inner = (void*)(this_obj & (~1));
19158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19159 UnsignedNodeAnnouncement_free(this_obj_conv);
19162 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
19163 LDKUnsignedNodeAnnouncement this_ptr_conv;
19164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19165 this_ptr_conv.is_owned = false;
19166 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
19167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19169 uint64_t ret_ref = (uint64_t)ret_var.inner;
19170 if (ret_var.is_owned) {
19176 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
19177 LDKUnsignedNodeAnnouncement this_ptr_conv;
19178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19179 this_ptr_conv.is_owned = false;
19180 LDKNodeFeatures val_conv;
19181 val_conv.inner = (void*)(val & (~1));
19182 val_conv.is_owned = (val & 1) || (val == 0);
19183 val_conv = NodeFeatures_clone(&val_conv);
19184 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
19187 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
19188 LDKUnsignedNodeAnnouncement this_ptr_conv;
19189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19190 this_ptr_conv.is_owned = false;
19191 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
19195 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
19196 LDKUnsignedNodeAnnouncement this_ptr_conv;
19197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19198 this_ptr_conv.is_owned = false;
19199 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
19202 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
19203 LDKUnsignedNodeAnnouncement this_ptr_conv;
19204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19205 this_ptr_conv.is_owned = false;
19206 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19207 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
19211 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
19212 LDKUnsignedNodeAnnouncement this_ptr_conv;
19213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19214 this_ptr_conv.is_owned = false;
19215 LDKPublicKey val_ref;
19216 CHECK(*((uint32_t*)val) == 33);
19217 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19218 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
19221 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
19222 LDKUnsignedNodeAnnouncement this_ptr_conv;
19223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19224 this_ptr_conv.is_owned = false;
19225 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19226 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
19230 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
19231 LDKUnsignedNodeAnnouncement this_ptr_conv;
19232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19233 this_ptr_conv.is_owned = false;
19234 LDKThreeBytes val_ref;
19235 CHECK(*((uint32_t*)val) == 3);
19236 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19237 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
19240 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
19241 LDKUnsignedNodeAnnouncement this_ptr_conv;
19242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19243 this_ptr_conv.is_owned = false;
19244 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19245 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
19249 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
19250 LDKUnsignedNodeAnnouncement this_ptr_conv;
19251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19252 this_ptr_conv.is_owned = false;
19253 LDKThirtyTwoBytes val_ref;
19254 CHECK(*((uint32_t*)val) == 32);
19255 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19256 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
19259 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19260 LDKUnsignedNodeAnnouncement this_ptr_conv;
19261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19262 this_ptr_conv.is_owned = false;
19263 LDKCVec_NetAddressZ val_constr;
19264 val_constr.datalen = *((uint32_t*)val);
19265 if (val_constr.datalen > 0)
19266 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19268 val_constr.data = NULL;
19269 uint32_t* val_vals = (uint32_t*)(val + 4);
19270 for (size_t m = 0; m < val_constr.datalen; m++) {
19271 uint32_t val_conv_12 = val_vals[m];
19272 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19273 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19274 val_constr.data[m] = val_conv_12_conv;
19276 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
19279 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
19280 LDKUnsignedNodeAnnouncement orig_conv;
19281 orig_conv.inner = (void*)(orig & (~1));
19282 orig_conv.is_owned = false;
19283 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
19284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19286 uint64_t ret_ref = (uint64_t)ret_var.inner;
19287 if (ret_var.is_owned) {
19293 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
19294 LDKNodeAnnouncement this_obj_conv;
19295 this_obj_conv.inner = (void*)(this_obj & (~1));
19296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19297 NodeAnnouncement_free(this_obj_conv);
19300 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
19301 LDKNodeAnnouncement this_ptr_conv;
19302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19303 this_ptr_conv.is_owned = false;
19304 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19305 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
19309 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
19310 LDKNodeAnnouncement this_ptr_conv;
19311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19312 this_ptr_conv.is_owned = false;
19313 LDKSignature val_ref;
19314 CHECK(*((uint32_t*)val) == 64);
19315 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19316 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
19319 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
19320 LDKNodeAnnouncement this_ptr_conv;
19321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19322 this_ptr_conv.is_owned = false;
19323 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
19324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19326 uint64_t ret_ref = (uint64_t)ret_var.inner;
19327 if (ret_var.is_owned) {
19333 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
19334 LDKNodeAnnouncement this_ptr_conv;
19335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19336 this_ptr_conv.is_owned = false;
19337 LDKUnsignedNodeAnnouncement val_conv;
19338 val_conv.inner = (void*)(val & (~1));
19339 val_conv.is_owned = (val & 1) || (val == 0);
19340 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
19341 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
19344 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
19345 LDKSignature signature_arg_ref;
19346 CHECK(*((uint32_t*)signature_arg) == 64);
19347 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19348 LDKUnsignedNodeAnnouncement contents_arg_conv;
19349 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19350 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19351 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
19352 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
19353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19355 uint64_t ret_ref = (uint64_t)ret_var.inner;
19356 if (ret_var.is_owned) {
19362 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
19363 LDKNodeAnnouncement orig_conv;
19364 orig_conv.inner = (void*)(orig & (~1));
19365 orig_conv.is_owned = false;
19366 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
19367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19369 uint64_t ret_ref = (uint64_t)ret_var.inner;
19370 if (ret_var.is_owned) {
19376 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
19377 LDKUnsignedChannelAnnouncement this_obj_conv;
19378 this_obj_conv.inner = (void*)(this_obj & (~1));
19379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19380 UnsignedChannelAnnouncement_free(this_obj_conv);
19383 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
19384 LDKUnsignedChannelAnnouncement this_ptr_conv;
19385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19386 this_ptr_conv.is_owned = false;
19387 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
19388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19390 uint64_t ret_ref = (uint64_t)ret_var.inner;
19391 if (ret_var.is_owned) {
19397 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
19398 LDKUnsignedChannelAnnouncement this_ptr_conv;
19399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19400 this_ptr_conv.is_owned = false;
19401 LDKChannelFeatures val_conv;
19402 val_conv.inner = (void*)(val & (~1));
19403 val_conv.is_owned = (val & 1) || (val == 0);
19404 val_conv = ChannelFeatures_clone(&val_conv);
19405 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
19408 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
19409 LDKUnsignedChannelAnnouncement this_ptr_conv;
19410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19411 this_ptr_conv.is_owned = false;
19412 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19413 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
19417 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19418 LDKUnsignedChannelAnnouncement this_ptr_conv;
19419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19420 this_ptr_conv.is_owned = false;
19421 LDKThirtyTwoBytes val_ref;
19422 CHECK(*((uint32_t*)val) == 32);
19423 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19424 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
19427 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
19428 LDKUnsignedChannelAnnouncement this_ptr_conv;
19429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19430 this_ptr_conv.is_owned = false;
19431 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
19435 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
19436 LDKUnsignedChannelAnnouncement this_ptr_conv;
19437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19438 this_ptr_conv.is_owned = false;
19439 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
19442 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
19443 LDKUnsignedChannelAnnouncement this_ptr_conv;
19444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19445 this_ptr_conv.is_owned = false;
19446 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19447 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
19451 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
19452 LDKUnsignedChannelAnnouncement this_ptr_conv;
19453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19454 this_ptr_conv.is_owned = false;
19455 LDKPublicKey val_ref;
19456 CHECK(*((uint32_t*)val) == 33);
19457 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19458 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
19461 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
19462 LDKUnsignedChannelAnnouncement this_ptr_conv;
19463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19464 this_ptr_conv.is_owned = false;
19465 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19466 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
19470 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
19471 LDKUnsignedChannelAnnouncement this_ptr_conv;
19472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19473 this_ptr_conv.is_owned = false;
19474 LDKPublicKey val_ref;
19475 CHECK(*((uint32_t*)val) == 33);
19476 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19477 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
19480 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
19481 LDKUnsignedChannelAnnouncement this_ptr_conv;
19482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19483 this_ptr_conv.is_owned = false;
19484 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19485 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
19489 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
19490 LDKUnsignedChannelAnnouncement this_ptr_conv;
19491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19492 this_ptr_conv.is_owned = false;
19493 LDKPublicKey val_ref;
19494 CHECK(*((uint32_t*)val) == 33);
19495 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19496 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
19499 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
19500 LDKUnsignedChannelAnnouncement this_ptr_conv;
19501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19502 this_ptr_conv.is_owned = false;
19503 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
19504 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
19508 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
19509 LDKUnsignedChannelAnnouncement this_ptr_conv;
19510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19511 this_ptr_conv.is_owned = false;
19512 LDKPublicKey val_ref;
19513 CHECK(*((uint32_t*)val) == 33);
19514 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
19515 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
19518 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
19519 LDKUnsignedChannelAnnouncement orig_conv;
19520 orig_conv.inner = (void*)(orig & (~1));
19521 orig_conv.is_owned = false;
19522 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
19523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19525 uint64_t ret_ref = (uint64_t)ret_var.inner;
19526 if (ret_var.is_owned) {
19532 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
19533 LDKChannelAnnouncement this_obj_conv;
19534 this_obj_conv.inner = (void*)(this_obj & (~1));
19535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19536 ChannelAnnouncement_free(this_obj_conv);
19539 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
19540 LDKChannelAnnouncement this_ptr_conv;
19541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19542 this_ptr_conv.is_owned = false;
19543 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19544 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
19548 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
19549 LDKChannelAnnouncement this_ptr_conv;
19550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19551 this_ptr_conv.is_owned = false;
19552 LDKSignature val_ref;
19553 CHECK(*((uint32_t*)val) == 64);
19554 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19555 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
19558 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
19559 LDKChannelAnnouncement this_ptr_conv;
19560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19561 this_ptr_conv.is_owned = false;
19562 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19563 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
19567 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
19568 LDKChannelAnnouncement this_ptr_conv;
19569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19570 this_ptr_conv.is_owned = false;
19571 LDKSignature val_ref;
19572 CHECK(*((uint32_t*)val) == 64);
19573 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19574 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
19577 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
19578 LDKChannelAnnouncement this_ptr_conv;
19579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19580 this_ptr_conv.is_owned = false;
19581 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19582 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
19586 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
19587 LDKChannelAnnouncement this_ptr_conv;
19588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19589 this_ptr_conv.is_owned = false;
19590 LDKSignature val_ref;
19591 CHECK(*((uint32_t*)val) == 64);
19592 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19593 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
19596 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
19597 LDKChannelAnnouncement this_ptr_conv;
19598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19599 this_ptr_conv.is_owned = false;
19600 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19601 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
19605 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
19606 LDKChannelAnnouncement this_ptr_conv;
19607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19608 this_ptr_conv.is_owned = false;
19609 LDKSignature val_ref;
19610 CHECK(*((uint32_t*)val) == 64);
19611 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19612 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
19615 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
19616 LDKChannelAnnouncement this_ptr_conv;
19617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19618 this_ptr_conv.is_owned = false;
19619 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
19620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19622 uint64_t ret_ref = (uint64_t)ret_var.inner;
19623 if (ret_var.is_owned) {
19629 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
19630 LDKChannelAnnouncement this_ptr_conv;
19631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19632 this_ptr_conv.is_owned = false;
19633 LDKUnsignedChannelAnnouncement val_conv;
19634 val_conv.inner = (void*)(val & (~1));
19635 val_conv.is_owned = (val & 1) || (val == 0);
19636 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
19637 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
19640 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) {
19641 LDKSignature node_signature_1_arg_ref;
19642 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
19643 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
19644 LDKSignature node_signature_2_arg_ref;
19645 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
19646 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
19647 LDKSignature bitcoin_signature_1_arg_ref;
19648 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
19649 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
19650 LDKSignature bitcoin_signature_2_arg_ref;
19651 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
19652 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
19653 LDKUnsignedChannelAnnouncement contents_arg_conv;
19654 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19655 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19656 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
19657 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);
19658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19660 uint64_t ret_ref = (uint64_t)ret_var.inner;
19661 if (ret_var.is_owned) {
19667 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
19668 LDKChannelAnnouncement orig_conv;
19669 orig_conv.inner = (void*)(orig & (~1));
19670 orig_conv.is_owned = false;
19671 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
19672 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19673 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19674 uint64_t ret_ref = (uint64_t)ret_var.inner;
19675 if (ret_var.is_owned) {
19681 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
19682 LDKUnsignedChannelUpdate this_obj_conv;
19683 this_obj_conv.inner = (void*)(this_obj & (~1));
19684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19685 UnsignedChannelUpdate_free(this_obj_conv);
19688 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
19689 LDKUnsignedChannelUpdate this_ptr_conv;
19690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19691 this_ptr_conv.is_owned = false;
19692 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19693 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
19697 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19698 LDKUnsignedChannelUpdate this_ptr_conv;
19699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19700 this_ptr_conv.is_owned = false;
19701 LDKThirtyTwoBytes val_ref;
19702 CHECK(*((uint32_t*)val) == 32);
19703 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19704 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
19707 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
19708 LDKUnsignedChannelUpdate this_ptr_conv;
19709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19710 this_ptr_conv.is_owned = false;
19711 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
19715 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
19716 LDKUnsignedChannelUpdate this_ptr_conv;
19717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19718 this_ptr_conv.is_owned = false;
19719 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
19722 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
19723 LDKUnsignedChannelUpdate this_ptr_conv;
19724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19725 this_ptr_conv.is_owned = false;
19726 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
19730 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
19731 LDKUnsignedChannelUpdate this_ptr_conv;
19732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19733 this_ptr_conv.is_owned = false;
19734 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
19737 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
19738 LDKUnsignedChannelUpdate this_ptr_conv;
19739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19740 this_ptr_conv.is_owned = false;
19741 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
19745 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
19746 LDKUnsignedChannelUpdate this_ptr_conv;
19747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19748 this_ptr_conv.is_owned = false;
19749 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
19752 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
19753 LDKUnsignedChannelUpdate this_ptr_conv;
19754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19755 this_ptr_conv.is_owned = false;
19756 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
19760 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
19761 LDKUnsignedChannelUpdate this_ptr_conv;
19762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19763 this_ptr_conv.is_owned = false;
19764 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
19767 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
19768 LDKUnsignedChannelUpdate this_ptr_conv;
19769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19770 this_ptr_conv.is_owned = false;
19771 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
19775 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
19776 LDKUnsignedChannelUpdate this_ptr_conv;
19777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19778 this_ptr_conv.is_owned = false;
19779 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
19782 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
19783 LDKUnsignedChannelUpdate this_ptr_conv;
19784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19785 this_ptr_conv.is_owned = false;
19786 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
19790 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
19791 LDKUnsignedChannelUpdate this_ptr_conv;
19792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19793 this_ptr_conv.is_owned = false;
19794 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19797 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
19798 LDKUnsignedChannelUpdate this_ptr_conv;
19799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19800 this_ptr_conv.is_owned = false;
19801 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19805 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
19806 LDKUnsignedChannelUpdate this_ptr_conv;
19807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19808 this_ptr_conv.is_owned = false;
19809 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19812 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
19813 LDKUnsignedChannelUpdate orig_conv;
19814 orig_conv.inner = (void*)(orig & (~1));
19815 orig_conv.is_owned = false;
19816 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19819 uint64_t ret_ref = (uint64_t)ret_var.inner;
19820 if (ret_var.is_owned) {
19826 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
19827 LDKChannelUpdate this_obj_conv;
19828 this_obj_conv.inner = (void*)(this_obj & (~1));
19829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19830 ChannelUpdate_free(this_obj_conv);
19833 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
19834 LDKChannelUpdate this_ptr_conv;
19835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19836 this_ptr_conv.is_owned = false;
19837 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
19838 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
19842 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
19843 LDKChannelUpdate this_ptr_conv;
19844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19845 this_ptr_conv.is_owned = false;
19846 LDKSignature val_ref;
19847 CHECK(*((uint32_t*)val) == 64);
19848 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
19849 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19852 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
19853 LDKChannelUpdate this_ptr_conv;
19854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19855 this_ptr_conv.is_owned = false;
19856 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19859 uint64_t ret_ref = (uint64_t)ret_var.inner;
19860 if (ret_var.is_owned) {
19866 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
19867 LDKChannelUpdate this_ptr_conv;
19868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19869 this_ptr_conv.is_owned = false;
19870 LDKUnsignedChannelUpdate val_conv;
19871 val_conv.inner = (void*)(val & (~1));
19872 val_conv.is_owned = (val & 1) || (val == 0);
19873 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19874 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19877 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
19878 LDKSignature signature_arg_ref;
19879 CHECK(*((uint32_t*)signature_arg) == 64);
19880 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
19881 LDKUnsignedChannelUpdate contents_arg_conv;
19882 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19883 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19884 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19885 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19888 uint64_t ret_ref = (uint64_t)ret_var.inner;
19889 if (ret_var.is_owned) {
19895 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
19896 LDKChannelUpdate orig_conv;
19897 orig_conv.inner = (void*)(orig & (~1));
19898 orig_conv.is_owned = false;
19899 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19902 uint64_t ret_ref = (uint64_t)ret_var.inner;
19903 if (ret_var.is_owned) {
19909 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
19910 LDKQueryChannelRange this_obj_conv;
19911 this_obj_conv.inner = (void*)(this_obj & (~1));
19912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19913 QueryChannelRange_free(this_obj_conv);
19916 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
19917 LDKQueryChannelRange this_ptr_conv;
19918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19919 this_ptr_conv.is_owned = false;
19920 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19921 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
19925 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
19926 LDKQueryChannelRange this_ptr_conv;
19927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19928 this_ptr_conv.is_owned = false;
19929 LDKThirtyTwoBytes val_ref;
19930 CHECK(*((uint32_t*)val) == 32);
19931 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19932 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19935 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
19936 LDKQueryChannelRange this_ptr_conv;
19937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19938 this_ptr_conv.is_owned = false;
19939 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19943 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
19944 LDKQueryChannelRange this_ptr_conv;
19945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19946 this_ptr_conv.is_owned = false;
19947 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19950 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
19951 LDKQueryChannelRange this_ptr_conv;
19952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19953 this_ptr_conv.is_owned = false;
19954 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19958 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
19959 LDKQueryChannelRange this_ptr_conv;
19960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19961 this_ptr_conv.is_owned = false;
19962 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19965 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
19966 LDKThirtyTwoBytes chain_hash_arg_ref;
19967 CHECK(*((uint32_t*)chain_hash_arg) == 32);
19968 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
19969 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19972 uint64_t ret_ref = (uint64_t)ret_var.inner;
19973 if (ret_var.is_owned) {
19979 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
19980 LDKQueryChannelRange orig_conv;
19981 orig_conv.inner = (void*)(orig & (~1));
19982 orig_conv.is_owned = false;
19983 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19986 uint64_t ret_ref = (uint64_t)ret_var.inner;
19987 if (ret_var.is_owned) {
19993 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
19994 LDKReplyChannelRange this_obj_conv;
19995 this_obj_conv.inner = (void*)(this_obj & (~1));
19996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19997 ReplyChannelRange_free(this_obj_conv);
20000 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
20001 LDKReplyChannelRange this_ptr_conv;
20002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20003 this_ptr_conv.is_owned = false;
20004 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20005 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
20009 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20010 LDKReplyChannelRange this_ptr_conv;
20011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20012 this_ptr_conv.is_owned = false;
20013 LDKThirtyTwoBytes val_ref;
20014 CHECK(*((uint32_t*)val) == 32);
20015 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20016 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20019 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
20020 LDKReplyChannelRange this_ptr_conv;
20021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20022 this_ptr_conv.is_owned = false;
20023 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20027 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
20028 LDKReplyChannelRange this_ptr_conv;
20029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20030 this_ptr_conv.is_owned = false;
20031 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20034 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
20035 LDKReplyChannelRange this_ptr_conv;
20036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20037 this_ptr_conv.is_owned = false;
20038 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20042 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
20043 LDKReplyChannelRange this_ptr_conv;
20044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20045 this_ptr_conv.is_owned = false;
20046 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20049 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
20050 LDKReplyChannelRange this_ptr_conv;
20051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20052 this_ptr_conv.is_owned = false;
20053 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20057 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
20058 LDKReplyChannelRange this_ptr_conv;
20059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20060 this_ptr_conv.is_owned = false;
20061 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20064 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20065 LDKReplyChannelRange this_ptr_conv;
20066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20067 this_ptr_conv.is_owned = false;
20068 LDKCVec_u64Z val_constr;
20069 val_constr.datalen = *((uint32_t*)val);
20070 if (val_constr.datalen > 0)
20071 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20073 val_constr.data = NULL;
20074 int64_t* val_vals = (int64_t*)(val + 4);
20075 for (size_t i = 0; i < val_constr.datalen; i++) {
20076 int64_t val_conv_8 = val_vals[i];
20077 val_constr.data[i] = val_conv_8;
20079 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20082 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) {
20083 LDKThirtyTwoBytes chain_hash_arg_ref;
20084 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20085 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20086 LDKCVec_u64Z short_channel_ids_arg_constr;
20087 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20088 if (short_channel_ids_arg_constr.datalen > 0)
20089 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20091 short_channel_ids_arg_constr.data = NULL;
20092 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20093 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20094 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20095 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20097 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20100 uint64_t ret_ref = (uint64_t)ret_var.inner;
20101 if (ret_var.is_owned) {
20107 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
20108 LDKReplyChannelRange orig_conv;
20109 orig_conv.inner = (void*)(orig & (~1));
20110 orig_conv.is_owned = false;
20111 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20114 uint64_t ret_ref = (uint64_t)ret_var.inner;
20115 if (ret_var.is_owned) {
20121 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
20122 LDKQueryShortChannelIds this_obj_conv;
20123 this_obj_conv.inner = (void*)(this_obj & (~1));
20124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20125 QueryShortChannelIds_free(this_obj_conv);
20128 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
20129 LDKQueryShortChannelIds this_ptr_conv;
20130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20131 this_ptr_conv.is_owned = false;
20132 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20133 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
20137 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20138 LDKQueryShortChannelIds this_ptr_conv;
20139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20140 this_ptr_conv.is_owned = false;
20141 LDKThirtyTwoBytes val_ref;
20142 CHECK(*((uint32_t*)val) == 32);
20143 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20144 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
20147 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
20148 LDKQueryShortChannelIds this_ptr_conv;
20149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20150 this_ptr_conv.is_owned = false;
20151 LDKCVec_u64Z val_constr;
20152 val_constr.datalen = *((uint32_t*)val);
20153 if (val_constr.datalen > 0)
20154 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20156 val_constr.data = NULL;
20157 int64_t* val_vals = (int64_t*)(val + 4);
20158 for (size_t i = 0; i < val_constr.datalen; i++) {
20159 int64_t val_conv_8 = val_vals[i];
20160 val_constr.data[i] = val_conv_8;
20162 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
20165 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
20166 LDKThirtyTwoBytes chain_hash_arg_ref;
20167 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20168 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20169 LDKCVec_u64Z short_channel_ids_arg_constr;
20170 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
20171 if (short_channel_ids_arg_constr.datalen > 0)
20172 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20174 short_channel_ids_arg_constr.data = NULL;
20175 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
20176 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
20177 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
20178 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
20180 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
20181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20183 uint64_t ret_ref = (uint64_t)ret_var.inner;
20184 if (ret_var.is_owned) {
20190 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
20191 LDKQueryShortChannelIds orig_conv;
20192 orig_conv.inner = (void*)(orig & (~1));
20193 orig_conv.is_owned = false;
20194 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
20195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20197 uint64_t ret_ref = (uint64_t)ret_var.inner;
20198 if (ret_var.is_owned) {
20204 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
20205 LDKReplyShortChannelIdsEnd this_obj_conv;
20206 this_obj_conv.inner = (void*)(this_obj & (~1));
20207 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20208 ReplyShortChannelIdsEnd_free(this_obj_conv);
20211 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
20212 LDKReplyShortChannelIdsEnd this_ptr_conv;
20213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20214 this_ptr_conv.is_owned = false;
20215 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20216 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
20220 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20221 LDKReplyShortChannelIdsEnd this_ptr_conv;
20222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20223 this_ptr_conv.is_owned = false;
20224 LDKThirtyTwoBytes val_ref;
20225 CHECK(*((uint32_t*)val) == 32);
20226 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20227 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
20230 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
20231 LDKReplyShortChannelIdsEnd this_ptr_conv;
20232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20233 this_ptr_conv.is_owned = false;
20234 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
20238 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
20239 LDKReplyShortChannelIdsEnd this_ptr_conv;
20240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20241 this_ptr_conv.is_owned = false;
20242 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
20245 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
20246 LDKThirtyTwoBytes chain_hash_arg_ref;
20247 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20248 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20249 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
20250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20252 uint64_t ret_ref = (uint64_t)ret_var.inner;
20253 if (ret_var.is_owned) {
20259 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
20260 LDKReplyShortChannelIdsEnd orig_conv;
20261 orig_conv.inner = (void*)(orig & (~1));
20262 orig_conv.is_owned = false;
20263 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
20264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20266 uint64_t ret_ref = (uint64_t)ret_var.inner;
20267 if (ret_var.is_owned) {
20273 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
20274 LDKGossipTimestampFilter this_obj_conv;
20275 this_obj_conv.inner = (void*)(this_obj & (~1));
20276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20277 GossipTimestampFilter_free(this_obj_conv);
20280 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
20281 LDKGossipTimestampFilter this_ptr_conv;
20282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20283 this_ptr_conv.is_owned = false;
20284 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
20285 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
20289 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
20290 LDKGossipTimestampFilter this_ptr_conv;
20291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20292 this_ptr_conv.is_owned = false;
20293 LDKThirtyTwoBytes val_ref;
20294 CHECK(*((uint32_t*)val) == 32);
20295 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
20296 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
20299 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
20300 LDKGossipTimestampFilter this_ptr_conv;
20301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20302 this_ptr_conv.is_owned = false;
20303 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
20307 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
20308 LDKGossipTimestampFilter this_ptr_conv;
20309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20310 this_ptr_conv.is_owned = false;
20311 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
20314 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
20315 LDKGossipTimestampFilter this_ptr_conv;
20316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20317 this_ptr_conv.is_owned = false;
20318 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
20322 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
20323 LDKGossipTimestampFilter this_ptr_conv;
20324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20325 this_ptr_conv.is_owned = false;
20326 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
20329 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
20330 LDKThirtyTwoBytes chain_hash_arg_ref;
20331 CHECK(*((uint32_t*)chain_hash_arg) == 32);
20332 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
20333 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
20334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20336 uint64_t ret_ref = (uint64_t)ret_var.inner;
20337 if (ret_var.is_owned) {
20343 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
20344 LDKGossipTimestampFilter orig_conv;
20345 orig_conv.inner = (void*)(orig & (~1));
20346 orig_conv.is_owned = false;
20347 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
20348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20350 uint64_t ret_ref = (uint64_t)ret_var.inner;
20351 if (ret_var.is_owned) {
20357 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
20358 if ((this_ptr & 1) != 0) return;
20359 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
20360 FREE((void*)this_ptr);
20361 ErrorAction_free(this_ptr_conv);
20364 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
20365 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
20366 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20367 *ret_copy = ErrorAction_clone(orig_conv);
20368 uint64_t ret_ref = (uint64_t)ret_copy;
20372 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
20373 LDKErrorMessage msg_conv;
20374 msg_conv.inner = (void*)(msg & (~1));
20375 msg_conv.is_owned = (msg & 1) || (msg == 0);
20376 msg_conv = ErrorMessage_clone(&msg_conv);
20377 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20378 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
20379 uint64_t ret_ref = (uint64_t)ret_copy;
20383 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
20384 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20385 *ret_copy = ErrorAction_ignore_error();
20386 uint64_t ret_ref = (uint64_t)ret_copy;
20390 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
20391 LDKLevel a_conv = LDKLevel_from_js(a);
20392 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20393 *ret_copy = ErrorAction_ignore_and_log(a_conv);
20394 uint64_t ret_ref = (uint64_t)ret_copy;
20398 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
20399 LDKErrorMessage msg_conv;
20400 msg_conv.inner = (void*)(msg & (~1));
20401 msg_conv.is_owned = (msg & 1) || (msg == 0);
20402 msg_conv = ErrorMessage_clone(&msg_conv);
20403 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20404 *ret_copy = ErrorAction_send_error_message(msg_conv);
20405 uint64_t ret_ref = (uint64_t)ret_copy;
20409 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
20410 LDKLightningError this_obj_conv;
20411 this_obj_conv.inner = (void*)(this_obj & (~1));
20412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20413 LightningError_free(this_obj_conv);
20416 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
20417 LDKLightningError this_ptr_conv;
20418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20419 this_ptr_conv.is_owned = false;
20420 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
20421 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20426 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
20427 LDKLightningError this_ptr_conv;
20428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20429 this_ptr_conv.is_owned = false;
20430 LDKStr val_conv = str_ref_to_owned_c(val);
20431 LightningError_set_err(&this_ptr_conv, val_conv);
20434 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
20435 LDKLightningError this_ptr_conv;
20436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20437 this_ptr_conv.is_owned = false;
20438 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20439 *ret_copy = LightningError_get_action(&this_ptr_conv);
20440 uint64_t ret_ref = (uint64_t)ret_copy;
20444 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
20445 LDKLightningError this_ptr_conv;
20446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20447 this_ptr_conv.is_owned = false;
20448 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
20449 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
20450 LightningError_set_action(&this_ptr_conv, val_conv);
20453 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
20454 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
20455 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
20456 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
20457 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
20458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20460 uint64_t ret_ref = (uint64_t)ret_var.inner;
20461 if (ret_var.is_owned) {
20467 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
20468 LDKLightningError orig_conv;
20469 orig_conv.inner = (void*)(orig & (~1));
20470 orig_conv.is_owned = false;
20471 LDKLightningError ret_var = LightningError_clone(&orig_conv);
20472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20474 uint64_t ret_ref = (uint64_t)ret_var.inner;
20475 if (ret_var.is_owned) {
20481 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
20482 LDKCommitmentUpdate this_obj_conv;
20483 this_obj_conv.inner = (void*)(this_obj & (~1));
20484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20485 CommitmentUpdate_free(this_obj_conv);
20488 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
20489 LDKCommitmentUpdate this_ptr_conv;
20490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20491 this_ptr_conv.is_owned = false;
20492 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
20493 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
20494 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
20495 for (size_t p = 0; p < ret_var.datalen; p++) {
20496 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
20497 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20498 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20499 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
20500 if (ret_conv_15_var.is_owned) {
20501 ret_conv_15_ref |= 1;
20503 ret_arr_ptr[p] = ret_conv_15_ref;
20505 FREE(ret_var.data);
20509 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
20510 LDKCommitmentUpdate this_ptr_conv;
20511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20512 this_ptr_conv.is_owned = false;
20513 LDKCVec_UpdateAddHTLCZ val_constr;
20514 val_constr.datalen = *((uint32_t*)val);
20515 if (val_constr.datalen > 0)
20516 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20518 val_constr.data = NULL;
20519 uint32_t* val_vals = (uint32_t*)(val + 4);
20520 for (size_t p = 0; p < val_constr.datalen; p++) {
20521 uint32_t val_conv_15 = val_vals[p];
20522 LDKUpdateAddHTLC val_conv_15_conv;
20523 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
20524 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
20525 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
20526 val_constr.data[p] = val_conv_15_conv;
20528 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
20531 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
20532 LDKCommitmentUpdate this_ptr_conv;
20533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20534 this_ptr_conv.is_owned = false;
20535 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
20536 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
20537 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
20538 for (size_t t = 0; t < ret_var.datalen; t++) {
20539 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
20540 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20541 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20542 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
20543 if (ret_conv_19_var.is_owned) {
20544 ret_conv_19_ref |= 1;
20546 ret_arr_ptr[t] = ret_conv_19_ref;
20548 FREE(ret_var.data);
20552 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
20553 LDKCommitmentUpdate this_ptr_conv;
20554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20555 this_ptr_conv.is_owned = false;
20556 LDKCVec_UpdateFulfillHTLCZ val_constr;
20557 val_constr.datalen = *((uint32_t*)val);
20558 if (val_constr.datalen > 0)
20559 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20561 val_constr.data = NULL;
20562 uint32_t* val_vals = (uint32_t*)(val + 4);
20563 for (size_t t = 0; t < val_constr.datalen; t++) {
20564 uint32_t val_conv_19 = val_vals[t];
20565 LDKUpdateFulfillHTLC val_conv_19_conv;
20566 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
20567 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
20568 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
20569 val_constr.data[t] = val_conv_19_conv;
20571 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
20574 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
20575 LDKCommitmentUpdate this_ptr_conv;
20576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20577 this_ptr_conv.is_owned = false;
20578 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
20579 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
20580 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
20581 for (size_t q = 0; q < ret_var.datalen; q++) {
20582 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
20583 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20584 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20585 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
20586 if (ret_conv_16_var.is_owned) {
20587 ret_conv_16_ref |= 1;
20589 ret_arr_ptr[q] = ret_conv_16_ref;
20591 FREE(ret_var.data);
20595 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
20596 LDKCommitmentUpdate this_ptr_conv;
20597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20598 this_ptr_conv.is_owned = false;
20599 LDKCVec_UpdateFailHTLCZ val_constr;
20600 val_constr.datalen = *((uint32_t*)val);
20601 if (val_constr.datalen > 0)
20602 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20604 val_constr.data = NULL;
20605 uint32_t* val_vals = (uint32_t*)(val + 4);
20606 for (size_t q = 0; q < val_constr.datalen; q++) {
20607 uint32_t val_conv_16 = val_vals[q];
20608 LDKUpdateFailHTLC val_conv_16_conv;
20609 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
20610 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
20611 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
20612 val_constr.data[q] = val_conv_16_conv;
20614 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
20617 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
20618 LDKCommitmentUpdate this_ptr_conv;
20619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20620 this_ptr_conv.is_owned = false;
20621 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
20622 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
20623 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
20624 for (size_t z = 0; z < ret_var.datalen; z++) {
20625 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
20626 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20627 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20628 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
20629 if (ret_conv_25_var.is_owned) {
20630 ret_conv_25_ref |= 1;
20632 ret_arr_ptr[z] = ret_conv_25_ref;
20634 FREE(ret_var.data);
20638 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
20639 LDKCommitmentUpdate this_ptr_conv;
20640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20641 this_ptr_conv.is_owned = false;
20642 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
20643 val_constr.datalen = *((uint32_t*)val);
20644 if (val_constr.datalen > 0)
20645 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20647 val_constr.data = NULL;
20648 uint32_t* val_vals = (uint32_t*)(val + 4);
20649 for (size_t z = 0; z < val_constr.datalen; z++) {
20650 uint32_t val_conv_25 = val_vals[z];
20651 LDKUpdateFailMalformedHTLC val_conv_25_conv;
20652 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
20653 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
20654 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
20655 val_constr.data[z] = val_conv_25_conv;
20657 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
20660 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
20661 LDKCommitmentUpdate this_ptr_conv;
20662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20663 this_ptr_conv.is_owned = false;
20664 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
20665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20667 uint64_t ret_ref = (uint64_t)ret_var.inner;
20668 if (ret_var.is_owned) {
20674 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
20675 LDKCommitmentUpdate this_ptr_conv;
20676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20677 this_ptr_conv.is_owned = false;
20678 LDKUpdateFee val_conv;
20679 val_conv.inner = (void*)(val & (~1));
20680 val_conv.is_owned = (val & 1) || (val == 0);
20681 val_conv = UpdateFee_clone(&val_conv);
20682 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
20685 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
20686 LDKCommitmentUpdate this_ptr_conv;
20687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20688 this_ptr_conv.is_owned = false;
20689 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
20690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20692 uint64_t ret_ref = (uint64_t)ret_var.inner;
20693 if (ret_var.is_owned) {
20699 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
20700 LDKCommitmentUpdate this_ptr_conv;
20701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20702 this_ptr_conv.is_owned = false;
20703 LDKCommitmentSigned val_conv;
20704 val_conv.inner = (void*)(val & (~1));
20705 val_conv.is_owned = (val & 1) || (val == 0);
20706 val_conv = CommitmentSigned_clone(&val_conv);
20707 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
20710 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) {
20711 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
20712 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
20713 if (update_add_htlcs_arg_constr.datalen > 0)
20714 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20716 update_add_htlcs_arg_constr.data = NULL;
20717 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
20718 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
20719 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
20720 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
20721 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
20722 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
20723 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
20724 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
20726 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
20727 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
20728 if (update_fulfill_htlcs_arg_constr.datalen > 0)
20729 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20731 update_fulfill_htlcs_arg_constr.data = NULL;
20732 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
20733 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
20734 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
20735 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
20736 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
20737 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
20738 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
20739 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
20741 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
20742 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
20743 if (update_fail_htlcs_arg_constr.datalen > 0)
20744 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20746 update_fail_htlcs_arg_constr.data = NULL;
20747 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
20748 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
20749 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
20750 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
20751 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
20752 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
20753 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
20754 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
20756 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
20757 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
20758 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
20759 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20761 update_fail_malformed_htlcs_arg_constr.data = NULL;
20762 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
20763 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
20764 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
20765 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
20766 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
20767 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);
20768 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
20769 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
20771 LDKUpdateFee update_fee_arg_conv;
20772 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
20773 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
20774 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
20775 LDKCommitmentSigned commitment_signed_arg_conv;
20776 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
20777 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
20778 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
20779 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);
20780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20782 uint64_t ret_ref = (uint64_t)ret_var.inner;
20783 if (ret_var.is_owned) {
20789 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
20790 LDKCommitmentUpdate orig_conv;
20791 orig_conv.inner = (void*)(orig & (~1));
20792 orig_conv.is_owned = false;
20793 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
20794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20796 uint64_t ret_ref = (uint64_t)ret_var.inner;
20797 if (ret_var.is_owned) {
20803 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
20804 if ((this_ptr & 1) != 0) return;
20805 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20806 FREE((void*)this_ptr);
20807 ChannelMessageHandler_free(this_ptr_conv);
20810 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
20811 if ((this_ptr & 1) != 0) return;
20812 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20813 FREE((void*)this_ptr);
20814 RoutingMessageHandler_free(this_ptr_conv);
20817 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
20818 LDKAcceptChannel obj_conv;
20819 obj_conv.inner = (void*)(obj & (~1));
20820 obj_conv.is_owned = false;
20821 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20822 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20823 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20824 CVec_u8Z_free(ret_var);
20828 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
20829 LDKu8slice ser_ref;
20830 ser_ref.datalen = *((uint32_t*)ser);
20831 ser_ref.data = (int8_t*)(ser + 4);
20832 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20833 *ret_conv = AcceptChannel_read(ser_ref);
20834 return (uint64_t)ret_conv;
20837 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
20838 LDKAnnouncementSignatures obj_conv;
20839 obj_conv.inner = (void*)(obj & (~1));
20840 obj_conv.is_owned = false;
20841 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20842 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20843 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20844 CVec_u8Z_free(ret_var);
20848 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
20849 LDKu8slice ser_ref;
20850 ser_ref.datalen = *((uint32_t*)ser);
20851 ser_ref.data = (int8_t*)(ser + 4);
20852 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20853 *ret_conv = AnnouncementSignatures_read(ser_ref);
20854 return (uint64_t)ret_conv;
20857 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
20858 LDKChannelReestablish obj_conv;
20859 obj_conv.inner = (void*)(obj & (~1));
20860 obj_conv.is_owned = false;
20861 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20862 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20863 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20864 CVec_u8Z_free(ret_var);
20868 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
20869 LDKu8slice ser_ref;
20870 ser_ref.datalen = *((uint32_t*)ser);
20871 ser_ref.data = (int8_t*)(ser + 4);
20872 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20873 *ret_conv = ChannelReestablish_read(ser_ref);
20874 return (uint64_t)ret_conv;
20877 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
20878 LDKClosingSigned obj_conv;
20879 obj_conv.inner = (void*)(obj & (~1));
20880 obj_conv.is_owned = false;
20881 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20882 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20883 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20884 CVec_u8Z_free(ret_var);
20888 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
20889 LDKu8slice ser_ref;
20890 ser_ref.datalen = *((uint32_t*)ser);
20891 ser_ref.data = (int8_t*)(ser + 4);
20892 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20893 *ret_conv = ClosingSigned_read(ser_ref);
20894 return (uint64_t)ret_conv;
20897 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
20898 LDKClosingSignedFeeRange obj_conv;
20899 obj_conv.inner = (void*)(obj & (~1));
20900 obj_conv.is_owned = false;
20901 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
20902 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20903 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20904 CVec_u8Z_free(ret_var);
20908 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
20909 LDKu8slice ser_ref;
20910 ser_ref.datalen = *((uint32_t*)ser);
20911 ser_ref.data = (int8_t*)(ser + 4);
20912 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20913 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
20914 return (uint64_t)ret_conv;
20917 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
20918 LDKCommitmentSigned obj_conv;
20919 obj_conv.inner = (void*)(obj & (~1));
20920 obj_conv.is_owned = false;
20921 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20922 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20923 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20924 CVec_u8Z_free(ret_var);
20928 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
20929 LDKu8slice ser_ref;
20930 ser_ref.datalen = *((uint32_t*)ser);
20931 ser_ref.data = (int8_t*)(ser + 4);
20932 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20933 *ret_conv = CommitmentSigned_read(ser_ref);
20934 return (uint64_t)ret_conv;
20937 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
20938 LDKFundingCreated obj_conv;
20939 obj_conv.inner = (void*)(obj & (~1));
20940 obj_conv.is_owned = false;
20941 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20942 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20943 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20944 CVec_u8Z_free(ret_var);
20948 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
20949 LDKu8slice ser_ref;
20950 ser_ref.datalen = *((uint32_t*)ser);
20951 ser_ref.data = (int8_t*)(ser + 4);
20952 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20953 *ret_conv = FundingCreated_read(ser_ref);
20954 return (uint64_t)ret_conv;
20957 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
20958 LDKFundingSigned obj_conv;
20959 obj_conv.inner = (void*)(obj & (~1));
20960 obj_conv.is_owned = false;
20961 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20962 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20963 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20964 CVec_u8Z_free(ret_var);
20968 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
20969 LDKu8slice ser_ref;
20970 ser_ref.datalen = *((uint32_t*)ser);
20971 ser_ref.data = (int8_t*)(ser + 4);
20972 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20973 *ret_conv = FundingSigned_read(ser_ref);
20974 return (uint64_t)ret_conv;
20977 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
20978 LDKFundingLocked obj_conv;
20979 obj_conv.inner = (void*)(obj & (~1));
20980 obj_conv.is_owned = false;
20981 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20982 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
20983 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
20984 CVec_u8Z_free(ret_var);
20988 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
20989 LDKu8slice ser_ref;
20990 ser_ref.datalen = *((uint32_t*)ser);
20991 ser_ref.data = (int8_t*)(ser + 4);
20992 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20993 *ret_conv = FundingLocked_read(ser_ref);
20994 return (uint64_t)ret_conv;
20997 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
20999 obj_conv.inner = (void*)(obj & (~1));
21000 obj_conv.is_owned = false;
21001 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
21002 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21003 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21004 CVec_u8Z_free(ret_var);
21008 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
21009 LDKu8slice ser_ref;
21010 ser_ref.datalen = *((uint32_t*)ser);
21011 ser_ref.data = (int8_t*)(ser + 4);
21012 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21013 *ret_conv = Init_read(ser_ref);
21014 return (uint64_t)ret_conv;
21017 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
21018 LDKOpenChannel obj_conv;
21019 obj_conv.inner = (void*)(obj & (~1));
21020 obj_conv.is_owned = false;
21021 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
21022 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21023 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21024 CVec_u8Z_free(ret_var);
21028 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
21029 LDKu8slice ser_ref;
21030 ser_ref.datalen = *((uint32_t*)ser);
21031 ser_ref.data = (int8_t*)(ser + 4);
21032 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21033 *ret_conv = OpenChannel_read(ser_ref);
21034 return (uint64_t)ret_conv;
21037 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
21038 LDKRevokeAndACK obj_conv;
21039 obj_conv.inner = (void*)(obj & (~1));
21040 obj_conv.is_owned = false;
21041 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
21042 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21043 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21044 CVec_u8Z_free(ret_var);
21048 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
21049 LDKu8slice ser_ref;
21050 ser_ref.datalen = *((uint32_t*)ser);
21051 ser_ref.data = (int8_t*)(ser + 4);
21052 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21053 *ret_conv = RevokeAndACK_read(ser_ref);
21054 return (uint64_t)ret_conv;
21057 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
21058 LDKShutdown obj_conv;
21059 obj_conv.inner = (void*)(obj & (~1));
21060 obj_conv.is_owned = false;
21061 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
21062 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21063 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21064 CVec_u8Z_free(ret_var);
21068 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
21069 LDKu8slice ser_ref;
21070 ser_ref.datalen = *((uint32_t*)ser);
21071 ser_ref.data = (int8_t*)(ser + 4);
21072 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21073 *ret_conv = Shutdown_read(ser_ref);
21074 return (uint64_t)ret_conv;
21077 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
21078 LDKUpdateFailHTLC obj_conv;
21079 obj_conv.inner = (void*)(obj & (~1));
21080 obj_conv.is_owned = false;
21081 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
21082 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21083 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21084 CVec_u8Z_free(ret_var);
21088 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
21089 LDKu8slice ser_ref;
21090 ser_ref.datalen = *((uint32_t*)ser);
21091 ser_ref.data = (int8_t*)(ser + 4);
21092 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21093 *ret_conv = UpdateFailHTLC_read(ser_ref);
21094 return (uint64_t)ret_conv;
21097 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
21098 LDKUpdateFailMalformedHTLC obj_conv;
21099 obj_conv.inner = (void*)(obj & (~1));
21100 obj_conv.is_owned = false;
21101 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
21102 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21103 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21104 CVec_u8Z_free(ret_var);
21108 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
21109 LDKu8slice ser_ref;
21110 ser_ref.datalen = *((uint32_t*)ser);
21111 ser_ref.data = (int8_t*)(ser + 4);
21112 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21113 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21114 return (uint64_t)ret_conv;
21117 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
21118 LDKUpdateFee obj_conv;
21119 obj_conv.inner = (void*)(obj & (~1));
21120 obj_conv.is_owned = false;
21121 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21122 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21123 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21124 CVec_u8Z_free(ret_var);
21128 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
21129 LDKu8slice ser_ref;
21130 ser_ref.datalen = *((uint32_t*)ser);
21131 ser_ref.data = (int8_t*)(ser + 4);
21132 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21133 *ret_conv = UpdateFee_read(ser_ref);
21134 return (uint64_t)ret_conv;
21137 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
21138 LDKUpdateFulfillHTLC obj_conv;
21139 obj_conv.inner = (void*)(obj & (~1));
21140 obj_conv.is_owned = false;
21141 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21142 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21143 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21144 CVec_u8Z_free(ret_var);
21148 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
21149 LDKu8slice ser_ref;
21150 ser_ref.datalen = *((uint32_t*)ser);
21151 ser_ref.data = (int8_t*)(ser + 4);
21152 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21153 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
21154 return (uint64_t)ret_conv;
21157 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
21158 LDKUpdateAddHTLC obj_conv;
21159 obj_conv.inner = (void*)(obj & (~1));
21160 obj_conv.is_owned = false;
21161 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
21162 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21163 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21164 CVec_u8Z_free(ret_var);
21168 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
21169 LDKu8slice ser_ref;
21170 ser_ref.datalen = *((uint32_t*)ser);
21171 ser_ref.data = (int8_t*)(ser + 4);
21172 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21173 *ret_conv = UpdateAddHTLC_read(ser_ref);
21174 return (uint64_t)ret_conv;
21177 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
21179 obj_conv.inner = (void*)(obj & (~1));
21180 obj_conv.is_owned = false;
21181 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
21182 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21183 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21184 CVec_u8Z_free(ret_var);
21188 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
21189 LDKu8slice ser_ref;
21190 ser_ref.datalen = *((uint32_t*)ser);
21191 ser_ref.data = (int8_t*)(ser + 4);
21192 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21193 *ret_conv = Ping_read(ser_ref);
21194 return (uint64_t)ret_conv;
21197 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
21199 obj_conv.inner = (void*)(obj & (~1));
21200 obj_conv.is_owned = false;
21201 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
21202 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21203 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21204 CVec_u8Z_free(ret_var);
21208 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
21209 LDKu8slice ser_ref;
21210 ser_ref.datalen = *((uint32_t*)ser);
21211 ser_ref.data = (int8_t*)(ser + 4);
21212 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21213 *ret_conv = Pong_read(ser_ref);
21214 return (uint64_t)ret_conv;
21217 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
21218 LDKUnsignedChannelAnnouncement obj_conv;
21219 obj_conv.inner = (void*)(obj & (~1));
21220 obj_conv.is_owned = false;
21221 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
21222 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21223 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21224 CVec_u8Z_free(ret_var);
21228 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
21229 LDKu8slice ser_ref;
21230 ser_ref.datalen = *((uint32_t*)ser);
21231 ser_ref.data = (int8_t*)(ser + 4);
21232 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21233 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
21234 return (uint64_t)ret_conv;
21237 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
21238 LDKChannelAnnouncement obj_conv;
21239 obj_conv.inner = (void*)(obj & (~1));
21240 obj_conv.is_owned = false;
21241 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
21242 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21243 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21244 CVec_u8Z_free(ret_var);
21248 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
21249 LDKu8slice ser_ref;
21250 ser_ref.datalen = *((uint32_t*)ser);
21251 ser_ref.data = (int8_t*)(ser + 4);
21252 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21253 *ret_conv = ChannelAnnouncement_read(ser_ref);
21254 return (uint64_t)ret_conv;
21257 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
21258 LDKUnsignedChannelUpdate obj_conv;
21259 obj_conv.inner = (void*)(obj & (~1));
21260 obj_conv.is_owned = false;
21261 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
21262 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21263 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21264 CVec_u8Z_free(ret_var);
21268 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
21269 LDKu8slice ser_ref;
21270 ser_ref.datalen = *((uint32_t*)ser);
21271 ser_ref.data = (int8_t*)(ser + 4);
21272 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21273 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
21274 return (uint64_t)ret_conv;
21277 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
21278 LDKChannelUpdate obj_conv;
21279 obj_conv.inner = (void*)(obj & (~1));
21280 obj_conv.is_owned = false;
21281 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
21282 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21283 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21284 CVec_u8Z_free(ret_var);
21288 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
21289 LDKu8slice ser_ref;
21290 ser_ref.datalen = *((uint32_t*)ser);
21291 ser_ref.data = (int8_t*)(ser + 4);
21292 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21293 *ret_conv = ChannelUpdate_read(ser_ref);
21294 return (uint64_t)ret_conv;
21297 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
21298 LDKErrorMessage obj_conv;
21299 obj_conv.inner = (void*)(obj & (~1));
21300 obj_conv.is_owned = false;
21301 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
21302 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21303 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21304 CVec_u8Z_free(ret_var);
21308 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
21309 LDKu8slice ser_ref;
21310 ser_ref.datalen = *((uint32_t*)ser);
21311 ser_ref.data = (int8_t*)(ser + 4);
21312 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21313 *ret_conv = ErrorMessage_read(ser_ref);
21314 return (uint64_t)ret_conv;
21317 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
21318 LDKUnsignedNodeAnnouncement obj_conv;
21319 obj_conv.inner = (void*)(obj & (~1));
21320 obj_conv.is_owned = false;
21321 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
21322 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21323 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21324 CVec_u8Z_free(ret_var);
21328 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
21329 LDKu8slice ser_ref;
21330 ser_ref.datalen = *((uint32_t*)ser);
21331 ser_ref.data = (int8_t*)(ser + 4);
21332 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21333 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
21334 return (uint64_t)ret_conv;
21337 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
21338 LDKNodeAnnouncement obj_conv;
21339 obj_conv.inner = (void*)(obj & (~1));
21340 obj_conv.is_owned = false;
21341 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
21342 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21343 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21344 CVec_u8Z_free(ret_var);
21348 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
21349 LDKu8slice ser_ref;
21350 ser_ref.datalen = *((uint32_t*)ser);
21351 ser_ref.data = (int8_t*)(ser + 4);
21352 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21353 *ret_conv = NodeAnnouncement_read(ser_ref);
21354 return (uint64_t)ret_conv;
21357 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
21358 LDKu8slice ser_ref;
21359 ser_ref.datalen = *((uint32_t*)ser);
21360 ser_ref.data = (int8_t*)(ser + 4);
21361 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21362 *ret_conv = QueryShortChannelIds_read(ser_ref);
21363 return (uint64_t)ret_conv;
21366 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
21367 LDKQueryShortChannelIds obj_conv;
21368 obj_conv.inner = (void*)(obj & (~1));
21369 obj_conv.is_owned = false;
21370 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
21371 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21372 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21373 CVec_u8Z_free(ret_var);
21377 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
21378 LDKReplyShortChannelIdsEnd obj_conv;
21379 obj_conv.inner = (void*)(obj & (~1));
21380 obj_conv.is_owned = false;
21381 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
21382 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21383 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21384 CVec_u8Z_free(ret_var);
21388 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
21389 LDKu8slice ser_ref;
21390 ser_ref.datalen = *((uint32_t*)ser);
21391 ser_ref.data = (int8_t*)(ser + 4);
21392 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21393 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
21394 return (uint64_t)ret_conv;
21397 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
21398 LDKQueryChannelRange this_arg_conv;
21399 this_arg_conv.inner = (void*)(this_arg & (~1));
21400 this_arg_conv.is_owned = false;
21401 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
21405 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
21406 LDKQueryChannelRange obj_conv;
21407 obj_conv.inner = (void*)(obj & (~1));
21408 obj_conv.is_owned = false;
21409 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
21410 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21411 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21412 CVec_u8Z_free(ret_var);
21416 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
21417 LDKu8slice ser_ref;
21418 ser_ref.datalen = *((uint32_t*)ser);
21419 ser_ref.data = (int8_t*)(ser + 4);
21420 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21421 *ret_conv = QueryChannelRange_read(ser_ref);
21422 return (uint64_t)ret_conv;
21425 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
21426 LDKu8slice ser_ref;
21427 ser_ref.datalen = *((uint32_t*)ser);
21428 ser_ref.data = (int8_t*)(ser + 4);
21429 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21430 *ret_conv = ReplyChannelRange_read(ser_ref);
21431 return (uint64_t)ret_conv;
21434 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
21435 LDKReplyChannelRange obj_conv;
21436 obj_conv.inner = (void*)(obj & (~1));
21437 obj_conv.is_owned = false;
21438 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
21439 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21440 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21441 CVec_u8Z_free(ret_var);
21445 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
21446 LDKGossipTimestampFilter obj_conv;
21447 obj_conv.inner = (void*)(obj & (~1));
21448 obj_conv.is_owned = false;
21449 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
21450 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21451 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21452 CVec_u8Z_free(ret_var);
21456 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
21457 LDKu8slice ser_ref;
21458 ser_ref.datalen = *((uint32_t*)ser);
21459 ser_ref.data = (int8_t*)(ser + 4);
21460 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21461 *ret_conv = GossipTimestampFilter_read(ser_ref);
21462 return (uint64_t)ret_conv;
21465 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
21466 if ((this_ptr & 1) != 0) return;
21467 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
21468 FREE((void*)this_ptr);
21469 CustomMessageHandler_free(this_ptr_conv);
21472 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
21473 LDKIgnoringMessageHandler this_obj_conv;
21474 this_obj_conv.inner = (void*)(this_obj & (~1));
21475 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21476 IgnoringMessageHandler_free(this_obj_conv);
21479 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
21480 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
21481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21483 uint64_t ret_ref = (uint64_t)ret_var.inner;
21484 if (ret_var.is_owned) {
21490 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
21491 LDKIgnoringMessageHandler this_arg_conv;
21492 this_arg_conv.inner = (void*)(this_arg & (~1));
21493 this_arg_conv.is_owned = false;
21494 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21495 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
21496 return (uint64_t)ret_ret;
21499 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
21500 LDKIgnoringMessageHandler this_arg_conv;
21501 this_arg_conv.inner = (void*)(this_arg & (~1));
21502 this_arg_conv.is_owned = false;
21503 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21504 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
21505 return (uint64_t)ret_ret;
21508 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
21509 LDKIgnoringMessageHandler this_arg_conv;
21510 this_arg_conv.inner = (void*)(this_arg & (~1));
21511 this_arg_conv.is_owned = false;
21512 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
21513 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
21514 return (uint64_t)ret_ret;
21517 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
21518 LDKIgnoringMessageHandler this_arg_conv;
21519 this_arg_conv.inner = (void*)(this_arg & (~1));
21520 this_arg_conv.is_owned = false;
21521 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
21522 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
21523 return (uint64_t)ret_ret;
21526 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
21527 LDKErroringMessageHandler this_obj_conv;
21528 this_obj_conv.inner = (void*)(this_obj & (~1));
21529 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21530 ErroringMessageHandler_free(this_obj_conv);
21533 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
21534 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
21535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21537 uint64_t ret_ref = (uint64_t)ret_var.inner;
21538 if (ret_var.is_owned) {
21544 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
21545 LDKErroringMessageHandler this_arg_conv;
21546 this_arg_conv.inner = (void*)(this_arg & (~1));
21547 this_arg_conv.is_owned = false;
21548 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21549 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
21550 return (uint64_t)ret_ret;
21553 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
21554 LDKErroringMessageHandler this_arg_conv;
21555 this_arg_conv.inner = (void*)(this_arg & (~1));
21556 this_arg_conv.is_owned = false;
21557 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21558 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
21559 return (uint64_t)ret_ret;
21562 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
21563 LDKMessageHandler this_obj_conv;
21564 this_obj_conv.inner = (void*)(this_obj & (~1));
21565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21566 MessageHandler_free(this_obj_conv);
21569 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
21570 LDKMessageHandler this_ptr_conv;
21571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21572 this_ptr_conv.is_owned = false;
21573 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
21577 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
21578 LDKMessageHandler this_ptr_conv;
21579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21580 this_ptr_conv.is_owned = false;
21581 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
21582 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
21585 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
21586 LDKMessageHandler this_ptr_conv;
21587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21588 this_ptr_conv.is_owned = false;
21589 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
21593 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
21594 LDKMessageHandler this_ptr_conv;
21595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21596 this_ptr_conv.is_owned = false;
21597 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
21598 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
21601 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
21602 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
21603 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
21604 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
21605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21607 uint64_t ret_ref = (uint64_t)ret_var.inner;
21608 if (ret_var.is_owned) {
21614 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
21615 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
21616 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21617 *ret_ret = SocketDescriptor_clone(orig_conv);
21618 return (uint64_t)ret_ret;
21621 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
21622 if ((this_ptr & 1) != 0) return;
21623 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
21624 FREE((void*)this_ptr);
21625 SocketDescriptor_free(this_ptr_conv);
21628 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
21629 LDKPeerHandleError this_obj_conv;
21630 this_obj_conv.inner = (void*)(this_obj & (~1));
21631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21632 PeerHandleError_free(this_obj_conv);
21635 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
21636 LDKPeerHandleError this_ptr_conv;
21637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21638 this_ptr_conv.is_owned = false;
21639 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
21643 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
21644 LDKPeerHandleError this_ptr_conv;
21645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21646 this_ptr_conv.is_owned = false;
21647 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
21650 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
21651 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
21652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21654 uint64_t ret_ref = (uint64_t)ret_var.inner;
21655 if (ret_var.is_owned) {
21661 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
21662 LDKPeerHandleError orig_conv;
21663 orig_conv.inner = (void*)(orig & (~1));
21664 orig_conv.is_owned = false;
21665 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
21666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21668 uint64_t ret_ref = (uint64_t)ret_var.inner;
21669 if (ret_var.is_owned) {
21675 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
21676 LDKPeerManager this_obj_conv;
21677 this_obj_conv.inner = (void*)(this_obj & (~1));
21678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21679 PeerManager_free(this_obj_conv);
21682 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) {
21683 LDKMessageHandler message_handler_conv;
21684 message_handler_conv.inner = (void*)(message_handler & (~1));
21685 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
21686 // Warning: we need a move here but no clone is available for LDKMessageHandler
21687 LDKSecretKey our_node_secret_ref;
21688 CHECK(*((uint32_t*)our_node_secret) == 32);
21689 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
21690 unsigned char ephemeral_random_data_arr[32];
21691 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
21692 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
21693 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
21694 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21695 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
21696 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
21697 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21698 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21699 uint64_t ret_ref = (uint64_t)ret_var.inner;
21700 if (ret_var.is_owned) {
21706 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
21707 LDKPeerManager this_arg_conv;
21708 this_arg_conv.inner = (void*)(this_arg & (~1));
21709 this_arg_conv.is_owned = false;
21710 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
21711 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
21712 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
21713 for (size_t m = 0; m < ret_var.datalen; m++) {
21714 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21715 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
21716 ret_arr_ptr[m] = ret_conv_12_arr;
21718 FREE(ret_var.data);
21722 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
21723 LDKPeerManager this_arg_conv;
21724 this_arg_conv.inner = (void*)(this_arg & (~1));
21725 this_arg_conv.is_owned = false;
21726 LDKPublicKey their_node_id_ref;
21727 CHECK(*((uint32_t*)their_node_id) == 33);
21728 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
21729 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21730 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21731 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
21732 return (uint64_t)ret_conv;
21735 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
21736 LDKPeerManager this_arg_conv;
21737 this_arg_conv.inner = (void*)(this_arg & (~1));
21738 this_arg_conv.is_owned = false;
21739 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21740 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21741 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
21742 return (uint64_t)ret_conv;
21745 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
21746 LDKPeerManager this_arg_conv;
21747 this_arg_conv.inner = (void*)(this_arg & (~1));
21748 this_arg_conv.is_owned = false;
21749 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21750 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21751 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
21752 return (uint64_t)ret_conv;
21755 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
21756 LDKPeerManager this_arg_conv;
21757 this_arg_conv.inner = (void*)(this_arg & (~1));
21758 this_arg_conv.is_owned = false;
21759 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
21760 LDKu8slice data_ref;
21761 data_ref.datalen = *((uint32_t*)data);
21762 data_ref.data = (int8_t*)(data + 4);
21763 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21764 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
21765 return (uint64_t)ret_conv;
21768 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
21769 LDKPeerManager this_arg_conv;
21770 this_arg_conv.inner = (void*)(this_arg & (~1));
21771 this_arg_conv.is_owned = false;
21772 PeerManager_process_events(&this_arg_conv);
21775 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
21776 LDKPeerManager this_arg_conv;
21777 this_arg_conv.inner = (void*)(this_arg & (~1));
21778 this_arg_conv.is_owned = false;
21779 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21780 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
21783 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
21784 LDKPeerManager this_arg_conv;
21785 this_arg_conv.inner = (void*)(this_arg & (~1));
21786 this_arg_conv.is_owned = false;
21787 LDKPublicKey node_id_ref;
21788 CHECK(*((uint32_t*)node_id) == 33);
21789 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
21790 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
21793 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
21794 LDKPeerManager this_arg_conv;
21795 this_arg_conv.inner = (void*)(this_arg & (~1));
21796 this_arg_conv.is_owned = false;
21797 PeerManager_timer_tick_occurred(&this_arg_conv);
21800 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
21801 unsigned char commitment_seed_arr[32];
21802 CHECK(*((uint32_t*)commitment_seed) == 32);
21803 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
21804 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21805 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
21806 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
21810 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) {
21811 LDKCVec_u8Z to_holder_script_ref;
21812 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
21813 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
21814 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
21815 LDKCVec_u8Z to_counterparty_script_ref;
21816 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
21817 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
21818 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
21819 LDKOutPoint funding_outpoint_conv;
21820 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
21821 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
21822 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
21823 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);
21824 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
21825 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
21826 Transaction_free(ret_var);
21830 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
21831 LDKPublicKey per_commitment_point_ref;
21832 CHECK(*((uint32_t*)per_commitment_point) == 33);
21833 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21834 unsigned char base_secret_arr[32];
21835 CHECK(*((uint32_t*)base_secret) == 32);
21836 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
21837 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21838 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21839 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21840 return (uint64_t)ret_conv;
21843 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
21844 LDKPublicKey per_commitment_point_ref;
21845 CHECK(*((uint32_t*)per_commitment_point) == 33);
21846 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21847 LDKPublicKey base_point_ref;
21848 CHECK(*((uint32_t*)base_point) == 33);
21849 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
21850 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21851 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21852 return (uint64_t)ret_conv;
21855 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
21856 unsigned char per_commitment_secret_arr[32];
21857 CHECK(*((uint32_t*)per_commitment_secret) == 32);
21858 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
21859 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21860 unsigned char countersignatory_revocation_base_secret_arr[32];
21861 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
21862 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
21863 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21864 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21865 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21866 return (uint64_t)ret_conv;
21869 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
21870 LDKPublicKey per_commitment_point_ref;
21871 CHECK(*((uint32_t*)per_commitment_point) == 33);
21872 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
21873 LDKPublicKey countersignatory_revocation_base_point_ref;
21874 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
21875 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
21876 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21877 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21878 return (uint64_t)ret_conv;
21881 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
21882 LDKTxCreationKeys this_obj_conv;
21883 this_obj_conv.inner = (void*)(this_obj & (~1));
21884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21885 TxCreationKeys_free(this_obj_conv);
21888 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
21889 LDKTxCreationKeys this_ptr_conv;
21890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21891 this_ptr_conv.is_owned = false;
21892 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21893 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
21897 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
21898 LDKTxCreationKeys this_ptr_conv;
21899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21900 this_ptr_conv.is_owned = false;
21901 LDKPublicKey val_ref;
21902 CHECK(*((uint32_t*)val) == 33);
21903 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21904 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21907 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
21908 LDKTxCreationKeys this_ptr_conv;
21909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21910 this_ptr_conv.is_owned = false;
21911 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21912 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
21916 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
21917 LDKTxCreationKeys this_ptr_conv;
21918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21919 this_ptr_conv.is_owned = false;
21920 LDKPublicKey val_ref;
21921 CHECK(*((uint32_t*)val) == 33);
21922 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21923 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21926 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
21927 LDKTxCreationKeys this_ptr_conv;
21928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21929 this_ptr_conv.is_owned = false;
21930 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21931 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
21935 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
21936 LDKTxCreationKeys this_ptr_conv;
21937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21938 this_ptr_conv.is_owned = false;
21939 LDKPublicKey val_ref;
21940 CHECK(*((uint32_t*)val) == 33);
21941 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21942 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21945 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
21946 LDKTxCreationKeys this_ptr_conv;
21947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21948 this_ptr_conv.is_owned = false;
21949 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21950 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
21954 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
21955 LDKTxCreationKeys this_ptr_conv;
21956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21957 this_ptr_conv.is_owned = false;
21958 LDKPublicKey val_ref;
21959 CHECK(*((uint32_t*)val) == 33);
21960 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21961 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21964 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
21965 LDKTxCreationKeys this_ptr_conv;
21966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21967 this_ptr_conv.is_owned = false;
21968 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
21969 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
21973 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
21974 LDKTxCreationKeys this_ptr_conv;
21975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21976 this_ptr_conv.is_owned = false;
21977 LDKPublicKey val_ref;
21978 CHECK(*((uint32_t*)val) == 33);
21979 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
21980 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21983 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) {
21984 LDKPublicKey per_commitment_point_arg_ref;
21985 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
21986 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
21987 LDKPublicKey revocation_key_arg_ref;
21988 CHECK(*((uint32_t*)revocation_key_arg) == 33);
21989 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
21990 LDKPublicKey broadcaster_htlc_key_arg_ref;
21991 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
21992 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
21993 LDKPublicKey countersignatory_htlc_key_arg_ref;
21994 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
21995 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
21996 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21997 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
21998 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
21999 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);
22000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22002 uint64_t ret_ref = (uint64_t)ret_var.inner;
22003 if (ret_var.is_owned) {
22009 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
22010 LDKTxCreationKeys orig_conv;
22011 orig_conv.inner = (void*)(orig & (~1));
22012 orig_conv.is_owned = false;
22013 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
22014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22016 uint64_t ret_ref = (uint64_t)ret_var.inner;
22017 if (ret_var.is_owned) {
22023 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
22024 LDKTxCreationKeys obj_conv;
22025 obj_conv.inner = (void*)(obj & (~1));
22026 obj_conv.is_owned = false;
22027 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
22028 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22029 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22030 CVec_u8Z_free(ret_var);
22034 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
22035 LDKu8slice ser_ref;
22036 ser_ref.datalen = *((uint32_t*)ser);
22037 ser_ref.data = (int8_t*)(ser + 4);
22038 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
22039 *ret_conv = TxCreationKeys_read(ser_ref);
22040 return (uint64_t)ret_conv;
22043 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
22044 LDKChannelPublicKeys this_obj_conv;
22045 this_obj_conv.inner = (void*)(this_obj & (~1));
22046 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22047 ChannelPublicKeys_free(this_obj_conv);
22050 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
22051 LDKChannelPublicKeys this_ptr_conv;
22052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22053 this_ptr_conv.is_owned = false;
22054 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22055 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22059 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22060 LDKChannelPublicKeys this_ptr_conv;
22061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22062 this_ptr_conv.is_owned = false;
22063 LDKPublicKey val_ref;
22064 CHECK(*((uint32_t*)val) == 33);
22065 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22066 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
22069 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
22070 LDKChannelPublicKeys this_ptr_conv;
22071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22072 this_ptr_conv.is_owned = false;
22073 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22074 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22078 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22079 LDKChannelPublicKeys this_ptr_conv;
22080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22081 this_ptr_conv.is_owned = false;
22082 LDKPublicKey val_ref;
22083 CHECK(*((uint32_t*)val) == 33);
22084 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22085 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
22088 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
22089 LDKChannelPublicKeys this_ptr_conv;
22090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22091 this_ptr_conv.is_owned = false;
22092 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22093 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
22097 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22098 LDKChannelPublicKeys this_ptr_conv;
22099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22100 this_ptr_conv.is_owned = false;
22101 LDKPublicKey val_ref;
22102 CHECK(*((uint32_t*)val) == 33);
22103 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22104 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
22107 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
22108 LDKChannelPublicKeys this_ptr_conv;
22109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22110 this_ptr_conv.is_owned = false;
22111 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22112 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22116 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22117 LDKChannelPublicKeys this_ptr_conv;
22118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22119 this_ptr_conv.is_owned = false;
22120 LDKPublicKey val_ref;
22121 CHECK(*((uint32_t*)val) == 33);
22122 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22123 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22126 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
22127 LDKChannelPublicKeys this_ptr_conv;
22128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22129 this_ptr_conv.is_owned = false;
22130 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
22131 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22135 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22136 LDKChannelPublicKeys this_ptr_conv;
22137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22138 this_ptr_conv.is_owned = false;
22139 LDKPublicKey val_ref;
22140 CHECK(*((uint32_t*)val) == 33);
22141 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
22142 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
22145 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) {
22146 LDKPublicKey funding_pubkey_arg_ref;
22147 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
22148 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
22149 LDKPublicKey revocation_basepoint_arg_ref;
22150 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
22151 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
22152 LDKPublicKey payment_point_arg_ref;
22153 CHECK(*((uint32_t*)payment_point_arg) == 33);
22154 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
22155 LDKPublicKey delayed_payment_basepoint_arg_ref;
22156 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
22157 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
22158 LDKPublicKey htlc_basepoint_arg_ref;
22159 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
22160 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
22161 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);
22162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22164 uint64_t ret_ref = (uint64_t)ret_var.inner;
22165 if (ret_var.is_owned) {
22171 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
22172 LDKChannelPublicKeys orig_conv;
22173 orig_conv.inner = (void*)(orig & (~1));
22174 orig_conv.is_owned = false;
22175 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
22176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22178 uint64_t ret_ref = (uint64_t)ret_var.inner;
22179 if (ret_var.is_owned) {
22185 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
22186 LDKChannelPublicKeys obj_conv;
22187 obj_conv.inner = (void*)(obj & (~1));
22188 obj_conv.is_owned = false;
22189 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
22190 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22191 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22192 CVec_u8Z_free(ret_var);
22196 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
22197 LDKu8slice ser_ref;
22198 ser_ref.datalen = *((uint32_t*)ser);
22199 ser_ref.data = (int8_t*)(ser + 4);
22200 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
22201 *ret_conv = ChannelPublicKeys_read(ser_ref);
22202 return (uint64_t)ret_conv;
22205 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) {
22206 LDKPublicKey per_commitment_point_ref;
22207 CHECK(*((uint32_t*)per_commitment_point) == 33);
22208 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22209 LDKPublicKey broadcaster_delayed_payment_base_ref;
22210 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
22211 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
22212 LDKPublicKey broadcaster_htlc_base_ref;
22213 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
22214 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
22215 LDKPublicKey countersignatory_revocation_base_ref;
22216 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
22217 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
22218 LDKPublicKey countersignatory_htlc_base_ref;
22219 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
22220 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
22221 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22222 *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);
22223 return (uint64_t)ret_conv;
22226 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
22227 LDKPublicKey per_commitment_point_ref;
22228 CHECK(*((uint32_t*)per_commitment_point) == 33);
22229 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
22230 LDKChannelPublicKeys broadcaster_keys_conv;
22231 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22232 broadcaster_keys_conv.is_owned = false;
22233 LDKChannelPublicKeys countersignatory_keys_conv;
22234 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22235 countersignatory_keys_conv.is_owned = false;
22236 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22237 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
22238 return (uint64_t)ret_conv;
22241 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
22242 LDKPublicKey revocation_key_ref;
22243 CHECK(*((uint32_t*)revocation_key) == 33);
22244 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
22245 LDKPublicKey broadcaster_delayed_payment_key_ref;
22246 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
22247 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
22248 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
22249 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22250 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22251 CVec_u8Z_free(ret_var);
22255 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
22256 LDKHTLCOutputInCommitment this_obj_conv;
22257 this_obj_conv.inner = (void*)(this_obj & (~1));
22258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22259 HTLCOutputInCommitment_free(this_obj_conv);
22262 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
22263 LDKHTLCOutputInCommitment this_ptr_conv;
22264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22265 this_ptr_conv.is_owned = false;
22266 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
22270 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
22271 LDKHTLCOutputInCommitment this_ptr_conv;
22272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22273 this_ptr_conv.is_owned = false;
22274 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
22277 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
22278 LDKHTLCOutputInCommitment this_ptr_conv;
22279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22280 this_ptr_conv.is_owned = false;
22281 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
22285 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
22286 LDKHTLCOutputInCommitment this_ptr_conv;
22287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22288 this_ptr_conv.is_owned = false;
22289 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
22292 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
22293 LDKHTLCOutputInCommitment this_ptr_conv;
22294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22295 this_ptr_conv.is_owned = false;
22296 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
22300 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
22301 LDKHTLCOutputInCommitment this_ptr_conv;
22302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22303 this_ptr_conv.is_owned = false;
22304 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
22307 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
22308 LDKHTLCOutputInCommitment this_ptr_conv;
22309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22310 this_ptr_conv.is_owned = false;
22311 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22312 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
22316 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
22317 LDKHTLCOutputInCommitment this_ptr_conv;
22318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22319 this_ptr_conv.is_owned = false;
22320 LDKThirtyTwoBytes val_ref;
22321 CHECK(*((uint32_t*)val) == 32);
22322 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22323 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
22326 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
22327 LDKHTLCOutputInCommitment this_ptr_conv;
22328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22329 this_ptr_conv.is_owned = false;
22330 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22331 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
22332 uint64_t ret_ref = (uint64_t)ret_copy;
22336 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
22337 LDKHTLCOutputInCommitment this_ptr_conv;
22338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22339 this_ptr_conv.is_owned = false;
22340 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
22341 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
22342 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
22345 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) {
22346 LDKThirtyTwoBytes payment_hash_arg_ref;
22347 CHECK(*((uint32_t*)payment_hash_arg) == 32);
22348 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
22349 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
22350 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
22351 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
22352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22354 uint64_t ret_ref = (uint64_t)ret_var.inner;
22355 if (ret_var.is_owned) {
22361 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
22362 LDKHTLCOutputInCommitment orig_conv;
22363 orig_conv.inner = (void*)(orig & (~1));
22364 orig_conv.is_owned = false;
22365 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
22366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22368 uint64_t ret_ref = (uint64_t)ret_var.inner;
22369 if (ret_var.is_owned) {
22375 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
22376 LDKHTLCOutputInCommitment obj_conv;
22377 obj_conv.inner = (void*)(obj & (~1));
22378 obj_conv.is_owned = false;
22379 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
22380 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22381 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22382 CVec_u8Z_free(ret_var);
22386 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
22387 LDKu8slice ser_ref;
22388 ser_ref.datalen = *((uint32_t*)ser);
22389 ser_ref.data = (int8_t*)(ser + 4);
22390 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
22391 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
22392 return (uint64_t)ret_conv;
22395 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
22396 LDKHTLCOutputInCommitment htlc_conv;
22397 htlc_conv.inner = (void*)(htlc & (~1));
22398 htlc_conv.is_owned = false;
22399 LDKTxCreationKeys keys_conv;
22400 keys_conv.inner = (void*)(keys & (~1));
22401 keys_conv.is_owned = false;
22402 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
22403 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22404 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22405 CVec_u8Z_free(ret_var);
22409 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
22410 LDKPublicKey broadcaster_ref;
22411 CHECK(*((uint32_t*)broadcaster) == 33);
22412 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
22413 LDKPublicKey countersignatory_ref;
22414 CHECK(*((uint32_t*)countersignatory) == 33);
22415 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
22416 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
22417 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22418 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22419 CVec_u8Z_free(ret_var);
22423 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) {
22424 unsigned char commitment_txid_arr[32];
22425 CHECK(*((uint32_t*)commitment_txid) == 32);
22426 memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32);
22427 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
22428 LDKHTLCOutputInCommitment htlc_conv;
22429 htlc_conv.inner = (void*)(htlc & (~1));
22430 htlc_conv.is_owned = false;
22431 LDKPublicKey broadcaster_delayed_payment_key_ref;
22432 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
22433 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
22434 LDKPublicKey revocation_key_ref;
22435 CHECK(*((uint32_t*)revocation_key) == 33);
22436 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
22437 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
22438 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22439 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22440 Transaction_free(ret_var);
22444 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
22445 LDKChannelTransactionParameters this_obj_conv;
22446 this_obj_conv.inner = (void*)(this_obj & (~1));
22447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22448 ChannelTransactionParameters_free(this_obj_conv);
22451 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
22452 LDKChannelTransactionParameters this_ptr_conv;
22453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22454 this_ptr_conv.is_owned = false;
22455 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
22456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22458 uint64_t ret_ref = (uint64_t)ret_var.inner;
22459 if (ret_var.is_owned) {
22465 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
22466 LDKChannelTransactionParameters this_ptr_conv;
22467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22468 this_ptr_conv.is_owned = false;
22469 LDKChannelPublicKeys val_conv;
22470 val_conv.inner = (void*)(val & (~1));
22471 val_conv.is_owned = (val & 1) || (val == 0);
22472 val_conv = ChannelPublicKeys_clone(&val_conv);
22473 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
22476 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
22477 LDKChannelTransactionParameters this_ptr_conv;
22478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22479 this_ptr_conv.is_owned = false;
22480 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
22484 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
22485 LDKChannelTransactionParameters this_ptr_conv;
22486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22487 this_ptr_conv.is_owned = false;
22488 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
22491 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
22492 LDKChannelTransactionParameters this_ptr_conv;
22493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22494 this_ptr_conv.is_owned = false;
22495 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
22499 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
22500 LDKChannelTransactionParameters this_ptr_conv;
22501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22502 this_ptr_conv.is_owned = false;
22503 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
22506 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
22507 LDKChannelTransactionParameters this_ptr_conv;
22508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22509 this_ptr_conv.is_owned = false;
22510 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
22511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22513 uint64_t ret_ref = (uint64_t)ret_var.inner;
22514 if (ret_var.is_owned) {
22520 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
22521 LDKChannelTransactionParameters this_ptr_conv;
22522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22523 this_ptr_conv.is_owned = false;
22524 LDKCounterpartyChannelTransactionParameters val_conv;
22525 val_conv.inner = (void*)(val & (~1));
22526 val_conv.is_owned = (val & 1) || (val == 0);
22527 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
22528 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
22531 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
22532 LDKChannelTransactionParameters this_ptr_conv;
22533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22534 this_ptr_conv.is_owned = false;
22535 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
22536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22538 uint64_t ret_ref = (uint64_t)ret_var.inner;
22539 if (ret_var.is_owned) {
22545 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
22546 LDKChannelTransactionParameters this_ptr_conv;
22547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22548 this_ptr_conv.is_owned = false;
22549 LDKOutPoint val_conv;
22550 val_conv.inner = (void*)(val & (~1));
22551 val_conv.is_owned = (val & 1) || (val == 0);
22552 val_conv = OutPoint_clone(&val_conv);
22553 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
22556 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) {
22557 LDKChannelPublicKeys holder_pubkeys_arg_conv;
22558 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
22559 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
22560 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
22561 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
22562 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
22563 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
22564 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
22565 LDKOutPoint funding_outpoint_arg_conv;
22566 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
22567 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
22568 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
22569 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);
22570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22572 uint64_t ret_ref = (uint64_t)ret_var.inner;
22573 if (ret_var.is_owned) {
22579 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
22580 LDKChannelTransactionParameters orig_conv;
22581 orig_conv.inner = (void*)(orig & (~1));
22582 orig_conv.is_owned = false;
22583 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
22584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22586 uint64_t ret_ref = (uint64_t)ret_var.inner;
22587 if (ret_var.is_owned) {
22593 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
22594 LDKCounterpartyChannelTransactionParameters this_obj_conv;
22595 this_obj_conv.inner = (void*)(this_obj & (~1));
22596 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22597 CounterpartyChannelTransactionParameters_free(this_obj_conv);
22600 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
22601 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22603 this_ptr_conv.is_owned = false;
22604 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
22605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22607 uint64_t ret_ref = (uint64_t)ret_var.inner;
22608 if (ret_var.is_owned) {
22614 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
22615 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22617 this_ptr_conv.is_owned = false;
22618 LDKChannelPublicKeys val_conv;
22619 val_conv.inner = (void*)(val & (~1));
22620 val_conv.is_owned = (val & 1) || (val == 0);
22621 val_conv = ChannelPublicKeys_clone(&val_conv);
22622 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
22625 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
22626 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22628 this_ptr_conv.is_owned = false;
22629 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
22633 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
22634 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22636 this_ptr_conv.is_owned = false;
22637 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
22640 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
22641 LDKChannelPublicKeys pubkeys_arg_conv;
22642 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
22643 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
22644 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
22645 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
22646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22648 uint64_t ret_ref = (uint64_t)ret_var.inner;
22649 if (ret_var.is_owned) {
22655 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
22656 LDKCounterpartyChannelTransactionParameters orig_conv;
22657 orig_conv.inner = (void*)(orig & (~1));
22658 orig_conv.is_owned = false;
22659 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
22660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22662 uint64_t ret_ref = (uint64_t)ret_var.inner;
22663 if (ret_var.is_owned) {
22669 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
22670 LDKChannelTransactionParameters this_arg_conv;
22671 this_arg_conv.inner = (void*)(this_arg & (~1));
22672 this_arg_conv.is_owned = false;
22673 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
22677 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
22678 LDKChannelTransactionParameters this_arg_conv;
22679 this_arg_conv.inner = (void*)(this_arg & (~1));
22680 this_arg_conv.is_owned = false;
22681 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
22682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22684 uint64_t ret_ref = (uint64_t)ret_var.inner;
22685 if (ret_var.is_owned) {
22691 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
22692 LDKChannelTransactionParameters this_arg_conv;
22693 this_arg_conv.inner = (void*)(this_arg & (~1));
22694 this_arg_conv.is_owned = false;
22695 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
22696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22698 uint64_t ret_ref = (uint64_t)ret_var.inner;
22699 if (ret_var.is_owned) {
22705 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
22706 LDKCounterpartyChannelTransactionParameters obj_conv;
22707 obj_conv.inner = (void*)(obj & (~1));
22708 obj_conv.is_owned = false;
22709 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
22710 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22711 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22712 CVec_u8Z_free(ret_var);
22716 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
22717 LDKu8slice ser_ref;
22718 ser_ref.datalen = *((uint32_t*)ser);
22719 ser_ref.data = (int8_t*)(ser + 4);
22720 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
22721 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
22722 return (uint64_t)ret_conv;
22725 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
22726 LDKChannelTransactionParameters obj_conv;
22727 obj_conv.inner = (void*)(obj & (~1));
22728 obj_conv.is_owned = false;
22729 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
22730 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22731 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22732 CVec_u8Z_free(ret_var);
22736 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
22737 LDKu8slice ser_ref;
22738 ser_ref.datalen = *((uint32_t*)ser);
22739 ser_ref.data = (int8_t*)(ser + 4);
22740 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
22741 *ret_conv = ChannelTransactionParameters_read(ser_ref);
22742 return (uint64_t)ret_conv;
22745 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
22746 LDKDirectedChannelTransactionParameters this_obj_conv;
22747 this_obj_conv.inner = (void*)(this_obj & (~1));
22748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22749 DirectedChannelTransactionParameters_free(this_obj_conv);
22752 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
22753 LDKDirectedChannelTransactionParameters this_arg_conv;
22754 this_arg_conv.inner = (void*)(this_arg & (~1));
22755 this_arg_conv.is_owned = false;
22756 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
22757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22759 uint64_t ret_ref = (uint64_t)ret_var.inner;
22760 if (ret_var.is_owned) {
22766 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
22767 LDKDirectedChannelTransactionParameters this_arg_conv;
22768 this_arg_conv.inner = (void*)(this_arg & (~1));
22769 this_arg_conv.is_owned = false;
22770 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
22771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22773 uint64_t ret_ref = (uint64_t)ret_var.inner;
22774 if (ret_var.is_owned) {
22780 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
22781 LDKDirectedChannelTransactionParameters this_arg_conv;
22782 this_arg_conv.inner = (void*)(this_arg & (~1));
22783 this_arg_conv.is_owned = false;
22784 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
22788 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
22789 LDKDirectedChannelTransactionParameters this_arg_conv;
22790 this_arg_conv.inner = (void*)(this_arg & (~1));
22791 this_arg_conv.is_owned = false;
22792 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22796 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
22797 LDKDirectedChannelTransactionParameters this_arg_conv;
22798 this_arg_conv.inner = (void*)(this_arg & (~1));
22799 this_arg_conv.is_owned = false;
22800 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22803 uint64_t ret_ref = (uint64_t)ret_var.inner;
22804 if (ret_var.is_owned) {
22810 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
22811 LDKHolderCommitmentTransaction this_obj_conv;
22812 this_obj_conv.inner = (void*)(this_obj & (~1));
22813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22814 HolderCommitmentTransaction_free(this_obj_conv);
22817 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
22818 LDKHolderCommitmentTransaction this_ptr_conv;
22819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22820 this_ptr_conv.is_owned = false;
22821 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
22822 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
22826 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
22827 LDKHolderCommitmentTransaction this_ptr_conv;
22828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22829 this_ptr_conv.is_owned = false;
22830 LDKSignature val_ref;
22831 CHECK(*((uint32_t*)val) == 64);
22832 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
22833 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22836 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
22837 LDKHolderCommitmentTransaction this_ptr_conv;
22838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22839 this_ptr_conv.is_owned = false;
22840 LDKCVec_SignatureZ val_constr;
22841 val_constr.datalen = *((uint32_t*)val);
22842 if (val_constr.datalen > 0)
22843 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22845 val_constr.data = NULL;
22846 int8_tArray* val_vals = (int8_tArray*)(val + 4);
22847 for (size_t m = 0; m < val_constr.datalen; m++) {
22848 int8_tArray val_conv_12 = val_vals[m];
22849 LDKSignature val_conv_12_ref;
22850 CHECK(*((uint32_t*)val_conv_12) == 64);
22851 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
22852 val_constr.data[m] = val_conv_12_ref;
22854 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22857 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
22858 LDKHolderCommitmentTransaction orig_conv;
22859 orig_conv.inner = (void*)(orig & (~1));
22860 orig_conv.is_owned = false;
22861 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22864 uint64_t ret_ref = (uint64_t)ret_var.inner;
22865 if (ret_var.is_owned) {
22871 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
22872 LDKHolderCommitmentTransaction obj_conv;
22873 obj_conv.inner = (void*)(obj & (~1));
22874 obj_conv.is_owned = false;
22875 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_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 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
22883 LDKu8slice ser_ref;
22884 ser_ref.datalen = *((uint32_t*)ser);
22885 ser_ref.data = (int8_t*)(ser + 4);
22886 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22887 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22888 return (uint64_t)ret_conv;
22891 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) {
22892 LDKCommitmentTransaction commitment_tx_conv;
22893 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22894 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22895 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22896 LDKSignature counterparty_sig_ref;
22897 CHECK(*((uint32_t*)counterparty_sig) == 64);
22898 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
22899 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22900 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
22901 if (counterparty_htlc_sigs_constr.datalen > 0)
22902 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22904 counterparty_htlc_sigs_constr.data = NULL;
22905 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
22906 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
22907 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
22908 LDKSignature counterparty_htlc_sigs_conv_12_ref;
22909 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
22910 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
22911 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
22913 LDKPublicKey holder_funding_key_ref;
22914 CHECK(*((uint32_t*)holder_funding_key) == 33);
22915 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
22916 LDKPublicKey counterparty_funding_key_ref;
22917 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
22918 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
22919 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22922 uint64_t ret_ref = (uint64_t)ret_var.inner;
22923 if (ret_var.is_owned) {
22929 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
22930 LDKBuiltCommitmentTransaction 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 BuiltCommitmentTransaction_free(this_obj_conv);
22936 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
22937 LDKBuiltCommitmentTransaction this_ptr_conv;
22938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22939 this_ptr_conv.is_owned = false;
22940 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22941 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
22942 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
22943 Transaction_free(ret_var);
22947 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
22948 LDKBuiltCommitmentTransaction this_ptr_conv;
22949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22950 this_ptr_conv.is_owned = false;
22951 LDKTransaction val_ref;
22952 val_ref.datalen = *((uint32_t*)val);
22953 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22954 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
22955 val_ref.data_is_owned = true;
22956 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22959 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
22960 LDKBuiltCommitmentTransaction this_ptr_conv;
22961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22962 this_ptr_conv.is_owned = false;
22963 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
22964 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
22968 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
22969 LDKBuiltCommitmentTransaction this_ptr_conv;
22970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22971 this_ptr_conv.is_owned = false;
22972 LDKThirtyTwoBytes val_ref;
22973 CHECK(*((uint32_t*)val) == 32);
22974 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
22975 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22978 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
22979 LDKTransaction transaction_arg_ref;
22980 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
22981 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22982 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
22983 transaction_arg_ref.data_is_owned = true;
22984 LDKThirtyTwoBytes txid_arg_ref;
22985 CHECK(*((uint32_t*)txid_arg) == 32);
22986 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
22987 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22990 uint64_t ret_ref = (uint64_t)ret_var.inner;
22991 if (ret_var.is_owned) {
22997 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
22998 LDKBuiltCommitmentTransaction orig_conv;
22999 orig_conv.inner = (void*)(orig & (~1));
23000 orig_conv.is_owned = false;
23001 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
23002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23004 uint64_t ret_ref = (uint64_t)ret_var.inner;
23005 if (ret_var.is_owned) {
23011 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
23012 LDKBuiltCommitmentTransaction obj_conv;
23013 obj_conv.inner = (void*)(obj & (~1));
23014 obj_conv.is_owned = false;
23015 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
23016 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23017 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23018 CVec_u8Z_free(ret_var);
23022 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
23023 LDKu8slice ser_ref;
23024 ser_ref.datalen = *((uint32_t*)ser);
23025 ser_ref.data = (int8_t*)(ser + 4);
23026 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
23027 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
23028 return (uint64_t)ret_conv;
23031 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23032 LDKBuiltCommitmentTransaction this_arg_conv;
23033 this_arg_conv.inner = (void*)(this_arg & (~1));
23034 this_arg_conv.is_owned = false;
23035 LDKu8slice funding_redeemscript_ref;
23036 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23037 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23038 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23039 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23043 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) {
23044 LDKBuiltCommitmentTransaction this_arg_conv;
23045 this_arg_conv.inner = (void*)(this_arg & (~1));
23046 this_arg_conv.is_owned = false;
23047 unsigned char funding_key_arr[32];
23048 CHECK(*((uint32_t*)funding_key) == 32);
23049 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23050 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23051 LDKu8slice funding_redeemscript_ref;
23052 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23053 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23054 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23055 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23059 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
23060 LDKClosingTransaction this_obj_conv;
23061 this_obj_conv.inner = (void*)(this_obj & (~1));
23062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23063 ClosingTransaction_free(this_obj_conv);
23066 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) {
23067 LDKCVec_u8Z to_holder_script_ref;
23068 to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
23069 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
23070 memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
23071 LDKCVec_u8Z to_counterparty_script_ref;
23072 to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
23073 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
23074 memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
23075 LDKOutPoint funding_outpoint_conv;
23076 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23077 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23078 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23079 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
23080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23082 uint64_t ret_ref = (uint64_t)ret_var.inner;
23083 if (ret_var.is_owned) {
23089 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
23090 LDKClosingTransaction this_arg_conv;
23091 this_arg_conv.inner = (void*)(this_arg & (~1));
23092 this_arg_conv.is_owned = false;
23093 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
23094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23096 uint64_t ret_ref = (uint64_t)ret_var.inner;
23097 if (ret_var.is_owned) {
23103 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
23104 LDKClosingTransaction this_arg_conv;
23105 this_arg_conv.inner = (void*)(this_arg & (~1));
23106 this_arg_conv.is_owned = false;
23107 LDKOutPoint funding_outpoint_conv;
23108 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
23109 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
23110 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
23111 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
23112 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
23113 return (uint64_t)ret_conv;
23116 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
23117 LDKClosingTransaction this_arg_conv;
23118 this_arg_conv.inner = (void*)(this_arg & (~1));
23119 this_arg_conv.is_owned = false;
23120 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
23124 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
23125 LDKClosingTransaction this_arg_conv;
23126 this_arg_conv.inner = (void*)(this_arg & (~1));
23127 this_arg_conv.is_owned = false;
23128 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
23132 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
23133 LDKClosingTransaction this_arg_conv;
23134 this_arg_conv.inner = (void*)(this_arg & (~1));
23135 this_arg_conv.is_owned = false;
23136 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
23137 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23138 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23142 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
23143 LDKClosingTransaction this_arg_conv;
23144 this_arg_conv.inner = (void*)(this_arg & (~1));
23145 this_arg_conv.is_owned = false;
23146 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
23147 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23148 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23152 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
23153 LDKTrustedClosingTransaction this_obj_conv;
23154 this_obj_conv.inner = (void*)(this_obj & (~1));
23155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23156 TrustedClosingTransaction_free(this_obj_conv);
23159 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
23160 LDKTrustedClosingTransaction this_arg_conv;
23161 this_arg_conv.inner = (void*)(this_arg & (~1));
23162 this_arg_conv.is_owned = false;
23163 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
23164 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23165 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23166 Transaction_free(ret_var);
23170 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
23171 LDKTrustedClosingTransaction this_arg_conv;
23172 this_arg_conv.inner = (void*)(this_arg & (~1));
23173 this_arg_conv.is_owned = false;
23174 LDKu8slice funding_redeemscript_ref;
23175 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23176 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23177 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23178 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
23182 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) {
23183 LDKTrustedClosingTransaction this_arg_conv;
23184 this_arg_conv.inner = (void*)(this_arg & (~1));
23185 this_arg_conv.is_owned = false;
23186 unsigned char funding_key_arr[32];
23187 CHECK(*((uint32_t*)funding_key) == 32);
23188 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
23189 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23190 LDKu8slice funding_redeemscript_ref;
23191 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
23192 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
23193 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
23194 memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
23198 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
23199 LDKCommitmentTransaction this_obj_conv;
23200 this_obj_conv.inner = (void*)(this_obj & (~1));
23201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23202 CommitmentTransaction_free(this_obj_conv);
23205 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
23206 LDKCommitmentTransaction orig_conv;
23207 orig_conv.inner = (void*)(orig & (~1));
23208 orig_conv.is_owned = false;
23209 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
23210 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23211 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23212 uint64_t ret_ref = (uint64_t)ret_var.inner;
23213 if (ret_var.is_owned) {
23219 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
23220 LDKCommitmentTransaction obj_conv;
23221 obj_conv.inner = (void*)(obj & (~1));
23222 obj_conv.is_owned = false;
23223 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
23224 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23225 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23226 CVec_u8Z_free(ret_var);
23230 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
23231 LDKu8slice ser_ref;
23232 ser_ref.datalen = *((uint32_t*)ser);
23233 ser_ref.data = (int8_t*)(ser + 4);
23234 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
23235 *ret_conv = CommitmentTransaction_read(ser_ref);
23236 return (uint64_t)ret_conv;
23239 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
23240 LDKCommitmentTransaction this_arg_conv;
23241 this_arg_conv.inner = (void*)(this_arg & (~1));
23242 this_arg_conv.is_owned = false;
23243 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23247 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
23248 LDKCommitmentTransaction this_arg_conv;
23249 this_arg_conv.inner = (void*)(this_arg & (~1));
23250 this_arg_conv.is_owned = false;
23251 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23255 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
23256 LDKCommitmentTransaction this_arg_conv;
23257 this_arg_conv.inner = (void*)(this_arg & (~1));
23258 this_arg_conv.is_owned = false;
23259 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23263 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
23264 LDKCommitmentTransaction this_arg_conv;
23265 this_arg_conv.inner = (void*)(this_arg & (~1));
23266 this_arg_conv.is_owned = false;
23267 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23271 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
23272 LDKCommitmentTransaction this_arg_conv;
23273 this_arg_conv.inner = (void*)(this_arg & (~1));
23274 this_arg_conv.is_owned = false;
23275 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23278 uint64_t ret_ref = (uint64_t)ret_var.inner;
23279 if (ret_var.is_owned) {
23285 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
23286 LDKCommitmentTransaction this_arg_conv;
23287 this_arg_conv.inner = (void*)(this_arg & (~1));
23288 this_arg_conv.is_owned = false;
23289 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23290 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23291 channel_parameters_conv.is_owned = false;
23292 LDKChannelPublicKeys broadcaster_keys_conv;
23293 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23294 broadcaster_keys_conv.is_owned = false;
23295 LDKChannelPublicKeys countersignatory_keys_conv;
23296 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23297 countersignatory_keys_conv.is_owned = false;
23298 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
23299 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
23300 return (uint64_t)ret_conv;
23303 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
23304 LDKTrustedCommitmentTransaction this_obj_conv;
23305 this_obj_conv.inner = (void*)(this_obj & (~1));
23306 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23307 TrustedCommitmentTransaction_free(this_obj_conv);
23310 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
23311 LDKTrustedCommitmentTransaction this_arg_conv;
23312 this_arg_conv.inner = (void*)(this_arg & (~1));
23313 this_arg_conv.is_owned = false;
23314 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
23315 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
23319 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
23320 LDKTrustedCommitmentTransaction this_arg_conv;
23321 this_arg_conv.inner = (void*)(this_arg & (~1));
23322 this_arg_conv.is_owned = false;
23323 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
23324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23326 uint64_t ret_ref = (uint64_t)ret_var.inner;
23327 if (ret_var.is_owned) {
23333 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
23334 LDKTrustedCommitmentTransaction this_arg_conv;
23335 this_arg_conv.inner = (void*)(this_arg & (~1));
23336 this_arg_conv.is_owned = false;
23337 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
23338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23340 uint64_t ret_ref = (uint64_t)ret_var.inner;
23341 if (ret_var.is_owned) {
23347 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
23348 LDKTrustedCommitmentTransaction this_arg_conv;
23349 this_arg_conv.inner = (void*)(this_arg & (~1));
23350 this_arg_conv.is_owned = false;
23351 unsigned char htlc_base_key_arr[32];
23352 CHECK(*((uint32_t*)htlc_base_key) == 32);
23353 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
23354 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
23355 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23356 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23357 channel_parameters_conv.is_owned = false;
23358 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
23359 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
23360 return (uint64_t)ret_conv;
23363 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) {
23364 LDKPublicKey broadcaster_payment_basepoint_ref;
23365 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
23366 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
23367 LDKPublicKey countersignatory_payment_basepoint_ref;
23368 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
23369 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
23370 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
23374 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
23375 LDKInitFeatures a_conv;
23376 a_conv.inner = (void*)(a & (~1));
23377 a_conv.is_owned = false;
23378 LDKInitFeatures b_conv;
23379 b_conv.inner = (void*)(b & (~1));
23380 b_conv.is_owned = false;
23381 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
23385 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
23386 LDKNodeFeatures a_conv;
23387 a_conv.inner = (void*)(a & (~1));
23388 a_conv.is_owned = false;
23389 LDKNodeFeatures b_conv;
23390 b_conv.inner = (void*)(b & (~1));
23391 b_conv.is_owned = false;
23392 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
23396 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
23397 LDKChannelFeatures a_conv;
23398 a_conv.inner = (void*)(a & (~1));
23399 a_conv.is_owned = false;
23400 LDKChannelFeatures b_conv;
23401 b_conv.inner = (void*)(b & (~1));
23402 b_conv.is_owned = false;
23403 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
23407 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
23408 LDKInvoiceFeatures a_conv;
23409 a_conv.inner = (void*)(a & (~1));
23410 a_conv.is_owned = false;
23411 LDKInvoiceFeatures b_conv;
23412 b_conv.inner = (void*)(b & (~1));
23413 b_conv.is_owned = false;
23414 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
23418 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
23419 LDKInitFeatures orig_conv;
23420 orig_conv.inner = (void*)(orig & (~1));
23421 orig_conv.is_owned = false;
23422 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
23423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23425 uint64_t ret_ref = (uint64_t)ret_var.inner;
23426 if (ret_var.is_owned) {
23432 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
23433 LDKNodeFeatures orig_conv;
23434 orig_conv.inner = (void*)(orig & (~1));
23435 orig_conv.is_owned = false;
23436 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
23437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23439 uint64_t ret_ref = (uint64_t)ret_var.inner;
23440 if (ret_var.is_owned) {
23446 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
23447 LDKChannelFeatures orig_conv;
23448 orig_conv.inner = (void*)(orig & (~1));
23449 orig_conv.is_owned = false;
23450 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
23451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23453 uint64_t ret_ref = (uint64_t)ret_var.inner;
23454 if (ret_var.is_owned) {
23460 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
23461 LDKInvoiceFeatures orig_conv;
23462 orig_conv.inner = (void*)(orig & (~1));
23463 orig_conv.is_owned = false;
23464 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
23465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23467 uint64_t ret_ref = (uint64_t)ret_var.inner;
23468 if (ret_var.is_owned) {
23474 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
23475 LDKInitFeatures this_obj_conv;
23476 this_obj_conv.inner = (void*)(this_obj & (~1));
23477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23478 InitFeatures_free(this_obj_conv);
23481 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
23482 LDKNodeFeatures this_obj_conv;
23483 this_obj_conv.inner = (void*)(this_obj & (~1));
23484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23485 NodeFeatures_free(this_obj_conv);
23488 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
23489 LDKChannelFeatures this_obj_conv;
23490 this_obj_conv.inner = (void*)(this_obj & (~1));
23491 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23492 ChannelFeatures_free(this_obj_conv);
23495 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
23496 LDKInvoiceFeatures this_obj_conv;
23497 this_obj_conv.inner = (void*)(this_obj & (~1));
23498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23499 InvoiceFeatures_free(this_obj_conv);
23502 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
23503 LDKInitFeatures ret_var = InitFeatures_empty();
23504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23506 uint64_t ret_ref = (uint64_t)ret_var.inner;
23507 if (ret_var.is_owned) {
23513 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
23514 LDKInitFeatures ret_var = InitFeatures_known();
23515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23517 uint64_t ret_ref = (uint64_t)ret_var.inner;
23518 if (ret_var.is_owned) {
23524 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
23525 LDKInitFeatures this_arg_conv;
23526 this_arg_conv.inner = (void*)(this_arg & (~1));
23527 this_arg_conv.is_owned = false;
23528 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
23532 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
23533 LDKNodeFeatures ret_var = NodeFeatures_empty();
23534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23536 uint64_t ret_ref = (uint64_t)ret_var.inner;
23537 if (ret_var.is_owned) {
23543 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
23544 LDKNodeFeatures ret_var = NodeFeatures_known();
23545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23547 uint64_t ret_ref = (uint64_t)ret_var.inner;
23548 if (ret_var.is_owned) {
23554 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
23555 LDKNodeFeatures this_arg_conv;
23556 this_arg_conv.inner = (void*)(this_arg & (~1));
23557 this_arg_conv.is_owned = false;
23558 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
23562 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
23563 LDKChannelFeatures ret_var = ChannelFeatures_empty();
23564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23566 uint64_t ret_ref = (uint64_t)ret_var.inner;
23567 if (ret_var.is_owned) {
23573 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
23574 LDKChannelFeatures ret_var = ChannelFeatures_known();
23575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23577 uint64_t ret_ref = (uint64_t)ret_var.inner;
23578 if (ret_var.is_owned) {
23584 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
23585 LDKChannelFeatures this_arg_conv;
23586 this_arg_conv.inner = (void*)(this_arg & (~1));
23587 this_arg_conv.is_owned = false;
23588 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
23592 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
23593 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
23594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23596 uint64_t ret_ref = (uint64_t)ret_var.inner;
23597 if (ret_var.is_owned) {
23603 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
23604 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
23605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23607 uint64_t ret_ref = (uint64_t)ret_var.inner;
23608 if (ret_var.is_owned) {
23614 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
23615 LDKInvoiceFeatures this_arg_conv;
23616 this_arg_conv.inner = (void*)(this_arg & (~1));
23617 this_arg_conv.is_owned = false;
23618 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
23622 jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
23623 LDKInitFeatures this_arg_conv;
23624 this_arg_conv.inner = (void*)(this_arg & (~1));
23625 this_arg_conv.is_owned = false;
23626 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
23630 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
23631 LDKNodeFeatures this_arg_conv;
23632 this_arg_conv.inner = (void*)(this_arg & (~1));
23633 this_arg_conv.is_owned = false;
23634 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
23638 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
23639 LDKInvoiceFeatures this_arg_conv;
23640 this_arg_conv.inner = (void*)(this_arg & (~1));
23641 this_arg_conv.is_owned = false;
23642 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
23646 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
23647 LDKInitFeatures obj_conv;
23648 obj_conv.inner = (void*)(obj & (~1));
23649 obj_conv.is_owned = false;
23650 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
23651 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23652 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23653 CVec_u8Z_free(ret_var);
23657 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
23658 LDKNodeFeatures obj_conv;
23659 obj_conv.inner = (void*)(obj & (~1));
23660 obj_conv.is_owned = false;
23661 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
23662 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23663 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23664 CVec_u8Z_free(ret_var);
23668 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
23669 LDKChannelFeatures obj_conv;
23670 obj_conv.inner = (void*)(obj & (~1));
23671 obj_conv.is_owned = false;
23672 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
23673 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23674 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23675 CVec_u8Z_free(ret_var);
23679 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
23680 LDKInvoiceFeatures obj_conv;
23681 obj_conv.inner = (void*)(obj & (~1));
23682 obj_conv.is_owned = false;
23683 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
23684 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23685 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23686 CVec_u8Z_free(ret_var);
23690 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
23691 LDKu8slice ser_ref;
23692 ser_ref.datalen = *((uint32_t*)ser);
23693 ser_ref.data = (int8_t*)(ser + 4);
23694 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23695 *ret_conv = InitFeatures_read(ser_ref);
23696 return (uint64_t)ret_conv;
23699 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
23700 LDKu8slice ser_ref;
23701 ser_ref.datalen = *((uint32_t*)ser);
23702 ser_ref.data = (int8_t*)(ser + 4);
23703 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23704 *ret_conv = NodeFeatures_read(ser_ref);
23705 return (uint64_t)ret_conv;
23708 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
23709 LDKu8slice ser_ref;
23710 ser_ref.datalen = *((uint32_t*)ser);
23711 ser_ref.data = (int8_t*)(ser + 4);
23712 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23713 *ret_conv = ChannelFeatures_read(ser_ref);
23714 return (uint64_t)ret_conv;
23717 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
23718 LDKu8slice ser_ref;
23719 ser_ref.datalen = *((uint32_t*)ser);
23720 ser_ref.data = (int8_t*)(ser + 4);
23721 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
23722 *ret_conv = InvoiceFeatures_read(ser_ref);
23723 return (uint64_t)ret_conv;
23726 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
23727 LDKShutdownScript this_obj_conv;
23728 this_obj_conv.inner = (void*)(this_obj & (~1));
23729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23730 ShutdownScript_free(this_obj_conv);
23733 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
23734 LDKShutdownScript orig_conv;
23735 orig_conv.inner = (void*)(orig & (~1));
23736 orig_conv.is_owned = false;
23737 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
23738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23740 uint64_t ret_ref = (uint64_t)ret_var.inner;
23741 if (ret_var.is_owned) {
23747 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
23748 LDKInvalidShutdownScript this_obj_conv;
23749 this_obj_conv.inner = (void*)(this_obj & (~1));
23750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23751 InvalidShutdownScript_free(this_obj_conv);
23754 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
23755 LDKInvalidShutdownScript this_ptr_conv;
23756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23757 this_ptr_conv.is_owned = false;
23758 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
23759 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23760 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23764 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
23765 LDKInvalidShutdownScript this_ptr_conv;
23766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23767 this_ptr_conv.is_owned = false;
23768 LDKCVec_u8Z val_ref;
23769 val_ref.datalen = *((uint32_t*)val);
23770 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23771 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
23772 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
23775 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
23776 LDKCVec_u8Z script_arg_ref;
23777 script_arg_ref.datalen = *((uint32_t*)script_arg);
23778 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23779 memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
23780 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
23781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23783 uint64_t ret_ref = (uint64_t)ret_var.inner;
23784 if (ret_var.is_owned) {
23790 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
23791 LDKShutdownScript obj_conv;
23792 obj_conv.inner = (void*)(obj & (~1));
23793 obj_conv.is_owned = false;
23794 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
23795 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23796 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23797 CVec_u8Z_free(ret_var);
23801 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
23802 LDKu8slice ser_ref;
23803 ser_ref.datalen = *((uint32_t*)ser);
23804 ser_ref.data = (int8_t*)(ser + 4);
23805 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
23806 *ret_conv = ShutdownScript_read(ser_ref);
23807 return (uint64_t)ret_conv;
23810 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
23811 unsigned char pubkey_hash_arr[20];
23812 CHECK(*((uint32_t*)pubkey_hash) == 20);
23813 memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
23814 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
23815 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
23816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23818 uint64_t ret_ref = (uint64_t)ret_var.inner;
23819 if (ret_var.is_owned) {
23825 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
23826 unsigned char script_hash_arr[32];
23827 CHECK(*((uint32_t*)script_hash) == 32);
23828 memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
23829 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
23830 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
23831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23833 uint64_t ret_ref = (uint64_t)ret_var.inner;
23834 if (ret_var.is_owned) {
23840 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
23841 LDKu8slice program_ref;
23842 program_ref.datalen = *((uint32_t*)program);
23843 program_ref.data = (int8_t*)(program + 4);
23844 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
23845 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
23846 return (uint64_t)ret_conv;
23849 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
23850 LDKShutdownScript this_arg_conv;
23851 this_arg_conv.inner = (void*)(this_arg & (~1));
23852 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
23853 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
23854 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
23855 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23856 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23857 CVec_u8Z_free(ret_var);
23861 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
23862 LDKShutdownScript this_arg_conv;
23863 this_arg_conv.inner = (void*)(this_arg & (~1));
23864 this_arg_conv.is_owned = false;
23865 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
23866 memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
23870 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
23871 LDKShutdownScript this_arg_conv;
23872 this_arg_conv.inner = (void*)(this_arg & (~1));
23873 this_arg_conv.is_owned = false;
23874 LDKInitFeatures features_conv;
23875 features_conv.inner = (void*)(features & (~1));
23876 features_conv.is_owned = false;
23877 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
23881 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
23882 if ((this_ptr & 1) != 0) return;
23883 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
23884 FREE((void*)this_ptr);
23885 CustomMessageReader_free(this_ptr_conv);
23888 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
23889 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
23890 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
23891 *ret_ret = Type_clone(orig_conv);
23892 return (uint64_t)ret_ret;
23895 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
23896 if ((this_ptr & 1) != 0) return;
23897 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
23898 FREE((void*)this_ptr);
23899 Type_free(this_ptr_conv);
23902 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
23903 if ((this_ptr & 1) != 0) return;
23904 LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1);
23905 FREE((void*)this_ptr);
23906 Score_free(this_ptr_conv);
23909 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
23910 LDKNodeId this_obj_conv;
23911 this_obj_conv.inner = (void*)(this_obj & (~1));
23912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23913 NodeId_free(this_obj_conv);
23916 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
23917 LDKNodeId orig_conv;
23918 orig_conv.inner = (void*)(orig & (~1));
23919 orig_conv.is_owned = false;
23920 LDKNodeId ret_var = NodeId_clone(&orig_conv);
23921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23923 uint64_t ret_ref = (uint64_t)ret_var.inner;
23924 if (ret_var.is_owned) {
23930 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
23931 LDKPublicKey pubkey_ref;
23932 CHECK(*((uint32_t*)pubkey) == 33);
23933 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
23934 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
23935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23937 uint64_t ret_ref = (uint64_t)ret_var.inner;
23938 if (ret_var.is_owned) {
23944 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
23945 LDKNodeId this_arg_conv;
23946 this_arg_conv.inner = (void*)(this_arg & (~1));
23947 this_arg_conv.is_owned = false;
23948 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
23949 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23950 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23954 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
23956 o_conv.inner = (void*)(o & (~1));
23957 o_conv.is_owned = false;
23958 int64_t ret_val = NodeId_hash(&o_conv);
23962 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
23963 LDKNodeId obj_conv;
23964 obj_conv.inner = (void*)(obj & (~1));
23965 obj_conv.is_owned = false;
23966 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
23967 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
23968 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
23969 CVec_u8Z_free(ret_var);
23973 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
23974 LDKu8slice ser_ref;
23975 ser_ref.datalen = *((uint32_t*)ser);
23976 ser_ref.data = (int8_t*)(ser + 4);
23977 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
23978 *ret_conv = NodeId_read(ser_ref);
23979 return (uint64_t)ret_conv;
23982 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
23983 LDKNetworkGraph this_obj_conv;
23984 this_obj_conv.inner = (void*)(this_obj & (~1));
23985 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23986 NetworkGraph_free(this_obj_conv);
23989 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
23990 LDKNetworkGraph orig_conv;
23991 orig_conv.inner = (void*)(orig & (~1));
23992 orig_conv.is_owned = false;
23993 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23996 uint64_t ret_ref = (uint64_t)ret_var.inner;
23997 if (ret_var.is_owned) {
24003 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
24004 LDKReadOnlyNetworkGraph this_obj_conv;
24005 this_obj_conv.inner = (void*)(this_obj & (~1));
24006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24007 ReadOnlyNetworkGraph_free(this_obj_conv);
24010 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
24011 if ((this_ptr & 1) != 0) return;
24012 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
24013 FREE((void*)this_ptr);
24014 NetworkUpdate_free(this_ptr_conv);
24017 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
24018 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
24019 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24020 *ret_copy = NetworkUpdate_clone(orig_conv);
24021 uint64_t ret_ref = (uint64_t)ret_copy;
24025 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
24026 LDKChannelUpdate msg_conv;
24027 msg_conv.inner = (void*)(msg & (~1));
24028 msg_conv.is_owned = (msg & 1) || (msg == 0);
24029 msg_conv = ChannelUpdate_clone(&msg_conv);
24030 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24031 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
24032 uint64_t ret_ref = (uint64_t)ret_copy;
24036 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
24037 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24038 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
24039 uint64_t ret_ref = (uint64_t)ret_copy;
24043 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
24044 LDKPublicKey node_id_ref;
24045 CHECK(*((uint32_t*)node_id) == 33);
24046 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
24047 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
24048 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
24049 uint64_t ret_ref = (uint64_t)ret_copy;
24053 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
24054 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
24055 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
24056 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24057 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24058 CVec_u8Z_free(ret_var);
24062 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
24063 LDKNetGraphMsgHandler this_arg_conv;
24064 this_arg_conv.inner = (void*)(this_arg & (~1));
24065 this_arg_conv.is_owned = false;
24066 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
24067 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
24068 return (uint64_t)ret_ret;
24071 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
24072 LDKNetGraphMsgHandler this_obj_conv;
24073 this_obj_conv.inner = (void*)(this_obj & (~1));
24074 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24075 NetGraphMsgHandler_free(this_obj_conv);
24078 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
24079 LDKNetGraphMsgHandler this_ptr_conv;
24080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24081 this_ptr_conv.is_owned = false;
24082 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
24083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24085 uint64_t ret_ref = (uint64_t)ret_var.inner;
24086 if (ret_var.is_owned) {
24092 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
24093 LDKNetGraphMsgHandler this_ptr_conv;
24094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24095 this_ptr_conv.is_owned = false;
24096 LDKNetworkGraph val_conv;
24097 val_conv.inner = (void*)(val & (~1));
24098 val_conv.is_owned = (val & 1) || (val == 0);
24099 val_conv = NetworkGraph_clone(&val_conv);
24100 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
24103 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
24104 LDKNetworkGraph network_graph_conv;
24105 network_graph_conv.inner = (void*)(network_graph & (~1));
24106 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
24107 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
24108 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24109 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24110 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24111 // Manually implement clone for Java trait instances
24113 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24114 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
24115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24117 uint64_t ret_ref = (uint64_t)ret_var.inner;
24118 if (ret_var.is_owned) {
24124 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
24125 LDKNetGraphMsgHandler this_arg_conv;
24126 this_arg_conv.inner = (void*)(this_arg & (~1));
24127 this_arg_conv.is_owned = false;
24128 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
24129 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
24130 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
24131 // Manually implement clone for Java trait instances
24133 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
24136 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
24137 LDKNetGraphMsgHandler this_arg_conv;
24138 this_arg_conv.inner = (void*)(this_arg & (~1));
24139 this_arg_conv.is_owned = false;
24140 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24141 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
24142 return (uint64_t)ret_ret;
24145 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
24146 LDKNetGraphMsgHandler this_arg_conv;
24147 this_arg_conv.inner = (void*)(this_arg & (~1));
24148 this_arg_conv.is_owned = false;
24149 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24150 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
24151 return (uint64_t)ret_ret;
24154 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
24155 LDKDirectionalChannelInfo this_obj_conv;
24156 this_obj_conv.inner = (void*)(this_obj & (~1));
24157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24158 DirectionalChannelInfo_free(this_obj_conv);
24161 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
24162 LDKDirectionalChannelInfo this_ptr_conv;
24163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24164 this_ptr_conv.is_owned = false;
24165 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
24169 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24170 LDKDirectionalChannelInfo this_ptr_conv;
24171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24172 this_ptr_conv.is_owned = false;
24173 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24176 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
24177 LDKDirectionalChannelInfo this_ptr_conv;
24178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24179 this_ptr_conv.is_owned = false;
24180 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24184 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
24185 LDKDirectionalChannelInfo this_ptr_conv;
24186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24187 this_ptr_conv.is_owned = false;
24188 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24191 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24192 LDKDirectionalChannelInfo this_ptr_conv;
24193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24194 this_ptr_conv.is_owned = false;
24195 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24199 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24200 LDKDirectionalChannelInfo this_ptr_conv;
24201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24202 this_ptr_conv.is_owned = false;
24203 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24206 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
24207 LDKDirectionalChannelInfo this_ptr_conv;
24208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24209 this_ptr_conv.is_owned = false;
24210 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24214 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
24215 LDKDirectionalChannelInfo this_ptr_conv;
24216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24217 this_ptr_conv.is_owned = false;
24218 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24221 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
24222 LDKDirectionalChannelInfo this_ptr_conv;
24223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24224 this_ptr_conv.is_owned = false;
24225 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24226 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24227 uint64_t ret_ref = (uint64_t)ret_copy;
24231 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
24232 LDKDirectionalChannelInfo this_ptr_conv;
24233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24234 this_ptr_conv.is_owned = false;
24235 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24236 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24237 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24240 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
24241 LDKDirectionalChannelInfo this_ptr_conv;
24242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24243 this_ptr_conv.is_owned = false;
24244 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24247 uint64_t ret_ref = (uint64_t)ret_var.inner;
24248 if (ret_var.is_owned) {
24254 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
24255 LDKDirectionalChannelInfo this_ptr_conv;
24256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24257 this_ptr_conv.is_owned = false;
24258 LDKRoutingFees val_conv;
24259 val_conv.inner = (void*)(val & (~1));
24260 val_conv.is_owned = (val & 1) || (val == 0);
24261 val_conv = RoutingFees_clone(&val_conv);
24262 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24265 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
24266 LDKDirectionalChannelInfo this_ptr_conv;
24267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24268 this_ptr_conv.is_owned = false;
24269 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24272 uint64_t ret_ref = (uint64_t)ret_var.inner;
24273 if (ret_var.is_owned) {
24279 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
24280 LDKDirectionalChannelInfo this_ptr_conv;
24281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24282 this_ptr_conv.is_owned = false;
24283 LDKChannelUpdate val_conv;
24284 val_conv.inner = (void*)(val & (~1));
24285 val_conv.is_owned = (val & 1) || (val == 0);
24286 val_conv = ChannelUpdate_clone(&val_conv);
24287 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
24290 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) {
24291 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
24292 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
24293 LDKRoutingFees fees_arg_conv;
24294 fees_arg_conv.inner = (void*)(fees_arg & (~1));
24295 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
24296 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
24297 LDKChannelUpdate last_update_message_arg_conv;
24298 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
24299 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
24300 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
24301 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);
24302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24304 uint64_t ret_ref = (uint64_t)ret_var.inner;
24305 if (ret_var.is_owned) {
24311 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
24312 LDKDirectionalChannelInfo orig_conv;
24313 orig_conv.inner = (void*)(orig & (~1));
24314 orig_conv.is_owned = false;
24315 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_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 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
24326 LDKDirectionalChannelInfo obj_conv;
24327 obj_conv.inner = (void*)(obj & (~1));
24328 obj_conv.is_owned = false;
24329 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
24330 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24331 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24332 CVec_u8Z_free(ret_var);
24336 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
24337 LDKu8slice ser_ref;
24338 ser_ref.datalen = *((uint32_t*)ser);
24339 ser_ref.data = (int8_t*)(ser + 4);
24340 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
24341 *ret_conv = DirectionalChannelInfo_read(ser_ref);
24342 return (uint64_t)ret_conv;
24345 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
24346 LDKChannelInfo this_obj_conv;
24347 this_obj_conv.inner = (void*)(this_obj & (~1));
24348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24349 ChannelInfo_free(this_obj_conv);
24352 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
24353 LDKChannelInfo this_ptr_conv;
24354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24355 this_ptr_conv.is_owned = false;
24356 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
24357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24359 uint64_t ret_ref = (uint64_t)ret_var.inner;
24360 if (ret_var.is_owned) {
24366 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
24367 LDKChannelInfo this_ptr_conv;
24368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24369 this_ptr_conv.is_owned = false;
24370 LDKChannelFeatures val_conv;
24371 val_conv.inner = (void*)(val & (~1));
24372 val_conv.is_owned = (val & 1) || (val == 0);
24373 val_conv = ChannelFeatures_clone(&val_conv);
24374 ChannelInfo_set_features(&this_ptr_conv, val_conv);
24377 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
24378 LDKChannelInfo this_ptr_conv;
24379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24380 this_ptr_conv.is_owned = false;
24381 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
24382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24384 uint64_t ret_ref = (uint64_t)ret_var.inner;
24385 if (ret_var.is_owned) {
24391 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
24392 LDKChannelInfo this_ptr_conv;
24393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24394 this_ptr_conv.is_owned = false;
24395 LDKNodeId val_conv;
24396 val_conv.inner = (void*)(val & (~1));
24397 val_conv.is_owned = (val & 1) || (val == 0);
24398 val_conv = NodeId_clone(&val_conv);
24399 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
24402 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
24403 LDKChannelInfo this_ptr_conv;
24404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24405 this_ptr_conv.is_owned = false;
24406 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
24407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24409 uint64_t ret_ref = (uint64_t)ret_var.inner;
24410 if (ret_var.is_owned) {
24416 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
24417 LDKChannelInfo this_ptr_conv;
24418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24419 this_ptr_conv.is_owned = false;
24420 LDKDirectionalChannelInfo val_conv;
24421 val_conv.inner = (void*)(val & (~1));
24422 val_conv.is_owned = (val & 1) || (val == 0);
24423 val_conv = DirectionalChannelInfo_clone(&val_conv);
24424 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
24427 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
24428 LDKChannelInfo this_ptr_conv;
24429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24430 this_ptr_conv.is_owned = false;
24431 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
24432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24434 uint64_t ret_ref = (uint64_t)ret_var.inner;
24435 if (ret_var.is_owned) {
24441 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
24442 LDKChannelInfo this_ptr_conv;
24443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24444 this_ptr_conv.is_owned = false;
24445 LDKNodeId val_conv;
24446 val_conv.inner = (void*)(val & (~1));
24447 val_conv.is_owned = (val & 1) || (val == 0);
24448 val_conv = NodeId_clone(&val_conv);
24449 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
24452 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
24453 LDKChannelInfo this_ptr_conv;
24454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24455 this_ptr_conv.is_owned = false;
24456 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
24457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24459 uint64_t ret_ref = (uint64_t)ret_var.inner;
24460 if (ret_var.is_owned) {
24466 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
24467 LDKChannelInfo this_ptr_conv;
24468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24469 this_ptr_conv.is_owned = false;
24470 LDKDirectionalChannelInfo val_conv;
24471 val_conv.inner = (void*)(val & (~1));
24472 val_conv.is_owned = (val & 1) || (val == 0);
24473 val_conv = DirectionalChannelInfo_clone(&val_conv);
24474 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
24477 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
24478 LDKChannelInfo this_ptr_conv;
24479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24480 this_ptr_conv.is_owned = false;
24481 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24482 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
24483 uint64_t ret_ref = (uint64_t)ret_copy;
24487 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
24488 LDKChannelInfo this_ptr_conv;
24489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24490 this_ptr_conv.is_owned = false;
24491 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24492 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
24493 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
24496 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
24497 LDKChannelInfo this_ptr_conv;
24498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24499 this_ptr_conv.is_owned = false;
24500 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
24501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24503 uint64_t ret_ref = (uint64_t)ret_var.inner;
24504 if (ret_var.is_owned) {
24510 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24511 LDKChannelInfo this_ptr_conv;
24512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24513 this_ptr_conv.is_owned = false;
24514 LDKChannelAnnouncement val_conv;
24515 val_conv.inner = (void*)(val & (~1));
24516 val_conv.is_owned = (val & 1) || (val == 0);
24517 val_conv = ChannelAnnouncement_clone(&val_conv);
24518 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24521 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
24522 LDKChannelFeatures features_arg_conv;
24523 features_arg_conv.inner = (void*)(features_arg & (~1));
24524 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24525 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24526 LDKNodeId node_one_arg_conv;
24527 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
24528 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
24529 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
24530 LDKDirectionalChannelInfo one_to_two_arg_conv;
24531 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24532 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24533 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24534 LDKNodeId node_two_arg_conv;
24535 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
24536 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
24537 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
24538 LDKDirectionalChannelInfo two_to_one_arg_conv;
24539 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24540 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24541 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24542 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24543 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
24544 LDKChannelAnnouncement announcement_message_arg_conv;
24545 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24546 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24547 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24548 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
24549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24551 uint64_t ret_ref = (uint64_t)ret_var.inner;
24552 if (ret_var.is_owned) {
24558 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
24559 LDKChannelInfo orig_conv;
24560 orig_conv.inner = (void*)(orig & (~1));
24561 orig_conv.is_owned = false;
24562 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24565 uint64_t ret_ref = (uint64_t)ret_var.inner;
24566 if (ret_var.is_owned) {
24572 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
24573 LDKChannelInfo obj_conv;
24574 obj_conv.inner = (void*)(obj & (~1));
24575 obj_conv.is_owned = false;
24576 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24577 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24578 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24579 CVec_u8Z_free(ret_var);
24583 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
24584 LDKu8slice ser_ref;
24585 ser_ref.datalen = *((uint32_t*)ser);
24586 ser_ref.data = (int8_t*)(ser + 4);
24587 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24588 *ret_conv = ChannelInfo_read(ser_ref);
24589 return (uint64_t)ret_conv;
24592 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
24593 LDKRoutingFees this_obj_conv;
24594 this_obj_conv.inner = (void*)(this_obj & (~1));
24595 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24596 RoutingFees_free(this_obj_conv);
24599 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
24600 LDKRoutingFees this_ptr_conv;
24601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24602 this_ptr_conv.is_owned = false;
24603 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24607 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
24608 LDKRoutingFees this_ptr_conv;
24609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24610 this_ptr_conv.is_owned = false;
24611 RoutingFees_set_base_msat(&this_ptr_conv, val);
24614 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
24615 LDKRoutingFees this_ptr_conv;
24616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24617 this_ptr_conv.is_owned = false;
24618 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24622 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
24623 LDKRoutingFees this_ptr_conv;
24624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24625 this_ptr_conv.is_owned = false;
24626 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24629 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
24630 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24633 uint64_t ret_ref = (uint64_t)ret_var.inner;
24634 if (ret_var.is_owned) {
24640 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
24641 LDKRoutingFees a_conv;
24642 a_conv.inner = (void*)(a & (~1));
24643 a_conv.is_owned = false;
24644 LDKRoutingFees b_conv;
24645 b_conv.inner = (void*)(b & (~1));
24646 b_conv.is_owned = false;
24647 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24651 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
24652 LDKRoutingFees orig_conv;
24653 orig_conv.inner = (void*)(orig & (~1));
24654 orig_conv.is_owned = false;
24655 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24658 uint64_t ret_ref = (uint64_t)ret_var.inner;
24659 if (ret_var.is_owned) {
24665 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
24666 LDKRoutingFees o_conv;
24667 o_conv.inner = (void*)(o & (~1));
24668 o_conv.is_owned = false;
24669 int64_t ret_val = RoutingFees_hash(&o_conv);
24673 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
24674 LDKRoutingFees obj_conv;
24675 obj_conv.inner = (void*)(obj & (~1));
24676 obj_conv.is_owned = false;
24677 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24678 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24679 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24680 CVec_u8Z_free(ret_var);
24684 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
24685 LDKu8slice ser_ref;
24686 ser_ref.datalen = *((uint32_t*)ser);
24687 ser_ref.data = (int8_t*)(ser + 4);
24688 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24689 *ret_conv = RoutingFees_read(ser_ref);
24690 return (uint64_t)ret_conv;
24693 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
24694 LDKNodeAnnouncementInfo this_obj_conv;
24695 this_obj_conv.inner = (void*)(this_obj & (~1));
24696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24697 NodeAnnouncementInfo_free(this_obj_conv);
24700 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
24701 LDKNodeAnnouncementInfo this_ptr_conv;
24702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24703 this_ptr_conv.is_owned = false;
24704 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24707 uint64_t ret_ref = (uint64_t)ret_var.inner;
24708 if (ret_var.is_owned) {
24714 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
24715 LDKNodeAnnouncementInfo this_ptr_conv;
24716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24717 this_ptr_conv.is_owned = false;
24718 LDKNodeFeatures val_conv;
24719 val_conv.inner = (void*)(val & (~1));
24720 val_conv.is_owned = (val & 1) || (val == 0);
24721 val_conv = NodeFeatures_clone(&val_conv);
24722 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24725 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
24726 LDKNodeAnnouncementInfo this_ptr_conv;
24727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24728 this_ptr_conv.is_owned = false;
24729 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24733 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
24734 LDKNodeAnnouncementInfo this_ptr_conv;
24735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24736 this_ptr_conv.is_owned = false;
24737 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24740 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
24741 LDKNodeAnnouncementInfo this_ptr_conv;
24742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24743 this_ptr_conv.is_owned = false;
24744 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
24745 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
24749 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
24750 LDKNodeAnnouncementInfo this_ptr_conv;
24751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24752 this_ptr_conv.is_owned = false;
24753 LDKThreeBytes val_ref;
24754 CHECK(*((uint32_t*)val) == 3);
24755 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
24756 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24759 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
24760 LDKNodeAnnouncementInfo this_ptr_conv;
24761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24762 this_ptr_conv.is_owned = false;
24763 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
24764 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
24768 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
24769 LDKNodeAnnouncementInfo this_ptr_conv;
24770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24771 this_ptr_conv.is_owned = false;
24772 LDKThirtyTwoBytes val_ref;
24773 CHECK(*((uint32_t*)val) == 32);
24774 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
24775 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24778 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
24779 LDKNodeAnnouncementInfo this_ptr_conv;
24780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24781 this_ptr_conv.is_owned = false;
24782 LDKCVec_NetAddressZ val_constr;
24783 val_constr.datalen = *((uint32_t*)val);
24784 if (val_constr.datalen > 0)
24785 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24787 val_constr.data = NULL;
24788 uint32_t* val_vals = (uint32_t*)(val + 4);
24789 for (size_t m = 0; m < val_constr.datalen; m++) {
24790 uint32_t val_conv_12 = val_vals[m];
24791 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24792 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24793 val_constr.data[m] = val_conv_12_conv;
24795 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24798 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
24799 LDKNodeAnnouncementInfo this_ptr_conv;
24800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24801 this_ptr_conv.is_owned = false;
24802 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_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 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
24813 LDKNodeAnnouncementInfo this_ptr_conv;
24814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24815 this_ptr_conv.is_owned = false;
24816 LDKNodeAnnouncement val_conv;
24817 val_conv.inner = (void*)(val & (~1));
24818 val_conv.is_owned = (val & 1) || (val == 0);
24819 val_conv = NodeAnnouncement_clone(&val_conv);
24820 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24823 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) {
24824 LDKNodeFeatures features_arg_conv;
24825 features_arg_conv.inner = (void*)(features_arg & (~1));
24826 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24827 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24828 LDKThreeBytes rgb_arg_ref;
24829 CHECK(*((uint32_t*)rgb_arg) == 3);
24830 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
24831 LDKThirtyTwoBytes alias_arg_ref;
24832 CHECK(*((uint32_t*)alias_arg) == 32);
24833 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
24834 LDKCVec_NetAddressZ addresses_arg_constr;
24835 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
24836 if (addresses_arg_constr.datalen > 0)
24837 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24839 addresses_arg_constr.data = NULL;
24840 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
24841 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24842 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
24843 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24844 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24846 LDKNodeAnnouncement announcement_message_arg_conv;
24847 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24848 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24849 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24850 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24853 uint64_t ret_ref = (uint64_t)ret_var.inner;
24854 if (ret_var.is_owned) {
24860 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
24861 LDKNodeAnnouncementInfo orig_conv;
24862 orig_conv.inner = (void*)(orig & (~1));
24863 orig_conv.is_owned = false;
24864 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24867 uint64_t ret_ref = (uint64_t)ret_var.inner;
24868 if (ret_var.is_owned) {
24874 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
24875 LDKNodeAnnouncementInfo obj_conv;
24876 obj_conv.inner = (void*)(obj & (~1));
24877 obj_conv.is_owned = false;
24878 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24879 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
24880 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
24881 CVec_u8Z_free(ret_var);
24885 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
24886 LDKu8slice ser_ref;
24887 ser_ref.datalen = *((uint32_t*)ser);
24888 ser_ref.data = (int8_t*)(ser + 4);
24889 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24890 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24891 return (uint64_t)ret_conv;
24894 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
24895 LDKNodeInfo this_obj_conv;
24896 this_obj_conv.inner = (void*)(this_obj & (~1));
24897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24898 NodeInfo_free(this_obj_conv);
24901 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
24902 LDKNodeInfo this_ptr_conv;
24903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24904 this_ptr_conv.is_owned = false;
24905 LDKCVec_u64Z val_constr;
24906 val_constr.datalen = *((uint32_t*)val);
24907 if (val_constr.datalen > 0)
24908 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24910 val_constr.data = NULL;
24911 int64_t* val_vals = (int64_t*)(val + 4);
24912 for (size_t i = 0; i < val_constr.datalen; i++) {
24913 int64_t val_conv_8 = val_vals[i];
24914 val_constr.data[i] = val_conv_8;
24916 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24919 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
24920 LDKNodeInfo this_ptr_conv;
24921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24922 this_ptr_conv.is_owned = false;
24923 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24924 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24925 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24926 uint64_t ret_ref = (uint64_t)ret_var.inner;
24927 if (ret_var.is_owned) {
24933 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
24934 LDKNodeInfo this_ptr_conv;
24935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24936 this_ptr_conv.is_owned = false;
24937 LDKRoutingFees val_conv;
24938 val_conv.inner = (void*)(val & (~1));
24939 val_conv.is_owned = (val & 1) || (val == 0);
24940 val_conv = RoutingFees_clone(&val_conv);
24941 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24944 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
24945 LDKNodeInfo this_ptr_conv;
24946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24947 this_ptr_conv.is_owned = false;
24948 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24951 uint64_t ret_ref = (uint64_t)ret_var.inner;
24952 if (ret_var.is_owned) {
24958 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
24959 LDKNodeInfo this_ptr_conv;
24960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24961 this_ptr_conv.is_owned = false;
24962 LDKNodeAnnouncementInfo val_conv;
24963 val_conv.inner = (void*)(val & (~1));
24964 val_conv.is_owned = (val & 1) || (val == 0);
24965 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24966 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24969 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
24970 LDKCVec_u64Z channels_arg_constr;
24971 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
24972 if (channels_arg_constr.datalen > 0)
24973 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24975 channels_arg_constr.data = NULL;
24976 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
24977 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
24978 int64_t channels_arg_conv_8 = channels_arg_vals[i];
24979 channels_arg_constr.data[i] = channels_arg_conv_8;
24981 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24982 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24983 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24984 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24985 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24986 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24987 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24988 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24989 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24992 uint64_t ret_ref = (uint64_t)ret_var.inner;
24993 if (ret_var.is_owned) {
24999 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
25000 LDKNodeInfo orig_conv;
25001 orig_conv.inner = (void*)(orig & (~1));
25002 orig_conv.is_owned = false;
25003 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
25004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25006 uint64_t ret_ref = (uint64_t)ret_var.inner;
25007 if (ret_var.is_owned) {
25013 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
25014 LDKNodeInfo obj_conv;
25015 obj_conv.inner = (void*)(obj & (~1));
25016 obj_conv.is_owned = false;
25017 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
25018 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25019 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25020 CVec_u8Z_free(ret_var);
25024 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
25025 LDKu8slice ser_ref;
25026 ser_ref.datalen = *((uint32_t*)ser);
25027 ser_ref.data = (int8_t*)(ser + 4);
25028 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25029 *ret_conv = NodeInfo_read(ser_ref);
25030 return (uint64_t)ret_conv;
25033 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
25034 LDKNetworkGraph obj_conv;
25035 obj_conv.inner = (void*)(obj & (~1));
25036 obj_conv.is_owned = false;
25037 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
25038 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25039 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25040 CVec_u8Z_free(ret_var);
25044 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
25045 LDKu8slice ser_ref;
25046 ser_ref.datalen = *((uint32_t*)ser);
25047 ser_ref.data = (int8_t*)(ser + 4);
25048 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25049 *ret_conv = NetworkGraph_read(ser_ref);
25050 return (uint64_t)ret_conv;
25053 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
25054 LDKThirtyTwoBytes genesis_hash_ref;
25055 CHECK(*((uint32_t*)genesis_hash) == 32);
25056 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
25057 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
25058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25060 uint64_t ret_ref = (uint64_t)ret_var.inner;
25061 if (ret_var.is_owned) {
25067 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
25068 LDKNetworkGraph this_arg_conv;
25069 this_arg_conv.inner = (void*)(this_arg & (~1));
25070 this_arg_conv.is_owned = false;
25071 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
25072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25074 uint64_t ret_ref = (uint64_t)ret_var.inner;
25075 if (ret_var.is_owned) {
25081 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
25082 LDKNetworkGraph this_arg_conv;
25083 this_arg_conv.inner = (void*)(this_arg & (~1));
25084 this_arg_conv.is_owned = false;
25085 LDKNodeAnnouncement msg_conv;
25086 msg_conv.inner = (void*)(msg & (~1));
25087 msg_conv.is_owned = false;
25088 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25089 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
25090 return (uint64_t)ret_conv;
25093 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
25094 LDKNetworkGraph this_arg_conv;
25095 this_arg_conv.inner = (void*)(this_arg & (~1));
25096 this_arg_conv.is_owned = false;
25097 LDKUnsignedNodeAnnouncement msg_conv;
25098 msg_conv.inner = (void*)(msg & (~1));
25099 msg_conv.is_owned = false;
25100 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25101 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
25102 return (uint64_t)ret_conv;
25105 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25106 LDKNetworkGraph this_arg_conv;
25107 this_arg_conv.inner = (void*)(this_arg & (~1));
25108 this_arg_conv.is_owned = false;
25109 LDKChannelAnnouncement msg_conv;
25110 msg_conv.inner = (void*)(msg & (~1));
25111 msg_conv.is_owned = false;
25112 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
25113 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25114 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25115 // Manually implement clone for Java trait instances
25117 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25118 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25119 return (uint64_t)ret_conv;
25122 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
25123 LDKNetworkGraph this_arg_conv;
25124 this_arg_conv.inner = (void*)(this_arg & (~1));
25125 this_arg_conv.is_owned = false;
25126 LDKUnsignedChannelAnnouncement msg_conv;
25127 msg_conv.inner = (void*)(msg & (~1));
25128 msg_conv.is_owned = false;
25129 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
25130 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
25131 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
25132 // Manually implement clone for Java trait instances
25134 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25135 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
25136 return (uint64_t)ret_conv;
25139 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
25140 LDKNetworkGraph this_arg_conv;
25141 this_arg_conv.inner = (void*)(this_arg & (~1));
25142 this_arg_conv.is_owned = false;
25143 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
25146 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
25147 LDKNetworkGraph this_arg_conv;
25148 this_arg_conv.inner = (void*)(this_arg & (~1));
25149 this_arg_conv.is_owned = false;
25150 LDKPublicKey _node_id_ref;
25151 CHECK(*((uint32_t*)_node_id) == 33);
25152 memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
25153 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
25156 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
25157 LDKNetworkGraph this_arg_conv;
25158 this_arg_conv.inner = (void*)(this_arg & (~1));
25159 this_arg_conv.is_owned = false;
25160 LDKChannelUpdate msg_conv;
25161 msg_conv.inner = (void*)(msg & (~1));
25162 msg_conv.is_owned = false;
25163 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25164 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
25165 return (uint64_t)ret_conv;
25168 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
25169 LDKNetworkGraph this_arg_conv;
25170 this_arg_conv.inner = (void*)(this_arg & (~1));
25171 this_arg_conv.is_owned = false;
25172 LDKUnsignedChannelUpdate msg_conv;
25173 msg_conv.inner = (void*)(msg & (~1));
25174 msg_conv.is_owned = false;
25175 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25176 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
25177 return (uint64_t)ret_conv;
25180 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
25181 LDKReadOnlyNetworkGraph this_arg_conv;
25182 this_arg_conv.inner = (void*)(this_arg & (~1));
25183 this_arg_conv.is_owned = false;
25184 LDKPublicKey pubkey_ref;
25185 CHECK(*((uint32_t*)pubkey) == 33);
25186 memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
25187 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
25188 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
25189 uint64_t ret_ref = (uint64_t)ret_copy;
25193 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
25194 LDKRouteHop this_obj_conv;
25195 this_obj_conv.inner = (void*)(this_obj & (~1));
25196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25197 RouteHop_free(this_obj_conv);
25200 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
25201 LDKRouteHop this_ptr_conv;
25202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25203 this_ptr_conv.is_owned = false;
25204 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25205 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
25209 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
25210 LDKRouteHop this_ptr_conv;
25211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25212 this_ptr_conv.is_owned = false;
25213 LDKPublicKey val_ref;
25214 CHECK(*((uint32_t*)val) == 33);
25215 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25216 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
25219 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
25220 LDKRouteHop this_ptr_conv;
25221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25222 this_ptr_conv.is_owned = false;
25223 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
25224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25226 uint64_t ret_ref = (uint64_t)ret_var.inner;
25227 if (ret_var.is_owned) {
25233 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
25234 LDKRouteHop this_ptr_conv;
25235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25236 this_ptr_conv.is_owned = false;
25237 LDKNodeFeatures val_conv;
25238 val_conv.inner = (void*)(val & (~1));
25239 val_conv.is_owned = (val & 1) || (val == 0);
25240 val_conv = NodeFeatures_clone(&val_conv);
25241 RouteHop_set_node_features(&this_ptr_conv, val_conv);
25244 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
25245 LDKRouteHop this_ptr_conv;
25246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25247 this_ptr_conv.is_owned = false;
25248 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
25252 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25253 LDKRouteHop this_ptr_conv;
25254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25255 this_ptr_conv.is_owned = false;
25256 RouteHop_set_short_channel_id(&this_ptr_conv, val);
25259 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
25260 LDKRouteHop this_ptr_conv;
25261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25262 this_ptr_conv.is_owned = false;
25263 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
25264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25266 uint64_t ret_ref = (uint64_t)ret_var.inner;
25267 if (ret_var.is_owned) {
25273 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
25274 LDKRouteHop this_ptr_conv;
25275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25276 this_ptr_conv.is_owned = false;
25277 LDKChannelFeatures val_conv;
25278 val_conv.inner = (void*)(val & (~1));
25279 val_conv.is_owned = (val & 1) || (val == 0);
25280 val_conv = ChannelFeatures_clone(&val_conv);
25281 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
25284 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
25285 LDKRouteHop this_ptr_conv;
25286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25287 this_ptr_conv.is_owned = false;
25288 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
25292 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
25293 LDKRouteHop this_ptr_conv;
25294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25295 this_ptr_conv.is_owned = false;
25296 RouteHop_set_fee_msat(&this_ptr_conv, val);
25299 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
25300 LDKRouteHop this_ptr_conv;
25301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25302 this_ptr_conv.is_owned = false;
25303 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
25307 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
25308 LDKRouteHop this_ptr_conv;
25309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25310 this_ptr_conv.is_owned = false;
25311 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
25314 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) {
25315 LDKPublicKey pubkey_arg_ref;
25316 CHECK(*((uint32_t*)pubkey_arg) == 33);
25317 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
25318 LDKNodeFeatures node_features_arg_conv;
25319 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
25320 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
25321 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
25322 LDKChannelFeatures channel_features_arg_conv;
25323 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
25324 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
25325 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
25326 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);
25327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25329 uint64_t ret_ref = (uint64_t)ret_var.inner;
25330 if (ret_var.is_owned) {
25336 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
25337 LDKRouteHop orig_conv;
25338 orig_conv.inner = (void*)(orig & (~1));
25339 orig_conv.is_owned = false;
25340 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
25341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25343 uint64_t ret_ref = (uint64_t)ret_var.inner;
25344 if (ret_var.is_owned) {
25350 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
25351 LDKRouteHop o_conv;
25352 o_conv.inner = (void*)(o & (~1));
25353 o_conv.is_owned = false;
25354 int64_t ret_val = RouteHop_hash(&o_conv);
25358 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
25359 LDKRouteHop a_conv;
25360 a_conv.inner = (void*)(a & (~1));
25361 a_conv.is_owned = false;
25362 LDKRouteHop b_conv;
25363 b_conv.inner = (void*)(b & (~1));
25364 b_conv.is_owned = false;
25365 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
25369 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
25370 LDKRouteHop obj_conv;
25371 obj_conv.inner = (void*)(obj & (~1));
25372 obj_conv.is_owned = false;
25373 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
25374 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25375 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25376 CVec_u8Z_free(ret_var);
25380 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
25381 LDKu8slice ser_ref;
25382 ser_ref.datalen = *((uint32_t*)ser);
25383 ser_ref.data = (int8_t*)(ser + 4);
25384 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
25385 *ret_conv = RouteHop_read(ser_ref);
25386 return (uint64_t)ret_conv;
25389 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
25390 LDKRoute this_obj_conv;
25391 this_obj_conv.inner = (void*)(this_obj & (~1));
25392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25393 Route_free(this_obj_conv);
25396 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
25397 LDKRoute this_ptr_conv;
25398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25399 this_ptr_conv.is_owned = false;
25400 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
25401 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
25402 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
25403 for (size_t m = 0; m < ret_var.datalen; m++) {
25404 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
25405 uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
25406 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
25407 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
25408 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
25409 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25410 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25411 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
25412 if (ret_conv_12_conv_10_var.is_owned) {
25413 ret_conv_12_conv_10_ref |= 1;
25415 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
25417 FREE(ret_conv_12_var.data);
25418 ret_arr_ptr[m] = ret_conv_12_arr;
25420 FREE(ret_var.data);
25424 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
25425 LDKRoute this_ptr_conv;
25426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25427 this_ptr_conv.is_owned = false;
25428 LDKCVec_CVec_RouteHopZZ val_constr;
25429 val_constr.datalen = *((uint32_t*)val);
25430 if (val_constr.datalen > 0)
25431 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
25433 val_constr.data = NULL;
25434 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
25435 for (size_t m = 0; m < val_constr.datalen; m++) {
25436 uint32_tArray val_conv_12 = val_vals[m];
25437 LDKCVec_RouteHopZ val_conv_12_constr;
25438 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
25439 if (val_conv_12_constr.datalen > 0)
25440 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25442 val_conv_12_constr.data = NULL;
25443 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
25444 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
25445 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
25446 LDKRouteHop val_conv_12_conv_10_conv;
25447 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
25448 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
25449 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
25450 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
25452 val_constr.data[m] = val_conv_12_constr;
25454 Route_set_paths(&this_ptr_conv, val_constr);
25457 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
25458 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
25459 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
25460 if (paths_arg_constr.datalen > 0)
25461 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
25463 paths_arg_constr.data = NULL;
25464 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
25465 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
25466 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
25467 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
25468 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
25469 if (paths_arg_conv_12_constr.datalen > 0)
25470 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25472 paths_arg_conv_12_constr.data = NULL;
25473 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
25474 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
25475 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
25476 LDKRouteHop paths_arg_conv_12_conv_10_conv;
25477 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
25478 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
25479 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
25480 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
25482 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
25484 LDKRoute ret_var = Route_new(paths_arg_constr);
25485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25487 uint64_t ret_ref = (uint64_t)ret_var.inner;
25488 if (ret_var.is_owned) {
25494 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
25495 LDKRoute orig_conv;
25496 orig_conv.inner = (void*)(orig & (~1));
25497 orig_conv.is_owned = false;
25498 LDKRoute ret_var = Route_clone(&orig_conv);
25499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25501 uint64_t ret_ref = (uint64_t)ret_var.inner;
25502 if (ret_var.is_owned) {
25508 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
25510 o_conv.inner = (void*)(o & (~1));
25511 o_conv.is_owned = false;
25512 int64_t ret_val = Route_hash(&o_conv);
25516 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
25518 a_conv.inner = (void*)(a & (~1));
25519 a_conv.is_owned = false;
25521 b_conv.inner = (void*)(b & (~1));
25522 b_conv.is_owned = false;
25523 jboolean ret_val = Route_eq(&a_conv, &b_conv);
25527 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
25528 LDKRoute this_arg_conv;
25529 this_arg_conv.inner = (void*)(this_arg & (~1));
25530 this_arg_conv.is_owned = false;
25531 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
25535 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
25536 LDKRoute this_arg_conv;
25537 this_arg_conv.inner = (void*)(this_arg & (~1));
25538 this_arg_conv.is_owned = false;
25539 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
25543 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
25545 obj_conv.inner = (void*)(obj & (~1));
25546 obj_conv.is_owned = false;
25547 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
25548 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
25549 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
25550 CVec_u8Z_free(ret_var);
25554 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
25555 LDKu8slice ser_ref;
25556 ser_ref.datalen = *((uint32_t*)ser);
25557 ser_ref.data = (int8_t*)(ser + 4);
25558 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
25559 *ret_conv = Route_read(ser_ref);
25560 return (uint64_t)ret_conv;
25563 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
25564 LDKRouteHint this_obj_conv;
25565 this_obj_conv.inner = (void*)(this_obj & (~1));
25566 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25567 RouteHint_free(this_obj_conv);
25570 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
25571 LDKRouteHint orig_conv;
25572 orig_conv.inner = (void*)(orig & (~1));
25573 orig_conv.is_owned = false;
25574 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
25575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25577 uint64_t ret_ref = (uint64_t)ret_var.inner;
25578 if (ret_var.is_owned) {
25584 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
25585 LDKRouteHint o_conv;
25586 o_conv.inner = (void*)(o & (~1));
25587 o_conv.is_owned = false;
25588 int64_t ret_val = RouteHint_hash(&o_conv);
25592 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
25593 LDKRouteHint a_conv;
25594 a_conv.inner = (void*)(a & (~1));
25595 a_conv.is_owned = false;
25596 LDKRouteHint b_conv;
25597 b_conv.inner = (void*)(b & (~1));
25598 b_conv.is_owned = false;
25599 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
25603 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
25604 LDKRouteHintHop this_obj_conv;
25605 this_obj_conv.inner = (void*)(this_obj & (~1));
25606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25607 RouteHintHop_free(this_obj_conv);
25610 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
25611 LDKRouteHintHop this_ptr_conv;
25612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25613 this_ptr_conv.is_owned = false;
25614 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
25615 memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
25619 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
25620 LDKRouteHintHop this_ptr_conv;
25621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25622 this_ptr_conv.is_owned = false;
25623 LDKPublicKey val_ref;
25624 CHECK(*((uint32_t*)val) == 33);
25625 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
25626 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
25629 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
25630 LDKRouteHintHop this_ptr_conv;
25631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25632 this_ptr_conv.is_owned = false;
25633 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
25637 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25638 LDKRouteHintHop this_ptr_conv;
25639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25640 this_ptr_conv.is_owned = false;
25641 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
25644 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
25645 LDKRouteHintHop this_ptr_conv;
25646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25647 this_ptr_conv.is_owned = false;
25648 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
25649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25651 uint64_t ret_ref = (uint64_t)ret_var.inner;
25652 if (ret_var.is_owned) {
25658 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
25659 LDKRouteHintHop this_ptr_conv;
25660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25661 this_ptr_conv.is_owned = false;
25662 LDKRoutingFees val_conv;
25663 val_conv.inner = (void*)(val & (~1));
25664 val_conv.is_owned = (val & 1) || (val == 0);
25665 val_conv = RoutingFees_clone(&val_conv);
25666 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
25669 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
25670 LDKRouteHintHop this_ptr_conv;
25671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25672 this_ptr_conv.is_owned = false;
25673 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
25677 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25678 LDKRouteHintHop this_ptr_conv;
25679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25680 this_ptr_conv.is_owned = false;
25681 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
25684 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
25685 LDKRouteHintHop this_ptr_conv;
25686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25687 this_ptr_conv.is_owned = false;
25688 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25689 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
25690 uint64_t ret_ref = (uint64_t)ret_copy;
25694 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
25695 LDKRouteHintHop this_ptr_conv;
25696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25697 this_ptr_conv.is_owned = false;
25698 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25699 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
25700 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
25703 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
25704 LDKRouteHintHop this_ptr_conv;
25705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25706 this_ptr_conv.is_owned = false;
25707 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25708 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
25709 uint64_t ret_ref = (uint64_t)ret_copy;
25713 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
25714 LDKRouteHintHop this_ptr_conv;
25715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25716 this_ptr_conv.is_owned = false;
25717 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25718 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
25719 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
25722 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) {
25723 LDKPublicKey src_node_id_arg_ref;
25724 CHECK(*((uint32_t*)src_node_id_arg) == 33);
25725 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
25726 LDKRoutingFees fees_arg_conv;
25727 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25728 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25729 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25730 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
25731 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
25732 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25733 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
25734 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);
25735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25737 uint64_t ret_ref = (uint64_t)ret_var.inner;
25738 if (ret_var.is_owned) {
25744 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
25745 LDKRouteHintHop orig_conv;
25746 orig_conv.inner = (void*)(orig & (~1));
25747 orig_conv.is_owned = false;
25748 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
25749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25751 uint64_t ret_ref = (uint64_t)ret_var.inner;
25752 if (ret_var.is_owned) {
25758 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
25759 LDKRouteHintHop o_conv;
25760 o_conv.inner = (void*)(o & (~1));
25761 o_conv.is_owned = false;
25762 int64_t ret_val = RouteHintHop_hash(&o_conv);
25766 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
25767 LDKRouteHintHop a_conv;
25768 a_conv.inner = (void*)(a & (~1));
25769 a_conv.is_owned = false;
25770 LDKRouteHintHop b_conv;
25771 b_conv.inner = (void*)(b & (~1));
25772 b_conv.is_owned = false;
25773 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
25777 uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_pubkey, 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, uint32_t scorer) {
25778 LDKPublicKey our_node_pubkey_ref;
25779 CHECK(*((uint32_t*)our_node_pubkey) == 33);
25780 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
25781 LDKNetworkGraph network_conv;
25782 network_conv.inner = (void*)(network & (~1));
25783 network_conv.is_owned = false;
25784 LDKPublicKey payee_ref;
25785 CHECK(*((uint32_t*)payee) == 33);
25786 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
25787 LDKCVec_ChannelDetailsZ first_hops_constr;
25788 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25789 if (first_hops != 0) {
25790 first_hops_constr.datalen = *((uint32_t*)first_hops);
25791 if (first_hops_constr.datalen > 0)
25792 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25794 first_hops_constr.data = NULL;
25795 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
25796 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25797 uint32_t first_hops_conv_16 = first_hops_vals[q];
25798 LDKChannelDetails first_hops_conv_16_conv;
25799 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25800 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25801 first_hops_constr.data[q] = first_hops_conv_16_conv;
25803 first_hops_ptr = &first_hops_constr;
25805 LDKCVec_RouteHintZ last_hops_constr;
25806 last_hops_constr.datalen = *((uint32_t*)last_hops);
25807 if (last_hops_constr.datalen > 0)
25808 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25810 last_hops_constr.data = NULL;
25811 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
25812 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25813 uint32_t last_hops_conv_11 = last_hops_vals[l];
25814 LDKRouteHint last_hops_conv_11_conv;
25815 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25816 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25817 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25818 last_hops_constr.data[l] = last_hops_conv_11_conv;
25820 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25821 LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1);
25822 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25823 *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
25824 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25825 return (uint64_t)ret_conv;
25828 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_pubkey, 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, uint32_t scorer) {
25829 LDKPublicKey our_node_pubkey_ref;
25830 CHECK(*((uint32_t*)our_node_pubkey) == 33);
25831 memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
25832 LDKNetworkGraph network_conv;
25833 network_conv.inner = (void*)(network & (~1));
25834 network_conv.is_owned = false;
25835 LDKPublicKey payee_ref;
25836 CHECK(*((uint32_t*)payee) == 33);
25837 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
25838 LDKInvoiceFeatures payee_features_conv;
25839 payee_features_conv.inner = (void*)(payee_features & (~1));
25840 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
25841 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
25842 LDKCVec_ChannelDetailsZ first_hops_constr;
25843 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25844 if (first_hops != 0) {
25845 first_hops_constr.datalen = *((uint32_t*)first_hops);
25846 if (first_hops_constr.datalen > 0)
25847 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25849 first_hops_constr.data = NULL;
25850 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
25851 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25852 uint32_t first_hops_conv_16 = first_hops_vals[q];
25853 LDKChannelDetails first_hops_conv_16_conv;
25854 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25855 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25856 first_hops_constr.data[q] = first_hops_conv_16_conv;
25858 first_hops_ptr = &first_hops_constr;
25860 LDKCVec_RouteHintZ last_hops_constr;
25861 last_hops_constr.datalen = *((uint32_t*)last_hops);
25862 if (last_hops_constr.datalen > 0)
25863 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25865 last_hops_constr.data = NULL;
25866 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
25867 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25868 uint32_t last_hops_conv_11 = last_hops_vals[l];
25869 LDKRouteHint last_hops_conv_11_conv;
25870 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25871 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25872 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25873 last_hops_constr.data[l] = last_hops_conv_11_conv;
25875 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25876 LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1);
25877 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25878 *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
25879 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25880 return (uint64_t)ret_conv;
25883 void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
25884 LDKScorer this_obj_conv;
25885 this_obj_conv.inner = (void*)(this_obj & (~1));
25886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25887 Scorer_free(this_obj_conv);
25890 uint32_t __attribute__((visibility("default"))) TS_Scorer_new(int64_t base_penalty_msat) {
25891 LDKScorer ret_var = Scorer_new(base_penalty_msat);
25892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25894 uint64_t ret_ref = (uint64_t)ret_var.inner;
25895 if (ret_var.is_owned) {
25901 uint32_t __attribute__((visibility("default"))) TS_Scorer_default() {
25902 LDKScorer ret_var = Scorer_default();
25903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25905 uint64_t ret_ref = (uint64_t)ret_var.inner;
25906 if (ret_var.is_owned) {
25912 uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) {
25913 LDKScorer this_arg_conv;
25914 this_arg_conv.inner = (void*)(this_arg & (~1));
25915 this_arg_conv.is_owned = false;
25916 LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore");
25917 *ret_ret = Scorer_as_Score(&this_arg_conv);
25918 return (uint64_t)ret_ret;
25921 void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) {
25922 LDKFilesystemPersister this_obj_conv;
25923 this_obj_conv.inner = (void*)(this_obj & (~1));
25924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25925 FilesystemPersister_free(this_obj_conv);
25928 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_new(jstring path_to_channel_data) {
25929 LDKStr path_to_channel_data_conv = str_ref_to_owned_c(path_to_channel_data);
25930 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
25931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25933 uint64_t ret_ref = (uint64_t)ret_var.inner;
25934 if (ret_var.is_owned) {
25940 jstring __attribute__((visibility("default"))) TS_FilesystemPersister_get_data_dir(uint32_t this_arg) {
25941 LDKFilesystemPersister this_arg_conv;
25942 this_arg_conv.inner = (void*)(this_arg & (~1));
25943 this_arg_conv.is_owned = false;
25944 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
25945 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25950 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_persist_manager(jstring data_dir, uint32_t manager) {
25951 LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
25952 LDKChannelManager manager_conv;
25953 manager_conv.inner = (void*)(manager & (~1));
25954 manager_conv.is_owned = false;
25955 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25956 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
25957 return (uint64_t)ret_conv;
25960 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_read_channelmonitors(uint32_t this_arg, uint32_t keys_manager) {
25961 LDKFilesystemPersister this_arg_conv;
25962 this_arg_conv.inner = (void*)(this_arg & (~1));
25963 this_arg_conv.is_owned = false;
25964 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25965 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
25966 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
25967 return (uint64_t)ret_conv;
25970 uint32_t __attribute__((visibility("default"))) TS_FilesystemPersister_as_Persist(uint32_t this_arg) {
25971 LDKFilesystemPersister this_arg_conv;
25972 this_arg_conv.inner = (void*)(this_arg & (~1));
25973 this_arg_conv.is_owned = false;
25974 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
25975 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
25976 return (uint64_t)ret_ret;
25979 void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
25980 LDKBackgroundProcessor this_obj_conv;
25981 this_obj_conv.inner = (void*)(this_obj & (~1));
25982 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25983 BackgroundProcessor_free(this_obj_conv);
25986 void __attribute__((visibility("default"))) TS_ChannelManagerPersister_free(uint32_t this_ptr) {
25987 if ((this_ptr & 1) != 0) return;
25988 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
25989 FREE((void*)this_ptr);
25990 ChannelManagerPersister_free(this_ptr_conv);
25993 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) {
25994 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
25995 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
25996 LDKChainMonitor chain_monitor_conv;
25997 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
25998 chain_monitor_conv.is_owned = false;
25999 LDKChannelManager channel_manager_conv;
26000 channel_manager_conv.inner = (void*)(channel_manager & (~1));
26001 channel_manager_conv.is_owned = false;
26002 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
26003 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
26004 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
26005 LDKPeerManager peer_manager_conv;
26006 peer_manager_conv.inner = (void*)(peer_manager & (~1));
26007 peer_manager_conv.is_owned = false;
26008 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
26009 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);
26010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26012 uint64_t ret_ref = (uint64_t)ret_var.inner;
26013 if (ret_var.is_owned) {
26019 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
26020 LDKBackgroundProcessor this_arg_conv;
26021 this_arg_conv.inner = (void*)(this_arg & (~1));
26022 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26023 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26024 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26025 *ret_conv = BackgroundProcessor_join(this_arg_conv);
26026 return (uint64_t)ret_conv;
26029 uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
26030 LDKBackgroundProcessor this_arg_conv;
26031 this_arg_conv.inner = (void*)(this_arg & (~1));
26032 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26033 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26034 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26035 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
26036 return (uint64_t)ret_conv;
26039 void __attribute__((visibility("default"))) TS_check_platform() {
26043 void __attribute__((visibility("default"))) TS_Invoice_free(uint32_t this_obj) {
26044 LDKInvoice this_obj_conv;
26045 this_obj_conv.inner = (void*)(this_obj & (~1));
26046 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26047 Invoice_free(this_obj_conv);
26050 jboolean __attribute__((visibility("default"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
26052 a_conv.inner = (void*)(a & (~1));
26053 a_conv.is_owned = false;
26055 b_conv.inner = (void*)(b & (~1));
26056 b_conv.is_owned = false;
26057 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
26061 uint32_t __attribute__((visibility("default"))) TS_Invoice_clone(uint32_t orig) {
26062 LDKInvoice orig_conv;
26063 orig_conv.inner = (void*)(orig & (~1));
26064 orig_conv.is_owned = false;
26065 LDKInvoice ret_var = Invoice_clone(&orig_conv);
26066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26068 uint64_t ret_ref = (uint64_t)ret_var.inner;
26069 if (ret_var.is_owned) {
26075 void __attribute__((visibility("default"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
26076 LDKSignedRawInvoice this_obj_conv;
26077 this_obj_conv.inner = (void*)(this_obj & (~1));
26078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26079 SignedRawInvoice_free(this_obj_conv);
26082 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
26083 LDKSignedRawInvoice a_conv;
26084 a_conv.inner = (void*)(a & (~1));
26085 a_conv.is_owned = false;
26086 LDKSignedRawInvoice b_conv;
26087 b_conv.inner = (void*)(b & (~1));
26088 b_conv.is_owned = false;
26089 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
26093 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_clone(uint32_t orig) {
26094 LDKSignedRawInvoice orig_conv;
26095 orig_conv.inner = (void*)(orig & (~1));
26096 orig_conv.is_owned = false;
26097 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
26098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26100 uint64_t ret_ref = (uint64_t)ret_var.inner;
26101 if (ret_var.is_owned) {
26107 void __attribute__((visibility("default"))) TS_RawInvoice_free(uint32_t this_obj) {
26108 LDKRawInvoice this_obj_conv;
26109 this_obj_conv.inner = (void*)(this_obj & (~1));
26110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26111 RawInvoice_free(this_obj_conv);
26114 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
26115 LDKRawInvoice this_ptr_conv;
26116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26117 this_ptr_conv.is_owned = false;
26118 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
26119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26121 uint64_t ret_ref = (uint64_t)ret_var.inner;
26122 if (ret_var.is_owned) {
26128 void __attribute__((visibility("default"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
26129 LDKRawInvoice this_ptr_conv;
26130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26131 this_ptr_conv.is_owned = false;
26132 LDKRawDataPart val_conv;
26133 val_conv.inner = (void*)(val & (~1));
26134 val_conv.is_owned = (val & 1) || (val == 0);
26135 val_conv = RawDataPart_clone(&val_conv);
26136 RawInvoice_set_data(&this_ptr_conv, val_conv);
26139 jboolean __attribute__((visibility("default"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
26140 LDKRawInvoice a_conv;
26141 a_conv.inner = (void*)(a & (~1));
26142 a_conv.is_owned = false;
26143 LDKRawInvoice b_conv;
26144 b_conv.inner = (void*)(b & (~1));
26145 b_conv.is_owned = false;
26146 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
26150 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_clone(uint32_t orig) {
26151 LDKRawInvoice orig_conv;
26152 orig_conv.inner = (void*)(orig & (~1));
26153 orig_conv.is_owned = false;
26154 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
26155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26157 uint64_t ret_ref = (uint64_t)ret_var.inner;
26158 if (ret_var.is_owned) {
26164 void __attribute__((visibility("default"))) TS_RawDataPart_free(uint32_t this_obj) {
26165 LDKRawDataPart this_obj_conv;
26166 this_obj_conv.inner = (void*)(this_obj & (~1));
26167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26168 RawDataPart_free(this_obj_conv);
26171 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
26172 LDKRawDataPart this_ptr_conv;
26173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26174 this_ptr_conv.is_owned = false;
26175 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
26176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26178 uint64_t ret_ref = (uint64_t)ret_var.inner;
26179 if (ret_var.is_owned) {
26185 void __attribute__((visibility("default"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
26186 LDKRawDataPart this_ptr_conv;
26187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26188 this_ptr_conv.is_owned = false;
26189 LDKPositiveTimestamp val_conv;
26190 val_conv.inner = (void*)(val & (~1));
26191 val_conv.is_owned = (val & 1) || (val == 0);
26192 val_conv = PositiveTimestamp_clone(&val_conv);
26193 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
26196 jboolean __attribute__((visibility("default"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
26197 LDKRawDataPart a_conv;
26198 a_conv.inner = (void*)(a & (~1));
26199 a_conv.is_owned = false;
26200 LDKRawDataPart b_conv;
26201 b_conv.inner = (void*)(b & (~1));
26202 b_conv.is_owned = false;
26203 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
26207 uint32_t __attribute__((visibility("default"))) TS_RawDataPart_clone(uint32_t orig) {
26208 LDKRawDataPart orig_conv;
26209 orig_conv.inner = (void*)(orig & (~1));
26210 orig_conv.is_owned = false;
26211 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
26212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26214 uint64_t ret_ref = (uint64_t)ret_var.inner;
26215 if (ret_var.is_owned) {
26221 void __attribute__((visibility("default"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
26222 LDKPositiveTimestamp this_obj_conv;
26223 this_obj_conv.inner = (void*)(this_obj & (~1));
26224 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26225 PositiveTimestamp_free(this_obj_conv);
26228 jboolean __attribute__((visibility("default"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
26229 LDKPositiveTimestamp a_conv;
26230 a_conv.inner = (void*)(a & (~1));
26231 a_conv.is_owned = false;
26232 LDKPositiveTimestamp b_conv;
26233 b_conv.inner = (void*)(b & (~1));
26234 b_conv.is_owned = false;
26235 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
26239 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_clone(uint32_t orig) {
26240 LDKPositiveTimestamp orig_conv;
26241 orig_conv.inner = (void*)(orig & (~1));
26242 orig_conv.is_owned = false;
26243 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
26244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26246 uint64_t ret_ref = (uint64_t)ret_var.inner;
26247 if (ret_var.is_owned) {
26253 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_clone(uint32_t orig) {
26254 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
26255 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
26259 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_milli() {
26260 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
26264 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_micro() {
26265 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
26269 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_nano() {
26270 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
26274 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_pico() {
26275 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
26279 jboolean __attribute__((visibility("default"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
26280 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
26281 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
26282 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
26286 int64_t __attribute__((visibility("default"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
26287 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
26288 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
26292 uint32_t __attribute__((visibility("default"))) TS_Currency_clone(uint32_t orig) {
26293 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
26294 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
26298 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin() {
26299 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
26303 uint32_t __attribute__((visibility("default"))) TS_Currency_bitcoin_testnet() {
26304 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
26308 uint32_t __attribute__((visibility("default"))) TS_Currency_regtest() {
26309 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
26313 uint32_t __attribute__((visibility("default"))) TS_Currency_simnet() {
26314 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
26318 uint32_t __attribute__((visibility("default"))) TS_Currency_signet() {
26319 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
26323 int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
26324 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
26325 int64_t ret_val = Currency_hash(o_conv);
26329 jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
26330 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
26331 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
26332 jboolean ret_val = Currency_eq(a_conv, b_conv);
26336 void __attribute__((visibility("default"))) TS_Sha256_free(uint32_t this_obj) {
26337 LDKSha256 this_obj_conv;
26338 this_obj_conv.inner = (void*)(this_obj & (~1));
26339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26340 Sha256_free(this_obj_conv);
26343 uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
26344 LDKSha256 orig_conv;
26345 orig_conv.inner = (void*)(orig & (~1));
26346 orig_conv.is_owned = false;
26347 LDKSha256 ret_var = Sha256_clone(&orig_conv);
26348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26350 uint64_t ret_ref = (uint64_t)ret_var.inner;
26351 if (ret_var.is_owned) {
26357 int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
26359 o_conv.inner = (void*)(o & (~1));
26360 o_conv.is_owned = false;
26361 int64_t ret_val = Sha256_hash(&o_conv);
26365 jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
26367 a_conv.inner = (void*)(a & (~1));
26368 a_conv.is_owned = false;
26370 b_conv.inner = (void*)(b & (~1));
26371 b_conv.is_owned = false;
26372 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
26376 void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
26377 LDKDescription this_obj_conv;
26378 this_obj_conv.inner = (void*)(this_obj & (~1));
26379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26380 Description_free(this_obj_conv);
26383 uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
26384 LDKDescription orig_conv;
26385 orig_conv.inner = (void*)(orig & (~1));
26386 orig_conv.is_owned = false;
26387 LDKDescription ret_var = Description_clone(&orig_conv);
26388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26390 uint64_t ret_ref = (uint64_t)ret_var.inner;
26391 if (ret_var.is_owned) {
26397 int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
26398 LDKDescription o_conv;
26399 o_conv.inner = (void*)(o & (~1));
26400 o_conv.is_owned = false;
26401 int64_t ret_val = Description_hash(&o_conv);
26405 jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
26406 LDKDescription a_conv;
26407 a_conv.inner = (void*)(a & (~1));
26408 a_conv.is_owned = false;
26409 LDKDescription b_conv;
26410 b_conv.inner = (void*)(b & (~1));
26411 b_conv.is_owned = false;
26412 jboolean ret_val = Description_eq(&a_conv, &b_conv);
26416 void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
26417 LDKPayeePubKey this_obj_conv;
26418 this_obj_conv.inner = (void*)(this_obj & (~1));
26419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26420 PayeePubKey_free(this_obj_conv);
26423 uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
26424 LDKPayeePubKey orig_conv;
26425 orig_conv.inner = (void*)(orig & (~1));
26426 orig_conv.is_owned = false;
26427 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
26428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26430 uint64_t ret_ref = (uint64_t)ret_var.inner;
26431 if (ret_var.is_owned) {
26437 int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
26438 LDKPayeePubKey o_conv;
26439 o_conv.inner = (void*)(o & (~1));
26440 o_conv.is_owned = false;
26441 int64_t ret_val = PayeePubKey_hash(&o_conv);
26445 jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
26446 LDKPayeePubKey a_conv;
26447 a_conv.inner = (void*)(a & (~1));
26448 a_conv.is_owned = false;
26449 LDKPayeePubKey b_conv;
26450 b_conv.inner = (void*)(b & (~1));
26451 b_conv.is_owned = false;
26452 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
26456 void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
26457 LDKExpiryTime this_obj_conv;
26458 this_obj_conv.inner = (void*)(this_obj & (~1));
26459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26460 ExpiryTime_free(this_obj_conv);
26463 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
26464 LDKExpiryTime orig_conv;
26465 orig_conv.inner = (void*)(orig & (~1));
26466 orig_conv.is_owned = false;
26467 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
26468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26470 uint64_t ret_ref = (uint64_t)ret_var.inner;
26471 if (ret_var.is_owned) {
26477 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
26478 LDKExpiryTime o_conv;
26479 o_conv.inner = (void*)(o & (~1));
26480 o_conv.is_owned = false;
26481 int64_t ret_val = ExpiryTime_hash(&o_conv);
26485 jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
26486 LDKExpiryTime a_conv;
26487 a_conv.inner = (void*)(a & (~1));
26488 a_conv.is_owned = false;
26489 LDKExpiryTime b_conv;
26490 b_conv.inner = (void*)(b & (~1));
26491 b_conv.is_owned = false;
26492 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
26496 void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
26497 LDKMinFinalCltvExpiry this_obj_conv;
26498 this_obj_conv.inner = (void*)(this_obj & (~1));
26499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26500 MinFinalCltvExpiry_free(this_obj_conv);
26503 uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
26504 LDKMinFinalCltvExpiry orig_conv;
26505 orig_conv.inner = (void*)(orig & (~1));
26506 orig_conv.is_owned = false;
26507 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
26508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26510 uint64_t ret_ref = (uint64_t)ret_var.inner;
26511 if (ret_var.is_owned) {
26517 int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
26518 LDKMinFinalCltvExpiry o_conv;
26519 o_conv.inner = (void*)(o & (~1));
26520 o_conv.is_owned = false;
26521 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
26525 jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
26526 LDKMinFinalCltvExpiry a_conv;
26527 a_conv.inner = (void*)(a & (~1));
26528 a_conv.is_owned = false;
26529 LDKMinFinalCltvExpiry b_conv;
26530 b_conv.inner = (void*)(b & (~1));
26531 b_conv.is_owned = false;
26532 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
26536 void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
26537 if ((this_ptr & 1) != 0) return;
26538 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
26539 FREE((void*)this_ptr);
26540 Fallback_free(this_ptr_conv);
26543 uint32_t __attribute__((visibility("default"))) TS_Fallback_clone(uint32_t orig) {
26544 LDKFallback* orig_conv = (LDKFallback*)orig;
26545 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26546 *ret_copy = Fallback_clone(orig_conv);
26547 uint64_t ret_ref = (uint64_t)ret_copy;
26551 uint32_t __attribute__((visibility("default"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
26553 LDKCVec_u8Z program_ref;
26554 program_ref.datalen = *((uint32_t*)program);
26555 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
26556 memcpy(program_ref.data, (uint8_t*)(program + 4), program_ref.datalen);
26557 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26558 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
26559 uint64_t ret_ref = (uint64_t)ret_copy;
26563 uint32_t __attribute__((visibility("default"))) TS_Fallback_pub_key_hash(int8_tArray a) {
26564 LDKTwentyBytes a_ref;
26565 CHECK(*((uint32_t*)a) == 20);
26566 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
26567 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26568 *ret_copy = Fallback_pub_key_hash(a_ref);
26569 uint64_t ret_ref = (uint64_t)ret_copy;
26573 uint32_t __attribute__((visibility("default"))) TS_Fallback_script_hash(int8_tArray a) {
26574 LDKTwentyBytes a_ref;
26575 CHECK(*((uint32_t*)a) == 20);
26576 memcpy(a_ref.data, (uint8_t*)(a + 4), 20);
26577 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26578 *ret_copy = Fallback_script_hash(a_ref);
26579 uint64_t ret_ref = (uint64_t)ret_copy;
26583 int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
26584 LDKFallback* o_conv = (LDKFallback*)o;
26585 int64_t ret_val = Fallback_hash(o_conv);
26589 jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
26590 LDKFallback* a_conv = (LDKFallback*)a;
26591 LDKFallback* b_conv = (LDKFallback*)b;
26592 jboolean ret_val = Fallback_eq(a_conv, b_conv);
26596 void __attribute__((visibility("default"))) TS_InvoiceSignature_free(uint32_t this_obj) {
26597 LDKInvoiceSignature this_obj_conv;
26598 this_obj_conv.inner = (void*)(this_obj & (~1));
26599 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26600 InvoiceSignature_free(this_obj_conv);
26603 uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
26604 LDKInvoiceSignature orig_conv;
26605 orig_conv.inner = (void*)(orig & (~1));
26606 orig_conv.is_owned = false;
26607 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
26608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26610 uint64_t ret_ref = (uint64_t)ret_var.inner;
26611 if (ret_var.is_owned) {
26617 jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
26618 LDKInvoiceSignature a_conv;
26619 a_conv.inner = (void*)(a & (~1));
26620 a_conv.is_owned = false;
26621 LDKInvoiceSignature b_conv;
26622 b_conv.inner = (void*)(b & (~1));
26623 b_conv.is_owned = false;
26624 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
26628 void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
26629 LDKPrivateRoute this_obj_conv;
26630 this_obj_conv.inner = (void*)(this_obj & (~1));
26631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26632 PrivateRoute_free(this_obj_conv);
26635 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
26636 LDKPrivateRoute orig_conv;
26637 orig_conv.inner = (void*)(orig & (~1));
26638 orig_conv.is_owned = false;
26639 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
26640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26642 uint64_t ret_ref = (uint64_t)ret_var.inner;
26643 if (ret_var.is_owned) {
26649 int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
26650 LDKPrivateRoute o_conv;
26651 o_conv.inner = (void*)(o & (~1));
26652 o_conv.is_owned = false;
26653 int64_t ret_val = PrivateRoute_hash(&o_conv);
26657 jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
26658 LDKPrivateRoute a_conv;
26659 a_conv.inner = (void*)(a & (~1));
26660 a_conv.is_owned = false;
26661 LDKPrivateRoute b_conv;
26662 b_conv.inner = (void*)(b & (~1));
26663 b_conv.is_owned = false;
26664 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
26668 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
26669 LDKSignedRawInvoice this_arg_conv;
26670 this_arg_conv.inner = (void*)(this_arg & (~1));
26671 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26672 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
26673 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
26674 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
26675 return ((uint64_t)ret_conv);
26678 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
26679 LDKSignedRawInvoice this_arg_conv;
26680 this_arg_conv.inner = (void*)(this_arg & (~1));
26681 this_arg_conv.is_owned = false;
26682 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
26683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26685 uint64_t ret_ref = (uint64_t)ret_var.inner;
26686 if (ret_var.is_owned) {
26692 int8_tArray __attribute__((visibility("default"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
26693 LDKSignedRawInvoice this_arg_conv;
26694 this_arg_conv.inner = (void*)(this_arg & (~1));
26695 this_arg_conv.is_owned = false;
26696 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26697 memcpy((uint8_t*)(ret_arr + 4), *SignedRawInvoice_hash(&this_arg_conv), 32);
26701 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
26702 LDKSignedRawInvoice this_arg_conv;
26703 this_arg_conv.inner = (void*)(this_arg & (~1));
26704 this_arg_conv.is_owned = false;
26705 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
26706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26708 uint64_t ret_ref = (uint64_t)ret_var.inner;
26709 if (ret_var.is_owned) {
26715 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
26716 LDKSignedRawInvoice this_arg_conv;
26717 this_arg_conv.inner = (void*)(this_arg & (~1));
26718 this_arg_conv.is_owned = false;
26719 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
26720 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
26721 return (uint64_t)ret_conv;
26724 jboolean __attribute__((visibility("default"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
26725 LDKSignedRawInvoice this_arg_conv;
26726 this_arg_conv.inner = (void*)(this_arg & (~1));
26727 this_arg_conv.is_owned = false;
26728 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
26732 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_hash(uint32_t this_arg) {
26733 LDKRawInvoice this_arg_conv;
26734 this_arg_conv.inner = (void*)(this_arg & (~1));
26735 this_arg_conv.is_owned = false;
26736 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26737 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_hash(&this_arg_conv).data, 32);
26741 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
26742 LDKRawInvoice this_arg_conv;
26743 this_arg_conv.inner = (void*)(this_arg & (~1));
26744 this_arg_conv.is_owned = false;
26745 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
26746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26748 uint64_t ret_ref = (uint64_t)ret_var.inner;
26749 if (ret_var.is_owned) {
26755 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description(uint32_t this_arg) {
26756 LDKRawInvoice this_arg_conv;
26757 this_arg_conv.inner = (void*)(this_arg & (~1));
26758 this_arg_conv.is_owned = false;
26759 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
26760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26762 uint64_t ret_ref = (uint64_t)ret_var.inner;
26763 if (ret_var.is_owned) {
26769 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
26770 LDKRawInvoice this_arg_conv;
26771 this_arg_conv.inner = (void*)(this_arg & (~1));
26772 this_arg_conv.is_owned = false;
26773 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
26774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26776 uint64_t ret_ref = (uint64_t)ret_var.inner;
26777 if (ret_var.is_owned) {
26783 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
26784 LDKRawInvoice this_arg_conv;
26785 this_arg_conv.inner = (void*)(this_arg & (~1));
26786 this_arg_conv.is_owned = false;
26787 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
26788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26790 uint64_t ret_ref = (uint64_t)ret_var.inner;
26791 if (ret_var.is_owned) {
26797 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
26798 LDKRawInvoice this_arg_conv;
26799 this_arg_conv.inner = (void*)(this_arg & (~1));
26800 this_arg_conv.is_owned = false;
26801 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
26802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26804 uint64_t ret_ref = (uint64_t)ret_var.inner;
26805 if (ret_var.is_owned) {
26811 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
26812 LDKRawInvoice this_arg_conv;
26813 this_arg_conv.inner = (void*)(this_arg & (~1));
26814 this_arg_conv.is_owned = false;
26815 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
26816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26818 uint64_t ret_ref = (uint64_t)ret_var.inner;
26819 if (ret_var.is_owned) {
26825 int8_tArray __attribute__((visibility("default"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
26826 LDKRawInvoice this_arg_conv;
26827 this_arg_conv.inner = (void*)(this_arg & (~1));
26828 this_arg_conv.is_owned = false;
26829 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26830 memcpy((uint8_t*)(ret_arr + 4), RawInvoice_payment_secret(&this_arg_conv).data, 32);
26834 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_features(uint32_t this_arg) {
26835 LDKRawInvoice this_arg_conv;
26836 this_arg_conv.inner = (void*)(this_arg & (~1));
26837 this_arg_conv.is_owned = false;
26838 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
26839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26841 uint64_t ret_ref = (uint64_t)ret_var.inner;
26842 if (ret_var.is_owned) {
26848 uint32_tArray __attribute__((visibility("default"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
26849 LDKRawInvoice this_arg_conv;
26850 this_arg_conv.inner = (void*)(this_arg & (~1));
26851 this_arg_conv.is_owned = false;
26852 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
26853 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
26854 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26855 for (size_t o = 0; o < ret_var.datalen; o++) {
26856 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26857 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26858 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26859 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26860 if (ret_conv_14_var.is_owned) {
26861 ret_conv_14_ref |= 1;
26863 ret_arr_ptr[o] = ret_conv_14_ref;
26865 FREE(ret_var.data);
26869 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
26870 LDKRawInvoice this_arg_conv;
26871 this_arg_conv.inner = (void*)(this_arg & (~1));
26872 this_arg_conv.is_owned = false;
26873 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26874 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
26875 uint64_t ret_ref = (uint64_t)ret_copy;
26879 uint32_t __attribute__((visibility("default"))) TS_RawInvoice_currency(uint32_t this_arg) {
26880 LDKRawInvoice this_arg_conv;
26881 this_arg_conv.inner = (void*)(this_arg & (~1));
26882 this_arg_conv.is_owned = false;
26883 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
26887 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
26888 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26889 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
26890 return (uint64_t)ret_conv;
26893 uint32_t __attribute__((visibility("default"))) TS_PositiveTimestamp_from_system_time(int64_t time) {
26894 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26895 *ret_conv = PositiveTimestamp_from_system_time(time);
26896 return (uint64_t)ret_conv;
26899 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
26900 LDKPositiveTimestamp this_arg_conv;
26901 this_arg_conv.inner = (void*)(this_arg & (~1));
26902 this_arg_conv.is_owned = false;
26903 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
26907 int64_t __attribute__((visibility("default"))) TS_PositiveTimestamp_as_time(uint32_t this_arg) {
26908 LDKPositiveTimestamp this_arg_conv;
26909 this_arg_conv.inner = (void*)(this_arg & (~1));
26910 this_arg_conv.is_owned = false;
26911 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
26915 uint32_t __attribute__((visibility("default"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
26916 LDKInvoice this_arg_conv;
26917 this_arg_conv.inner = (void*)(this_arg & (~1));
26918 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26919 this_arg_conv = Invoice_clone(&this_arg_conv);
26920 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
26921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26923 uint64_t ret_ref = (uint64_t)ret_var.inner;
26924 if (ret_var.is_owned) {
26930 uint32_t __attribute__((visibility("default"))) TS_Invoice_check_signature(uint32_t this_arg) {
26931 LDKInvoice this_arg_conv;
26932 this_arg_conv.inner = (void*)(this_arg & (~1));
26933 this_arg_conv.is_owned = false;
26934 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
26935 *ret_conv = Invoice_check_signature(&this_arg_conv);
26936 return (uint64_t)ret_conv;
26939 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
26940 LDKSignedRawInvoice signed_invoice_conv;
26941 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
26942 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
26943 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
26944 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
26945 *ret_conv = Invoice_from_signed(signed_invoice_conv);
26946 return (uint64_t)ret_conv;
26949 int64_t __attribute__((visibility("default"))) TS_Invoice_timestamp(uint32_t this_arg) {
26950 LDKInvoice this_arg_conv;
26951 this_arg_conv.inner = (void*)(this_arg & (~1));
26952 this_arg_conv.is_owned = false;
26953 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
26957 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_hash(uint32_t this_arg) {
26958 LDKInvoice this_arg_conv;
26959 this_arg_conv.inner = (void*)(this_arg & (~1));
26960 this_arg_conv.is_owned = false;
26961 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26962 memcpy((uint8_t*)(ret_arr + 4), *Invoice_payment_hash(&this_arg_conv), 32);
26966 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
26967 LDKInvoice this_arg_conv;
26968 this_arg_conv.inner = (void*)(this_arg & (~1));
26969 this_arg_conv.is_owned = false;
26970 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
26971 memcpy((uint8_t*)(ret_arr + 4), Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
26975 int8_tArray __attribute__((visibility("default"))) TS_Invoice_payment_secret(uint32_t this_arg) {
26976 LDKInvoice this_arg_conv;
26977 this_arg_conv.inner = (void*)(this_arg & (~1));
26978 this_arg_conv.is_owned = false;
26979 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
26980 memcpy((uint8_t*)(ret_arr + 4), Invoice_payment_secret(&this_arg_conv).data, 32);
26984 uint32_t __attribute__((visibility("default"))) TS_Invoice_features(uint32_t this_arg) {
26985 LDKInvoice this_arg_conv;
26986 this_arg_conv.inner = (void*)(this_arg & (~1));
26987 this_arg_conv.is_owned = false;
26988 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
26989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26991 uint64_t ret_ref = (uint64_t)ret_var.inner;
26992 if (ret_var.is_owned) {
26998 int8_tArray __attribute__((visibility("default"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
26999 LDKInvoice this_arg_conv;
27000 this_arg_conv.inner = (void*)(this_arg & (~1));
27001 this_arg_conv.is_owned = false;
27002 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
27003 memcpy((uint8_t*)(ret_arr + 4), Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
27007 int64_t __attribute__((visibility("default"))) TS_Invoice_expiry_time(uint32_t this_arg) {
27008 LDKInvoice this_arg_conv;
27009 this_arg_conv.inner = (void*)(this_arg & (~1));
27010 this_arg_conv.is_owned = false;
27011 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
27015 int64_t __attribute__((visibility("default"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
27016 LDKInvoice this_arg_conv;
27017 this_arg_conv.inner = (void*)(this_arg & (~1));
27018 this_arg_conv.is_owned = false;
27019 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
27023 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_private_routes(uint32_t this_arg) {
27024 LDKInvoice this_arg_conv;
27025 this_arg_conv.inner = (void*)(this_arg & (~1));
27026 this_arg_conv.is_owned = false;
27027 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
27028 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27029 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27030 for (size_t o = 0; o < ret_var.datalen; o++) {
27031 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27032 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27033 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27034 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27035 if (ret_conv_14_var.is_owned) {
27036 ret_conv_14_ref |= 1;
27038 ret_arr_ptr[o] = ret_conv_14_ref;
27040 FREE(ret_var.data);
27044 uint32_tArray __attribute__((visibility("default"))) TS_Invoice_route_hints(uint32_t this_arg) {
27045 LDKInvoice this_arg_conv;
27046 this_arg_conv.inner = (void*)(this_arg & (~1));
27047 this_arg_conv.is_owned = false;
27048 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
27049 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
27050 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27051 for (size_t l = 0; l < ret_var.datalen; l++) {
27052 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27053 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27054 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27055 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27056 if (ret_conv_11_var.is_owned) {
27057 ret_conv_11_ref |= 1;
27059 ret_arr_ptr[l] = ret_conv_11_ref;
27061 FREE(ret_var.data);
27065 uint32_t __attribute__((visibility("default"))) TS_Invoice_currency(uint32_t this_arg) {
27066 LDKInvoice this_arg_conv;
27067 this_arg_conv.inner = (void*)(this_arg & (~1));
27068 this_arg_conv.is_owned = false;
27069 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
27073 uint32_t __attribute__((visibility("default"))) TS_Invoice_amount_pico_btc(uint32_t this_arg) {
27074 LDKInvoice this_arg_conv;
27075 this_arg_conv.inner = (void*)(this_arg & (~1));
27076 this_arg_conv.is_owned = false;
27077 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27078 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
27079 uint64_t ret_ref = (uint64_t)ret_copy;
27083 uint32_t __attribute__((visibility("default"))) TS_Description_new(jstring description) {
27084 LDKStr description_conv = str_ref_to_owned_c(description);
27085 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27086 *ret_conv = Description_new(description_conv);
27087 return (uint64_t)ret_conv;
27090 jstring __attribute__((visibility("default"))) TS_Description_into_inner(uint32_t this_arg) {
27091 LDKDescription this_arg_conv;
27092 this_arg_conv.inner = (void*)(this_arg & (~1));
27093 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27094 this_arg_conv = Description_clone(&this_arg_conv);
27095 LDKStr ret_str = Description_into_inner(this_arg_conv);
27096 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27101 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
27102 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27103 *ret_conv = ExpiryTime_from_seconds(seconds);
27104 return (uint64_t)ret_conv;
27107 uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_from_duration(int64_t duration) {
27108 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27109 *ret_conv = ExpiryTime_from_duration(duration);
27110 return (uint64_t)ret_conv;
27113 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
27114 LDKExpiryTime this_arg_conv;
27115 this_arg_conv.inner = (void*)(this_arg & (~1));
27116 this_arg_conv.is_owned = false;
27117 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
27121 int64_t __attribute__((visibility("default"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
27122 LDKExpiryTime this_arg_conv;
27123 this_arg_conv.inner = (void*)(this_arg & (~1));
27124 this_arg_conv.is_owned = false;
27125 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
27129 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_new(uint32_t hops) {
27130 LDKRouteHint hops_conv;
27131 hops_conv.inner = (void*)(hops & (~1));
27132 hops_conv.is_owned = (hops & 1) || (hops == 0);
27133 hops_conv = RouteHint_clone(&hops_conv);
27134 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27135 *ret_conv = PrivateRoute_new(hops_conv);
27136 return (uint64_t)ret_conv;
27139 uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
27140 LDKPrivateRoute this_arg_conv;
27141 this_arg_conv.inner = (void*)(this_arg & (~1));
27142 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27143 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
27144 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
27145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27147 uint64_t ret_ref = (uint64_t)ret_var.inner;
27148 if (ret_var.is_owned) {
27154 uint32_t __attribute__((visibility("default"))) TS_CreationError_clone(uint32_t orig) {
27155 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
27156 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
27160 uint32_t __attribute__((visibility("default"))) TS_CreationError_description_too_long() {
27161 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
27165 uint32_t __attribute__((visibility("default"))) TS_CreationError_route_too_long() {
27166 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
27170 uint32_t __attribute__((visibility("default"))) TS_CreationError_timestamp_out_of_bounds() {
27171 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
27175 uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_out_of_bounds() {
27176 uint32_t ret_conv = LDKCreationError_to_js(CreationError_expiry_time_out_of_bounds());
27180 jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
27181 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
27182 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
27183 jboolean ret_val = CreationError_eq(a_conv, b_conv);
27187 jstring __attribute__((visibility("default"))) TS_CreationError_to_str(uint32_t o) {
27188 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
27189 LDKStr ret_str = CreationError_to_str(o_conv);
27190 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27195 uint32_t __attribute__((visibility("default"))) TS_SemanticError_clone(uint32_t orig) {
27196 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
27197 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
27201 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_hash() {
27202 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
27206 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_hashes() {
27207 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
27211 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_description() {
27212 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
27216 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_descriptions() {
27217 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
27221 uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
27222 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
27226 uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
27227 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
27231 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_features() {
27232 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
27236 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_recovery_id() {
27237 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
27241 uint32_t __attribute__((visibility("default"))) TS_SemanticError_invalid_signature() {
27242 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
27246 uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
27247 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
27251 jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
27252 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
27253 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
27254 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
27258 jstring __attribute__((visibility("default"))) TS_SemanticError_to_str(uint32_t o) {
27259 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
27260 LDKStr ret_str = SemanticError_to_str(o_conv);
27261 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27266 void __attribute__((visibility("default"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
27267 if ((this_ptr & 1) != 0) return;
27268 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
27269 FREE((void*)this_ptr);
27270 SignOrCreationError_free(this_ptr_conv);
27273 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_clone(uint32_t orig) {
27274 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
27275 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27276 *ret_copy = SignOrCreationError_clone(orig_conv);
27277 uint64_t ret_ref = (uint64_t)ret_copy;
27281 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_sign_error() {
27282 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27283 *ret_copy = SignOrCreationError_sign_error();
27284 uint64_t ret_ref = (uint64_t)ret_copy;
27288 uint32_t __attribute__((visibility("default"))) TS_SignOrCreationError_creation_error(uint32_t a) {
27289 LDKCreationError a_conv = LDKCreationError_from_js(a);
27290 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27291 *ret_copy = SignOrCreationError_creation_error(a_conv);
27292 uint64_t ret_ref = (uint64_t)ret_copy;
27296 jboolean __attribute__((visibility("default"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
27297 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
27298 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
27299 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
27303 jstring __attribute__((visibility("default"))) TS_SignOrCreationError_to_str(uint32_t o) {
27304 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
27305 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
27306 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27311 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) {
27312 LDKChannelManager channelmanager_conv;
27313 channelmanager_conv.inner = (void*)(channelmanager & (~1));
27314 channelmanager_conv.is_owned = false;
27315 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
27316 LDKCurrency network_conv = LDKCurrency_from_js(network);
27317 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
27318 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
27319 LDKStr description_conv = str_ref_to_owned_c(description);
27320 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
27321 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
27322 return (uint64_t)ret_conv;
27325 uint32_t __attribute__((visibility("default"))) TS_SiPrefix_from_str(jstring s) {
27326 LDKStr s_conv = str_ref_to_owned_c(s);
27327 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
27328 *ret_conv = SiPrefix_from_str(s_conv);
27329 return (uint64_t)ret_conv;
27332 uint32_t __attribute__((visibility("default"))) TS_Invoice_from_str(jstring s) {
27333 LDKStr s_conv = str_ref_to_owned_c(s);
27334 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
27335 *ret_conv = Invoice_from_str(s_conv);
27336 return (uint64_t)ret_conv;
27339 uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_from_str(jstring s) {
27340 LDKStr s_conv = str_ref_to_owned_c(s);
27341 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
27342 *ret_conv = SignedRawInvoice_from_str(s_conv);
27343 return (uint64_t)ret_conv;
27346 jstring __attribute__((visibility("default"))) TS_Invoice_to_str(uint32_t o) {
27348 o_conv.inner = (void*)(o & (~1));
27349 o_conv.is_owned = false;
27350 LDKStr ret_str = Invoice_to_str(&o_conv);
27351 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27356 jstring __attribute__((visibility("default"))) TS_SignedRawInvoice_to_str(uint32_t o) {
27357 LDKSignedRawInvoice o_conv;
27358 o_conv.inner = (void*)(o & (~1));
27359 o_conv.is_owned = false;
27360 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
27361 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27366 jstring __attribute__((visibility("default"))) TS_Currency_to_str(uint32_t o) {
27367 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
27368 LDKStr ret_str = Currency_to_str(o_conv);
27369 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27374 jstring __attribute__((visibility("default"))) TS_SiPrefix_to_str(uint32_t o) {
27375 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
27376 LDKStr ret_str = SiPrefix_to_str(o_conv);
27377 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);